com.tensegrity.generic.attribute.event
Class AttributableOnSetEvent

java.lang.Object
  extended bycom.tensegrity.generic.attribute.event.AbstractAttributableOnSetEvent
      extended bycom.tensegrity.generic.attribute.event.AttributableOnSetEvent
All Implemented Interfaces:
AttributableOnSetRootEvent

public class AttributableOnSetEvent
extends AbstractAttributableOnSetEvent

* This event indicates that a change in the attribute objects of an AttributableOnSet-object has occured. Registered listeners will get informed about this event. The receivers can get an description telling what kind of event occured and a reference to the object where it happened.

* * * * * * * * * * * * * * * * * * *

Version:
$Id: AttributableOnSetEvent.java,v 1.4 2003/02/28 17:24:39 sr Exp $
Author:
Stepan Rutz, MKegel

Field Summary
static int ATTRIBUTES_CHANGED_VALUE
          indicator for an attribute change
 
Constructor Summary
AttributableOnSetEvent(int eventid, AttributableOnSet attributableOnSet, AttributeSet attributeschanged_tablelike, AttributeSet attributeschanged_treelike, java.util.Map attribute2oldvalue_tablelike, java.util.Map attribute2oldvalue_treelike)
           Constructor specifying the kind of event and the AttributableOnSet instance this event is raised by.
 
Method Summary
 AttributeSet getChangedAttributes()
           Returns an AttributeSet of the Attributes that have been changed.
 AttributeSet getChangedAttributesTree()
           Returns an AttributeSet of the Attributes that have been changed.
 java.lang.Object getOldValue(java.lang.String name)
           Returns either the old value for the given name or null if the old value is not specified.
 java.lang.Object getOldValueTree(java.lang.String name)
           Returns either the old value for the given name or null if the old value is not specified.
 boolean hasOldValues()
           Returns a boolean that indicates whether this event comes with the old values for the changed Attribute objects of the table like structure.
 boolean hasOldValuesTree()
           Returns a boolean that indicates whether this event comes with the old values for the changed Attribute objects of the tree like structure.
 java.util.Iterator iteratorOldValues()
           Returns an Iterator instance which can be used to iterate over the names of the changed Attribute objects of the table like structure.
 java.util.Iterator iteratorOldValuesTree()
           Returns an Iterator instance which can be used to iterate over the names of the changed Attribute objects of the tree like structure.
 
Methods inherited from class com.tensegrity.generic.attribute.event.AbstractAttributableOnSetEvent
getAttributableOnSet, getDescription
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTRIBUTES_CHANGED_VALUE

public static final int ATTRIBUTES_CHANGED_VALUE
indicator for an attribute change

See Also:
Constant Field Values
Constructor Detail

AttributableOnSetEvent

public AttributableOnSetEvent(int eventid,
                              AttributableOnSet attributableOnSet,
                              AttributeSet attributeschanged_tablelike,
                              AttributeSet attributeschanged_treelike,
                              java.util.Map attribute2oldvalue_tablelike,
                              java.util.Map attribute2oldvalue_treelike)

Constructor specifying the kind of event and the AttributableOnSet instance this event is raised by.
Optionally the attributes that have been changed can be specified through the given AttributeSet instances. The changed attributes should be given in their table like structure as well as in their tree like structure and should carry their new values.
It is possible to specify the old values of the changed attributes through the Map instances passed into the constructor. These object should map the attribute paths onto their old value. This parameter is also optionally. Accordingly to the changed attributes the old value Map objects should be given for the table like structure as well as for the tree like structure.


Additionally the AttributeSet instances and the Attribute instances that are passed into should be non mutable.
Notice:Non mutable does not refer to the mutable state of the Attribute/AttributeSet itself but to be an Attribute/AttributeSet instance created through the mthods: AttributeFactory.immutableAttribute(Attribute) or respectively AttributeFactory.immutableAttributeSet(AttributeSet)

When passing null into instead of AttributeSet instances the receiver of this event has to expect that all attributes have been changed.
Of course it is possible for this case to pass in the corresponding Map instances which holds the old values of all attributes.

Parameters:
eventid - the id for this event.
attributableOnSet - the AttributableOnSet that raises this event
attributeschanged_tablelike - the changed Attribute instances in their table like structure
attributeschanged_treelike - the changed Attribute instances in their tree like structure
Method Detail

getChangedAttributes

public final AttributeSet getChangedAttributes()

Returns an AttributeSet of the Attributes that have been changed. The returned AttributeSet could be null or empty.

In the case that the returned AttributeSet is empty no Attribute has been changed.

In the case that the returned AttributeSet is null an undefinable number of Attributes habe been changed.

The returned AttributSet has the same hierarchical structure as the AttributeSet returned by AttributableOnSet.getAttributes().

Returns:
List a list of the Attributes that have been changed

getChangedAttributesTree

public final AttributeSet getChangedAttributesTree()

Returns an AttributeSet of the Attributes that have been changed. The returned AttributeSet could be null or empty.

In the case that the returned AttributeSet is empty no Attribute has been changed.

In the case that the returned AttributeSet is null an undefinable number of Attributes habe been changed.

The returned AttributSet has the same hierarchical structure as the AttributeSet returned by AttributableOnSet.getAttributesTree().

Returns:
List a list of the Attributes that have been changed

hasOldValues

public final boolean hasOldValues()

Returns a boolean that indicates whether this event comes with the old values for the changed Attribute objects of the table like structure.

Returns:
boolean a flag indicating whether the event provides the old values of the changed Attribute objects

iteratorOldValues

public final java.util.Iterator iteratorOldValues()

Returns an Iterator instance which can be used to iterate over the names of the changed Attribute objects of the table like structure.

Notice:Name does not mean the name of the attribute. Furthermore it refers to the name the old values can be queried by from this event.
In fact the name is the complete path of the attribute plus its name.

Returns:
Iterator to walk through the names of the stored old values

getOldValue

public final java.lang.Object getOldValue(java.lang.String name)

Returns either the old value for the given name or null if the old value is not specified.
In order to get the old value the given name must refer to an Attribute object located (directly or indirectly) within the AttributeSet instance returned by getChangedAttributes().

Parameters:
name - the key of the old value that is querried
Returns:
Object the old value of the given Attribute instance or null if the old value is not specified
See Also:
iteratorOldValues()

hasOldValuesTree

public final boolean hasOldValuesTree()

Returns a boolean that indicates whether this event comes with the old values for the changed Attribute objects of the tree like structure.

Returns:
boolean a flag indicating whether the event provides the old values of the changed Attribute objects

iteratorOldValuesTree

public final java.util.Iterator iteratorOldValuesTree()

Returns an Iterator instance which can be used to iterate over the names of the changed Attribute objects of the tree like structure.

Notice:Name does not mean the name of the attribute. Furthermore it refers to the name the old values can be queried by from this event.
In fact the name is the complete path of the attribute plus its name.

Returns:
Iterator to walk through the names of the stored old values

getOldValueTree

public final java.lang.Object getOldValueTree(java.lang.String name)

Returns either the old value for the given name or null if the old value is not specified.
In order to get the old value the given name must refer to an Attribute object located (directly or indirectly) within the AttributeSet instance returned by getChangedAttributesTree().

Parameters:
name - the key of the old value that is querried
Returns:
Object the old value of the given Attribute instance or null if the old value is not specified
See Also:
iteratorOldValuesTree()


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.