com.sun.electric.database.text
Class Name

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

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

A Name is a text-parsing object for port, node and arc names. These names can use bus notation:

name = username | tempname
username = itemname { ',' itemname }
itemname = simplename { '[' index ']' }
index = indexitem { ',' indexitem ']' }
indexitem = simplename | number [':' number]

tempname = simplename '@' number

simplename = string

string doesn't contain '[', ']', ',', ':'. Bus names are expanded into a list of subnames.


Method Summary
 int busWidth()
          Returns number of subnames of a bus.
 java.lang.String canonicString()
          Returns canonic equivalent String of this Name.
static java.lang.String checkName(java.lang.String ns)
          Method to check whether or not string is a valid name.
 int compareTo(Name name)
          Compares this Name with the specified Name for order.
static Name findName(java.lang.String ns)
          Method to return the name object for this string.
 Name findSuffixed(int i)
          Returns the name obtained from base of this simple name by adding numerical suffix.
 Name getBasename()
          Returns basename of temporary Name.
 int getNumSuffix()
          Returns numerical suffix of temporary Name.
 boolean hasDuplicates()
          Tells whether Name has duplicate subnames.
 boolean hasEmptySubnames()
          Tells whether Name has duplicate subnames.
 boolean isBus()
          Tells whether or not this Name is a bus name.
 boolean isList()
          Tells whether or not this Name is a list of names separated by comma.
 boolean isTempname()
          Tells whether or not this Name is a temporary name
 boolean isValid()
          Tells whether or not this Name is a valid bus or signal name.
static void printStatistics()
          Print statistics about Names.
 Name subname(int i)
          Returns subname of a bus name.
 java.lang.String toString()
          Returns a printable version of this Name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

findName

public static final Name findName(java.lang.String ns)
Method to return the name object for this string.

Parameters:
ns - given string
Returns:
the name object for the string.

checkName

public static java.lang.String checkName(java.lang.String ns)
Method to check whether or not string is a valid name.

Parameters:
ns - given string
Returns:
the error description or null if string is correct name.

printStatistics

public static void printStatistics()
Print statistics about Names.


toString

public final java.lang.String toString()
Returns a printable version of this Name.

Overrides:
toString in class java.lang.Object
Returns:
a printable version of this Name.

canonicString

public final java.lang.String canonicString()
Returns canonic equivalent String of this Name.

Returns:
canonic equivalent String of this Name.

compareTo

public int compareTo(Name name)
Compares this Name with the specified Name for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Specified by:
compareTo in interface java.lang.Comparable<Name>
Parameters:
name - the Name to be compared.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

isValid

public final boolean isValid()
Tells whether or not this Name is a valid bus or signal name.

Returns:
true if Name is a valid name.

isTempname

public final boolean isTempname()
Tells whether or not this Name is a temporary name

Returns:
true if Name is a temporary name.

hasDuplicates

public final boolean hasDuplicates()
Tells whether Name has duplicate subnames.

Returns:
true if Name has duplicate subnames.

hasEmptySubnames

public final boolean hasEmptySubnames()
Tells whether Name has duplicate subnames.

Returns:
true if Name has duplicate subnames.

isList

public final boolean isList()
Tells whether or not this Name is a list of names separated by comma.

Returns:
true if Name is a list of names separated by comma.

isBus

public final boolean isBus()
Tells whether or not this Name is a bus name.

Returns:
true if name is a bus name.

subname

public final Name subname(int i)
Returns subname of a bus name.

Parameters:
i - an index of subname.
Returns:
the view part of a parsed Cell name.

busWidth

public final int busWidth()
Returns number of subnames of a bus.

Returns:
the number of subnames of a bus.

getBasename

public final Name getBasename()
Returns basename of temporary Name. Returns null if not temporary Name.

Returns:
base of name.

getNumSuffix

public final int getNumSuffix()
Returns numerical suffix of temporary Name. Returns -1 if not temporary name.

Returns:
numerical suffix.

findSuffixed

public final Name findSuffixed(int i)
Returns the name obtained from base of this simple name by adding numerical suffix. Returns null if name is not simple or if i is negative.

Parameters:
i - numerical suffix
Returns:
suffixed name.