Package org.emftrace.metamodel.RuleModel

Examples of org.emftrace.metamodel.RuleModel.LogicCondition


   
    @Test
    public void testFindElementsForDeletion()
    {
        Rule rule = RuleModelFactory.eINSTANCE.createRule();
        LogicCondition logicCondition = RuleModelFactory.eINSTANCE.createLogicCondition();
        BaseCondition baseCondition = RuleModelFactory.eINSTANCE.createBaseCondition();
        ElementDefinition e1 = RuleModelFactory.eINSTANCE.createElementDefinition();
        ElementDefinition e2 = RuleModelFactory.eINSTANCE.createElementDefinition();
        e1.setAlias("e1");
        e2.setAlias("e2");
       
        rule.getElements().add(e1);
        rule.getElements().add(e2);
              
        rule.setConditions(logicCondition);
               
        List<Integer> paths = new ArrayList<Integer>();
       
        ConditionProcessorHelper.findElementsForDeletion(paths, rule, logicCondition);
        assertTrue(paths.isEmpty());
       
        logicCondition.getBaseConditions().add(baseCondition);
        baseCondition.setSource("e2");
       
        ConditionProcessorHelper.findElementsForDeletion(paths, rule, logicCondition);
        assertEquals(1, paths.size());
        assertEquals(1, (int)paths.get(0));
View Full Code Here


        l2.add(new ArrayList<EObject>());
        l2.add(new ArrayList<EObject>());
        l2.get(1).add(c2);
       
        Rule rule = RuleModelFactory.eINSTANCE.createRule();
        LogicCondition logicCondition = RuleModelFactory.eINSTANCE.createLogicCondition();
        BaseCondition baseCondition = RuleModelFactory.eINSTANCE.createBaseCondition();
        ElementDefinition e1 = RuleModelFactory.eINSTANCE.createElementDefinition();
        ElementDefinition e2 = RuleModelFactory.eINSTANCE.createElementDefinition();
        e1.setAlias("e1");
        e2.setAlias("e2");
       
        rule.getElements().add(e1);
        rule.getElements().add(e2);
       
        baseCondition.setSource("e2");
       
        rule.setConditions(logicCondition);
        logicCondition.getBaseConditions().add(baseCondition);
       
        assertEquals(1, l1.get(0).size());
        assertEquals(1, l1.get(1).size());
        assertEquals(0, l2.get(0).size());
        assertEquals(1, l2.get(1).size());
View Full Code Here

        tuples.get(0).get(0)[1] = c2;
        tuples.get(1).get(0)[0] = c3;
       
      Rule rule = RuleModelFactory.eINSTANCE.createRule();
     
      LogicCondition lc1 = RuleModelFactory.eINSTANCE.createLogicCondition();
      LogicCondition lc2 = RuleModelFactory.eINSTANCE.createLogicCondition();
     
      accessLayer.addElement(project, rule);
      accessLayer.addElement(project, lc1);
      accessLayer.addElement(project, lc2);
     
      rule.setConditions(lc1);
     
      BaseCondition bc1 = RuleModelFactory.eINSTANCE.createBaseCondition();
      BaseCondition bc2 = RuleModelFactory.eINSTANCE.createBaseCondition();
     
      accessLayer.addElement(project, bc1);
      accessLayer.addElement(project, bc2);
     
      lc1.getLogicConditions().add(lc2);
      lc1.getBaseConditions().add(bc1);
      lc2.getBaseConditions().add(bc2);
     
      assertNull(copy);
      copy = ConditionProcessorHelper.createDeepCopyOfTupleList(accessLayer, tuples, rule, lc2);
      assertNotNull(copy);
      assertEquals(2, copy.size());
View Full Code Here

      List<List<EObject[]>> tuples = new ArrayList<List<EObject[]>>();
      List<List<EObject[]>> copy   = new ArrayList<List<EObject[]>>();
     
      Rule rule = RuleModelFactory.eINSTANCE.createRule();
     
      LogicCondition lc1 = RuleModelFactory.eINSTANCE.createLogicCondition();
      LogicCondition lc2 = RuleModelFactory.eINSTANCE.createLogicCondition();
     
      accessLayer.addElement(project, rule);
      accessLayer.addElement(project, lc1);
      accessLayer.addElement(project, lc2);
     
      rule.setConditions(lc1);
     
      BaseCondition bc1 = RuleModelFactory.eINSTANCE.createBaseCondition();
      BaseCondition bc2 = RuleModelFactory.eINSTANCE.createBaseCondition();
     
      accessLayer.addElement(project, bc1);
      accessLayer.addElement(project, bc2);
     
      lc1.getLogicConditions().add(lc2);
      lc1.getBaseConditions().add(bc1);
      lc2.getBaseConditions().add(bc2);
     
      Concern c1 = URNModelFactory.eINSTANCE.createConcern();
        Concern c2 = URNModelFactory.eINSTANCE.createConcern();
        Concern c3 = URNModelFactory.eINSTANCE.createConcern();
        Concern c4 = URNModelFactory.eINSTANCE.createConcern();
View Full Code Here

    {
      List<List<EObject[]>> tuples = new ArrayList<List<EObject[]>>();
     
      Rule rule = RuleModelFactory.eINSTANCE.createRule();
     
      LogicCondition logicCondition = RuleModelFactory.eINSTANCE.createLogicCondition();
     
      accessLayer.addElement(project, rule);
      accessLayer.addElement(project, logicCondition);
     
      rule.setConditions(logicCondition);
     
      BaseCondition bc1 = RuleModelFactory.eINSTANCE.createBaseCondition();
      BaseCondition bc2 = RuleModelFactory.eINSTANCE.createBaseCondition();
     
      accessLayer.addElement(project, bc1);
      accessLayer.addElement(project, bc2);
     
      logicCondition.getBaseConditions().add(bc1);
      logicCondition.getBaseConditions().add(bc2);
     
      assertTrue(tuples.isEmpty());
      ConditionProcessorHelper.prepareTupleLists(accessLayer, rule, tuples);
      assertEquals(2, tuples.size());
    }
View Full Code Here

       
        e1.setAlias("number_1");
        e2.setAlias("number_2");
       
        BaseCondition baseCondition = RuleModelFactory.eINSTANCE.createBaseCondition();
        LogicCondition logicCondition = RuleModelFactory.eINSTANCE.createLogicCondition();
        accessLayer.addElement(project, baseCondition);
        accessLayer.addElement(project, logicCondition);
       
        rule.setConditions(logicCondition);
        logicCondition.getBaseConditions().add(baseCondition);
        logicCondition.setType(LogicConditionType.AND);
        baseCondition.setSource("number_1::Id");
        baseCondition.setTarget("number_2::Id");
       
        List<EObject[]> tuples = new ArrayList<EObject[]>();
       
View Full Code Here

        e1.setAlias("number_1");
        e2.setAlias("number_2");
       
        BaseCondition baseCondition1 = RuleModelFactory.eINSTANCE.createBaseCondition();
        BaseCondition baseCondition2 = RuleModelFactory.eINSTANCE.createBaseCondition();
        LogicCondition logicCondition = RuleModelFactory.eINSTANCE.createLogicCondition();
        accessLayer.addElement(project, baseCondition1);
        accessLayer.addElement(project, baseCondition2);
        accessLayer.addElement(project, logicCondition);
       
        rule.setConditions(logicCondition);
        logicCondition.getBaseConditions().add(baseCondition1);
        logicCondition.getBaseConditions().add(baseCondition2);
        baseCondition1.setSource("number_1::Id");
        baseCondition1.setTarget("number_2::Id");
        baseCondition1.setType(BaseConditionType.VALUE_EQUALS);
        baseCondition2.setSource("number_1::name");
        baseCondition2.setTarget("number_2::name");
        baseCondition2.setType(BaseConditionType.VALUE_EQUALS);
       
        List<List<EObject[]>> tuples = new ArrayList<List<EObject[]>>();
        tuples.add(new ArrayList<EObject[]>());
        tuples.add(new ArrayList<EObject[]>());
       
        // test "AND":
        c1.setId("creator");
        c2.setId("creator");
        c1.setName("name");
        c2.setName("name");
        logicCondition.setType(LogicConditionType.AND);
        assertTrue(conditionProcessor.executeLogicCondition(rule, result, rule.getConditions(), tuples));
        c1.setId("creator__");
        assertFalse(conditionProcessor.executeLogicCondition(rule, result, rule.getConditions(), tuples));
        result.get(0).clear();
        result.get(0).add(c1);
        result.get(1).clear();
        result.get(1).add(c2);
       
        // test "OR":
        logicCondition.setType(LogicConditionType.OR);
        assertTrue(conditionProcessor.executeLogicCondition(rule, result, rule.getConditions(), tuples));
        c2.setName("name___");
        assertFalse(conditionProcessor.executeLogicCondition(rule, result, rule.getConditions(), tuples));
        result.get(0).clear();
        result.get(0).add(c1);
        result.get(1).clear();
        result.get(1).add(c2);
       
        // test "XOR":
        c1.setId("creator");
        logicCondition.setType(LogicConditionType.XOR);
        assertTrue(conditionProcessor.executeLogicCondition(rule, result, rule.getConditions(), tuples));
        c1.setId("creator");
        c2.setId("creator");
        c1.setName("name");
        c2.setName("name");
        result.get(0).clear();
        result.get(0).add(c1);
        result.get(1).clear();
        result.get(1).add(c2);
        assertFalse(conditionProcessor.executeLogicCondition(rule, result, rule.getConditions(), tuples));
        result.get(0).clear();
        result.get(0).add(c1);
        result.get(1).clear();
        result.get(1).add(c2);
       
        // test "NOT":
        c1.setId("creator__");
        logicCondition.setType(LogicConditionType.NOT);
        logicCondition.getBaseConditions().remove(baseCondition2);
        assertEquals(2, result.size());
        assertTrue(conditionProcessor.executeLogicCondition(rule, result, rule.getConditions(), tuples));
        result.get(0).clear();
        result.get(0).add(c1);
        result.get(1).clear();
View Full Code Here

        e1.setAlias("number_1");
        e2.setAlias("number_2");
       
        BaseCondition baseCondition1 = RuleModelFactory.eINSTANCE.createBaseCondition();
        BaseCondition baseCondition2 = RuleModelFactory.eINSTANCE.createBaseCondition();
        LogicCondition logicCondition = RuleModelFactory.eINSTANCE.createLogicCondition();
        accessLayer.addElement(project, baseCondition1);
        accessLayer.addElement(project, baseCondition2);
        accessLayer.addElement(project, logicCondition);
       
        rule.setConditions(logicCondition);
        logicCondition.getBaseConditions().add(baseCondition1);
        logicCondition.getBaseConditions().add(baseCondition2);
        baseCondition1.setSource("number_1::Id");
        baseCondition1.setTarget("number_2::Id");
        baseCondition1.setType(BaseConditionType.VALUE_EQUALS);
        baseCondition2.setSource("number_1::name");
        baseCondition2.setTarget("number_2::name");
        baseCondition2.setType(BaseConditionType.VALUE_EQUALS);
       
        c1.setId("1");
        c2.setId("1");
        c1.setName("name");
        c2.setName("name");
        logicCondition.setType(LogicConditionType.AND);
       
        List<List<EObject[]>> tuples = new ArrayList<List<EObject[]>>();
        tuples.add(new ArrayList<EObject[]>());
        tuples.add(new ArrayList<EObject[]>());
       
View Full Code Here

           * </AND>
           */
         
          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();
         
          ActionDefinition a = RuleModelFactory.eINSTANCE.createActionDefinition();
          a.setActionType(ActionType.CREATE_LINK);
         
          rule.getElements().add(e1);
          rule.getElements().add(e2);
          rule.getElements().add(e3);
         
          rule.getActions().add(a);
         
          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");
View Full Code Here

           
            e1.setAlias("number_1");
            e2.setAlias("number_2");
           
            BaseCondition baseCondition = RuleModelFactory.eINSTANCE.createBaseCondition();
            LogicCondition logicCondition = RuleModelFactory.eINSTANCE.createLogicCondition();
            accessLayer.addElement(project, baseCondition);
            accessLayer.addElement(project, logicCondition);
           
            rule.setConditions(logicCondition);
            logicCondition.getBaseConditions().add(baseCondition);
            logicCondition.setType(LogicConditionType.AND);
            baseCondition.setSource("number_1::Id");
            baseCondition.setTarget("number_2::Id");
           
            List<EObject[]> tuples = new ArrayList<EObject[]>();
           
View Full Code Here

TOP

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

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.