edu.byu.ece.edif.core
Class NamedPropertyObject

java.lang.Object
  extended by edu.byu.ece.edif.core.NamedPropertyObject
All Implemented Interfaces:
Properties, java.io.Serializable
Direct Known Subclasses:
EdifCell, EdifCellInstance, EdifDesign, EdifEnvironment, EdifLibrary, EdifNet, EdifPort, PseudoNet

public abstract class NamedPropertyObject
extends java.lang.Object
implements Properties, java.io.Serializable

Represents a container class that contains an EdifNameable object (to define the name of this object) as well as a PropertyList object to store all properties of the object. This class is used as a base class for many of the Edif objects used in this package that require a name as well as properties.

To save memory, this class will not create any PropertyList object unless properties are added to the object.

Version:
$Id:NamedPropertyObject.java 198 2008-04-16 21:14:21Z jamesfcarroll $
See Also:
Serialized Form

Field Summary
private  EdifNameable _name
          The EdifNameable object that names this object.
private  PropertyList _pl
          The PropertyList object.
 
Constructor Summary
NamedPropertyObject(EdifNameable name)
          Construct a NamedPropertyObject with the specified name object as its value
NamedPropertyObject(java.lang.String name)
          Construct a NamedPropertyObject with the specified name
 
Method Summary
 void addProperty(Property p)
          Add a single property to this object.
 void addProperty(java.lang.String name, EdifTypedValue value)
          Add a single property to this object.
 void addPropertyList(PropertyList pList)
          Add a list of properties to the object.
 void copyProperties(Properties props)
          Copy properties of given properties object into this object.
 boolean equals(NamedPropertyObject cmp)
           
 boolean equalsProperties(NamedPropertyObject cmp)
          Return True if the passed-in NamedPropertyObject's PropertyList matches the PropertyList Object contained in this Object.
 EdifNameable getEdifNameable()
          Get the EdifNameable object that names this object.
 java.lang.String getName()
          Get the Edif name of this object.
 java.lang.String getOldName()
          Return the "old name" associated with this Named object.
 Property getProperty(java.lang.String str)
          Get a property from this object.
 PropertyList getPropertyList()
          Return the complete PropertyList of this object.
(package private)  void rename(EdifNameable newName)
          Rename this object
(package private)  void rename(java.lang.String newName)
          Rename this object.
(package private)  void rename(java.lang.String newName, java.lang.String oldName)
          Rename this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_name

private EdifNameable _name
The EdifNameable object that names this object.


_pl

private PropertyList _pl
The PropertyList object. This is kept null unless at least one property is added to the object.

Constructor Detail

NamedPropertyObject

public NamedPropertyObject(java.lang.String name)
                    throws InvalidEdifNameException
Construct a NamedPropertyObject with the specified name

Parameters:
name - The name of this new NamedPropertyObject
Throws:
InvalidEdifNameException

NamedPropertyObject

public NamedPropertyObject(EdifNameable name)
Construct a NamedPropertyObject with the specified name object as its value

Parameters:
name - The object containing name information for this new NamedPropertyObject
Method Detail

addProperty

public void addProperty(java.lang.String name,
                        EdifTypedValue value)
Add a single property to this object.

Parameters:
name - The name of the property object
value - The instance specific value of this property

addProperty

public void addProperty(Property p)
Add a single property to this object.

Specified by:
addProperty in interface Properties
Parameters:
p - The Property Object to add to this objects list of properties.

addPropertyList

public void addPropertyList(PropertyList pList)
Add a list of properties to the object. This will append the current list of properties with the list of properties that are passed in as an argument.

Parameters:
pList - The list of properties to add to this object.

copyProperties

public void copyProperties(Properties props)
Copy properties of given properties object into this object.

Specified by:
copyProperties in interface Properties

equals

public boolean equals(NamedPropertyObject cmp)

equalsProperties

public boolean equalsProperties(NamedPropertyObject cmp)
Return True if the passed-in NamedPropertyObject's PropertyList matches the PropertyList Object contained in this Object.

Parameters:
cmp - The Object whose PropertyList Object will be matched up with the one in this Object
Returns:
True if this Object's PropertyList matches with the passed-in one's PropertyList

getEdifNameable

public EdifNameable getEdifNameable()
Get the EdifNameable object that names this object.

Returns:
An EdifNameable Object that contains the name information of this object

getName

public java.lang.String getName()
Get the Edif name of this object.

Returns:
A String Object specifying the name of this object

getOldName

public java.lang.String getOldName()
Return the "old name" associated with this Named object. If the object does not have an old name (i.e. it is not of type RenamedObject), it will return the Edif name.

Returns:
EDIF old name

getProperty

public Property getProperty(java.lang.String str)
Get a property from this object.

Specified by:
getProperty in interface Properties
Parameters:
str - The 'key' of the property
Returns:
A Property Object that corresponds to the passed-in String object

getPropertyList

public PropertyList getPropertyList()
Return the complete PropertyList of this object.

TODO: Should we return the list or a copy of the list? Returning the actual list seems dangerous as the list can be easily modified.

Specified by:
getPropertyList in interface Properties
Returns:
A PropertyList Object containing all the properties of this object.

rename

void rename(java.lang.String newName,
            java.lang.String oldName)
Rename this object.

Parameters:
newName - The new name for this object
oldName - The new name for this object

rename

void rename(java.lang.String newName)
Rename this object.

Parameters:
newName - The new name for this object

rename

void rename(EdifNameable newName)
Rename this object

Parameters:
newName - A NamedObject representing the new name for this object