org.objectweb.dream.protocol.causality
Class BasicMatrixClockImpl

java.lang.Object
  extended byorg.objectweb.dream.AbstractComponent
      extended byorg.objectweb.dream.protocol.causality.BasicMatrixClockImpl
All Implemented Interfaces:
AttributeController, BindingController, LifeCycleController, Loggable, MatrixClock, MatrixClockAttributeController

public class BasicMatrixClockImpl
extends AbstractComponent
implements MatrixClock, MatrixClockAttributeController

Basic Implementation of a matrix clock. Stamps used by this component are integer arrays. This implementation is not efficient if the number of process involved in the causality order is important.


Field Summary
 
Fields inherited from class org.objectweb.dream.AbstractComponent
bindingLogger, componentDesc, fcState, lifeCycleLogger, logger, weaveableC
 
Fields inherited from interface org.objectweb.dream.protocol.causality.MatrixClock
ALREADY_DELIVERED, DELIVER, MATRIX_CLOCK_ITF_NAME, WAIT_TO_DELIVER
 
Fields inherited from interface org.objectweb.fractal.api.control.LifeCycleController
STARTED, STOPPED
 
Constructor Summary
BasicMatrixClockImpl()
           
 
Method Summary
 short getNumberOfProcess()
          Returns the number of process implied in the causality.
 Object getStamp(short from, short to)
          Generate a stamp for the specified destination identifier.
 String[] listFc()
           
 void setNumberOfProcess(short numberOfProcess)
          Sets the number of process implied in the causality.
 void startFc()
           
 int testRecvMatrix(Object stamp, short from, short to)
          Test if the received message, the given stamp belong, can be delivered.
 
Methods inherited from class org.objectweb.dream.AbstractComponent
bindFc, getFcState, initComponent, lookupFc, setLogger, stopFc, unbindFc
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicMatrixClockImpl

public BasicMatrixClockImpl()
Method Detail

testRecvMatrix

public int testRecvMatrix(Object stamp,
                          short from,
                          short to)
Description copied from interface: MatrixClock
Test if the received message, the given stamp belong, can be delivered. If the message is ready to be delivered, the method returns DELIVER and the matrix clock is updated. If the message has already been delivered, the method returns ALREADY_DELIVERED, and if other messages are waited before this message the method returns WAIT_TO_DELIVER. In the last two case the matrix clock remains unchanged.

Specified by:
testRecvMatrix in interface MatrixClock
Parameters:
stamp - a stamp
from - the identifier of the sender process.
to - the identifier of the local process.
Returns:
DELIVER,ALREADY_DELIVERED, or WAIT_TO_DELIVER code.
See Also:
MatrixClock.testRecvMatrix(Object, short, short)

getStamp

public Object getStamp(short from,
                       short to)
Description copied from interface: MatrixClock
Generate a stamp for the specified destination identifier.

Specified by:
getStamp in interface MatrixClock
Parameters:
from - the local process identifier
to - the destination process identifier
Returns:
a stamp.
See Also:
MatrixClock.getStamp(short, short)

getNumberOfProcess

public short getNumberOfProcess()
Description copied from interface: MatrixClockAttributeController
Returns the number of process implied in the causality.

Specified by:
getNumberOfProcess in interface MatrixClockAttributeController
Returns:
the number of process implied in the causality.
See Also:
MatrixClockAttributeController.getNumberOfProcess()

setNumberOfProcess

public void setNumberOfProcess(short numberOfProcess)
Description copied from interface: MatrixClockAttributeController
Sets the number of process implied in the causality.

Specified by:
setNumberOfProcess in interface MatrixClockAttributeController
Parameters:
numberOfProcess - the number of process implied in the causality.
See Also:
MatrixClockAttributeController.setNumberOfProcess(short)

listFc

public String[] listFc()
Specified by:
listFc in interface BindingController
See Also:
BindingController.listFc()

startFc

public void startFc()
             throws IllegalLifeCycleException
Specified by:
startFc in interface LifeCycleController
Throws:
IllegalLifeCycleException
See Also:
LifeCycleController.startFc()


Copyright © 2003, 2004 - INRIA Rhone-Alpes - All Rights Reserved.