com.speckled.specksim.imp.comm
Class OctTreeField

java.lang.Object
  extended by com.speckled.specksim.imp.comm.OctTreeField
All Implemented Interfaces:
ValueListener, MovementModelListener, WallListener

@ConfigurableType(value="Octree options")
public class OctTreeField
extends java.lang.Object
implements ValueListener, MovementModelListener, WallListener

This class determines which specks are in the range of a broadcast, using an octree to improve performance

Author:
ryanm

Field Summary
 int maxDepth
          The maximum depth of the tree
 float repopulationThreshold
          The distance that each speck can travel before repopulating the tree becomes a good idea.
 int subDivisionThreshold
          The maximum number of specks that a leaf node in the tree can contain
 
Method Summary
 java.util.SortedSet<Speck> findRecipients(Speck sender, MessageShell shell, float time)
          Finds the recipients of a broadcast
 void movementModelSet(MovementModel mm)
          Notifies that a new MovementModel has been set
 void valueChanged(java.lang.String name)
          Is called by the configurator when a variable is changed
 void wallStateChanged()
          This method is called whenever something is changed with the walls.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

repopulationThreshold

@ConfigurableVariable(value="Movement Threshold")
@Description(value="The maximum distance a speck may move before the tree is repopulated")
@NumberRange(value={9.999999747378752E-5f,1.0f})
public float repopulationThreshold
The distance that each speck can travel before repopulating the tree becomes a good idea.


subDivisionThreshold

@ConfigurableVariable(value="Subdivision threshold")
@Description(value="The maximum number of specks that a node can hold before it is subdivided")
@NumberRange(value=1.0f)
public int subDivisionThreshold
The maximum number of specks that a leaf node in the tree can contain


maxDepth

@ConfigurableVariable(value="Maximum depth")
@Description(value="The maximum depth of the tree")
@NumberRange(value=1.0f)
public int maxDepth
The maximum depth of the tree

Method Detail

findRecipients

public java.util.SortedSet<Speck> findRecipients(Speck sender,
                                                 MessageShell shell,
                                                 float time)
Finds the recipients of a broadcast

Parameters:
sender - The sender of the broadcast
shell - The limits of the broadcast
time - the time of the broadcast
Returns:
A list of specks that are within the limits of the broadcast, and have line of sight to the sender

movementModelSet

public void movementModelSet(MovementModel mm)
Description copied from interface: MovementModelListener
Notifies that a new MovementModel has been set

Specified by:
movementModelSet in interface MovementModelListener
Parameters:
mm - The new MovementModel

wallStateChanged

public void wallStateChanged()
Description copied from interface: WallListener
This method is called whenever something is changed with the walls. Walls can be assumed to be static and unchanging between calls to this method

Specified by:
wallStateChanged in interface WallListener

valueChanged

public void valueChanged(java.lang.String name)
Description copied from interface: ValueListener
Is called by the configurator when a variable is changed

Specified by:
valueChanged in interface ValueListener
Parameters:
name - The name of the variable