Package casa.lepton
Class OppNode
java.lang.Object
org.graphstream.graph.implementations.AbstractElement
org.graphstream.graph.implementations.AbstractNode
org.graphstream.graph.implementations.AdjacencyListNode
org.graphstream.graph.implementations.MultiNode
casa.lepton.OppNode
- All Implemented Interfaces:
Iterable<org.graphstream.graph.Edge>,org.graphstream.graph.Element,org.graphstream.graph.Node
public class OppNode
extends org.graphstream.graph.implementations.MultiNode
A
Node representing a device in an
opprotunistic network. The device has a location, can be on/offline, and has
several connectivity types. For each connectivity type, it can have edges
with other nodes that are within a range defined for this connectivity type.-
Nested Class Summary
Nested classes/interfaces inherited from class org.graphstream.graph.implementations.AdjacencyListNode
org.graphstream.graph.implementations.AdjacencyListNode.EdgeIterator<T extends org.graphstream.graph.Edge>Nested classes/interfaces inherited from class org.graphstream.graph.implementations.AbstractElement
org.graphstream.graph.implementations.AbstractElement.AttributeChangeEvent -
Field Summary
Fields inherited from class org.graphstream.graph.implementations.MultiNode
neighborMapFields inherited from class org.graphstream.graph.implementations.AdjacencyListNode
degree, edges, GROWTH_FACTOR, I_EDGE, INITIAL_EDGE_CAPACITY, IO_EDGE, ioStart, O_EDGE, oStartFields inherited from class org.graphstream.graph.implementations.AbstractNode
graphFields inherited from class org.graphstream.graph.implementations.AbstractElement
attributes, attributesBeingRemoved, id -
Constructor Summary
ConstructorsConstructorDescriptionOppNode(OppNetGraph graph, String id, String profile, OppNodeProperties props, String label, Walker walker) Construct a new node.OppNode(OppNetGraph graph, String id, String profile, OppNodeProperties props, String label, casa.util.geom.CoordCar coord) Construct a new node. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddConnectivityType(String connectivityType) Add a new enabled connectivity type.protected voidattributeChanged(org.graphstream.graph.implementations.AbstractElement.AttributeChangeEvent event, String attribute, Object oldValue, Object newValue) Return the device's enabled connectivity types.casa.util.geom.CoordCargetCoord()Give the device location.getGraph()getLabel()getNeighbors(String connectivityType, String edgeStatus) Give all the node's neighbors for a given connectivity type and a given status.Return the node's status for a given connectivity type.getTag()booleanhasConnectivityType(String connectivityType) Return true if the device has the given connectivity type.voidinit()Attributes initializations.booleanisMobile()booleanisNeighbor(OppNode node, String connectivityType, String edgeStatus) Returns true if there is an edge with the node for the given connectivity type and status.booleanisOnline()Give the on/offline status of the device.booleanisTagged()booleanremoveConnectivityType(String connectivityType) Disable a connectivity type.voidsetCoord(casa.util.geom.CoordCar coord) Change the coord attribute.final voidfinal voidsetMobile(boolean mobile) final booleansetOnline(boolean online) Change the on/offline status of the device.booleanUpdate the status of the node for a given type.final voidtoDGS()Gives a string representation of the node to be printed to a DGS output.toString()booleanwalk(long time) Change the device's location and update its edges distances usingOppEdge.updateDistance().Methods inherited from class org.graphstream.graph.implementations.MultiNode
addEdgeCallback, clearCallback, getEdgeSetBetween, getEdgeSetBetween, getEdgeSetBetween, getNeighborNodeIterator, locateEdge, removeEdgeMethods inherited from class org.graphstream.graph.implementations.AdjacencyListNode
edgeType, getDegree, getEdge, getEdgeBetween, getEdgeFrom, getEdgeIterator, getEdgeToward, getEnteringEdge, getEnteringEdgeIterator, getInDegree, getLeavingEdge, getLeavingEdgeIterator, getOutDegree, removeEdgeCallbackMethods inherited from class org.graphstream.graph.implementations.AbstractNode
getBreadthFirstIterator, getBreadthFirstIterator, getDepthFirstIterator, getDepthFirstIterator, getEachEdge, getEachEnteringEdge, getEachLeavingEdge, getEdgeBetween, getEdgeBetween, getEdgeFrom, getEdgeFrom, getEdgeSet, getEdgeToward, getEdgeToward, getEnteringEdgeSet, getLeavingEdgeSet, hasEdgeBetween, hasEdgeBetween, hasEdgeBetween, hasEdgeFrom, hasEdgeFrom, hasEdgeFrom, hasEdgeToward, hasEdgeToward, hasEdgeToward, isEnteringEdge, isIncidentEdge, isLeavingEdge, iterator, nullAttributesAreErrorsMethods inherited from class org.graphstream.graph.implementations.AbstractElement
addAttribute, addAttributes, changeAttribute, clearAttributes, clearAttributesWithNoEvent, getArray, getAttribute, getAttribute, getAttributeCount, getAttributeKeyIterator, getAttributeKeySet, getEachAttributeKey, getFirstAttributeOf, getFirstAttributeOf, getHash, getId, getIndex, getLabel, getNumber, getVector, hasArray, hasAttribute, hasAttribute, hasHash, hasLabel, hasNumber, hasVector, removeAttribute, setAttribute, setIndexMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.graphstream.graph.Element
addAttribute, addAttributes, changeAttribute, clearAttributes, getArray, getAttribute, getAttribute, getAttributeCount, getAttributeKeyIterator, getAttributeKeySet, getEachAttributeKey, getFirstAttributeOf, getFirstAttributeOf, getHash, getId, getIndex, getLabel, getNumber, getVector, hasArray, hasAttribute, hasAttribute, hasHash, hasLabel, hasNumber, hasVector, removeAttribute, setAttributeMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
OppNode
public OppNode(OppNetGraph graph, String id, String profile, OppNodeProperties props, String label, Walker walker) Construct a new node.- Parameters:
graph- the graph representing the network.id- the node id (unique).profile- the profile nameprops- the propertieswalker- the walker that implements the node mobility
-
OppNode
public OppNode(OppNetGraph graph, String id, String profile, OppNodeProperties props, String label, casa.util.geom.CoordCar coord) Construct a new node.- Parameters:
graph- the graph representing the network.id- the node id (unique).profile- the profile nameprops- the propertiescoord- the node initial location
-
-
Method Details
-
init
public void init()Attributes initializations. Must be invoked afterOppNetGraph.addNode(java.lang.String, java.lang.String) -
toDGS
Gives a string representation of the node to be printed to a DGS output.- Returns:
- DGS sring representation of the node
-
getLabel
-
setLabel
-
toString
- Specified by:
toStringin interfaceorg.graphstream.graph.Node- Overrides:
toStringin classorg.graphstream.graph.implementations.AbstractElement
-
isTagged
public boolean isTagged() -
getTag
-
setTag
-
setMobile
public final void setMobile(boolean mobile) -
isMobile
public boolean isMobile() -
getNeighbors
Give all the node's neighbors for a given connectivity type and a given status. If connectivityType is null, give all neighbors for any connectivity type. If status is null, give all neighbors for any status.- Parameters:
connectivityType- the connectivity type (may be null).edgeStatus- the status (may be null).- Returns:
- neighbors
-
isNeighbor
Returns true if there is an edge with the node for the given connectivity type and status. If connectivityType is null, return true if there is an edge for any connectivity type. If status is null, give all neighbors for any status.- Parameters:
node- a node.connectivityType- the connectivity type (may be null).edgeStatus- the status (may be null).- Returns:
- true if the given node is a neighbor
-
setOnline
public final boolean setOnline(boolean online) Change the on/offline status of the device.- Parameters:
online- the new status value.- Returns:
- true if the status has changed.
-
addConnectivityType
Add a new enabled connectivity type.- Parameters:
connectivityType- the new connectivity type.- Returns:
- true if the types have changed.
-
removeConnectivityType
Disable a connectivity type.- Parameters:
connectivityType- the connectivity type.- Returns:
- true if the types have changed.
-
walk
public boolean walk(long time) Change the device's location and update its edges distances usingOppEdge.updateDistance().- Parameters:
time- the time when the device's location must be changed.- Returns:
- true if the device's location has changed.
-
setCoord
public void setCoord(casa.util.geom.CoordCar coord) Change the coord attribute.- Parameters:
coord- the new coord attribute.
-
setStatus
Update the status of the node for a given type.- Parameters:
connectivityType- the connectivity type.status- the new status.- Returns:
- true if the status has been changed.
-
isOnline
public boolean isOnline()Give the on/offline status of the device.- Returns:
- true if the status is online.
-
hasConnectivityType
Return true if the device has the given connectivity type.- Parameters:
connectivityType- a connectivity type- Returns:
- true if the device has the given connectivity type.
-
getConnectivityTypes
Return the device's enabled connectivity types.- Returns:
- a collection of the device's enabled connectivity types.
-
getCoord
public casa.util.geom.CoordCar getCoord()Give the device location.- Returns:
- the device location.
-
getStatus
Return the node's status for a given connectivity type.- Parameters:
connectivityType- a connectivity type- Returns:
- the node's status for this connectivity type.
-
getGraph
- Specified by:
getGraphin interfaceorg.graphstream.graph.Node- Overrides:
getGraphin classorg.graphstream.graph.implementations.AbstractNode
-
attributeChanged
protected void attributeChanged(org.graphstream.graph.implementations.AbstractElement.AttributeChangeEvent event, String attribute, Object oldValue, Object newValue) - Overrides:
attributeChangedin classorg.graphstream.graph.implementations.AbstractNode
-