uka.transport
Class ReadOnlyObjectSpace

java.lang.Object
  extended byuka.util.IDConstants
      extended byuka.transport.ObjectSpaceAdapter
          extended byuka.transport.ReadOnlyObjectSpace
All Implemented Interfaces:
ObjectSpace, java.io.Serializable

public class ReadOnlyObjectSpace
extends ObjectSpaceAdapter

An object space adapter behaves exactly like the original object space passed to its constructor.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class uka.transport.ObjectSpaceAdapter
original
 
Fields inherited from class uka.util.IDConstants
FIRST_NEW_ID, FIRST_VALID_ID, INVALID_ID, UNUSED_ID
 
Constructor Summary
ReadOnlyObjectSpace(ObjectSpace original)
           
 
Method Summary
 void clear()
          Clears the object space by removing all identifier assignments.
 int getID(java.lang.Object obj)
          Returns the identifier for a given object.
 ObjectSpace getOriginal()
           
 void includeID(int id)
          Make the object that corresponds to the given identifier part of this object space.
 void remove(int id)
          Removes the given identifer from this object space.
 void resetObject(int id, java.lang.Object obj)
          Reassigns a new object to an existing identifier.
 void setObject(int id, java.lang.Object obj)
          Assigns the given object to an application provided identifier and includes the given object to this object space.
 
Methods inherited from class uka.transport.ObjectSpaceAdapter
findID, getObject, getUsedIDs, isAccepted, isIncluded, isShared, isUsed
 
Methods inherited from class uka.util.IDConstants
isNew, isValid, normalizeID, toggleNew
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReadOnlyObjectSpace

public ReadOnlyObjectSpace(ObjectSpace original)
Method Detail

getOriginal

public final ObjectSpace getOriginal()
Overrides:
getOriginal in class ObjectSpaceAdapter

getID

public int getID(java.lang.Object obj)
Description copied from interface: ObjectSpace
Returns the identifier for a given object. If the object was presented to the ObjectSpace the first time, the #isNew method returns true for the resulting identifier.

Specified by:
getID in interface ObjectSpace
Overrides:
getID in class ObjectSpaceAdapter

setObject

public void setObject(int id,
                      java.lang.Object obj)
Description copied from interface: ObjectSpace
Assigns the given object to an application provided identifier and includes the given object to this object space.

Specified by:
setObject in interface ObjectSpace
Overrides:
setObject in class ObjectSpaceAdapter

resetObject

public void resetObject(int id,
                        java.lang.Object obj)
Description copied from interface: ObjectSpace
Reassigns a new object to an existing identifier. The effect is the same as removing the identifier first and then reassigning it with ObjectSpace.setObject(int, java.lang.Object). Since ObjectSpace.setObject(int, java.lang.Object) may be overridden in subclasses to handle the first assignment of an identifier especially, ObjectSpace.resetObject(int, java.lang.Object) can be used to avoid additional calls to ObjectSpace.setObject(int, java.lang.Object).

Specified by:
resetObject in interface ObjectSpace
Overrides:
resetObject in class ObjectSpaceAdapter

remove

public void remove(int id)
Description copied from interface: ObjectSpace
Removes the given identifer from this object space. This operation removes the complete binding of the corresponding object to its identifier from this object space. A future call to ObjectSpace.getID(java.lang.Object) with the object corresponding to the given identifier as argument will result in a new identifier.

Specified by:
remove in interface ObjectSpace
Overrides:
remove in class ObjectSpaceAdapter

clear

public void clear()
Description copied from interface: ObjectSpace
Clears the object space by removing all identifier assignments.

Specified by:
clear in interface ObjectSpace
Overrides:
clear in class ObjectSpaceAdapter

includeID

public void includeID(int id)
Description copied from interface: ObjectSpace
Make the object that corresponds to the given identifier part of this object space. An object is part of an object space, if the ObjectSpace.isIncluded(int) method returns true for the corresponding identifier. An object can have an assigned identifier in some object space without being part of that object space.

Specified by:
includeID in interface ObjectSpace
Overrides:
includeID in class ObjectSpaceAdapter