at.spardat.xma.mdl.util
Class TransStringSetN

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

public class TransStringSetN
extends TransStringSet

A transactional string set that is not size restricted.


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

Constructor Detail

TransStringSetN

public TransStringSetN()
Method Detail

commit

public void commit()
Description copied from class: TransStringSet
Discards the history information.

Specified by:
commit in interface Transactional
Specified by:
commit in class TransStringSet
See Also:
TransStringSet.commit()

rollback

public void rollback()
Description copied from class: TransStringSet
Restores the state of this to the state of the last commit, rollback or construction.

Specified by:
rollback in interface Transactional
Specified by:
rollback in class TransStringSet
See Also:
TransStringSet.rollback()

changed

public boolean changed()
Description copied from class: TransStringSet
Returns true if this selection set has changed since construction or the last call to commit or rollback.

Specified by:
changed in interface Transactional
Specified by:
changed in class TransStringSet
See Also:
TransStringSet.changed()

add

public boolean add(java.lang.String key)
Description copied from class: TransStringSet
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.

Specified by:
add in class TransStringSet
Parameters:
key - the key to add; must not be null.
Returns:
true if added, false if already in the set
See Also:
TransStringSet.add(java.lang.String)

remove

public boolean remove(java.lang.String key)
Description copied from class: TransStringSet
Removes a given key from the selection set

Specified by:
remove in class TransStringSet
Parameters:
key - the key to remove
Returns:
true if removed, false if not in the set
See Also:
TransStringSet.remove(java.lang.String)

clear

public void clear()
Description copied from class: TransStringSet
Removes all entries from this.

Specified by:
clear in class TransStringSet
See Also:
TransStringSet.clear()

size

public int size()
Description copied from class: TransStringSet
Returns the number of strings in the set.

Specified by:
size in class TransStringSet
See Also:
TransStringSet.size()

getSome

public java.lang.String getSome()
Description copied from class: TransStringSet
Returns some String in this set or null if size() == 0.

Specified by:
getSome in class TransStringSet
See Also:
TransStringSet.getSome()

getAll

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

Specified by:
getAll in class TransStringSet
See Also:
TransStringSet.getAll()

contains

public boolean contains(java.lang.String key)
Description copied from class: TransStringSet
Returns true if this set contains the provided key

Specified by:
contains in class TransStringSet
See Also:
TransStringSet.contains(java.lang.String)

externalize

public void externalize(XmaOutput o,
                        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
Specified by:
externalize in class TransStringSet
Throws:
java.io.IOException
See Also:
Synchronization.externalize(at.spardat.xma.serializer.XmaOutput, boolean)

internalize

public void internalize(XmaInput i)
                 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
Specified by:
internalize in class TransStringSet
Throws:
java.io.IOException
java.lang.ClassNotFoundException
See Also:
Synchronization.internalize(at.spardat.xma.serializer.XmaInput)

equals

public boolean equals(java.lang.Object obj)
See Also:
Object.equals(java.lang.Object)

describe

public void describe(DNode node)
Produces a single row of information.

Specified by:
describe in interface Descriptive
Specified by:
describe in class TransStringSet
See Also:
Descriptive.describe(at.spardat.xma.mdl.util.DNode)

estimateMemory

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

Specified by:
estimateMemory in class TransStringSet