AROM-2_2_13

arom.kr.model
Interface InstanceSet

All Superinterfaces:
helix.util.beans.CompoundPropertySet
All Known Subinterfaces:
AMAssociation, AMClass, ClassExtension, Extension, Structure

public interface InstanceSet
extends helix.util.beans.CompoundPropertySet

An InstanceSet object represents a set of AROM instances. The InstanceSet interface defines basic operations on the set of AMInstances. An InstanceSet can be associated to a delegate which handles membership conditions. When an AMInstance is added to this instance set, the delegate is invoked to check membership.

Author:
bruley

Field Summary
static String INSTANCES
          The name of the composite property representing the collection of instances contained in this InstanceSet object.
 
Method Summary
 void addInstance(AMInstance instance)
          Add the supplied instance to this instance set.
 void addInstance(AMInstance instance, boolean acceptLostSlot)
          Add the supplied instance to this instance set.
 boolean contains(AMInstance instance)
          Tests if the specified instance is a component of this instance set.
 Membership getDelegate()
          Returns the delegate of this instance set.
 Iterator instances()
          Returns an iterator over the instances contained in this InstanceSet.
 AMInstance removeInstance(AMInstance instance)
          Removes the specified instance from this instance set.
 void setDelegate(Membership delegate)
          Sets the specified object as the delegate of this instance set.
 int size()
          Returns the number of instances contained in this instance set.
 
Methods inherited from interface helix.util.beans.CompoundPropertySet
addCompositionChangeListener, addCompositionChangeListener, addVetoableCompositionChangeListener, addVetoableCompositionChangeListener, removeCompositionChangeListener, removeCompositionChangeListener, removeVetoableCompositionChangeListener, removeVetoableCompositionChangeListener
 

Field Detail

INSTANCES

public static final String INSTANCES
The name of the composite property representing the collection of instances contained in this InstanceSet object.

See Also:
Constant Field Values
Method Detail

instances

public Iterator instances()
Returns an iterator over the instances contained in this InstanceSet.

Returns:
an iterator over the instances contained in this InstanceSet.

size

public int size()
Returns the number of instances contained in this instance set.

Returns:
the size of this set.

contains

public boolean contains(AMInstance instance)
Tests if the specified instance is a component of this instance set.

Parameters:
instance - an instance.
Returns:
true if the specified instance is the same as a component of this instance set, as determined by the equals method, false otherwise.

addInstance

public void addInstance(AMInstance instance)
                 throws MembershipVetoException
Add the supplied instance to this instance set. The instance set invokes it's delegate to check if the supplied instance can be added. If the delegate reject the instance, an exception is thrown.

If none delegate is set to this instance set, the instance is added to the set if all instance slots are preserved.

No action is performed if the supplied instance is already a component of this instance set.

Parameters:
instance - the instance to be added.
Throws:
MembershipVetoException - if the supplied instance can not be added to the instance set.

addInstance

public void addInstance(AMInstance instance,
                        boolean acceptLostSlot)
                 throws MembershipVetoException
Add the supplied instance to this instance set. The instance set invokes it's delegate to check if the supplied instance can be added. If the delegate reject the instance, an exception is thrown.

If none delegate is set to this instance set, the instance is added to the set if all instance slots are preserved or if acceptLostSlot is set to true.

No action is performed if the supplied instance is already a component of this instance set.

Parameters:
instance - the instance to be added.
acceptLostSlot - if set to true the instance is added to this InstanceSet even if some slots information will be lost.
Throws:
MembershipVetoException - if the supplied instance can not be added to the instance set.

removeInstance

public AMInstance removeInstance(AMInstance instance)
Removes the specified instance from this instance set.

Parameters:
instance - the instance to be removed.
Returns:
the removed instance if found, null if the supplied instance was not found in the instance set.

setDelegate

public void setDelegate(Membership delegate)
Sets the specified object as the delegate of this instance set.

Parameters:
delegate - the delegate of this instance set.

getDelegate

public Membership getDelegate()
Returns the delegate of this instance set.

Returns:
returns the delegate of this instance set.

AROM-2_2_13