visidia.simulation.process.synchronization
Class SynchronizationAlgorithm

java.lang.Object
  extended by visidia.simulation.process.algorithm.Algorithm
      extended by visidia.simulation.process.synchronization.SynchronizationAlgorithm
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Runnable

public abstract class SynchronizationAlgorithm
extends Algorithm

all synchronization algorithms should extend this class.

See Also:
Serialized Form

Field Summary
protected  int[] answer
          The answer.
protected  SynchronizationObject synob
          The synchronization object.
 
Fields inherited from class visidia.simulation.process.algorithm.Algorithm
proc
 
Constructor Summary
SynchronizationAlgorithm()
          Instantiates a new synchronization algorithm.
SynchronizationAlgorithm(SynchronizationAlgorithm algo)
          Instantiates a new synchronization algorithm.
 
Method Summary
 void breakSynchro()
          Breaks synchronization.
abstract  java.lang.Object clone()
           
 java.util.Collection<MessageType> getListTypes()
          Gets the list types.
protected  int getRandomConnectedDoor()
          Randomly gets a connected door.
 SynchronizationObject getSynchronizationObject()
          Gets the synchronization object.
 void init()
          This method is executed by the node.
 void setSynchronizationObject(SynchronizationObject synObj)
          Sets the synchronization object.
 java.lang.String toString()
           
abstract  void trySynchronize()
          Try synchronize.
 
Methods inherited from class visidia.simulation.process.algorithm.Algorithm
getArity, getDescription, getEdgeProperty, getId, getMessageTypeList, getNetSize, getOrientedDoors, getProperty, isIncomingDoor, isOutgoingDoor, putProperty, putProperty, receive, receiveFrom, receiveFrom, run, sendAll, sendTo, setDoorState, setEdgeProperty, setMessageProcess
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

answer

protected int[] answer
The answer.


synob

protected SynchronizationObject synob
The synchronization object.

Constructor Detail

SynchronizationAlgorithm

public SynchronizationAlgorithm()
Instantiates a new synchronization algorithm.


SynchronizationAlgorithm

public SynchronizationAlgorithm(SynchronizationAlgorithm algo)
Instantiates a new synchronization algorithm.

Parameters:
algo - the algorithm
Method Detail

clone

public abstract java.lang.Object clone()
Specified by:
clone in class Algorithm

trySynchronize

public abstract void trySynchronize()
Try synchronize.


getSynchronizationObject

public SynchronizationObject getSynchronizationObject()
Gets the synchronization object.

Returns:
the synchronization object

setSynchronizationObject

public void setSynchronizationObject(SynchronizationObject synObj)
Sets the synchronization object.

Parameters:
synObj - the new synchronization object

getRandomConnectedDoor

protected final int getRandomConnectedDoor()
Randomly gets a connected door.

Returns:
the connected door

getListTypes

public java.util.Collection<MessageType> getListTypes()
Gets the list types.

Returns:
the list types

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

breakSynchro

public void breakSynchro()
Breaks synchronization.


init

public void init()
Description copied from class: Algorithm
This method is executed by the node. The user has to overwrite it to implement its own algorithm using message passing.

Specified by:
init in class Algorithm