Package org.emftrace.metamodel.QUARCModel.Constraints

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


  @Test
  public void testForFloatEquals() {
    TechnicalProperty property = createPropertyWithTypeFloat();

    Constraint constraint = createConstraint(property, "1");
    constraint.setOperator(BaseConditionOperators.EQUALS);

    assignedConstraintsSet.getAssignedConstraints().add(constraint);

    BaseCondition baseCondition = createBaseCondition(property,
        BaseConditionOperators.EQUALS, "1");

    precondition.setLogicalConnectiveType(LogicalConnectiveTypes.AND);
    precondition.getBaseConditions().add(baseCondition);

    // test for true

    constraint.setValue("1");
    assertLogicalTrue();

    constraint.setValue("1.0");
    assertLogicalTrue();

    constraint.setValue("1.0f");
    assertLogicalTrue();

    // test for false
    constraint.setValue("0");
    assertLogicalFalse();

  }
View Full Code Here


 
  @Test
  public void testForFloatApproximatelyEqualsWithRelativeTolerance() {
    TechnicalProperty property = createPropertyWithTypeFloat();

    Constraint constraint = createConstraint(property, "1");
    constraint.setOperator(BaseConditionOperators.EQUALS);

    assignedConstraintsSet.getAssignedConstraints().add(constraint);

    BaseCondition baseCondition = createBaseCondition(property,
        BaseConditionOperators.APPROXIMATELY_EQUALS, "1");
   
    baseCondition.setTolerance("0.01");
    baseCondition.setToleranceType(ToleranceTypes.RELATIVE);

    precondition.setLogicalConnectiveType(LogicalConnectiveTypes.AND);
    precondition.getBaseConditions().add(baseCondition);

    // test for true

    constraint.setValue("1.0");
    assertLogicalTrue();

    constraint.setValue("1.01f");
    assertLogicalTrue();

    constraint.setValue("0.99f");
    assertLogicalTrue();

    // test for false
    constraint.setValue("1.011");
    assertLogicalFalse();
   
    constraint.setValue("0.989");
    assertLogicalFalse();

  }
View Full Code Here

 
  @Test
  public void testForFloatApproximatelyEqualsWithAbsoluteTolerance() {
    TechnicalProperty property = createPropertyWithTypeFloat();

    Constraint constraint = createConstraint(property, "1");
    constraint.setOperator(BaseConditionOperators.EQUALS);

    assignedConstraintsSet.getAssignedConstraints().add(constraint);

    BaseCondition baseCondition = createBaseCondition(property,
        BaseConditionOperators.APPROXIMATELY_EQUALS, "1");
   
    baseCondition.setTolerance("0.01");
    baseCondition.setToleranceType(ToleranceTypes.ABSOLUTE);

    precondition.setLogicalConnectiveType(LogicalConnectiveTypes.AND);
    precondition.getBaseConditions().add(baseCondition);

    // test for true

    constraint.setValue("1.0");
    assertLogicalTrue();

    constraint.setValue("1.01f");
    assertLogicalTrue();

    constraint.setValue("0.99f");
    assertLogicalTrue();

    // test for false
    constraint.setValue("1.011");
    assertLogicalFalse();
   
    constraint.setValue("0.989");
    assertLogicalFalse();
  }
View Full Code Here

   */
  @Override
  protected void doRun() {
    assignedConstraintsSet.setChanged(true);
    for (int i = assignedConstraintsSet.getAssignedConstraints().size()-1; i >=0; i--) {
      Constraint constraint = assignedConstraintsSet.getAssignedConstraints().get(i);
      assignedConstraintsSet.getAssignedConstraints().remove(constraint);
    }
   
  }
View Full Code Here

    createImpact(gss, p1, g1, 1);
    createImpact(gss, si1, p2, 1);
    createImpact(gss, si2, p1, 1);

    Constraint constraint = ConstraintsFactory.eINSTANCE.createConstraint();
    constraint.setTechnicalProperty(propery);
    constraint.setOperator(BaseConditionOperators.EQUALS);
    constraint.setValue("false");

    gssQuery.getAssignedConstraintsSet().getAssignedConstraints()
        .add(constraint);
    executeRequiredPhases();
View Full Code Here

    createImpact(gss, p1, g1, 1);
    createImpact(gss, si1, p2, 1);
    createImpact(gss, si1, p3, 1);

    Constraint constraint1 = ConstraintsFactory.eINSTANCE
        .createConstraint();
    constraint1.setTechnicalProperty(propery1);
    constraint1.setOperator(BaseConditionOperators.EQUALS);
    constraint1.setValue("false");

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

    Constraint constraint2 = ConstraintsFactory.eINSTANCE
        .createConstraint();
    constraint2.setTechnicalProperty(propery2);
    constraint2.setOperator(BaseConditionOperators.EQUALS);
    constraint2.setValue("true");

    gssQuery.getAssignedConstraintsSet().getAssignedConstraints()
        .add(constraint2);
    executeRequiredPhases();
View Full Code Here

  @Test
  public void test() {
 
    AssignedConstraintsSet assignedConstraintsSet = QueryFactory.eINSTANCE.createAssignedConstraintsSet();
    Constraint c1 = ConstraintsFactory.eINSTANCE.createConstraint();
    Constraint c2 = ConstraintsFactory.eINSTANCE.createConstraint();
    Constraint c3 = ConstraintsFactory.eINSTANCE.createConstraint();
   
    project.addModelElement(c1);
    project.addModelElement(c2);
    project.addModelElement(c3);
View Full Code Here

   * @see org.eclipse.jface.wizard.Wizard#performFinish()
   */
  @Override
  public boolean performFinish() {

    Constraint constraint = ConstraintsFactory.eINSTANCE.createConstraint();
    constraint.setTechnicalProperty(selectPropertyWizardPage.getSelectedProperty());
    constraint.setOperator(BaseConditionOperators.EQUALS);
    constraint.setValue(selectPropertyWizardPage.getValue());

    new AddConstraintToAssignedConstraintsSetCommand(assignedConstraintedSet, constraint).runAsJob();
    return true;
  }
View Full Code Here

public class InsertConstraintToAssignedConstraintsSetCommandTest extends QUARCCoreTestCase{

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

    gssQuery.getAssignedConstraintsSet().getAssignedConstraints().add(constraint1);
    gssQuery.getAssignedConstraintsSet().getAssignedConstraints().add(constraint3);
   
    new InsertConstraintToAssignedConstraintsSetCommand(gssQuery.getAssignedConstraintsSet(), constraint2,1).runWithoutUnicaseCommand();
View Full Code Here

public class AddConstraintToAssignedConstraintsSetCommandTest extends QUARCCoreTestCase{

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

   
    new AddConstraintToAssignedConstraintsSetCommand(gssQuery.getAssignedConstraintsSet(), constraint).runWithoutUnicaseCommand();
   
    assertEquals(1, gssQuery.getAssignedConstraintsSet().getAssignedConstraints().size());
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.