|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--implementations.JavaImplementationGenerator
Introduces basic funtionality for Java implementation generators.
Constructor Summary | |
JavaImplementationGenerator()
Constructs a JavaImplementationGenerator. |
Method Summary | |
void |
apply(ImplementationGenerator implementation,
GenerateImplementationVisitor generateImpl)
Applies the implementation generator. |
protected java.lang.String |
createClause(java.lang.String name,
java.util.Collection elements)
Creates a comma-separated clause and returns it. PRE: elements ::= Collection<Concept> |
protected java.lang.String |
createMethod(java.lang.String name,
java.util.Hashtable parms,
java.lang.String returnType,
java.lang.String body)
Creates a Java method body from the given data. |
protected java.util.Collection |
getClasses(java.util.Collection concepts)
Retrieves all concepts that can be interpreted as classes from the given list of concepts. PRE: concepts ::= Collection<Concept> POST: result ::= Collection<Concept> |
protected Composite |
getComposite()
Returns the composite to generate implementation for. |
protected java.util.Collection |
getConceptsFor(CompositeRole role)
Retrieves the concepts filling the given role. POST: result ::= Collection<Concept> |
protected java.lang.String |
getCurrentImplementation(Concept concept)
Retrieves current implementation for a concept. |
protected java.lang.String |
getCurrentImplementation(UniqueRealm realm)
Retrieves current implementation for a unique realm. |
protected ImplementationGenerator |
getImplGen()
Returns the corresponding ImplementationGenerator. |
protected java.lang.String |
getInstanceName(AbstractConcept concept)
Returns the name of a concept adapted as instance name. |
protected java.util.Collection |
getInterfaces(java.util.Collection concepts)
Retrieves all concepts that can be interpreted as interfaces from the given list of concepts. PRE: concepts ::= Collection<Concept> POST: result ::= Collection<Concept> |
protected Model |
getModel()
Returns the model. |
protected java.util.Collection |
getPrimitives(java.util.Collection concepts)
Retrieves all concepts that can be interpreted as primitives from the given list of concepts. PRE: concepts ::= Collection<Concept> POST: result ::= Collection<Concept> |
protected GenerateImplementationVisitor |
getVisitor()
Returns the corresponding GenerateImplementationVisitor. |
protected java.lang.String |
insertImports(java.lang.String impl,
java.util.Collection libraries)
Inserts an import clause into the implementation and returns the updated implementation. |
protected java.lang.String |
insertInheritance(java.lang.String impl,
java.lang.String inheritance)
Inserts an inheritance clause into the given implementation and returns it. |
protected java.lang.String |
insertMethod(java.lang.String impl,
java.lang.String method)
Inserts a method into a java implementation and returns it. |
protected java.lang.String |
insertMethodOverrideID(java.lang.String impl,
int id)
Inserts a method override id into the implementation and returns the updated implementation. |
protected java.lang.String |
insertParameters(java.lang.String impl,
java.util.Hashtable parms)
Inserts parameters into the method declaration and returns the updated implementation. |
protected java.lang.String |
insertPrimitiveImplementation(java.lang.String impl,
Concept primitive)
Inserts a primitive's implementation into a java implementation and returns it. |
protected java.lang.String |
insertPrimitiveImplementations(java.lang.String impl,
java.util.Collection primitives)
Inserts the implementations of the given Primitive concepts in the given implementation. |
protected java.lang.String |
insertReturnType(java.lang.String impl,
java.lang.String type)
Inserts a return type clause into the implementation and returns the updated implementation. |
protected java.lang.String |
insertVariables(java.lang.String impl,
java.util.Collection variables)
Inserts variables into the given implementation and returns it. |
protected boolean |
isClass(java.lang.String form)
Checks whether the given form can be interpreted as a class. |
protected boolean |
isInterface(java.lang.String form)
Checks whether the given form can be interpreted as an interface. |
protected boolean |
isMethod(java.lang.String form)
Checks whether the given form can be interpreted as a method. |
protected boolean |
isPrimitive(java.lang.String form)
Checks whether the given form can be interpreted as a primitive. |
protected boolean |
isStatic(java.lang.String form)
Checks whether the given form is static. |
protected java.lang.String |
lcfirst(java.lang.String str)
Changes the first character of the string to lowercase. |
protected void |
setCurrentImplementation(Concept concept,
java.lang.String impl)
Stores current implementation for a concept. |
protected void |
setCurrentImplementation(UniqueRealm realm,
java.lang.String impl)
Stores current implementation for a unique realm. |
protected java.lang.String |
ucfirst(java.lang.String str)
Changes the first character of the string to uppercase. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public JavaImplementationGenerator()
Method Detail |
protected ImplementationGenerator getImplGen()
protected GenerateImplementationVisitor getVisitor()
protected java.lang.String getCurrentImplementation(Concept concept)
concept
- The concept to get the implementation for.protected java.lang.String getCurrentImplementation(UniqueRealm realm)
realm
- The unique realm to get the implementation for.protected void setCurrentImplementation(Concept concept, java.lang.String impl)
concept
- The concept to get the implementation for.impl
- The implementation.protected void setCurrentImplementation(UniqueRealm realm, java.lang.String impl)
realm
- The unique realm to get the implementation for.impl
- The implementation.protected Composite getComposite()
protected Model getModel()
protected java.util.Collection getConceptsFor(CompositeRole role)
role
- The composite role that the requested concepts fill.protected java.lang.String lcfirst(java.lang.String str)
str
- The string to manipulate.protected java.lang.String ucfirst(java.lang.String str)
str
- The string to manipulate.protected java.lang.String getInstanceName(AbstractConcept concept)
concept
- The concept to name.protected boolean isClass(java.lang.String form)
form
- The concept form.protected boolean isInterface(java.lang.String form)
form
- The concept form.protected boolean isPrimitive(java.lang.String form)
form
- The concept form.protected boolean isMethod(java.lang.String form)
form
- The concept form.protected boolean isStatic(java.lang.String form)
form
- The concept form.protected java.util.Collection getClasses(java.util.Collection concepts) throws CoComposeException
concepts
- The collection of concepts to retrieve from.CoComposeException
- protected java.util.Collection getInterfaces(java.util.Collection concepts) throws CoComposeException
concepts
- The collection of concepts to retrieve from.CoComposeException
- protected java.util.Collection getPrimitives(java.util.Collection concepts) throws CoComposeException
concepts
- The collection of concepts to retrieve from.CoComposeException
- protected java.lang.String insertPrimitiveImplementation(java.lang.String impl, Concept primitive)
impl
- The current implementation.primitive
- The primitive concept.protected java.lang.String insertPrimitiveImplementations(java.lang.String impl, java.util.Collection primitives) throws CoComposeException
impl
- The implementation to adapt.primitives
- The Primitive concepts for which to insert the
implementation.CoComposeException
- if precondition not met.
PRE: primitives ::= Collectionprotected java.lang.String createClause(java.lang.String name, java.util.Collection elements) throws CoComposeException
name
- The name of the clause, e.g. 'extends'.elements
- The clause elements.CoComposeException
- protected java.lang.String createMethod(java.lang.String name, java.util.Hashtable parms, java.lang.String returnType, java.lang.String body)
name
- The method name.parms
- The method parameters (null = none).returnType
- The method return type (null = void).body
- The method body.protected java.lang.String insertMethod(java.lang.String impl, java.lang.String method)
impl
- The current implementation.method
- The method implementation.protected java.lang.String insertInheritance(java.lang.String impl, java.lang.String inheritance) throws CoComposeException
impl
- The current implementation.inheritance
- The inheritance clause.CoComposeException
- if illegal inheritance clause is attempted.protected java.lang.String insertVariables(java.lang.String impl, java.util.Collection variables)
impl
- The current implementation.variables
- The inheritance clause.protected java.lang.String insertParameters(java.lang.String impl, java.util.Hashtable parms)
impl
- The current implementation.parms
- The parameter declarations. Structure: protected java.lang.String insertImports(java.lang.String impl, java.util.Collection libraries)
impl
- The current implementation.libraries
- The set of libraries to be imported.protected java.lang.String insertReturnType(java.lang.String impl, java.lang.String type)
impl
- The current implementation.type
- The return type.protected java.lang.String insertMethodOverrideID(java.lang.String impl, int id)
impl
- The current implementation.id
- The overridden method id.public void apply(ImplementationGenerator implementation, GenerateImplementationVisitor generateImpl) throws CoComposeException
apply
in interface ImplementationGeneratorI
implementation
- The implementation generator to apply.generateImpl
- The language specific code generation operation
visitor.CoComposeException
- if generating implementation failed.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |