Package org.emftrace.metamodel.QUARCModel.Constraints

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


    if (property instanceof TechnicalPropertyCategory) {
       new Exception("assigned property must not be a TechnicalPropertyCategory ("+ baseCondtion+ ")").printStackTrace();
       result = LogicalValues.INVALID;
    } else {
    String constraintStringValue = getPropertyValue(property);
    BaseConditionOperators constraintOperator = getPropertyOperator(property);
    String conditionStringValue = baseCondtion.getValue();
    if (propertyIsAssigned(property))
      if  (baseCondtion.getTechnicalProperty() instanceof BooleanTechnicalProperty) {
        switch (baseCondtion.getOperator().getValue()) {
        case BaseConditionOperators.EQUALS_VALUE:
          if (!(constraintStringValue.equals("false") || constraintStringValue.equals("true"))) {
             new Exception("invalid constraint value ("+ constraintStringValue +")").printStackTrace();
             result = LogicalValues.INVALID;
          } else
          if (!(conditionStringValue.equals("false")|| conditionStringValue.equals("true"))) {
            new Exception("invalid condition value ("+ conditionStringValue +")").printStackTrace();
            result = LogicalValues.INVALID;
          } else {
         
          Boolean constraintBooleanValue = Boolean.parseBoolean(constraintStringValue);
          Boolean conditionBooleanValue = Boolean.parseBoolean(conditionStringValue);
          result = constraintBooleanValue == conditionBooleanValue ? LogicalValues.TRUE
              : LogicalValues.FALSE;
          }
          break;
        default:
          new Exception("invalid operator "
              + baseCondtion.getOperator()
              + " for "
              + baseCondtion.getTechnicalProperty().getClass().getName()).printStackTrace();
          result = LogicalValues.INVALID;
        }
      }
      else if  (baseCondtion.getTechnicalProperty() instanceof FloatTechnicalProperty) {


        Float constraintFloatValue = Float
            .parseFloat(constraintStringValue);
        Float conditionFloatValue = Float
            .parseFloat(conditionStringValue);
        switch (baseCondtion.getOperator().getValue()) {

        case BaseConditionOperators.EQUALS_VALUE:
        //todo do evaluation by including constraint operator
         
          switch (constraintOperator.getValue()) {
          case BaseConditionOperators.EQUALS_VALUE:
            if (constraintFloatValue.equals(conditionFloatValue))
              result = LogicalValues.TRUE;
            else
              result = LogicalValues.FALSE;
View Full Code Here

TOP

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

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.