net.sf.sasl.common.clock
Class SimpleLogicalClock

java.lang.Object
  extended by net.sf.sasl.common.clock.SimpleLogicalClock

public class SimpleLogicalClock
extends Object

Representation of a one dimensional Lamport logical clock.

Author:
Philipp Förmer

Constructor Summary
SimpleLogicalClock()
          Default constructor.
SimpleLogicalClock(long initialClockValue)
          Initializes the initial clock value with the given clock value.
 
Method Summary
 long getCurrentClockValue()
          Returns the current clock value.
static SimpleLogicalClock getSharedClockInstance()
          Returns a shared logical clock instance.
 long nextClockValue()
          Increments the current clock value by one and returns the increment clock value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleLogicalClock

public SimpleLogicalClock()
Default constructor. Initializes the initial clock value with 0.


SimpleLogicalClock

public SimpleLogicalClock(long initialClockValue)
Initializes the initial clock value with the given clock value.

Parameters:
initialClockValue - any long value
Since:
0.0.1 (sasl-common-aspect-library)
Method Detail

getSharedClockInstance

public static SimpleLogicalClock getSharedClockInstance()
Returns a shared logical clock instance.

Returns:
non null instance
Since:
0.0.1 (sasl-common-aspect-library)

getCurrentClockValue

public long getCurrentClockValue()
Returns the current clock value.

Returns:
any long value
Since:
0.0.1 (sasl-common-aspect-library)

nextClockValue

public long nextClockValue()
Increments the current clock value by one and returns the increment clock value.

Returns:
any integer value
Since:
0.0.1 (sasl-common-aspect-library)


Copyright © 2010. All Rights Reserved.