|
Dresden OCL Toolkit | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttudresden.ocl.NameCreator
A class that provides unique names for the processing of OCL expressions. Such names are necessary for normalization and for generating Java code. A generated name consist of three parts: a prefix which is usually "tuddOcl", a part called infix that can be set by the caller (might be something like "Var" or "Inv", and a postfix part chosen by NameCreator to make the name unique. A special instance of this class can be accessed through the getInstance method, but a strict singleton pattern is not enforced to allow several name spaces.
Nested Class Summary | |
(package private) class |
NameCreator.NameReserver
This inner class is used by the method reserveAllNames. |
Field Summary | |
static String |
defaultPrefix
|
protected HashMap |
fixmap
maps infixes (Strings) to Integers that will become postfixes |
protected HashSet |
names
contains all registered names |
protected String |
prefix
the prefix String, by default "tuddOcl" |
protected static NameCreator |
theInstance
|
Constructor Summary | |
NameCreator()
creates a new NameCreator with the default prefix String, "tuddOcl"; consider using the getInstance method if you don't need seperate name spaces |
|
NameCreator(String prefix)
creates a new NameCreator with the given prefix String; consider using the getInstance method if you don't need seperate name spaces |
Method Summary | |
void |
clear()
re-initialize this name creator, that means delete all registered names and restart postfix count |
static NameCreator |
getInstance()
|
String |
getPrefix()
|
String |
getUniqueName()
|
String |
getUniqueName(String infix)
create a new unique name (unique wrt. |
void |
reserveAllNames(OclTree tree)
Register all names used as variables in the OCL constraint represented by the given OclTree object as reserved, including self
and, if the constraint contains a post condition, result . |
boolean |
reserveName(String s)
register the name given as parameter as reserved; this name will not be returned as a new unique name in further calls to getUniqueName |
void |
setPrefix(String prefix)
changes the prefix to the given String |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static String defaultPrefix
protected static NameCreator theInstance
protected HashSet names
protected HashMap fixmap
protected String prefix
Constructor Detail |
public NameCreator(String prefix)
public NameCreator()
Method Detail |
public static NameCreator getInstance()
public void setPrefix(String prefix)
public String getPrefix()
public String getUniqueName()
public String getUniqueName(String infix)
public boolean reserveName(String s)
public void reserveAllNames(OclTree tree)
self
and, if the constraint contains a post condition, result
.
This method does not report an error if one of the names was reserved
before.
public void clear()
|
Dresden OCL Toolkit | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |