mnemosyne.core
Interface VersionCollection

All Known Implementing Classes:
ListVersionCollection

public interface VersionCollection

Interface for managing versions of a persistent object. Every persistent object instance has its own version manager.

Version:
$Id: VersionCollection.java,v 1.1.1.1 2004/08/07 06:41:15 charlesblaxland Exp $

Method Summary
 void addVersion(Version version, java.lang.Object obj)
          Adds a new version of the object.
 void removeVersion(Version version)
          Removes the given version of the object.
 void replaceVersion(Version version, java.lang.Object obj)
          Sets the value of this object at the given version.
 java.lang.Object retrieveVersion(Version versionToGet)
          Returns the object as it appeared at the given version.
 int size()
          Returns the number of items in this collection.
 

Method Detail

retrieveVersion

public java.lang.Object retrieveVersion(Version versionToGet)
Returns the object as it appeared at the given version. Persistent objects do not necessarily have an instance for *every* version that is created. Only objects that actually changed in a particular version have instances that exactly match that version.

If there is no version that matches exactly the version specified, then the last version previous to that is returned. This will be the version in which the object was last modified, or the version as at system startup if there have been no modifications. If there is no valid version found, a runtime exception is raised.

Parameters:
versionToGet - The version of the object to retrieve.
Returns:
The version of the object at the given version.

replaceVersion

public void replaceVersion(Version version,
                           java.lang.Object obj)
Sets the value of this object at the given version. If there is a current value of the object at the given version, it is replaced. If there is no version of the object at the given version, a runtime exception is raised.

Parameters:
version -
obj -

addVersion

public void addVersion(Version version,
                       java.lang.Object obj)
Adds a new version of the object. If there is a current value of the object at the given version, or if the given version is less than the latest version, a runtime exception is generated.

Parameters:
version -
obj -

removeVersion

public void removeVersion(Version version)
Removes the given version of the object. This is typically called by the version garbage collector to remove versions that are no longer being referenced by any threads.

If the given version does not exist, no action is taken.

Parameters:
version - The version of the object to remove.

size

public int size()
Returns the number of items in this collection.

Returns:


Copyright © 2004 Charles Blaxland. All Rights Reserved.