edu.buffalo.fs7.qsymbol2
Class NameStripper

java.lang.Object
  |
  +--edu.buffalo.fs7.qsymbol2.NameStripper

public class NameStripper
extends java.lang.Object

this class is a helper class to translate the naming convention of the Gate variables into a nested structure of GateContainers. For example a gate named topgroup.group.gate will translate into three gate containers named gate, nested into the one named group, nested into the one called topgroup. In order to facilitate grouping and ungrouping this class tokenizes the name of a variable and strips away for example the leading (toplevel) part.

See Also:
GateContainer, Gate

Field Summary
protected  java.util.Vector tokens
          holds the parts of the name
 
Constructor Summary
NameStripper(java.lang.String name)
          create a NameStripper object for a given string.
 
Method Summary
 java.lang.String getFullName()
          returns the full name
 java.lang.String getGroup(int i)
          returns a specified part of the name. 0 is the top level.
 int getGroupCount()
          counts the number of group levels.
 java.util.Enumeration getGroups()
          returns the parts of the name in order from top level to lowest level
 java.lang.String getName()
          returns the lowest order name
 void removeGroup(int i)
          removes a certain part of the name. 0 is the top level.
 void stripLeadingGroup()
          removes the top level group name
 java.lang.String toString()
          outputs all groups separated by tabs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

tokens

protected java.util.Vector tokens
holds the parts of the name
Constructor Detail

NameStripper

public NameStripper(java.lang.String name)
create a NameStripper object for a given string. The separator is the charakter '.'
Method Detail

stripLeadingGroup

public void stripLeadingGroup()
removes the top level group name

getFullName

public java.lang.String getFullName()
returns the full name

getName

public java.lang.String getName()
returns the lowest order name

getGroupCount

public int getGroupCount()
counts the number of group levels.
Returns:
if the name is containing of only one part it returns 0

getGroup

public java.lang.String getGroup(int i)
returns a specified part of the name. 0 is the top level.

getGroups

public java.util.Enumeration getGroups()
returns the parts of the name in order from top level to lowest level

removeGroup

public void removeGroup(int i)
removes a certain part of the name. 0 is the top level.

toString

public java.lang.String toString()
outputs all groups separated by tabs
Overrides:
toString in class java.lang.Object