Package nl.tue.id.oocsi.client.behavior
Class OOCSISpatial
java.lang.Object
nl.tue.id.oocsi.client.behavior.OOCSISystemCommunicator<nl.tue.id.oocsi.client.behavior.OOCSISpatial.Position>
nl.tue.id.oocsi.client.behavior.OOCSISpatial
public class OOCSISpatial extends OOCSISystemCommunicator<nl.tue.id.oocsi.client.behavior.OOCSISpatial.Position>
OOCSISpatial is a system-level primitive that allows for routing across a multi-dimensional lattice of positions of
different OOCSI clients.
- Author:
- matsfunk
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
OOCSISpatial.DistanceMetric<T>
Nested classes/interfaces inherited from class nl.tue.id.oocsi.client.behavior.OOCSISystemCommunicator
OOCSISystemCommunicator.SystemFilter<K>
-
Field Summary
Fields Modifier and Type Field Description java.util.Map<java.lang.String,nl.tue.id.oocsi.client.behavior.OOCSISpatial.Position>
positions
Fields inherited from class nl.tue.id.oocsi.client.behavior.OOCSISystemCommunicator
channelName, client, HANDLE
-
Constructor Summary
Constructors Constructor Description OOCSISpatial(OOCSIClient client, java.lang.String channelName, java.lang.String key, nl.tue.id.oocsi.client.behavior.OOCSISpatial.Position<?> neighborDistance)
same as all, one value and a distance metric, routing is easy (shortest by direct distance) -
Method Summary
Modifier and Type Method Description static OOCSISpatial
createSpatial(OOCSIClient client, java.lang.String channelName, java.lang.String key, float myPosition, float neighborDistance)
create an OOCSISpatial for 1D float positionsstatic OOCSISpatial
createSpatial(OOCSIClient client, java.lang.String channelName, java.lang.String key, float myPositionX, float myPositionY, float neighborDistance)
create an OOCSISpatial for 2D float positionsjava.lang.String
getClosestNeighbor()
returns the handle of the closest neighborjava.util.List<java.lang.String>
getNeighbors()
returns the current set of direct neighborsMultiMessage
neighborCall(java.lang.String callName)
return a message container that includes OOCSICalls to all neighbors which can be filled and sent all at onceMultiMessage
neighbors()
returns a message container that includes messages to all neighbors which can be filled and sent all at oncejava.lang.String
routing(java.lang.String destination)
returns the handle of the neighbor through which the closest path to the destination can be routed at this momentvoid
stop()
stop participating in this gathering processMethods inherited from class nl.tue.id.oocsi.client.behavior.OOCSISystemCommunicator
addFilter, getHandle, message, message, message, subscribe, triggerHandler, updateFilter
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
positions
public java.util.Map<java.lang.String,nl.tue.id.oocsi.client.behavior.OOCSISpatial.Position> positions
-
-
Constructor Details
-
OOCSISpatial
public OOCSISpatial(OOCSIClient client, java.lang.String channelName, java.lang.String key, nl.tue.id.oocsi.client.behavior.OOCSISpatial.Position<?> neighborDistance)same as all, one value and a distance metric, routing is easy (shortest by direct distance)- Parameters:
client
-channelName
-key
-neighborDistance
-
-
-
Method Details
-
createSpatial
public static OOCSISpatial createSpatial(OOCSIClient client, java.lang.String channelName, java.lang.String key, float myPosition, float neighborDistance)create an OOCSISpatial for 1D float positions- Parameters:
client
-channelName
-key
-myPosition
-neighborDistance
-- Returns:
-
createSpatial
public static OOCSISpatial createSpatial(OOCSIClient client, java.lang.String channelName, java.lang.String key, float myPositionX, float myPositionY, float neighborDistance)create an OOCSISpatial for 2D float positions- Parameters:
client
-channelName
-key
-myPositionX
-myPositionY
-neighborDistance
-- Returns:
-
stop
public void stop()stop participating in this gathering process -
getNeighbors
public java.util.List<java.lang.String> getNeighbors()returns the current set of direct neighbors- Returns:
-
neighbors
returns a message container that includes messages to all neighbors which can be filled and sent all at once- Returns:
-
neighborCall
return a message container that includes OOCSICalls to all neighbors which can be filled and sent all at once- Parameters:
callName
-- Returns:
-
getClosestNeighbor
public java.lang.String getClosestNeighbor()returns the handle of the closest neighbor- Returns:
-
routing
public java.lang.String routing(java.lang.String destination)returns the handle of the neighbor through which the closest path to the destination can be routed at this moment- Parameters:
destination
-- Returns:
-