visidia.simulation.process.algorithm
Class RuleAlgorithm

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

public abstract class RuleAlgorithm
extends Algorithm

Simulateur des regles de reecritures

See Also:
Serialized Form

Field Summary
protected  RelabelingSystem relSys
          The relabeling System to simulate
protected  SynchronizationAlgorithm synal
           
protected  SynchronizationObject synob
           
 int synType
          The synchronization used for simulation **
 
Fields inherited from class visidia.simulation.process.algorithm.Algorithm
proc
 
Constructor Summary
RuleAlgorithm()
          default constructor.
RuleAlgorithm(RelabelingSystem r)
          constructor.from a relabeling system.
RuleAlgorithm(RuleAlgorithm algo)
           
 
Method Summary
 int applyRule(int i)
          this method applies the rule on position i. the contexts is in synob, modifications are also done in synob.
abstract  java.lang.Object clone()
           
 void endRuleAction(int kindOfRule)
          this method do actions depending of the kind of the rule.
 java.lang.String getDescription()
          get help about the relabeling system
 java.util.Collection<MessageType> getMessageTypeList()
          return collection of Message Types. message types are defined in misc.MSG_TYPES. this method is common to all rules simulators.
 RelabelingSystem getRelSys()
           
 RSOptions getRSOptions()
          get user preferences
 java.lang.String getState()
          return the label of the node.
 SynchronizationAlgorithm getSynchronizationAlgorithm()
           
 void init()
          It's the algorithm of simulation of relabeling system.
 java.lang.String print()
          used to print.
 void receiveAndUpdateMyState()
          for RDV LC2, only LC1 should redefine it
 void sendMyState()
          send the label to the star center if he is connected. in LC1 they are many centers, so this methode is redefined in LC1Rule.
 void sendUpdate()
          send the states (described in synob) to synchronized neighbors. this method is used by the center after a transformation.
 void setMessageProcess(MessageProcess proc)
          Sets the message process.
 void setMyState(java.lang.String newState)
           
 void setRelSys(RelabelingSystem rs)
          set the relabeling system.
 java.lang.String toString()
           
 void updateNeigborhoodInfo()
          this method receives from all synchronized neighbors their states, and update the information in the synob. this method works with all synchronization algorithms.
 
Methods inherited from class visidia.simulation.process.algorithm.Algorithm
getArity, getEdgeProperty, getId, getNetSize, getOrientedDoors, getProperty, isIncomingDoor, isOutgoingDoor, putProperty, putProperty, receive, receiveFrom, receiveFrom, run, sendAll, sendTo, setDoorState, setEdgeProperty
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

relSys

protected transient RelabelingSystem relSys
The relabeling System to simulate


synType

public int synType
The synchronization used for simulation **


synal

protected transient SynchronizationAlgorithm synal

synob

protected transient SynchronizationObject synob
Constructor Detail

RuleAlgorithm

public RuleAlgorithm()
default constructor.


RuleAlgorithm

public RuleAlgorithm(RelabelingSystem r)
constructor.from a relabeling system.

Parameters:
r - the relabeling system to simulate.

RuleAlgorithm

public RuleAlgorithm(RuleAlgorithm algo)
Method Detail

setMessageProcess

public void setMessageProcess(MessageProcess proc)
Sets the message process.

Overrides:
setMessageProcess in class Algorithm
Parameters:
proc - the new message process

getSynchronizationAlgorithm

public final SynchronizationAlgorithm getSynchronizationAlgorithm()

clone

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

toString

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

getMessageTypeList

public final java.util.Collection<MessageType> getMessageTypeList()
return collection of Message Types. message types are defined in misc.MSG_TYPES. this method is common to all rules simulators.

Overrides:
getMessageTypeList in class Algorithm
Returns:
the message type list

print

public final java.lang.String print()
used to print. (for tests).


updateNeigborhoodInfo

public final void updateNeigborhoodInfo()
this method receives from all synchronized neighbors their states, and update the information in the synob. this method works with all synchronization algorithms.


sendUpdate

public final void sendUpdate()
send the states (described in synob) to synchronized neighbors. this method is used by the center after a transformation. Warning: this method is available only for RDV or LC2 synchronization types. it should be redefined for LC1.


setRelSys

public final void setRelSys(RelabelingSystem rs)
set the relabeling system.

Parameters:
rs - the new relabeling system.

getRelSys

public final RelabelingSystem getRelSys()

init

public void init()
It's the algorithm of simulation of relabeling system. Works with RDV, LC1, and LC2 and supports various options

Specified by:
init in class Algorithm

endRuleAction

public final void endRuleAction(int kindOfRule)
this method do actions depending of the kind of the rule.

Parameters:
kindOfRule - possible values defined in class SynCT.

sendMyState

public final void sendMyState()
send the label to the star center if he is connected. in LC1 they are many centers, so this methode is redefined in LC1Rule.


receiveAndUpdateMyState

public final void receiveAndUpdateMyState()
for RDV LC2, only LC1 should redefine it


getRSOptions

public final RSOptions getRSOptions()
get user preferences

Returns:
the RSOptions

getState

public final java.lang.String getState()
return the label of the node.


setMyState

public final void setMyState(java.lang.String newState)

applyRule

public final int applyRule(int i)
this method applies the rule on position i. the contexts is in synob, modifications are also done in synob.

Parameters:
i - position of the rule.
Returns:
the rule type

getDescription

public final java.lang.String getDescription()
get help about the relabeling system

Overrides:
getDescription in class Algorithm
Returns:
the description