T
- type of the objects in the topology. Usually some kind of an identifier.public interface TopologyProvider<T extends java.io.Serializable>
Provides a topology service for the compute level.
Topologies, beside defining “neighbours” for each node will provide annotations for each one of them. They may describe, for example, an abstract direction of the neighbour.
Neighbourhood may be directional. It means that 2 being a neighbour of 1 does not mean that 1 is a neighbour of 2.
Modifier and Type | Method and Description |
---|---|
void |
addNodes(java.util.Set<T> ids)
Add nodes to the current topology.
|
boolean |
areNeighbours(T first,
T second)
Check if the
second is a neighbour of first in this exact direction |
java.util.Map<T,java.util.Set<java.lang.String>> |
neighboursOf(T id)
Returns neighbours (according to the current topology).
|
java.util.Map<java.lang.String,T> |
neighboursOfByAnnotation(T id)
Returns neighbours (according to the current topology).
|
void |
setTopology(Topology<T> topology)
Set the new topology function.
|
void setTopology(Topology<T> topology)
Set the new topology function.
topology
- a function used to generate topologiesvoid addNodes(java.util.Set<T> ids)
Add nodes to the current topology.
ids
- IDs of the nodes to addjava.util.Map<T,java.util.Set<java.lang.String>> neighboursOf(T id)
Returns neighbours (according to the current topology).
id
- id of the workplace to look up neighbours#addNodes
) and values are sets of annotations assigned by the topology function to this neighbourjava.util.Map<java.lang.String,T> neighboursOfByAnnotation(T id)
Returns neighbours (according to the current topology).
Warning: values may be duplicated if single neighbour has multiple annotations on its edges.
id
- id of the workplace to look up neighbours#addNodes