at.spardat.xma.mdl.util
Class TransStringSet

java.lang.Object
  extended byat.spardat.xma.mdl.util.TransStringSet
All Implemented Interfaces:
Descriptive, Synchronization, Transactional
Direct Known Subclasses:
TransStringSet1, TransStringSetN

public abstract class TransStringSet
extends java.lang.Object
implements Transactional, Synchronization, Descriptive

This class technically is a set of Strings with the expanded capability to rollback changes made since particular points in the past. Therefore the name 'transactional string set'. Basically, the states to which the state may be rollbacked are construction and the last calls to commit or rollback.


Constructor Summary
TransStringSet()
           
 
Method Summary
abstract  boolean add(java.lang.String key)
          Adds a given key to the selection set.
abstract  boolean changed()
          Returns true if this selection set has changed since construction or the last call to commit or rollback.
abstract  void clear()
          Removes all entries from this.
abstract  void commit()
          Discards the history information.
abstract  boolean contains(java.lang.String key)
          Returns true if this set contains the provided key
abstract  void describe(DNode node)
          describe puts all relevant information about this into the provided node.
abstract  int estimateMemory()
          Estimates the number of bytes this object consumes in memory.
abstract  void externalize(XmaOutput xo, boolean forceFull)
          Externalizing either saves the actual state or deltas (changes) in a provided XMAObjectOutput.
abstract  java.lang.String[] getAll()
          Returns a newly allocated String[] containing all Strings in this set.
abstract  java.lang.String getSome()
          Returns some String in this set or null if size() == 0.
abstract  void internalize(XmaInput in)
          Updates the state of this with information of the given XMAObjectInput.
abstract  boolean remove(java.lang.String key)
          Removes a given key from the selection set
abstract  void rollback()
          Restores the state of this to the state of the last commit, rollback or construction.
abstract  int size()
          Returns the number of strings in the set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransStringSet

public TransStringSet()
Method Detail

commit

public abstract void commit()
Discards the history information.

Specified by:
commit in interface Transactional

rollback

public abstract void rollback()
Restores the state of this to the state of the last commit, rollback or construction.

Specified by:
rollback in interface Transactional

changed

public abstract boolean changed()
Returns true if this selection set has changed since construction or the last call to commit or rollback.

Specified by:
changed in interface Transactional
Returns:
true if changed, false otherwise

add

public abstract boolean add(java.lang.String key)
Adds a given key to the selection set. If the set is restricted in size (which may be decided upon by the subclass), the add operation may work like a replace in that an old element be removed from the set.

Parameters:
key - the key to add; must not be null.
Returns:
true if added, false if already in the set
Throws:
java.lang.IllegalArgumentException - if key is null.

remove

public abstract boolean remove(java.lang.String key)
Removes a given key from the selection set

Parameters:
key - the key to remove
Returns:
true if removed, false if not in the set
Throws:
java.lang.IllegalArgumentException - if key is null.

clear

public abstract void clear()
Removes all entries from this.


size

public abstract int size()
Returns the number of strings in the set.


getSome

public abstract java.lang.String getSome()
Returns some String in this set or null if size() == 0.


getAll

public abstract java.lang.String[] getAll()
Returns a newly allocated String[] containing all Strings in this set. The length of the returned array is size().


contains

public abstract boolean contains(java.lang.String key)
Returns true if this set contains the provided key


estimateMemory

public abstract int estimateMemory()
Estimates the number of bytes this object consumes in memory.


externalize

public abstract void externalize(XmaOutput xo,
                                 boolean forceFull)
                          throws java.io.IOException
Description copied from interface: Synchronization
Externalizing either saves the actual state or deltas (changes) in a provided XMAObjectOutput. The default behaviour is to serialize the changes if changes are beeing tracked. This behaviour may be overwritten by forceFull. If true, the complete state information is written.

If forceFull is false, the object implementing this interface must also implement Transactional. If the object implementing this is able to track changes, these are the changes since the last syncpoint.

Specified by:
externalize in interface Synchronization
Parameters:
xo - the serialization destination
forceFull - if true, the complete state is written and deltas are ignored.
Throws:
java.io.IOException - on serialization errors
See Also:
Synchronization.externalize(at.spardat.xma.serializer.XmaOutput, boolean)

internalize

public abstract void internalize(XmaInput in)
                          throws java.io.IOException,
                                 java.lang.ClassNotFoundException
Description copied from interface: Synchronization
Updates the state of this with information of the given XMAObjectInput. in either contains changes or the complete new state information. If in contains changes the implementing class also must implement Transactional and the state after calling internalize is !Transactional.changed(), e.g., a syncpoint is defined.

This method is not allowed to throw Exceptions because that would leave models in an inconsistent state. Thrown exceptions are considered to be programming errors. Internalize must not throw technical exceptions which indicate system or ressource failures. That implies that the person implementing internalize is not allowed to access ressources outside the JVM, either directly or via calls to other methods. Examples of ressource access which must not be triggered are calls to communication of file system services.

Specified by:
internalize in interface Synchronization
Parameters:
in - the XMAObjectInput. If a XMAObjectInputChangeListener is set in the object in, it will be notified after applying changes read from in.
Throws:
java.lang.ClassNotFoundException - on serialization errors
java.io.IOException - on serialization errors
See Also:
Synchronization.internalize(at.spardat.xma.serializer.XmaInput)

describe

public abstract void describe(DNode node)
Description copied from interface: Descriptive
describe puts all relevant information about this into the provided node. The implementing method may construct subnodes of node.

Specified by:
describe in interface Descriptive
Parameters:
node - the node going to hold information about this.
See Also:
Descriptive.describe(at.spardat.xma.mdl.util.DNode)