use of org.w3._2007.rif.Do.ActionVar in project hale by halestudio.
the class TestModelRifToRifTranslator method checkDoElements.
private void checkDoElements(Do do1) {
assertNotNull(do1.getActionVar());
assertTrue(do1.getActionVar().size() >= 1);
// count number of news and frames in the collection
int numNews = 0;
int numFrames = 0;
for (ActionVar v : do1.getActionVar()) {
assertNotNull(v);
if (v.getNew() != null) {
numNews++;
checkActionVarTypeNew(v);
}
if (v.getFrame() != null) {
numFrames++;
checkActionVarTypeFrame(v);
}
}
assertThat(numNews, is(equalTo(1)));
int numAsserts = 0;
for (Object action : do1.getActions().getACTION()) {
assertTrue(action instanceof org.w3._2007.rif.Assert);
numAsserts++;
org.w3._2007.rif.Assert a = (org.w3._2007.rif.Assert) action;
assertNotNull(a);
checkAssertTarget(a);
}
// CHECKSTYLE:OFF
assertThat(numAsserts, is(equalTo(3)));
// CHECKSTYLE:ON
}
use of org.w3._2007.rif.Do.ActionVar in project hale by halestudio.
the class ModelRifToRifTranslator method createTargetVariableDeclare.
private ActionVar createTargetVariableDeclare(RifVariable variable) {
ActionVar targetInstanceActionVar = factory.createDoActionVar();
Var var = factory.createVar();
var.getContent().add(variable.getName());
targetInstanceActionVar.setVar(var);
if (variable.getType() == Type.INSTANCE) {
// $NON-NLS-1$
targetInstanceActionVar.setNew(createElement("New"));
} else {
Frame frame = initialiseFrame(variable.getContextVariable());
createBindingSlot(variable, frame);
targetInstanceActionVar.setFrame(frame);
}
return targetInstanceActionVar;
}