All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class att.grappa.Attribute

java.lang.Object
   |
   +----java.util.Observable
           |
           +----att.grappa.Attribute

public class Attribute
extends Observable
A class used for representing attributes associated with the graph elements. An attribute consists of a name-value pair. Once an attribute is constructed, the name cannot be changed.

Version:
1.1, 30 Sep 1999; Copyright 1996 - 1999 by AT&T Corp.
Author:
John Mocenigo, Research @ AT&T Labs

Constructor Index

 o Attribute(Attribute)
Constructs a new attribute from an existing one.
 o Attribute(String, String)
Constructs a new attribute from a name / value pair.

Method Index

 o clearChanged()
Use to indicate that this object has no longer changed, or that it has already notified all of its observers of its most recent change.
 o equals(Attribute)
Tests for equality with the given attribute.
 o equalsValue(Attribute)
Tests for equality of this attribute's value with the given attribute's value.
 o getName()
Get the name of this attribute.
 o getNameHash()
Get the hash value for this attributes name.
 o getObject()
Get the general-purpose Object associated with this attribute.
 o getValue()
Get the value of this attribute.
 o setChanged()
Use to indicate that this object has changed.
 o setObject(Object)
Set the general-purpose Object associated with this attribute.
 o setValue(String)
Set the value of the attribute.
 o toString()
Returns a string representation of the object.

Constructors

 o Attribute
 public Attribute(String attrName,
                  String attrValue)
Constructs a new attribute from a name / value pair.

Parameters:
attrName - the name of the attribute.
attrValue - the value of the attribute.
 o Attribute
 public Attribute(Attribute attr)
Constructs a new attribute from an existing one.

Parameters:
attr - the attribute from which this new one is to be generated

Methods

 o getName
 public String getName()
Get the name of this attribute.

Returns:
the name of this attribute.
 o getValue
 public String getValue()
Get the value of this attribute.

Returns:
the value of the attribute.
 o setValue
 public String setValue(String attrValue)
Set the value of the attribute. If the value is different than the current value, the Observable changed indicator is set.

Parameters:
attrValue - the new attribute value.
Returns:
the old attribute value.
 o equals
 public boolean equals(Attribute attr)
Tests for equality with the given attribute.

Parameters:
attr - the attribute with which to compare this attribute.
Returns:
true if the two attributes are equal, false otherwise.
 o equalsValue
 public boolean equalsValue(Attribute attr)
Tests for equality of this attribute's value with the given attribute's value. The attribute names are not compated.

Parameters:
attr - the attribute with which to compare this attribute.
Returns:
true if the two attribute values are equal, false otherwise.
 o getNameHash
 public int getNameHash()
Get the hash value for this attributes name.

Returns:
the hash code for the name portion of this attribute
 o setChanged
 public void setChanged()
Use to indicate that this object has changed. This method is a convenience method that calls the corresponding protected method of the Observable class.

Overrides:
setChanged in class Observable
See Also:
setChanged
 o clearChanged
 public void clearChanged()
Use to indicate that this object has no longer changed, or that it has already notified all of its observers of its most recent change. This method is a convenience method that calls the corresponding protected method of the Observable class.

Overrides:
clearChanged in class Observable
See Also:
clearChanged
 o getObject
 public Object getObject()
Get the general-purpose Object associated with this attribute. The object is set to null whenever the attribute is changed. However, the object can be set or read by Observers as a convenience. For example, as an Attribute is propagated among Observers, an Observer (usually the first one contacted) can set the object value to some value computed using. perhaps. the attribute value, then other Observers that need to work with the value do not need to incur the overhead of recomputing the same value.

Returns:
the value of the object associated with this attributes
See Also:
setObject
 o setObject
 public void setObject(Object obj)
Set the general-purpose Object associated with this attribute.

Parameters:
obj - value to use in setting this Attribute's object
See Also:
getObject
 o toString
 public String toString()
Returns a string representation of the object.

Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index