com.speckled.specksim.imp.state
Class NeighbourhoodProcessor

java.lang.Object
  extended by com.speckled.specksim.state.StateProcessor
      extended by com.speckled.specksim.imp.state.NeighbourhoodProcessor

public class NeighbourhoodProcessor
extends StateProcessor

This processor generates an array, each element of which is an int array containing the indices of that speck's neighbours in the state array. The indices will be sorted into ascending order

Author:
ryanm

Field Summary
static java.lang.String NAME
          The name of this processor
 
Constructor Summary
NeighbourhoodProcessor()
           
 
Method Summary
protected  void doProcessing(StateSink state)
          Override this method to do the actual work of the processor.
 java.lang.String getName()
          Gets the name of this StateProcessor
 int[][] getNeighbourIndices()
          Gets the output of this processor.
 
Methods inherited from class com.speckled.specksim.state.StateProcessor
processState, refreshStateListeners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME

public static final java.lang.String NAME
The name of this processor

See Also:
Constant Field Values
Constructor Detail

NeighbourhoodProcessor

public NeighbourhoodProcessor()
Method Detail

getName

public java.lang.String getName()
Description copied from class: StateProcessor
Gets the name of this StateProcessor

Specified by:
getName in class StateProcessor
Returns:
A String name

getNeighbourIndices

public int[][] getNeighbourIndices()
Gets the output of this processor. The output is an array of arrays, one for each NeighbourhoodAware speck in the simulator. These arrays contain the indices of that speck's neighbours in the simulatorState. Speck IDs that are not found in the simulatorState will be represented with -1

Returns:
an array of int arrays

doProcessing

protected void doProcessing(StateSink state)
Description copied from class: StateProcessor
Override this method to do the actual work of the processor. This will only be called if the state has been updated since the last time this processor was used

Specified by:
doProcessing in class StateProcessor
Parameters:
state - The state to process