io.sarl.lang.jvmmodel
Class GenerationContext
abstract class GenerationContext
extends java.lang.Object
Describe generation context.
Maven Group Identifier:
io.sarl.lang
Maven Artifact Identifier:
compiler
Property Summary
Modifier and type Property and description
int actionIndex
Replies the index of the late created action.
int behaviorUnitIndex
Replies the index of the last created behavior unit.
org.eclipse.emf.ecore.EObject contextObject
Replies the context object.
java.util.Set<E> generatedCapacityUseFields
Replies the capacities for which capacity-use fields are generated.
java.util.Map<K,V> generatedConstructors
Replies the collection of the generated constructor.
org.eclipse.xtext.xbase.compiler.GeneratorConfig generatorConfig
Replies the generator configuration.
GeneratorConfig2 generatorConfig2
Replies the generator configuration v2.
java.util.Collection<E> guardEvaluationCodes
Replies the guard evaluation code for the given event.
java.util.Map<K,V> inheritedFinalOperations
Replies the collection of the inherited final operations.
java.util.Map<K,V> inheritedOperationsToImplement
Replies the collection of the inherited operations that are not yet implemented.
java.util.Map<K,V> inheritedOverridableOperations
Replies the collection of the inherited overridable operations.
int localTypeIndex
Replies the index of the late created local type.
GenerationContext parentContext
Replies the parent context if any.
java.util.List<E> postFinalizationElements
Replies the collection of the elements that must be generated after the generation process of the current SARL element.
java.util.List<E> preFinalizationElements
Replies the collection of the elements that must be generated at the end of the generation process.
long serial
Replies the computed serial number.
org.eclipse.xtext.common.types.JvmDeclaredType type
Replies the associated type.
java.lang.String typeIdentifier
Replies the identifier of the associated type.
Nested Type Summary
Modifier and type Type and description
record GenerationContext.BehaviorUnitGuardEvaluators
Define a group of guard evaluators.
Action Summary
Modifier and type Action and description
void addGeneratedCapacityUseField(String)
Add a capacity for which a capacity-use field is generated.
void addGeneratedConstructor(ActionParameterTypes,JvmConstructor)
Add a generated constructor into the context.
void addUserObject(String,Object)
Add a user data associated to the given id.
java.lang.Iterable<T> consumeUserObject(String)
Consume the user data associated to the given id.
java.lang.Iterable<T> consumeUserObject(String,Class<T>)
Consume the user data associated to the given id.
void doLocalOperationDefinition(ActionPrototype,JvmOperation)
Register a locally defined operation.
java.util.Collection<E> ensureGuardEvaluationCodeFor(SarlBehaviorUnit,TypeReferences)
Create and replies the guard evaluation code for the given event.
int getActionIndex
Replies the index of the late created action.
IActionPrototypeContext getActionPrototypeContext(IActionPrototypeProvider)
Get the context for the action prototype provider.
int getBehaviorUnitIndex
Replies the index of the last created behavior unit.
org.eclipse.emf.ecore.EObject getContextObject
Replies the context object.
org.eclipse.xtext.common.types.JvmOperation getDefinedOperation(ActionPrototype)
Replies the locally or inherited operation.
java.util.Set<E> getGeneratedCapacityUseFields
Replies the capacities for which capacity-use fields are generated.
java.util.Map<K,V> getGeneratedConstructors
Replies the collection of the generated constructor.
org.eclipse.xtext.xbase.compiler.GeneratorConfig getGeneratorConfig
Replies the generator configuration.
GeneratorConfig2 getGeneratorConfig2
Replies the generator configuration v2.
java.util.Collection<E> getGuardEvaluationCodes
Replies the guard evaluation code for the given event.
java.util.Map<K,V> getInheritedFinalOperations
Replies the collection of the inherited final operations.
org.eclipse.xtext.common.types.JvmOperation getInheritedImplementedOperation(ActionPrototype)
Replies the inherited and implemented operation with the given prototype.
org.eclipse.xtext.common.types.JvmOperation getInheritedOperation(ActionPrototype)
Replies the inherited operation with the given prototype.
java.util.Map<K,V> getInheritedOperationsToImplement
Replies the collection of the inherited operations that are not yet implemented.
java.util.Map<K,V> getInheritedOverridableOperations
Replies the collection of the inherited overridable operations.
org.eclipse.xtext.common.types.JvmOperation getLocalOperation(ActionPrototype)
Replies the operation with the given prototype that is locally defined.
int getLocalTypeIndex
Replies the index of the late created local type.
GenerationContext getParentContext
Replies the parent context if any.
java.util.List<E> getPostFinalizationElements
Replies the collection of the elements that must be generated after the generation process of the current SARL element.
java.util.List<E> getPreFinalizationElements
Replies the collection of the elements that must be generated at the end of the generation process.
long getSerial
Replies the computed serial number.
org.eclipse.xtext.common.types.JvmDeclaredType getType
Replies the associated type.
java.lang.String getTypeIdentifier
Replies the identifier of the associated type.
boolean hasConstructor
Replies if a constructor is generated.
protected static boolean hasInjectAnnotation(JvmAnnotationTarget)
Replies if the given target has the Inject annotation.
void incrementSerial(long)
Increment the serial number by the given ammount.
boolean isInjectable
Replies if the generated type is injectable.
boolean isMainFunctionGenerated
Replies if a main function (with the standard prototype) is generated from the source code or as synthetic.
boolean isMainFunctionManuallyDefined
Replies if a main function (with the standard prototype) is defined in the source code.
boolean isRelease
Replies if this context is released.
abstract boolean isSupportedMember(XtendMember)
Replies if the given member is supported in the current context.
void release
Release any allocated resource.
void setActionIndex(int)
Set the index of the late created action.
void setBehaviorUnitIndex(int)
Replies the index of the last created behavior unit.
void setInjectable(boolean)
Change the flag that indicates if the generated type is injectable.
void setInjectable(JvmAnnotationTarget)
Change the flag that indicates if the given element is injected.
void setInjectable(JvmTypeReference)
Change the flag that indicates if the given element is injected.
void setLocalTypeIndex(int)
Set the index of the late created local type.
void setParentContext(GenerationContext)
Change the parent context if any.
java.lang.String toString
Property Details
actionIndex
var actionIndex : int
Replies the index of the late created action.

This property is an alias for the action: getActionIndex

Returns:
the index.
behaviorUnitIndex
var behaviorUnitIndex : int
Replies the index of the last created behavior unit.

This property is an alias for the action: getBehaviorUnitIndex

Returns:
the index
contextObject
val contextObject : org.eclipse.emf.ecore.EObject
Replies the context object.

This property is an alias for the action: getContextObject

Returns:
the context object.
Since:
0.12
generatedCapacityUseFields
val generatedCapacityUseFields : java.util.Set<E>
Replies the capacities for which capacity-use fields are generated.

This property is an alias for the action: getGeneratedCapacityUseFields

Returns:
the capacity identifiers.
generatedConstructors
val generatedConstructors : java.util.Map<K,V>
Replies the collection of the generated constructor.

This property is an alias for the action: getGeneratedConstructors

Returns:
the original collection of constructors.
generatorConfig
val generatorConfig : org.eclipse.xtext.xbase.compiler.GeneratorConfig
Replies the generator configuration.

This property is an alias for the action: getGeneratorConfig

Returns:
the configuration.
generatorConfig2
val generatorConfig2 : GeneratorConfig2
Replies the generator configuration v2.

This property is an alias for the action: getGeneratorConfig2

Returns:
the configuration.
guardEvaluationCodes
val guardEvaluationCodes : java.util.Collection<E>
Replies the guard evaluation code for the given event.

This property is an alias for the action: getGuardEvaluationCodes

Returns:
the guard evaluators.
inheritedFinalOperations
val inheritedFinalOperations : java.util.Map<K,V>
Replies the collection of the inherited final operations.

This property is an alias for the action: getInheritedFinalOperations

Returns:
the original collection of operations.
inheritedOperationsToImplement
val inheritedOperationsToImplement : java.util.Map<K,V>
Replies the collection of the inherited operations that are not yet implemented.

This property is an alias for the action: getInheritedOperationsToImplement

Returns:
the original collection of operations.
inheritedOverridableOperations
val inheritedOverridableOperations : java.util.Map<K,V>
Replies the collection of the inherited overridable operations.

This property is an alias for the action: getInheritedOverridableOperations

Returns:
the original collection of operations.
localTypeIndex
var localTypeIndex : int
Replies the index of the late created local type.

This property is an alias for the action: getLocalTypeIndex

Returns:
the index.
parentContext
var parentContext : GenerationContext
Replies the parent context if any.

This property is an alias for the action: getParentContext

Returns:
the parent context or null .
Since:
0.5
postFinalizationElements
val postFinalizationElements : java.util.List<E>
Replies the collection of the elements that must be generated after the generation process of the current SARL element.

The differed generation element are the element's components that could be generated after the complete JVM type is generated. They are extended the JVM type definition with additional elements (annotations...)

This property is an alias for the action: getPostFinalizationElements

Returns:
the original collection of elements.
Since:
0.5
preFinalizationElements
val preFinalizationElements : java.util.List<E>
Replies the collection of the elements that must be generated at the end of the generation process.

The differed generation element are the element's components that should be created after all the elements from the SARL input. The runnable codes are run at the end of the JVM element generation.

This property is an alias for the action: getPreFinalizationElements

Returns:
the original collection of elements.
Since:
0.5
serial
val serial : long
Replies the computed serial number.

This property is an alias for the action: getSerial

Returns:
the serial number.
type
val type : org.eclipse.xtext.common.types.JvmDeclaredType
Replies the associated type.

This property is an alias for the action: getType

Returns:
the context's type.
Since:
0.8.6
typeIdentifier
val typeIdentifier : java.lang.String
Replies the identifier of the associated type.

This property is an alias for the action: getTypeIdentifier

Returns:
the identifier of the context's type.
Action Details
addGeneratedCapacityUseField(String)
def addGeneratedCapacityUseField(String)
Add a capacity for which a capacity-use field is generated.
Parameters:
capacity - the identifier of the capacity.
addGeneratedConstructor(ActionParameterTypes,JvmConstructor)
def addGeneratedConstructor(ActionParameterTypes,JvmConstructor)
Add a generated constructor into the context.
Parameters:
parameters - the specification of the parameters of the constructor.
jvmElement - the generated element.
addUserObject(String,Object)
def addUserObject(String,Object)
Add a user data associated to the given id.
Parameters:
id - the identifier of the user data.
value - the value to put into the list of user data with the given id.
Since:
0.12
consumeUserObject(String)
def consumeUserObject(String) : java.lang.Iterable<T>
Consume the user data associated to the given id.
Parameters:
id - the identifier of the user data.
Returns:
the value to put into the list of user data with the given id.
Since:
0.12
consumeUserObject(String,Class<T>)
def consumeUserObject(String,Class<T>) : java.lang.Iterable<T>

with T

Consume the user data associated to the given id.
Parameters:
<T> - the type of the data.
id - the identifier of the user data.
dataType - the type of the data.
Returns:
the value to put into the list of user data with the given id.
Since:
0.12
doLocalOperationDefinition(ActionPrototype,JvmOperation)
def doLocalOperationDefinition(ActionPrototype,JvmOperation)
Register a locally defined operation.
Parameters:
prototype - the prototype of the operation.
operation - the JVM operation.
Since:
0.12
ensureGuardEvaluationCodeFor(SarlBehaviorUnit,TypeReferences)
def ensureGuardEvaluationCodeFor(SarlBehaviorUnit,TypeReferences) : java.util.Collection<E>
Create and replies the guard evaluation code for the given event.
Parameters:
source - the source of the guard evaluation.
typeReferences - the tool for creating type references that may be needed in this function.
Returns:
the guard evaluators.
getActionIndex
def getActionIndex : int
Replies the index of the late created action.
Returns:
the index.
getActionPrototypeContext(IActionPrototypeProvider)
def getActionPrototypeContext(IActionPrototypeProvider) : IActionPrototypeContext
Get the context for the action prototype provider.
Parameters:
provider - the provider for creating the context if it was not created.
Returns:
the context
getBehaviorUnitIndex
def getBehaviorUnitIndex : int
Replies the index of the last created behavior unit.
Returns:
the index
getContextObject
def getContextObject : org.eclipse.emf.ecore.EObject
Replies the context object.
Returns:
the context object.
Since:
0.12
getDefinedOperation(ActionPrototype)
def getDefinedOperation(ActionPrototype) : org.eclipse.xtext.common.types.JvmOperation
Replies the locally or inherited operation.
Parameters:
prototype - the prototype to search for.
Returns:
the operation or null .
getGeneratedCapacityUseFields
def getGeneratedCapacityUseFields : java.util.Set<E>
Replies the capacities for which capacity-use fields are generated.
Returns:
the capacity identifiers.
getGeneratedConstructors
def getGeneratedConstructors : java.util.Map<K,V>
Replies the collection of the generated constructor.
Returns:
the original collection of constructors.
getGeneratorConfig
def getGeneratorConfig : org.eclipse.xtext.xbase.compiler.GeneratorConfig
Replies the generator configuration.
Returns:
the configuration.
getGeneratorConfig2
def getGeneratorConfig2 : GeneratorConfig2
Replies the generator configuration v2.
Returns:
the configuration.
getGuardEvaluationCodes
def getGuardEvaluationCodes : java.util.Collection<E>
Replies the guard evaluation code for the given event.
Returns:
the guard evaluators.
getInheritedFinalOperations
def getInheritedFinalOperations : java.util.Map<K,V>
Replies the collection of the inherited final operations.
Returns:
the original collection of operations.
getInheritedImplementedOperation(ActionPrototype)
def getInheritedImplementedOperation(ActionPrototype) : org.eclipse.xtext.common.types.JvmOperation
Replies the inherited and implemented operation with the given prototype.
Parameters:
prototype - the prototype to search for.
Returns:
the operation or null .
Since:
0.12
getInheritedOperation(ActionPrototype)
def getInheritedOperation(ActionPrototype) : org.eclipse.xtext.common.types.JvmOperation
Replies the inherited operation with the given prototype. The operation may be implemented or not into the super types.
Parameters:
prototype - the prototype to search for.
Returns:
the operation or null .
Since:
0.12
getInheritedOperationsToImplement
def getInheritedOperationsToImplement : java.util.Map<K,V>
Replies the collection of the inherited operations that are not yet implemented.
Returns:
the original collection of operations.
getInheritedOverridableOperations
def getInheritedOverridableOperations : java.util.Map<K,V>
Replies the collection of the inherited overridable operations.
Returns:
the original collection of operations.
getLocalOperation(ActionPrototype)
def getLocalOperation(ActionPrototype) : org.eclipse.xtext.common.types.JvmOperation
Replies the operation with the given prototype that is locally defined. This function does not search in inherited operations.
Parameters:
prototype - the prototype to search for.
Returns:
the locally defined operation.
Since:
0.12
getLocalTypeIndex
def getLocalTypeIndex : int
Replies the index of the late created local type.
Returns:
the index.
getParentContext
def getParentContext : GenerationContext
Replies the parent context if any.
Returns:
the parent context or null .
Since:
0.5
getPostFinalizationElements
def getPostFinalizationElements : java.util.List<E>
Replies the collection of the elements that must be generated after the generation process of the current SARL element.

The differed generation element are the element's components that could be generated after the complete JVM type is generated. They are extended the JVM type definition with additional elements (annotations...)
Returns:
the original collection of elements.
Since:
0.5
getPreFinalizationElements
def getPreFinalizationElements : java.util.List<E>
Replies the collection of the elements that must be generated at the end of the generation process.

The differed generation element are the element's components that should be created after all the elements from the SARL input. The runnable codes are run at the end of the JVM element generation.
Returns:
the original collection of elements.
Since:
0.5
getSerial
def getSerial : long
Replies the computed serial number.
Returns:
the serial number.
getType
def getType : org.eclipse.xtext.common.types.JvmDeclaredType
Replies the associated type.
Returns:
the context's type.
Since:
0.8.6
getTypeIdentifier
def getTypeIdentifier : java.lang.String
Replies the identifier of the associated type.
Returns:
the identifier of the context's type.
hasConstructor
def hasConstructor : boolean
Replies if a constructor is generated.
Returns:
true if the constructor is generated; false if created.
hasInjectAnnotation(JvmAnnotationTarget)
protected def hasInjectAnnotation(JvmAnnotationTarget) : boolean
Replies if the given target has the Inject annotation.
Parameters:
target - the target to analyze.
Returns:
true if the inject annotation is attached to the target.
Since:
0.14
incrementSerial(long)
def incrementSerial(long)
Increment the serial number by the given ammount.
Parameters:
value - the value to add to the serial number.
isInjectable
def isInjectable : boolean
Replies if the generated type is injectable.
Returns:
true if the generated type is injectable.
Since:
0.12
isMainFunctionGenerated
def isMainFunctionGenerated : boolean
Replies if a main function (with the standard prototype) is generated from the source code or as synthetic.
Returns:
true if a main function is generated.
Since:
0.15
isMainFunctionManuallyDefined
def isMainFunctionManuallyDefined : boolean
Replies if a main function (with the standard prototype) is defined in the source code.
Returns:
true if a main function is defined.
Since:
0.15
isRelease
def isRelease : boolean
Replies if this context is released.
Returns:
true if the context was released, otherwise false .
Since:
0.13
isSupportedMember(XtendMember)
def isSupportedMember(XtendMember) : boolean
Replies if the given member is supported in the current context.
Parameters:
member - the member to test.
Returns:
true if the member is supported, false for ignoring it.
release
def release
Release any allocated resource.
setActionIndex(int)
def setActionIndex(int)
Set the index of the late created action.
Parameters:
index - the index.
setBehaviorUnitIndex(int)
def setBehaviorUnitIndex(int)
Replies the index of the last created behavior unit.
Parameters:
index - the index.
setInjectable(boolean)
def setInjectable(boolean)
Change the flag that indicates if the generated type is injectable.
Parameters:
injectable - true if the generated type is injectable.
Since:
0.12
setInjectable(JvmAnnotationTarget)
def setInjectable(JvmAnnotationTarget)
Change the flag that indicates if the given element is injected.
Parameters:
element - the element to test.
Since:
0.12
setInjectable(JvmTypeReference)
def setInjectable(JvmTypeReference)
Change the flag that indicates if the given element is injected.
Parameters:
element - the element to test.
Since:
0.12
setLocalTypeIndex(int)
def setLocalTypeIndex(int)
Set the index of the late created local type.
Parameters:
index - the index.
setParentContext(GenerationContext)
def setParentContext(GenerationContext)
Change the parent context if any.
Parameters:
parent - the parent context or null.
Since:
0.5
toString
def toString : java.lang.String