com.sun.electric.database.text
Class CellName

java.lang.Object
  extended by com.sun.electric.database.text.CellName
All Implemented Interfaces:
java.lang.Comparable<CellName>

public class CellName
extends java.lang.Object
implements java.lang.Comparable<CellName>

A CellName is a text-parsing object for Cell names. Cell names have the form:

Name;Version{View}

where the Name names the cell, the Version is the version number, and the View is the view of the cell (layout, schematics, icon, etc.)

Only the name is necessary. If the ";Version" is omitted, then the most recent version is assumed. If the "{View}" is omitted, then the "unknown" view is assumed.


Method Summary
 void check()
          Checks invariant of this CellName.
 int compareTo(CellName that)
          Compares two CellName objects.
 boolean equals(java.lang.Object obj)
          Compares this CellName object to the specified object.
 boolean equalsIgnoreVersion(java.lang.Object obj)
          Compares this CellName object to the specified object.
 java.lang.String getName()
          Method to return the name part of a parsed Cell name.
 int getVersion()
          Method to return the version part of a parsed Cell name.
 View getView()
          Method to return the view part of a parsed Cell name.
 int hashCode()
          Returns a hash code for this Version.
 boolean isIcon()
          Method to determine whether this CellName is a name of an icon Cell.
 boolean isSchematic()
          Method to determine whether this CellName is a name of an schematic Cell.
static CellName newName(java.lang.String name, View view, int version)
          Create a CellName from the given name, view, and version.
static CellName parseName(java.lang.String name)
          Method to parse the specified Cell name and return a CellName object.
 java.lang.String toString()
          Method to build the full cell name.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getName

public java.lang.String getName()
Method to return the name part of a parsed Cell name.

Returns:
the name part of a parsed Cell name.

getView

public View getView()
Method to return the view part of a parsed Cell name.

Returns:
the view part of a parsed Cell name.

isIcon

public boolean isIcon()
Method to determine whether this CellName is a name of an icon Cell.

Returns:
true if this CellName is a name of an icon Cell.

isSchematic

public boolean isSchematic()
Method to determine whether this CellName is a name of an schematic Cell.

Returns:
true if this CellName is a name of an schematic Cell.

getVersion

public int getVersion()
Method to return the version part of a parsed Cell name.

Returns:
the version part of a parsed Cell name.

hashCode

public int hashCode()
Returns a hash code for this Version.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code value for this Version.

equals

public boolean equals(java.lang.Object obj)
Compares this CellName object to the specified object. The result is true if and only if the argument is not null and is an CellName object that contains the same version, view and case-insensitive name as this CellName.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to compare with.
Returns:
true if the objects are the same; false otherwise.

equalsIgnoreVersion

public boolean equalsIgnoreVersion(java.lang.Object obj)
Compares this CellName object to the specified object. The result is true if and only if the argument is not null and is an CellName object that contains the same view and case-insensitive name as this CellName.

Parameters:
obj - the object to compare with.
Returns:
true if the objects are the same; false otherwise.

compareTo

public int compareTo(CellName that)
Compares two CellName objects.

Specified by:
compareTo in interface java.lang.Comparable<CellName>
Parameters:
that - the CellName to be compared.
Returns:
the result of comparison.

toString

public java.lang.String toString()
Method to build the full cell name.

Overrides:
toString in class java.lang.Object
Returns:
the full cell name.

parseName

public static CellName parseName(java.lang.String name)
Method to parse the specified Cell name and return a CellName object.

Parameters:
name - the name of the Cell.
Returns:
a CellName object with the fields parsed.

newName

public static CellName newName(java.lang.String name,
                               View view,
                               int version)
Create a CellName from the given name, view, and version. Any view or version information that is part of the name is stripped away and ignored, and the arguments for view and version are used instead.

Parameters:
name - the name of the cell
view - the view
version - the version
Returns:
a CellName object for the given name, view, and version

check

public void check()
Checks invariant of this CellName.

Throws:
java.lang.AssertionError - if invariant is broken.