TrustGrapher
r52
A playabale simulator for modelling trust between agents
|
Public Member Functions | |
SimAbstractGraph (GraphConfig graphConfig, SimpleDirectedGraph innerGraph) | |
JungAdapterGraph | getReferenceGraph () |
String | getDisplayName () |
Object | getAlgorithm () |
int | getID () |
boolean | isDisplayed () |
boolean | evaluate (Context< Graph< Agent, TestbedEdge >, Object > context) |
void | graphConstructionEvent (TrustLogEvent event) |
abstract void | graphEvent (TrustLogEvent event, boolean forward) |
Protected Member Functions | |
Agent | ensureAgentExists (int id, JungAdapterGraph< Agent, TestbedEdge > caller) |
TestbedEdge | ensureEdgeExists (Agent src, Agent sink, JungAdapterGraph< Agent, TestbedEdge > caller) |
void | removeEdgeAndVertices (TestbedEdge edge) |
Protected Attributes | |
JungAdapterGraph< Agent, TestbedEdge > | referenceGraph |
GraphConfig | graphConfig |
A graph superclass that inherits lower level Graph methods from JungAdapterGraph This classs accepts a parameter of the jGraphT SimpleDirectedGraph that this graph is to be based on. The parameter will be used to create the superclass which acts as thje dynamic graph, and also to create a field which is the full graph.
This SimAbstractGraph acts as a dynamic graph. It is not displayed, but components in the full graph will only be displayed if they exist in the dynamic graph. As events occur, they are added to the dynamic graphs through their graphEvent() method.
The full graph is a field in this graph. It is shown in the GraphViewer, but all vertices and edges that are ever shown must be on the full graph before the events start playing. Their graphConstructionEvent() method is used as the events are parsed to add all components to the graph.
Definition at line 32 of file SimAbstractGraph.java.
cu.trustGrapher.graphs.SimAbstractGraph.SimAbstractGraph | ( | GraphConfig | graphConfig, |
SimpleDirectedGraph | innerGraph | ||
) |
Calls superclass and initializes some fields
graphConfig | This object contains all of the configurations for this graph |
innerGraph | The TrustTestBed graph that is to be a base graph for this graph |
Definition at line 43 of file SimAbstractGraph.java.
Agent cu.trustGrapher.graphs.SimAbstractGraph.ensureAgentExists | ( | int | id, |
JungAdapterGraph< Agent, TestbedEdge > | caller | ||
) | [protected] |
Ensures that an Agent with the given ID exists in the graph If it doesn't, then it is added
id | the ID of the agent that must exist |
caller | The graph to search in for the agent |
Definition at line 117 of file SimAbstractGraph.java.
TestbedEdge cu.trustGrapher.graphs.SimAbstractGraph.ensureEdgeExists | ( | Agent | src, |
Agent | sink, | ||
JungAdapterGraph< Agent, TestbedEdge > | caller | ||
) | [protected] |
Ensures that the edge with the given agents exists in the graph. If it doesn't exist, create it and add it to the graph. Then return the edge.
src | The Agent that the edge originates from |
sink | The Agent that the edge goes to |
caller | The graph that is calling, so that if an edge must be created, it knows what type to make, and what graph to add it to |
Definition at line 138 of file SimAbstractGraph.java.
boolean cu.trustGrapher.graphs.SimAbstractGraph.evaluate | ( | Context< Graph< Agent, TestbedEdge >, Object > | context | ) |
This is the predicate for whether to show the graph entities in the GraphViewer. It is called by the GraphViewer during every repaint for every entity. If the entity exists in this dynamic Graph, return true. Otherwise false.
context | The referenceGraph and element that is being checked |
Definition at line 98 of file SimAbstractGraph.java.
Object cu.trustGrapher.graphs.SimAbstractGraph.getAlgorithm | ( | ) |
Returns the algorithm of this Graphpair. If this GraphPair holds a SimFeedbackGraph, then it returns null.
Definition at line 71 of file SimAbstractGraph.java.
String cu.trustGrapher.graphs.SimAbstractGraph.getDisplayName | ( | ) |
Gets the display name for this graph. The Display name consits of the graphID and the name of the algorithm attached to it.
Definition at line 62 of file SimAbstractGraph.java.
int cu.trustGrapher.graphs.SimAbstractGraph.getID | ( | ) |
Returns the id of this graph. It is currently used to generate the name of the graph
Definition at line 79 of file SimAbstractGraph.java.
JungAdapterGraph cu.trustGrapher.graphs.SimAbstractGraph.getReferenceGraph | ( | ) |
Definition at line 53 of file SimAbstractGraph.java.
void cu.trustGrapher.graphs.SimAbstractGraph.graphConstructionEvent | ( | TrustLogEvent | event | ) |
Called by the EventPlayer whenever a TrustLogEvent occurs. It is assumed that this is a full graph. If this is a normal event, only adds any new Agents that there might be. If it is a null event, it is to signal that there are no more events. In that case, sll the possible edges that there might be are added instead.
event | The TrustLogEvent that has just occured |
Reimplemented in cu.trustGrapher.graphs.SimFeedbackGraph.
Definition at line 197 of file SimAbstractGraph.java.
abstract void cu.trustGrapher.graphs.SimAbstractGraph.graphEvent | ( | TrustLogEvent | event, |
boolean | forward | ||
) | [pure virtual] |
Called by the EventPlayer whenever a TrustLogEvent occurs. It is assumed that this graph is a dynamic graph. This method handles the addition or subtraction of edges and agents from the dynamic graph, and edge labels for both based on the event that is currently being processed.
event | The TrustLogEvent that is being processed |
forward | Whether or not the graph is being played forward |
Implemented in cu.trustGrapher.graphs.SimReputationGraph, cu.trustGrapher.graphs.SimTrustGraph, and cu.trustGrapher.graphs.SimFeedbackGraph.
boolean cu.trustGrapher.graphs.SimAbstractGraph.isDisplayed | ( | ) |
Whether or not this graph will have a viewer built for it
Definition at line 87 of file SimAbstractGraph.java.
void cu.trustGrapher.graphs.SimAbstractGraph.removeEdgeAndVertices | ( | TestbedEdge | edge | ) | [protected] |
Removes the given edge from the graph and and the Agents connected to it if they no longer have any edges after removing the given edge.
edge | The edge to be removed |
Definition at line 180 of file SimAbstractGraph.java.
Definition at line 35 of file SimAbstractGraph.java.
JungAdapterGraph<Agent, TestbedEdge> cu.trustGrapher.graphs.SimAbstractGraph.referenceGraph [protected] |
Definition at line 34 of file SimAbstractGraph.java.