edu.byu.ece.edif.core
Class RenamedObject

java.lang.Object
  extended by edu.byu.ece.edif.core.NamedObject
      extended by edu.byu.ece.edif.core.RenamedObject
All Implemented Interfaces:
EdifNameable, EdifOut, Nameable, java.io.Serializable, java.lang.Cloneable

public class RenamedObject
extends NamedObject
implements java.lang.Cloneable

Represents Edif names that are renamed using the RENAME keyword. This class actually contains two names: The first name is the "Edif" name that will be used by the EDIF infrastructure. This name is accessed/changed using the NamedObject super class methods. The second name is the "old name" or the original name that was renamed. This is often an invalid EDIF name that required renaming for internal use. This object is immutable.

Sample Edif:

  (rename diff_0 "diff(0)")
 

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

Field Summary
private  java.lang.String _oldname
          The old name that had to be renamed.
 
Fields inherited from class edu.byu.ece.edif.core.NamedObject
_name
 
Constructor Summary
RenamedObject(EdifNameable name, java.lang.String oldname)
           
RenamedObject(RenamedObject obj)
           
RenamedObject(java.lang.String name)
           
RenamedObject(java.lang.String name, java.lang.String oldname)
          Construct an initialized RenamedObject.
 
Method Summary
 java.lang.Object clone()
          Provide a deep clone of this object.
static EdifNameable createValidEdifNameable(java.lang.String string)
          This method will create a new EdifNameable object from the given string.
 boolean equals(java.lang.Object cmp)
          Compare this Object's name to the given Object.
 java.lang.String getOldName()
          Return the old name.
 void toEdif(EdifPrintWriter epw)
          Convert this object to EDIF format, and write it to the passed in EdifPrintWriter
 java.lang.String toString()
          Return a String representation of this object.
 
Methods inherited from class edu.byu.ece.edif.core.NamedObject
createValidEdifString, getName, isValidEdifName
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_oldname

private java.lang.String _oldname
The old name that had to be renamed.

Constructor Detail

RenamedObject

public RenamedObject(java.lang.String name)

RenamedObject

public RenamedObject(java.lang.String name,
                     java.lang.String oldname)
              throws InvalidEdifNameException
Construct an initialized RenamedObject.

Parameters:
name - The Edif name (new name)
oldname - The old original name that needed renaming
Throws:
InvalidEdifNameException

RenamedObject

public RenamedObject(EdifNameable name,
                     java.lang.String oldname)

RenamedObject

public RenamedObject(RenamedObject obj)
Method Detail

clone

public java.lang.Object clone()
Provide a deep clone of this object. New strings are created for the cloned object.

Overrides:
clone in class NamedObject
Returns:
An Object that is a copy of clone of this NamedObject

createValidEdifNameable

public static EdifNameable createValidEdifNameable(java.lang.String string)
This method will create a new EdifNameable object from the given string. The object will represent a valid Edif name. In this implementation, a NamedObject will be returned if the string is a valid Edif string. If an invalid string is passed in, a RenamedObject will be returned with the old invalid name stored in the old name field of the RenamedObject.

Parameters:
string - The string that will be used to make a valid and unique EDIF name
Returns:
And EdifNameable Object, containing the name, or new name and old name

equals

public boolean equals(java.lang.Object cmp)
Description copied from class: NamedObject
Compare this Object's name to the given Object.

Overrides:
equals in class NamedObject
Parameters:
cmp - The Object to compare to this one
Returns:
True if the name of this Object equals the name of the passed in one

getOldName

public java.lang.String getOldName()
Return the old name.

Specified by:
getOldName in interface EdifNameable
Overrides:
getOldName in class NamedObject
Returns:
A String object containing the old name of this object before it was renamed

toEdif

public void toEdif(EdifPrintWriter epw)
Convert this object to EDIF format, and write it to the passed in EdifPrintWriter

Specified by:
toEdif in interface EdifOut
Overrides:
toEdif in class NamedObject
Parameters:
epw - The EdifPrintWriter Object that the EDIF data will be written to

toString

public java.lang.String toString()
Return a String representation of this object.

Overrides:
toString in class NamedObject
Returns:
a String object that represents this renamed object