Package org.emftrace.metamodel.RuleModel

Examples of org.emftrace.metamodel.RuleModel.BaseCondition


        Rule rule = RuleModelFactory.eINSTANCE.createRule();
        accessLayer.addElement(project, rule);
       
        LogicCondition cnd1 = RuleModelFactory.eINSTANCE.createLogicCondition();
        accessLayer.addElement(project, cnd1);
        BaseCondition cnd2 = RuleModelFactory.eINSTANCE.createBaseCondition();
        accessLayer.addElement(project, cnd2);
         
        rule.setConditions(cnd1);
        cnd1.getBaseConditions().add(cnd2);
        cnd2.setSource("Test");
        cnd2.setTarget("Test");
       
        ElementDefinition e1 = RuleModelFactory.eINSTANCE.createElementDefinition();
        ElementDefinition e2 = RuleModelFactory.eINSTANCE.createElementDefinition();
        accessLayer.addElement(project, e1);
        accessLayer.addElement(project, e2);
        e1.setAlias("e1");
        e2.setAlias("e2");
        e1.setType("Concern");
        e2.setType("Concern");
       
        rule.getElements().add(e1);
        rule.getElements().add(e2);
        rule.setRuleID("TestRule");
       
        LinkType l1 = LinkModelFactory.eINSTANCE.createLinkType();
        accessLayer.addElement(project, l1);
        l1.setName("Test");
       
        ActionDefinition a1 = RuleModelFactory.eINSTANCE.createActionDefinition();
        accessLayer.addElement(project, a1);
        a1.setSourceElement("e1");
        a1.setTargetElement("e2");
        a1.setResultType("Test");
        a1.setActionType(ActionType.CREATE_LINK);
       
        BaseCondition baseCondition = RuleModelFactory.eINSTANCE.createBaseCondition();
        baseCondition.setSource("e1");
        baseCondition.setTarget("e2");
               
        LogicCondition logicCondition = RuleModelFactory.eINSTANCE.createLogicCondition();
        logicCondition.getBaseConditions().add(baseCondition);
       
        rule.setConditions(logicCondition);
View Full Code Here


        Rule rule = RuleModelFactory.eINSTANCE.createRule();
        accessLayer.addElement(project, rule);
       
        LogicCondition cnd1 = RuleModelFactory.eINSTANCE.createLogicCondition();
        accessLayer.addElement(project, cnd1);
        BaseCondition cnd2 = RuleModelFactory.eINSTANCE.createBaseCondition();
        accessLayer.addElement(project, cnd2);
         
        rule.setRuleID("TestRule");
        rule.setConditions(cnd1);
        cnd1.getBaseConditions().add(cnd2);
        cnd2.setSource("e1::Id");
        cnd2.setTarget("e2::Id");
       
        ElementDefinition e1 = RuleModelFactory.eINSTANCE.createElementDefinition();
        ElementDefinition e2 = RuleModelFactory.eINSTANCE.createElementDefinition();
        accessLayer.addElement(project, e1);
        accessLayer.addElement(project, e2);
View Full Code Here

        accessLayer.addElement(project, lc1);
        LogicCondition lc2 = RuleModelFactory.eINSTANCE.createLogicCondition();
        accessLayer.addElement(project, lc2);
        LogicCondition lc3 = RuleModelFactory.eINSTANCE.createLogicCondition();
        accessLayer.addElement(project, lc3);
        BaseCondition bc1 = RuleModelFactory.eINSTANCE.createBaseCondition();
        accessLayer.addElement(project, bc1);
        BaseCondition bc2 = RuleModelFactory.eINSTANCE.createBaseCondition();
        accessLayer.addElement(project, bc2);
        BaseCondition bc3 = RuleModelFactory.eINSTANCE.createBaseCondition();
        accessLayer.addElement(project, bc3);
       
        lc2.setType(LogicConditionType.NOT);
         
        rule.setRuleID("TestRule");
        rule.setConditions(lc1);
        lc1.getBaseConditions().add(bc1);
        lc1.getLogicConditions().add(lc2);
        bc1.setSource("e1::name");
        bc1.setTarget("e2::name");
       
        bc2.setSource("e1::name");
        bc2.setValue("test");
       
        bc3.setSource("e1::name");
        bc3.setValue("test2");
       
        ElementDefinition e1 = RuleModelFactory.eINSTANCE.createElementDefinition();
        ElementDefinition e2 = RuleModelFactory.eINSTANCE.createElementDefinition();
        accessLayer.addElement(project, e1);
        accessLayer.addElement(project, e2);
View Full Code Here

    {
        List<String> elements = new ArrayList<String>();
        elements.add("e1");
        elements.add("e2");
       
        BaseCondition b1 = RuleModelFactory.eINSTANCE.createBaseCondition();
       
        assertFalse(ruleValidator.checkBaseCondition(b1, elements));
        b1.setSource("e1");
        assertFalse(ruleValidator.checkBaseCondition(b1, elements));
        b1.setTarget("e2");
        assertFalse(ruleValidator.checkBaseCondition(b1, elements));
        b1.setSource("e1::name");
        assertFalse(ruleValidator.checkBaseCondition(b1, elements));
        b1.setTarget("e2::name");
        assertTrue(ruleValidator.checkBaseCondition(b1, elements));
    }
View Full Code Here

        elements.add("e1");
        elements.add("e2");
       
        LogicCondition c1 = RuleModelFactory.eINSTANCE.createLogicCondition();
        LogicCondition c2 = RuleModelFactory.eINSTANCE.createLogicCondition();
        BaseCondition b1 = RuleModelFactory.eINSTANCE.createBaseCondition();
        b1.setSource("e1::name");
        b1.setTarget("e2::name");
        b1.setType(BaseConditionType.VALUE_EQUALS);
       
        assertFalse(ruleValidator.checkLogicCondition(c1, elements));
        c1.getLogicConditions().add(c2);
        assertFalse(ruleValidator.checkLogicCondition(c1, elements));
        c2.getBaseConditions().add(b1);
View Full Code Here

        Rule rule = RuleModelFactory.eINSTANCE.createRule();
        accessLayer.addElement(project, rule);
       
        LogicCondition cnd1 = RuleModelFactory.eINSTANCE.createLogicCondition();
        accessLayer.addElement(project, cnd1);
        BaseCondition cnd2 = RuleModelFactory.eINSTANCE.createBaseCondition();
        accessLayer.addElement(project, cnd2);
         
        rule.setConditions(cnd1);
        cnd1.getBaseConditions().add(cnd2);
        cnd2.setSource("e1::creator");
        cnd2.setTarget("e2::creator");
       
        ElementDefinition e1 = RuleModelFactory.eINSTANCE.createElementDefinition();
        ElementDefinition e2 = RuleModelFactory.eINSTANCE.createElementDefinition();
        accessLayer.addElement(project, e1);
        accessLayer.addElement(project, e2);
View Full Code Here

       *  bc2
       *  bc3
       * </AND>
       */
      LogicCondition lc = RuleModelFactory.eINSTANCE.createLogicCondition();
      BaseCondition bc1 = RuleModelFactory.eINSTANCE.createBaseCondition();
      BaseCondition bc2 = RuleModelFactory.eINSTANCE.createBaseCondition();
      BaseCondition bc3 = RuleModelFactory.eINSTANCE.createBaseCondition();
     
      rule.setConditions(lc);
      lc.getBaseConditions().add(bc1);
      lc.getBaseConditions().add(bc2);
      lc.getBaseConditions().add(bc3);
     
      List<BaseCondition> conditions = new ArrayList<BaseCondition>();
      conditions.add(bc1);
      conditions.add(bc2);
      conditions.add(bc3);
     
      ElementDefinition e1 = RuleModelFactory.eINSTANCE.createElementDefinition();
      ElementDefinition e2 = RuleModelFactory.eINSTANCE.createElementDefinition();
     
      rule.getElements().add(e1);
      rule.getElements().add(e2);
     
      // set all the attributes:
      e1.setAlias("e1");
      e2.setAlias("e2");
     
      lc.setType(LogicConditionType.AND);
      bc1.setSource("e1");
      bc2.setSource("e1");
      bc3.setSource("e1");
      bc1.setTarget("e2");
      bc2.setTarget("e2");
      bc3.setTarget("e2");
     
      Concern c1 = URNModelFactory.eINSTANCE.createConcern();
      Concern c2 = URNModelFactory.eINSTANCE.createConcern();
      Concern c3 = URNModelFactory.eINSTANCE.createConcern();
      Concern c4 = URNModelFactory.eINSTANCE.createConcern();
View Full Code Here

    @Test
    public void testJoinFirstTupleList()
    {
      Rule rule = RuleModelFactory.eINSTANCE.createRule();
     
      BaseCondition bc1 = RuleModelFactory.eINSTANCE.createBaseCondition();
      BaseCondition bc2 = RuleModelFactory.eINSTANCE.createBaseCondition();
     
      List<BaseCondition> conditions = new ArrayList<BaseCondition>();
      conditions.add(bc1);
      conditions.add(bc2);
     
      ElementDefinition e1 = RuleModelFactory.eINSTANCE.createElementDefinition();
      ElementDefinition e2 = RuleModelFactory.eINSTANCE.createElementDefinition();
     
      rule.getElements().add(e1);
      rule.getElements().add(e2);
     
      // set all the attributes:
      e1.setAlias("e1");
      e2.setAlias("e2");
     
      List<EObject[]> finalTuples   = new ArrayList<EObject[]>();
      List<EObject[]> currentTuples = new ArrayList<EObject[]>();
     
      Concern c1 = URNModelFactory.eINSTANCE.createConcern();
      Concern c2 = URNModelFactory.eINSTANCE.createConcern();
          
      bc1.setSource("e1");
      bc1.setTarget("e2");
      bc2.setSource("e2");     
      bc2.setTarget("e3");
     
      currentTuples.add(new EObject[2]);
      currentTuples.get(0)[0] = c1;
      currentTuples.get(0)[1] = c2;
     
View Full Code Here

      Rule rule = RuleModelFactory.eINSTANCE.createRule();
     
      LogicCondition lc1 = RuleModelFactory.eINSTANCE.createLogicCondition();
      LogicCondition lc2 = RuleModelFactory.eINSTANCE.createLogicCondition();
     
      BaseCondition bc1 = RuleModelFactory.eINSTANCE.createBaseCondition();
      BaseCondition bc2 = RuleModelFactory.eINSTANCE.createBaseCondition();
      BaseCondition bc3 = RuleModelFactory.eINSTANCE.createBaseCondition();
      BaseCondition bc4 = RuleModelFactory.eINSTANCE.createBaseCondition();
     
      List<BaseCondition> conditions = new ArrayList<BaseCondition>();
      conditions.add(bc1);
      conditions.add(bc2);
      conditions.add(bc3);
      conditions.add(bc4);
     
      ElementDefinition e1 = RuleModelFactory.eINSTANCE.createElementDefinition();
      ElementDefinition e2 = RuleModelFactory.eINSTANCE.createElementDefinition();
      ElementDefinition e3 = RuleModelFactory.eINSTANCE.createElementDefinition();
     
      rule.getElements().add(e1);
      rule.getElements().add(e2);
      rule.getElements().add(e3);
     
      e1.setAlias("e1");
      e2.setAlias("e2");
      e3.setAlias("e3");
     
      rule.setConditions(lc1);
     
      lc1.setType(LogicConditionType.AND);
      lc2.setType(LogicConditionType.OR);
     
      lc1.getBaseConditions().add(bc1);
      lc1.getBaseConditions().add(bc2);
      lc2.getBaseConditions().add(bc3);
      lc2.getBaseConditions().add(bc4);
     
      lc1.getLogicConditions().add(lc2);
     
      bc1.setSource("e1");
      bc1.setTarget("e2");
      bc2.setSource("e2");
      bc2.setTarget("e3");
      bc3.setSource("e3");
      bc4.setSource("e3");
     
      List<List<EObject[]>> tuples = new ArrayList<List<EObject[]>>();
      tuples.add(new ArrayList<EObject[]>()); // bc1
      tuples.add(new ArrayList<EObject[]>()); // bc2
      tuples.add(new ArrayList<EObject[]>()); // bc3
View Full Code Here

    @Test
    public void testJoinOneElementTuples()
    {
      Rule rule = RuleModelFactory.eINSTANCE.createRule();
     
      BaseCondition bc1 = RuleModelFactory.eINSTANCE.createBaseCondition();
      BaseCondition bc2 = RuleModelFactory.eINSTANCE.createBaseCondition();
     
      List<BaseCondition> conditions = new ArrayList<BaseCondition>();
      conditions.add(bc1);
      conditions.add(bc2);
     
      ElementDefinition e1 = RuleModelFactory.eINSTANCE.createElementDefinition();
      ElementDefinition e2 = RuleModelFactory.eINSTANCE.createElementDefinition();
     
      rule.getElements().add(e1);
      rule.getElements().add(e2);
     
      // set all the attributes:
      e1.setAlias("e1");
      e2.setAlias("e2");
     
      List<EObject[]> finalTuples   = new ArrayList<EObject[]>();
      List<EObject[]> currentTuples = new ArrayList<EObject[]>();
     
      Concern c1 = URNModelFactory.eINSTANCE.createConcern();
      Concern c2 = URNModelFactory.eINSTANCE.createConcern();
      Concern c3 = URNModelFactory.eINSTANCE.createConcern();
      Concern c4 = URNModelFactory.eINSTANCE.createConcern();
          
      bc1.setSource("e1");
      bc1.setTarget("e2");
      bc2.setSource("e2");
     
      finalTuples.add(new EObject[2]);
      finalTuples.get(0)[0] = c1;
      finalTuples.get(0)[1] = c2;
      finalTuples.add(new EObject[2]);
View Full Code Here

TOP

Related Classes of org.emftrace.metamodel.RuleModel.BaseCondition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.