use of org.yakindu.sct.model.stext.stext.TimeEventSpec in project statecharts by Yakindu.
the class TimeEventSpecItemProvider method getText.
/**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getText(Object object) {
TimeEventType labelValue = ((TimeEventSpec) object).getType();
String label = labelValue == null ? null : labelValue.toString();
return label == null || label.length() == 0 ? getString("_UI_TimeEventSpec_type") : getString("_UI_TimeEventSpec_type") + " " + label;
}
use of org.yakindu.sct.model.stext.stext.TimeEventSpec in project statecharts by Yakindu.
the class StextTestFactory method _createTimeEventSpec.
public static TimeEventSpec _createTimeEventSpec(TimeEventType type, Expression value, TimeUnit unit, ReactionTrigger rt) {
TimeEventSpec timeTrigger = StextFactory.eINSTANCE.createTimeEventSpec();
timeTrigger.setType(type);
timeTrigger.setValue(value);
timeTrigger.setUnit(unit);
if (rt != null)
rt.getTriggers().add(timeTrigger);
return timeTrigger;
}
use of org.yakindu.sct.model.stext.stext.TimeEventSpec in project statecharts by Yakindu.
the class SCTResourceTest method testTransitionSerializing.
@Test
public void testTransitionSerializing() throws Exception {
res.setSerializerEnabled(true);
Transition transition = createTransition("after 10\n s [true] / 3 * 3");
res.getContents().add(transition);
ReactionTrigger trigger = (ReactionTrigger) transition.getTrigger();
TimeEventSpec timeTrigger = stextFac.createTimeEventSpec();
timeTrigger.setType(TimeEventType.EVERY);
timeTrigger.setUnit(TimeUnit.SECOND);
PrimitiveValueExpression exp = expFac.createPrimitiveValueExpression();
IntLiteral literal = expFac.createIntLiteral();
literal.setValue(42);
exp.setValue(literal);
timeTrigger.setValue(exp);
trigger.getTriggers().add(timeTrigger);
assertEquals("after 10\n s , every 42 s [true] / 3 * 3", transition.getSpecification());
assertEquals("" + res.getErrors(), 0, res.getErrors().size());
}
Aggregations