org.ov4j.data
Class Item<T extends java.lang.Comparable<? super T> & java.lang.Cloneable & java.io.Serializable,C extends java.lang.Comparable<? super C>>

java.lang.Object
  extended by org.ov4j.data.Item<T,C>
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class Item<T extends java.lang.Comparable<? super T> & java.lang.Cloneable & java.io.Serializable,C extends java.lang.Comparable<? super C>>
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

This is the objects stored in the system, it holds all versions for a given ID.

Author:
smolloy
See Also:
Serialized Form

Field Summary
static Item<?,?>[] EMPTY_ARRAY
          Empty Item array.
static int NO_ROLLOVER
          Use this version rollover to keep whole history.
 
Constructor Summary
Item()
          Constructor.
 
Method Summary
 boolean addVersion(Version<T> version, int versionRollover)
          Add a version to this item.
 Item<T,C> clone()
           
 boolean equals(java.lang.Object o)
           
 C getId()
           
 Version<T> getLatest()
           
 Version<T> getLatestBefore(long tstamp)
           
 long getModificationStamp()
           
 Version<T>[] getVersions()
           
 int hashCode()
           
 int numVersions()
           
 void setId(C id)
           
 void setLatest(Version<T> latest)
           
 void setModificationStamp(long modificationStamp)
           
 void setVersions(Version<T>[] newVersions)
           
 java.lang.String toString()
           
 void versions(Version<T>[] newVersions)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY_ARRAY

public static final Item<?,?>[] EMPTY_ARRAY
Empty Item array.


NO_ROLLOVER

public static final int NO_ROLLOVER
Use this version rollover to keep whole history.

See Also:
Constant Field Values
Constructor Detail

Item

public Item()
Constructor.

Method Detail

addVersion

public boolean addVersion(Version<T> version,
                          int versionRollover)
Add a version to this item.

Parameters:
version - The new version to be added.
versionRollover - How many versions to keep in history.
Returns:
True if the version was successfully added.

clone

public Item<T,C> clone()
                                                                                                                                           throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException
See Also:
Object.clone()

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

getId

public C getId()
Returns:
Returns the id.

getLatest

public Version<T> getLatest()
Returns:
The latest version of this item.

getLatestBefore

public Version<T> getLatestBefore(long tstamp)
Parameters:
tstamp - Timestamp to use for fetching the version.
Returns:
the latest version of this item before the specified timstamp.

getModificationStamp

public long getModificationStamp()
Returns:
Returns the modificationStamp.

getVersions

public Version<T>[] getVersions()
Returns:
Returns the versions.

hashCode

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

numVersions

public int numVersions()
Returns:
Number of versions in this item.

setId

public void setId(C id)
Parameters:
id - The id to set.

setLatest

public void setLatest(Version<T> latest)
Parameters:
latest - The latest version to set.

setModificationStamp

public void setModificationStamp(long modificationStamp)
Parameters:
modificationStamp - The modificationStamp to set.

setVersions

public void setVersions(Version<T>[] newVersions)
Parameters:
versions - The versions to set.

toString

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

versions

public void versions(Version<T>[] newVersions)
Parameters:
versions - The versions to set.


Copyright © 2004-2007 Steve Molloy. All Rights Reserved.