use of org.yakindu.base.types.Annotation in project statecharts by Yakindu.
the class JavaGeneratorModule method configureForExecutionStyle.
public void configureForExecutionStyle(GeneratorEntry entry, Binder binder) {
Statechart statechart = (Statechart) entry.getElementRef();
Annotation eventDrivenAnnotation = statechart.getAnnotationOfType(EVENT_DRIVEN_ANNOTATION);
if (eventDrivenAnnotation != null) {
binder.bind(Statemachine.class).to(EventDrivenStatemachine.class);
}
}
use of org.yakindu.base.types.Annotation in project statecharts by Yakindu.
the class CppCodeGeneratorModule method bindEventDrivenClasses.
protected void bindEventDrivenClasses(GeneratorEntry entry, Binder binder) {
Statechart statechart = (Statechart) entry.getElementRef();
Annotation eventDrivenAnnotation = statechart.getAnnotationOfType(EVENT_DRIVEN_ANNOTATION);
if (eventDrivenAnnotation != null) {
binder.bind(StatemachineHeader.class).to(EventDrivenStatemachineHeader.class);
binder.bind(StatemachineImplementation.class).to(EventDrivenStatemachineImplementation.class);
binder.bind(CppExpressionsGenerator.class).to(EventDrivenExpressionCode.class);
binder.bind(EventCode.class).to(EventDrivenEventCode.class);
binder.bind(StandardCppIncludeProvider.class).to(EventDrivenCppIncludeProvider.class);
}
}
use of org.yakindu.base.types.Annotation in project statecharts by Yakindu.
the class StextResource method serializeStatechart.
protected void serializeStatechart(Statechart statechart) {
StringBuilder builder = new StringBuilder();
if (statechart.getNamespace() != null) {
builder.append("namespace " + statechart.getNamespace());
builder.append(NEW_LINE);
}
for (Annotation annotation : statechart.getAnnotations()) {
builder.append(serialize(annotation));
builder.append(NEW_LINE);
}
for (Scope scope : statechart.getScopes()) {
builder.append(serialize(scope));
builder.append(NEW_LINE);
}
statechart.setSpecification(builder.toString());
}
use of org.yakindu.base.types.Annotation in project statecharts by Yakindu.
the class CCodeGeneratorModule method configureEventDriven.
protected void configureEventDriven(GeneratorEntry entry, Binder binder) {
Statechart statechart = (Statechart) entry.getElementRef();
Annotation eventDrivenAnnotation = statechart.getAnnotationOfType(EVENT_DRIVEN_ANNOTATION);
if (eventDrivenAnnotation != null) {
binder.bind(StatemachineHeader.class).to(EventDrivenStatemachineHeader.class);
binder.bind(StatemachineSource.class).to(EventDrivenStatemachineSource.class);
binder.bind(CExpressionsGenerator.class).to(EventDrivenExpressionCode.class);
}
}
use of org.yakindu.base.types.Annotation in project statecharts by Yakindu.
the class STextJavaValidator method checkAnnotations.
@Check(CheckType.FAST)
public void checkAnnotations(final Statechart statechart) {
Annotation eventDriven = statechart.getAnnotationOfType(EVENT_DRIVEN_ANNOTATION);
Annotation cycleBased = statechart.getAnnotationOfType(CYCLE_BASED_ANNOTATION);
if (eventDriven != null && cycleBased != null) {
String errorMsg = String.format(CONTRADICTORY_ANNOTATIONS, String.join(", ", eventDriven.getType().toString(), cycleBased.getType().toString()));
error(errorMsg, cycleBased, null, -1);
}
Annotation parentFirst = statechart.getAnnotationOfType(PARENT_FIRST_ANNOTATION);
Annotation childFirst = statechart.getAnnotationOfType(CHILD_FIRST_ANNOTATION);
if (parentFirst != null && childFirst != null) {
String errorMsg = String.format(CONTRADICTORY_ANNOTATIONS, String.join(", ", parentFirst.getType().toString(), childFirst.getType().toString()));
error(errorMsg, parentFirst, null, -1);
}
}
Aggregations