Package org.emftrace.metamodel.QUARCModel.Constraints

Examples of org.emftrace.metamodel.QUARCModel.Constraints.Constraint


   */
  @Override
  public String getText(Object object) {


  Constraint constraint =  (Constraint)object;
   
   String labelType = constraint.getOperator().getName();
   String labelValue = constraint.getValue() != null ? constraint.getValue() : "";
   String labelProperty =  constraint.getTechnicalProperty() != null  && constraint.getTechnicalProperty().getName() != null ? constraint.getTechnicalProperty().getName() : "";

  return   getString("_UI_Constraint_type") + " \" " + labelProperty + " " +labelType+ " "+ labelValue + "\"";
  }
View Full Code Here



    precondition.setLogicalConnectiveType(LogicalConnectiveTypes.NOT);
    precondition.getBaseConditions().add(baseCondition1);

    Constraint constraint1 = createConstraint(property1, "true");
    constraint1.setOperator(BaseConditionOperators.EQUALS);

    assignedConstraintsSet.getAssignedConstraints().add(constraint1);

    // true

    constraint1.setValue("true");
    assertLogicalFalse();
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // false

    constraint1.setValue("false");
    assertLogicalTrue();
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // undefined

    constraint1.setTechnicalProperty(property2);
    constraint1.setValue("true");
    assertLogicalUndefined();
    assertPropertyIsUnassigned(property1, true);
    assertAssignmentForPropertyIsNotRequiered(property2);

    constraint1.setTechnicalProperty(property2);
    constraint1.setValue("false");
    assertLogicalUndefined();
    assertPropertyIsUnassigned(property1, true);
    assertAssignmentForPropertyIsNotRequiered(property2);

  }
View Full Code Here

    precondition.setLogicalConnectiveType(LogicalConnectiveTypes.AND);
    precondition.getBaseConditions().add(baseCondition1);
    precondition.getBaseConditions().add(baseCondition2);

    Constraint constraint1 = createConstraint(property1, "true");
    constraint1.setOperator(BaseConditionOperators.EQUALS);
    Constraint constraint2 = createConstraint(property2, "true");
    constraint2.setOperator(BaseConditionOperators.EQUALS);

    assignedConstraintsSet.getAssignedConstraints().add(constraint1);
    assignedConstraintsSet.getAssignedConstraints().add(constraint2);

    // true / true

    constraint1.setValue("true");
    constraint2.setValue("true");
    assertLogicalTrue();
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // true / false

    constraint1.setValue("true");
    constraint2.setValue("false");
    assertLogicalFalse();
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // false /true

    constraint1.setValue("false");
    constraint2.setValue("true");
    assertLogicalFalse();
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // false /false

    constraint1.setValue("false");
    constraint2.setValue("false");
    assertLogicalFalse();
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // undefined /false

    constraint1.setTechnicalProperty(property3);
    constraint2.setTechnicalProperty(property2);
    constraint1.setValue("true");
    constraint2.setValue("false");
    assertLogicalFalse();
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // undefined /true

    constraint1.setTechnicalProperty(property3);
    constraint2.setTechnicalProperty(property2);
    constraint1.setValue("true");
    constraint2.setValue("true");
    assertLogicalUndefined();
   
    assertPropertyIsUnassigned(property1, true );
    assertAssignmentForPropertyIsNotRequiered(property2);

    // false / undefined

    constraint1.setTechnicalProperty(property1);
    constraint2.setTechnicalProperty(property3);

    constraint1.setValue("false");
    constraint2.setValue("true");
    assertLogicalFalse();
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // true / undefined

    constraint1.setTechnicalProperty(property1);
    constraint2.setTechnicalProperty(property3);

    constraint1.setValue("true");
    constraint2.setValue("true");
    assertLogicalUndefined();
   
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertPropertyIsUnassigned(property2, true );
   
    // undefined / undefined

    constraint1.setTechnicalProperty(property3);
    constraint2.setTechnicalProperty(property4);

    constraint1.setValue("true");
    constraint2.setValue("true");
    assertLogicalUndefined();
   
    assertPropertyIsUnassigned(property1, false );
    assertPropertyIsUnassigned(property2, false );
View Full Code Here

    precondition.setLogicalConnectiveType(LogicalConnectiveTypes.OR);
    precondition.getBaseConditions().add(baseCondition1);
    precondition.getBaseConditions().add(baseCondition2);

    Constraint constraint1 = createConstraint(property1, "true");
    constraint1.setOperator(BaseConditionOperators.EQUALS);
    Constraint constraint2 = createConstraint(property2, "true");
    constraint2.setOperator(BaseConditionOperators.EQUALS);

    assignedConstraintsSet.getAssignedConstraints().add(constraint1);
    assignedConstraintsSet.getAssignedConstraints().add(constraint2);

    // true / true

    constraint1.setValue("true");
    constraint2.setValue("true");
    assertLogicalTrue();
   
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // true / false

    constraint1.setValue("true");
    constraint2.setValue("false");
    assertLogicalTrue();
   
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // false /true

    constraint1.setValue("false");
    constraint2.setValue("true");
    assertLogicalTrue();
   
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // false /false

    constraint1.setValue("false");
    constraint2.setValue("false");
    assertLogicalFalse();
   
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // undefined /false

    constraint1.setTechnicalProperty(property3);
    constraint2.setTechnicalProperty(property2);
    constraint1.setValue("true");
    constraint2.setValue("false");
    assertLogicalUndefined();
   
    assertPropertyIsUnassigned(property1, true);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // undefined /true

    constraint1.setTechnicalProperty(property3);
    constraint2.setTechnicalProperty(property2);
    constraint1.setValue("true");
    constraint2.setValue("true");
    assertLogicalTrue();
   
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // false / undefined

    constraint1.setTechnicalProperty(property1);
    constraint2.setTechnicalProperty(property3);

    constraint1.setValue("false");
    constraint2.setValue("true");
    assertLogicalUndefined();
 
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertPropertyIsUnassigned(property2, true);


    // true / undefined

    constraint1.setTechnicalProperty(property1);
    constraint2.setTechnicalProperty(property3);

    constraint1.setValue("true");
    constraint2.setValue("true");
    assertLogicalTrue();
   
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // undefined / undefined

    constraint1.setTechnicalProperty(property3);
    constraint2.setTechnicalProperty(property4);

    constraint1.setValue("true");
    constraint2.setValue("true");
    assertLogicalUndefined();
   
    assertPropertyIsUnassigned(property1, true);
    assertPropertyIsUnassigned(property2, true);
View Full Code Here

    precondition.setLogicalConnectiveType(LogicalConnectiveTypes.XOR);
    precondition.getBaseConditions().add(baseCondition1);
    precondition.getBaseConditions().add(baseCondition2);

    Constraint constraint1 = createConstraint(property1, "true");
    constraint1.setOperator(BaseConditionOperators.EQUALS);
    Constraint constraint2 = createConstraint(property2, "true");
    constraint2.setOperator(BaseConditionOperators.EQUALS);
   
    assignedConstraintsSet.getAssignedConstraints().add(constraint1);
    assignedConstraintsSet.getAssignedConstraints().add(constraint2);

    // true / true

    constraint1.setValue("true");
    constraint2.setValue("true");
    assertLogicalFalse();
   
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // true / false

    constraint1.setValue("true");
    constraint2.setValue("false");
    assertLogicalTrue();

    assertAssignmentForPropertyIsNotRequiered(property1);
    assertAssignmentForPropertyIsNotRequiered(property2);
   
    // false /true

    constraint1.setValue("false");
    constraint2.setValue("true");
    assertLogicalTrue();
   
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // false /false

    constraint1.setValue("false");
    constraint2.setValue("false");
    assertLogicalFalse();
   
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // undefined /false

    constraint1.setTechnicalProperty(property3);
    constraint2.setTechnicalProperty(property2);
    constraint1.setValue("true");
    constraint2.setValue("false");
    assertLogicalUndefined();
   
    assertPropertyIsUnassigned(property1, true);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // undefined /true

    constraint1.setTechnicalProperty(property3);
    constraint2.setTechnicalProperty(property2);
    constraint1.setValue("true");
    constraint2.setValue("true");
    assertLogicalUndefined();
   
    assertPropertyIsUnassigned(property1, true);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // false / undefined

    constraint1.setTechnicalProperty(property1);
    constraint2.setTechnicalProperty(property3);

    constraint1.setValue("false");
    constraint2.setValue("true");
    assertLogicalUndefined();
   
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertPropertyIsUnassigned(property2, true);

    // true / undefined

    constraint1.setTechnicalProperty(property1);
    constraint2.setTechnicalProperty(property3);

    constraint1.setValue("true");
    constraint2.setValue("true");
    assertLogicalUndefined();
   
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertPropertyIsUnassigned(property2, true);

    // undefined / undefined

    constraint1.setTechnicalProperty(property3);
    constraint2.setTechnicalProperty(property4);

    constraint1.setValue("true");
    constraint2.setValue("true");
    assertLogicalUndefined();
   
    assertPropertyIsUnassigned(property1, false);
    assertPropertyIsUnassigned(property2, false);
View Full Code Here

    precondition.setLogicalConnectiveType(LogicalConnectiveTypes.NOR);
    precondition.getBaseConditions().add(baseCondition1);
    precondition.getBaseConditions().add(baseCondition2);

    Constraint constraint1 = createConstraint(property1, "true");
    constraint1.setOperator(BaseConditionOperators.EQUALS);
    Constraint constraint2 = createConstraint(property2, "true");
    constraint2.setOperator(BaseConditionOperators.EQUALS);

    assignedConstraintsSet.getAssignedConstraints().add(constraint1);
    assignedConstraintsSet.getAssignedConstraints().add(constraint2);

    // true / true

    constraint1.setValue("true");
    constraint2.setValue("true");
    assertLogicalFalse();
   
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // true / false

    constraint1.setValue("true");
    constraint2.setValue("false");
    assertLogicalFalse();
   
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // false /true

    constraint1.setValue("false");
    constraint2.setValue("true");
    assertLogicalFalse();
   
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // false /false

    constraint1.setValue("false");
    constraint2.setValue("false");
    assertLogicalTrue();
   
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // undefined /false

    constraint1.setTechnicalProperty(property3);
    constraint2.setTechnicalProperty(property2);
    constraint1.setValue("true");
    constraint2.setValue("false");
    assertLogicalUndefined();
   
    assertPropertyIsUnassigned(property1, true);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // undefined /true

    constraint1.setTechnicalProperty(property3);
    constraint2.setTechnicalProperty(property2);
    constraint1.setValue("true");
    constraint2.setValue("true");
    assertLogicalFalse();
   
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // false / undefined

    constraint1.setTechnicalProperty(property1);
    constraint2.setTechnicalProperty(property3);

    constraint1.setValue("false");
    constraint2.setValue("true");
    assertLogicalUndefined();
   
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertPropertyIsUnassigned(property2, true);


    // true / undefined

    constraint1.setTechnicalProperty(property1);
    constraint2.setTechnicalProperty(property3);

    constraint1.setValue("true");
    constraint2.setValue("true");
    assertLogicalFalse();
   
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // undefined / undefined

    constraint1.setTechnicalProperty(property3);
    constraint2.setTechnicalProperty(property4);

    constraint1.setValue("true");
    constraint2.setValue("true");
    assertLogicalUndefined();

    assertPropertyIsUnassigned(property1, true);
    assertPropertyIsUnassigned(property2, true);
  }
View Full Code Here

    precondition.setLogicalConnectiveType(LogicalConnectiveTypes.NAND);
    precondition.getBaseConditions().add(baseCondition1);
    precondition.getBaseConditions().add(baseCondition2);

    Constraint constraint1 = createConstraint(property1, "true");
    constraint1.setOperator(BaseConditionOperators.EQUALS);
    Constraint constraint2 = createConstraint(property2, "true");
    constraint2.setOperator(BaseConditionOperators.EQUALS);
   
    assignedConstraintsSet.getAssignedConstraints().add(constraint1);
    assignedConstraintsSet.getAssignedConstraints().add(constraint2);

    // true / true

    constraint1.setValue("true");
    constraint2.setValue("true");
    assertLogicalFalse();
   
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // true / false

    constraint1.setValue("true");
    constraint2.setValue("false");
    assertLogicalTrue();
   
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // false /true

    constraint1.setValue("false");
    constraint2.setValue("true");
    assertLogicalTrue();
   
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // false /false

    constraint1.setValue("false");
    constraint2.setValue("false");
    assertLogicalTrue();
   
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // undefined /false

    constraint1.setTechnicalProperty(property3);
    constraint2.setTechnicalProperty(property2);
    constraint1.setValue("true");
    constraint2.setValue("false");
    assertLogicalTrue();
   
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // undefined /true

    constraint1.setTechnicalProperty(property3);
    constraint2.setTechnicalProperty(property2);
    constraint1.setValue("true");
    constraint2.setValue("true");
    assertLogicalUndefined();
   
    assertPropertyIsUnassigned(property1, true);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // false / undefined

    constraint1.setTechnicalProperty(property1);
    constraint2.setTechnicalProperty(property3);

    constraint1.setValue("false");
    constraint2.setValue("true");
    assertLogicalTrue();
   
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // true / undefined

    constraint1.setTechnicalProperty(property1);
    constraint2.setTechnicalProperty(property3);

    constraint1.setValue("true");
    constraint2.setValue("true");
    assertLogicalUndefined();
   
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertPropertyIsUnassigned(property2, true);

    // undefined / undefined

    constraint1.setTechnicalProperty(property3);
    constraint2.setTechnicalProperty(property4);

    constraint1.setValue("true");
    constraint2.setValue("true");
    assertLogicalUndefined();
   
    assertPropertyIsUnassigned(property1, false);
    assertPropertyIsUnassigned(property2, false);
View Full Code Here

    precondition.setLogicalConnectiveType(LogicalConnectiveTypes.IMPLIES);
    precondition.getBaseConditions().add(baseCondition1);
    precondition.getBaseConditions().add(baseCondition2);

    Constraint constraint1 = createConstraint(property1, "true");
    constraint1.setOperator(BaseConditionOperators.EQUALS);
    Constraint constraint2 = createConstraint(property2, "true");
    constraint2.setOperator(BaseConditionOperators.EQUALS);

    assignedConstraintsSet.getAssignedConstraints().add(constraint1);
    assignedConstraintsSet.getAssignedConstraints().add(constraint2);

    // true / true

    constraint1.setValue("true");
    constraint2.setValue("true");
    assertLogicalTrue();
   
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // true / false

    constraint1.setValue("true");
    constraint2.setValue("false");
    assertLogicalFalse();
   
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // false /true

    constraint1.setValue("false");
    constraint2.setValue("true");
    assertLogicalTrue();
   
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // false /false

    constraint1.setValue("false");
    constraint2.setValue("false");
    assertLogicalTrue();
   
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // undefined /false

    constraint1.setTechnicalProperty(property3);
    constraint2.setTechnicalProperty(property2);
    constraint1.setValue("true");
    constraint2.setValue("false");
    assertLogicalUndefined();
   
    assertPropertyIsUnassigned(property1, true);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // undefined /true

    constraint1.setTechnicalProperty(property3);
    constraint2.setTechnicalProperty(property2);
    constraint1.setValue("true");
    constraint2.setValue("true");
    assertLogicalTrue();
   
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // false / undefined

    constraint1.setTechnicalProperty(property1);
    constraint2.setTechnicalProperty(property3);

    constraint1.setValue("false");
    constraint2.setValue("true");
    assertLogicalTrue();
   
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertAssignmentForPropertyIsNotRequiered(property2);

    // true / undefined

    constraint1.setTechnicalProperty(property1);
    constraint2.setTechnicalProperty(property3);

    constraint1.setValue("true");
    constraint2.setValue("true");
    assertLogicalUndefined();
   
    assertAssignmentForPropertyIsNotRequiered(property1);
    assertPropertyIsUnassigned(property2, true);

    // undefined / undefined

    constraint1.setTechnicalProperty(property3);
    constraint2.setTechnicalProperty(property4);

    constraint1.setValue("true");
    constraint2.setValue("true");
    assertLogicalUndefined();
   
    assertPropertyIsUnassigned(property1, true);
    assertPropertyIsUnassigned(property2, true);
View Full Code Here

public class SetConstraintValueCommandTest extends QUARCCoreTestCase {

  @Test
  public void test() {
    Constraint constraint = ConstraintsFactory.eINSTANCE.createConstraint();



    gssQuery.getAssignedConstraintsSet().getAssignedConstraints().add(constraint);

   
    new SetConstraintValueCommand(constraint, "true").runWithoutUnicaseCommand();
   
    assertEquals(1, gssQuery.getAssignedConstraintsSet().getAssignedConstraints().size());
    assertEquals("true", constraint.getValue());
   

   
    assertEquals(true, gssQuery.getAssignedConstraintsSet().isChanged());
  }
View Full Code Here

public class SetConstraintPropertyCommandTest extends QUARCCoreTestCase {

  @Test
  public void test() {
    Constraint constraint1 = ConstraintsFactory.eINSTANCE.createConstraint();

    TechnicalProperty property = ConstraintsFactory.eINSTANCE.createBooleanTechnicalProperty();

    gssQuery.getAssignedConstraintsSet().getAssignedConstraints().add(constraint1);

   
    new SetConstraintPropertyCommand(constraint1, property).runWithoutUnicaseCommand();
   
    assertEquals(1, gssQuery.getAssignedConstraintsSet().getAssignedConstraints().size());
    assertEquals(property, constraint1.getTechnicalProperty());
   

   
    assertEquals(true, gssQuery.getAssignedConstraintsSet().isChanged());
  }
View Full Code Here

TOP

Related Classes of org.emftrace.metamodel.QUARCModel.Constraints.Constraint

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.