Package casa.lepton
Interface OppNet
- All Superinterfaces:
OppNetEventsSource
- All Known Implementing Classes:
OppNetFullyConnected
,OppNetGraph
,OppNetGraphDGS
,OppNetGraphWalk
,OppNetProxy
This interface represents an opportunistic network composed of devices linked
by edges representing actual or possible connections between them.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addConnectivityType
(String nodeId, String connectivityType) Add a new connectivity type for the node and update edges accordingly.void
Add a new node in the OppNet.boolean
areNeighbors
(String nodeId1, String nodeId2, String connectivityType, String edgeStatus) Returns true if there is an edge with the node for the given connectivity type and status.void
deleteNode
(String nodeId) Remove a node from the OppNet.getEdgeStatus
(String nodeId1, String nodeId2, String connectivityType) Give the status of an edge charaterized by the nodes' ids and the connectivity type.Give the label of the nodegetNeighbors
(String nodeId, String connectivityType, String edgeStatus) Give the neighbors' ids of the node for a given connectivity type and status.getNodes()
Give the nodes in the OppNet.getNodeStatus
(String nodeId, String connectivityType) Give the status of a node for a given connectivity type.Give the tag of the node.boolean
Check whether the node exists in the OppNet.boolean
Give the on/offline status of the node.makeEdgeId
(String id1, String id2, String connectivityType) Give a unique edge id from the given nodes ids and connectivityType in the form "idA-idB:type" where idA = min(id1,id2) and idB = max(id1,id2).int
nbNeighbors
(String nodeId, String connectivityType, String edgeStatus) Returns the number of neighbors of the node for the given connectivity type and status.void
removeConnectivityType
(String nodeId, String connectivityType) Remove a connectivity type for the node and update edges accordingly.boolean
setEdgeStatus
(String nodeId1, String nodeId2, String connectivityType, String status) Change the status of an edge charaterized by the nodes' ids and the connectivity type.void
Change the label of the nodevoid
setNodeStatus
(String nodeId, String connectivityType, String status) Change the status of a node for a given connectivity type.void
Change the on/offline status of the node and update edges accordingly.void
Set the given tag to the node.Methods inherited from interface casa.lepton.OppNetEventsSource
addEdgeListener, addNodeListener, removeEdgeListener, removeNodeListener
-
Field Details
-
NODE_ADDED
- See Also:
-
NODE_REMOVED
- See Also:
-
NODE_MOVED
- See Also:
-
EDGE_ADDED
- See Also:
-
EDGE_REMOVED
- See Also:
-
EDGE_CHANGED
- See Also:
-
-
Method Details
-
addNode
Add a new node in the OppNet.- Parameters:
nodeId
- the new node id.profile
- the node's profile name (may be null)
-
deleteNode
Remove a node from the OppNet.- Parameters:
nodeId
- the id of the node to be deleted.
-
isNode
Check whether the node exists in the OppNet.- Parameters:
nodeId
- a node id.- Returns:
- true if a node having this node id exists in the graph.
-
getNodes
Collection<String> getNodes()Give the nodes in the OppNet.- Returns:
- a collection of all nodes in the graph.
-
setOnline
Change the on/offline status of the node and update edges accordingly.- Parameters:
nodeId
- a node id.online
- the new status for the node having this id.
-
isOnline
Give the on/offline status of the node.- Parameters:
nodeId
- a node id.- Returns:
- the status of the node having this id.
-
setLabel
Change the label of the node- Parameters:
nodeId
- a node id.label
- the new label for the node having this id.
-
getLabel
Give the label of the node- Parameters:
nodeId
- a node id.- Returns:
- the label for the node having this id.
-
setTag
Set the given tag to the node.- Parameters:
nodeId
- a node id.tag
- the new status for the node having this id.
-
getTag
Give the tag of the node.- Parameters:
nodeId
- a node id.- Returns:
- the tag of the node having this id.
-
addConnectivityType
Add a new connectivity type for the node and update edges accordingly.- Parameters:
nodeId
- a node id.connectivityType
- a connectivity type to be added to this node.
-
removeConnectivityType
Remove a connectivity type for the node and update edges accordingly.- Parameters:
nodeId
- a node id.connectivityType
- a connectivity type to be removed from this node.
-
setNodeStatus
Change the status of a node for a given connectivity type.- Parameters:
nodeId
- a node id.connectivityType
- a connectivity type.status
- the new status.
-
getNodeStatus
Give the status of a node for a given connectivity type.- Parameters:
nodeId
- a node id.connectivityType
- a connectivity type.- Returns:
- the status for this node and connectivity type.
-
setEdgeStatus
Change the status of an edge charaterized by the nodes' ids and the connectivity type. If the edge does not exist, do nothing and change the status of nodes accordingly.- Parameters:
nodeId1
- a node id.nodeId2
- another node id.connectivityType
- a connectivity type.status
- the new edge status.- Returns:
- true if the status has been changed.
-
getEdgeStatus
Give the status of an edge charaterized by the nodes' ids and the connectivity type. If the edge does not exist, return null- Parameters:
nodeId1
- a node id.nodeId2
- another node id.connectivityType
- a connectivity type.- Returns:
- the edge status
-
getNeighbors
Give the neighbors' ids of the node for a given connectivity type and status. If connectivityType is null, give all neighbors for any connectivity type. If status is null, give all neighbors for any status.- Parameters:
nodeId
- a node id.connectivityType
- a connectivity type. May be null.edgeStatus
- an edge status. May be null.- Returns:
- ids of nodes having edges with the given status and connectivity type.
-
areNeighbors
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:
nodeId1
- a node id.nodeId2
- another node id.connectivityType
- a connectivity type. May be null.edgeStatus
- an edge status. May be null.- Returns:
- return true if the nodes have an edge having the given status and connectivity type.
-
nbNeighbors
Returns the number of neighbors of the node for the given connectivity type and status. If connectivityType is null, returns the number of neighbors for any connectivity type. If status is null, returns the number of neighbors whatever the connectivity status.- Parameters:
nodeId
- a node id.connectivityType
- a connectivity type. May be null.edgeStatus
- an edge status. May be null.- Returns:
- return true if the nodes have an edge having the given status and connectivity type.
-
makeEdgeId
Give a unique edge id from the given nodes ids and connectivityType in the form "idA-idB:type" where idA = min(id1,id2) and idB = max(id1,id2).- Parameters:
id1
- a node id.id2
- other node id.connectivityType
- the connectivity type.- Returns:
- unique edge id.
-