Class ContextJungNetwork<T>
java.lang.Object
repast.simphony.context.space.graph.ContextJungNetwork<T>
- All Implemented Interfaces:
ContextListener<T>,Network<T>,Projection<T>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddAll()addEdge(RepastEdge<T> edge) Adds the specified edge to this Network.Adds an edge between the specified objects.Adds an edge between the specified objects.voidaddProjectionListener(ProjectionListener listener) Adds listener for this projection.voidbooleancontainsEdge(RepastEdge<T> edge) Returns whether or not this network contains the specified edge.booleanbooleanevaluate(ProjectionPredicate predicate) Evaluate this Projection against the specified Predicate.voideventOccured(ContextEvent<T> ev) Called to nofify the listener of a change to a context.getAdjacent(T agent) Gets any objects that are adjacent to this object.intGet the total degree (number of edges) for the graph.intGets the degree of the node associated with the specified object.Retrieves the edge between the specified source and target.EdgeCreator<? extends RepastEdge<T>,T> Gets the EdgeCreator used to create edges for this Network.getEdges()Gets all the edges in this Network.Gets all the edges where the specified object is a source or a target.edu.uci.ics.jung.graph.Graph<T,RepastEdge<T>> getGraph()intgetInDegree(T agent) Gets the in degree of the node associated with the specified object.getInEdges(T agent) Gets all the in-edges for the specified object.getName()getNodes()Gets an iterator over all the agent nodes in this network.intgetOutDegree(T agent) Gets the out degree of the node associated with the specified object.getOutEdges(T agent) Gets all the out-edges for the specified object.getPredecessors(T agent) Gets the predecessors of the specified object.Gets all the listeners for this projection.getRandomAdjacent(T agent) Gets a random object that is adjacent to the specified object.getRandomPredecessor(T agent) Get a random predecessor of the specified object.getRandomSuccessor(T agent) Gets a random successor of the specified object.getSuccessors(T agent) Gets the successors of the specified object.inthashCode()booleanisAdjacent(T first, T second) Returns true if the first object is adjacent to the second.booleanbooleanisPredecessor(T first, T second) Returns true if the first object is a predecessor of the second.booleanisSuccessor(T first, T second) Returns true if the first object is a successor of the second.intnumEdges()Gets the number of edges in this Network.protected voidvoidremoveEdge(RepastEdge<T> edge) Removes the specified edge from this Network.voidMethod removes all edges in the given network.booleanremoveProjectionListener(ProjectionListener listener) Removes a listener from the this projection.voidremoveVertex(T vertex) voidsetGraph(edu.uci.ics.jung.graph.Graph<T, RepastEdge<T>> graph) intsize()Gets the number of nodes in this network.toString()
-
Constructor Details
-
ContextJungNetwork
-
-
Method Details
-
eventOccured
Description copied from interface:ContextListenerCalled to nofify the listener of a change to a context.- Specified by:
eventOccuredin interfaceContextListener<T>- Parameters:
ev- The event of which to notify the listener.
-
addAll
protected void addAll() -
removeAll
protected void removeAll() -
getEdgeCreator
Gets the EdgeCreator used to create edges for this Network.addEdgeandaddEdgewill use this creator to create edges. Any edge added withaddEdgemust be of the same type as that created with this EdgeCreator. By default, an edge creator that creates RepastEdges is used. The default EdgeCreator will create RepastEdge- Specified by:
getEdgeCreatorin interfaceNetwork<T>- Returns:
- the edge class of this network
-
addEdge
Description copied from interface:NetworkAdds the specified edge to this Network. This will change the directionality of the edge to met that of the network. -
addEdge
Description copied from interface:NetworkAdds an edge between the specified objects. -
addEdge
Description copied from interface:NetworkAdds an edge between the specified objects. -
addProjectionListener
Description copied from interface:ProjectionAdds listener for this projection.- Specified by:
addProjectionListenerin interfaceProjection<T>- Parameters:
listener- the listener to add.
-
addVertex
-
equals
-
evaluate
Description copied from interface:ProjectionEvaluate this Projection against the specified Predicate. This typically involves a double dispatch where the Projection calls back to the predicate, passing itself.- Specified by:
evaluatein interfaceProjection<T>- Returns:
- true if the predicate evaluates to true, otherwise false. False can also mean that the predicate is not applicable to this Projection. For example, a linked type predicate evaluated against a grid projection.
-
getAdjacent
Description copied from interface:NetworkGets any objects that are adjacent to this object. An object is adjacent if it has an edge either from or to the specified object.- Specified by:
getAdjacentin interfaceNetwork<T>- Parameters:
agent- the object whose adjacent objects should be returned- Returns:
- an iterator over all the objects adjacent to the specified object.
-
getDegree
public int getDegree()Description copied from interface:NetworkGet the total degree (number of edges) for the graph. -
getDegree
Description copied from interface:NetworkGets the degree of the node associated with the specified object. -
getEdge
Description copied from interface:NetworkRetrieves the edge between the specified source and target. If multiple edges exist between these two objects, the first found will be returned. -
getEdges
Description copied from interface:NetworkGets all the edges in this Network. -
getEdges
Description copied from interface:NetworkGets all the edges where the specified object is a source or a target. -
getGraph
-
getInDegree
Description copied from interface:NetworkGets the in degree of the node associated with the specified object.- Specified by:
getInDegreein interfaceNetwork<T>- Parameters:
agent- the object whose node's in degree we want.- Returns:
- the in degree of the node associated with the specified object.
-
getInEdges
Description copied from interface:NetworkGets all the in-edges for the specified object. In a directed network an in edge is any edge where the specified object is the target. In an undirected network, edges are both in- and out-, and so all edges are returned.- Specified by:
getInEdgesin interfaceNetwork<T>- Parameters:
agent- the object whose in-edges should be returned- Returns:
- an iterator over all the in-edges for the specified object.
-
getName
- Specified by:
getNamein interfaceProjection<T>
-
getNodes
Description copied from interface:NetworkGets an iterator over all the agent nodes in this network. -
getOutDegree
Description copied from interface:NetworkGets the out degree of the node associated with the specified object.- Specified by:
getOutDegreein interfaceNetwork<T>- Parameters:
agent- the object whose node's out degree we want.- Returns:
- the out degree of the node associated with the specified object.
-
getOutEdges
Description copied from interface:NetworkGets all the out-edges for the specified object. In a directed network an out edge is any edge where the specified object is the source. In an undirected network, edges are both in- and out-, and so all edges are returned.- Specified by:
getOutEdgesin interfaceNetwork<T>- Parameters:
agent- the object whose out-edges should be returned- Returns:
- an iterator over all the out-edges for the specified object.
-
getPredecessors
Description copied from interface:NetworkGets the predecessors of the specified object. If the network is directed then the predecessors are any objects connected to the specified object by an edge where the specified object is the target of that edge. If the network is undirected, then this returns any object connected to the specified object.- Specified by:
getPredecessorsin interfaceNetwork<T>- Parameters:
agent- the object whose predecessors should be returned- Returns:
- an iterator over the predecessors of the specified object.
-
getProjectionListeners
Description copied from interface:ProjectionGets all the listeners for this projection.- Specified by:
getProjectionListenersin interfaceProjection<T>- Returns:
- an iterable over all the listeners for this projection.
-
getRandomAdjacent
Description copied from interface:NetworkGets a random object that is adjacent to the specified object.- Specified by:
getRandomAdjacentin interfaceNetwork<T>- Returns:
- a random object that is adjacent to the specified object or null if no objects are adjacent.
-
getRandomPredecessor
Description copied from interface:NetworkGet a random predecessor of the specified object. If the network is directed then the predecessors are any objects connected to the specified object by an edge where the specified object is the target of that edge. If the network is undirected, then a predecessor can be any object connected to the specified object.- Specified by:
getRandomPredecessorin interfaceNetwork<T>- Returns:
- a random predecessor of the specified object or null if there are no predecessors.
-
getRandomSuccessor
Description copied from interface:NetworkGets a random successor of the specified object. If the network is directed then the successors are any objects connected to the specified object by an edge where the specified object is the source of that edge. If the network is undirected, then a successor can be any object connected to the specified object.- Specified by:
getRandomSuccessorin interfaceNetwork<T>- Returns:
- a random predecessor of the specified object or null if there are no successors.
-
getSuccessors
Description copied from interface:NetworkGets the successors of the specified object. If the network is directed then the successors are any objects connected to the specified object by an edge where the specified object is the source of that edge. If the network is undirected, then this returns any object connected to the specified object.- Specified by:
getSuccessorsin interfaceNetwork<T>- Parameters:
agent- the object whose successors should be returned- Returns:
- an iterator over the successors of the specified object.
-
hashCode
public int hashCode() -
isAdjacent
Description copied from interface:NetworkReturns true if the first object is adjacent to the second. An object is adjacent to another if there is an edge between the first object and the second, regardeless of the edges directionality.- Specified by:
isAdjacentin interfaceNetwork<T>- Returns:
- true if the first object is a adjacent to the second.
-
isDirected
public boolean isDirected()- Specified by:
isDirectedin interfaceNetwork<T>- Returns:
- true if this Network is directed, otherwise false.
-
isPredecessor
Description copied from interface:NetworkReturns true if the first object is a predecessor of the second. If the network is directed then the predecessors are any objects connected to the specified object by an edge where the specified object is the target of that edge. If the network is undirected, then a predecessor can be any object connected to the specified object.- Specified by:
isPredecessorin interfaceNetwork<T>- Returns:
- true if the first object is a predecessor of the second.
-
isSuccessor
Description copied from interface:NetworkReturns true if the first object is a successor of the second. If the network is directed then the successors are any objects connected to the specified object by an edge where the specified object is the source of that edge. If the network is undirected, then a successor can be any object connected to the specified object.- Specified by:
isSuccessorin interfaceNetwork<T>- Returns:
- true if the first object is a successor of the second.
-
numEdges
public int numEdges()Description copied from interface:NetworkGets the number of edges in this Network. -
removeEdge
Description copied from interface:NetworkRemoves the specified edge from this Network.- Specified by:
removeEdgein interfaceNetwork<T>- Parameters:
edge- the edge to remove
-
containsEdge
Returns whether or not this network contains the specified edge.- Specified by:
containsEdgein interfaceNetwork<T>- Parameters:
edge- the edge to check- Returns:
- true if the network contains the specified edge, otherwise false.
-
removeProjectionListener
Description copied from interface:ProjectionRemoves a listener from the this projection.- Specified by:
removeProjectionListenerin interfaceProjection<T>- Parameters:
listener- the listener to remove- Returns:
- true if the listener was succesfully removed, otherwise false
-
removeVertex
-
setGraph
-
size
public int size()Description copied from interface:NetworkGets the number of nodes in this network. -
toString
-
removeEdges
public void removeEdges()Description copied from interface:NetworkMethod removes all edges in the given network.- Specified by:
removeEdgesin interfaceNetwork<T>
-