Search in sources :

Example 1 with ActionVar

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
}
Also used : ActionVar(org.w3._2007.rif.Do.ActionVar) Assert(org.w3._2007.rif.Assert) Assert(org.w3._2007.rif.Assert)

Example 2 with ActionVar

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;
}
Also used : ActionVar(org.w3._2007.rif.Do.ActionVar) Frame(org.w3._2007.rif.Frame) ActionVar(org.w3._2007.rif.Do.ActionVar) Var(org.w3._2007.rif.Var)

Aggregations

ActionVar (org.w3._2007.rif.Do.ActionVar)2 Assert (org.w3._2007.rif.Assert)1 Frame (org.w3._2007.rif.Frame)1 Var (org.w3._2007.rif.Var)1