|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.epsilon.hutn.xmi.parser.generator.SpecGenerator
public class SpecGenerator
Generates a HUTN spec in a LIFO manner. ClassObjects are generated
using #generateTopLevelClassObject(String)
and
#generateContainedClassObject(String, String)
.
Before generating any ClassObjects, the generator must first be
initialised using initialise()
or initialise(String)
.
To nest class objects, first use a call to
#generateTopLevelClassObject(String)
and then add levels of
nesting with #generateContainedClassObject(String)
.
A call to stopGeneratingCurrentClassObject()
completes the
generation of the current class object. Furthermore, the next class
object to be generated will have the same parent as the last class
object to be generated.
Example: To generate the following structure:
Family { members: Person { dog: Dog {} }, Person {} }the following calls would be made:
initialise("families"); generateTopLevelClassObject("Family"); generateContainedClassObject("Person"); generateContainedClassObject("Dog"); stopGeneratingCurrentClassObject(); // Dog stopGeneratingCurrentClassObject(); // Person generateContainedClassObject("Person"); stopGeneratingCurrentClassObject(); stopGeneratingCurrentClassObject(); // FamilyThe last two lines are optional, if no further ClassObjects are to be generated.
Constructor Summary | |
---|---|
SpecGenerator()
|
Method Summary | |
---|---|
void |
addAttributeValue(java.lang.String featureName,
java.lang.String value,
int lineNumber)
|
void |
generateContainedClassObject(java.lang.String containingFeature,
java.lang.String identifier,
int lineNumber)
Generates a new ClassObject whose type is determined by inspecting the class of the parent ClassObject. |
void |
generateContainedClassObject(java.lang.String containingFeature,
java.lang.String identifier,
java.lang.String type,
int lineNumber)
Generates a new ClassObject with the type specified. |
void |
generateTopLevelClassObject(java.lang.String identifier,
java.lang.String type,
int lineNumber)
|
ClassObject |
getCurrentClassObject()
|
Spec |
getSpec()
|
boolean |
hasCurrentClassObject()
|
void |
initialise()
|
void |
initialise(java.lang.String nsUri)
|
void |
stopGeneratingAndDeleteCurrentClassObject()
|
void |
stopGeneratingCurrentClassObject()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SpecGenerator()
Method Detail |
---|
public Spec getSpec()
public void initialise()
public void initialise(java.lang.String nsUri)
public void generateTopLevelClassObject(java.lang.String identifier, java.lang.String type, int lineNumber)
public void generateContainedClassObject(java.lang.String containingFeature, java.lang.String identifier, int lineNumber)
containingFeature
- - the name of the feature in the
parent ClassObject that will contain the newly generatedidentifier
- - the identifier for the ClassObject to
be created. Identifiers are used when adding values to
reference slots. null is allowed, but this will create a
ClassObject that cannot be referenced.
ClassObject.public void generateContainedClassObject(java.lang.String containingFeature, java.lang.String identifier, java.lang.String type, int lineNumber)
Generates a new ClassObject with the type specified. The newly generated ClassObject will be placed in a ContainmentSlot, with the feature specified, of the parent ClassObject.
If the parent ClassObject contains an existing ContainmentSlot with the feature specified, the newly generated ClassObject will be added to the values of that slot. Otherwise, a new ContainmentSlot with the feature specified will be created.
type
- - the type of ClassObject to be generated.containingFeature
- - the name of the feature in the
parent ClassObject that will contain the newly generated
ClassObject.identifier
- - the identifier for the ClassObject to
be created. Identifiers are used when adding values to
reference slots. null is allowed, but this will create a
ClassObject that cannot be referenced.lineNumber
- - the line number of the generated ClassObjectpublic ClassObject getCurrentClassObject()
public boolean hasCurrentClassObject()
public void stopGeneratingCurrentClassObject()
public void stopGeneratingAndDeleteCurrentClassObject()
public void addAttributeValue(java.lang.String featureName, java.lang.String value, int lineNumber)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |