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

    neighborMap

    Fields inherited from class org.graphstream.graph.implementations.AdjacencyListNode

    degree, edges, GROWTH_FACTOR, I_EDGE, INITIAL_EDGE_CAPACITY, IO_EDGE, ioStart, O_EDGE, oStart

    Fields inherited from class org.graphstream.graph.implementations.AbstractNode

    graph

    Fields inherited from class org.graphstream.graph.implementations.AbstractElement

    attributes, attributesBeingRemoved, id
  • Constructor Summary

    Constructors
    Constructor
    Description
    OppNode(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 Type
    Method
    Description
    boolean
    addConnectivityType(String connectivityType)
    Add a new enabled connectivity type.
    protected void
    attributeChanged(org.graphstream.graph.implementations.AbstractElement.AttributeChangeEvent event, String attribute, Object oldValue, Object newValue)
     
    Return the device's enabled connectivity types.
    casa.util.geom.CoordCar
    Give the device location.
     
     
    getNeighbors(String connectivityType, String edgeStatus)
    Give all the node's neighbors for a given connectivity type and a given status.
    getStatus(String connectivityType)
    Return the node's status for a given connectivity type.
     
    boolean
    hasConnectivityType(String connectivityType)
    Return true if the device has the given connectivity type.
    void
    Attributes initializations.
    boolean
     
    boolean
    isNeighbor(OppNode node, String connectivityType, String edgeStatus)
    Returns true if there is an edge with the node for the given connectivity type and status.
    boolean
    Give the on/offline status of the device.
    boolean
     
    boolean
    removeConnectivityType(String connectivityType)
    Disable a connectivity type.
    void
    setCoord(casa.util.geom.CoordCar coord)
    Change the coord attribute.
    final void
     
    final void
    setMobile(boolean mobile)
     
    final boolean
    setOnline(boolean online)
    Change the on/offline status of the device.
    boolean
    setStatus(String connectivityType, String status)
    Update the status of the node for a given type.
    final void
     
    Gives a string representation of the node to be printed to a DGS output.
     
    boolean
    walk(long time)
    Change the device's location and update its edges distances using OppEdge.updateDistance().

    Methods inherited from class org.graphstream.graph.implementations.MultiNode

    addEdgeCallback, clearCallback, getEdgeSetBetween, getEdgeSetBetween, getEdgeSetBetween, getNeighborNodeIterator, locateEdge, removeEdge

    Methods inherited from class org.graphstream.graph.implementations.AdjacencyListNode

    edgeType, getDegree, getEdge, getEdgeBetween, getEdgeFrom, getEdgeIterator, getEdgeToward, getEnteringEdge, getEnteringEdgeIterator, getInDegree, getLeavingEdge, getLeavingEdgeIterator, getOutDegree, removeEdgeCallback

    Methods 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, nullAttributesAreErrors

    Methods 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, setIndex

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods 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, setAttribute

    Methods 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 name
      props - the properties
      walker - 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 name
      props - the properties
      coord - the node initial location
  • Method Details

    • init

      public void init()
      Attributes initializations. Must be invoked after OppNetGraph.addNode(java.lang.String, java.lang.String)
    • toDGS

      public String toDGS()
      Gives a string representation of the node to be printed to a DGS output.
      Returns:
      DGS sring representation of the node
    • getLabel

      public String getLabel()
    • setLabel

      public final void setLabel(String label)
    • toString

      public String toString()
      Specified by:
      toString in interface org.graphstream.graph.Node
      Overrides:
      toString in class org.graphstream.graph.implementations.AbstractElement
    • isTagged

      public boolean isTagged()
    • getTag

      public String getTag()
    • setTag

      public final void setTag(String tag)
    • setMobile

      public final void setMobile(boolean mobile)
    • isMobile

      public boolean isMobile()
    • getNeighbors

      public Collection<OppNode> getNeighbors(String connectivityType, String edgeStatus)
      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

      public boolean isNeighbor(OppNode node, String connectivityType, String edgeStatus)
      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

      public boolean addConnectivityType(String connectivityType)
      Add a new enabled connectivity type.
      Parameters:
      connectivityType - the new connectivity type.
      Returns:
      true if the types have changed.
    • removeConnectivityType

      public boolean removeConnectivityType(String connectivityType)
      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 using OppEdge.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

      public boolean setStatus(String connectivityType, String status)
      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

      public boolean hasConnectivityType(String connectivityType)
      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

      public Collection<String> 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

      public String getStatus(String connectivityType)
      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

      public OppNetGraph getGraph()
      Specified by:
      getGraph in interface org.graphstream.graph.Node
      Overrides:
      getGraph in class org.graphstream.graph.implementations.AbstractNode
    • attributeChanged

      protected void attributeChanged(org.graphstream.graph.implementations.AbstractElement.AttributeChangeEvent event, String attribute, Object oldValue, Object newValue)
      Overrides:
      attributeChanged in class org.graphstream.graph.implementations.AbstractNode