org.jboss.cache.optimistic
Class DefaultDataVersion

java.lang.Object
  extended by org.jboss.cache.optimistic.DefaultDataVersion
All Implemented Interfaces:
java.io.Serializable, DataVersion

public class DefaultDataVersion
extends java.lang.Object
implements DataVersion

The default implementation of a DataVersion, uses a long to compare versions. This class is immutable.

Author:
Manik Surtani (manik@jboss.org)
See Also:
Serialized Form

Field Summary
static DataVersion ZERO
          Version zero.
 
Constructor Summary
DefaultDataVersion()
          Deprecated. use ZERO constant
DefaultDataVersion(long version)
          Constructs with a version number.
 
Method Summary
 boolean equals(java.lang.Object other)
           
 int hashCode()
           
 DataVersion increment()
          Returns a new DataVersion with a newer version number.
 boolean newerThan(DataVersion other)
          Returns true if this is a newer version than other.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ZERO

public static final DataVersion ZERO
Version zero. Assign this as the first version to your data.

Constructor Detail

DefaultDataVersion

public DefaultDataVersion()
Deprecated. use ZERO constant

Constructs with version 0.


DefaultDataVersion

public DefaultDataVersion(long version)
Constructs with a version number.

Method Detail

increment

public DataVersion increment()
Returns a new DataVersion with a newer version number.


newerThan

public boolean newerThan(DataVersion other)
Description copied from interface: DataVersion
Returns true if this is a newer version than other.

Specified by:
newerThan in interface DataVersion

toString

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

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object


Copyright 1998-2005 JBoss Inc . All Rights Reserved.