Examples of IBooleanExpression


Examples of org.apache.uima.ruta.expression.bool.IBooleanExpression

          RutaBlock parent) {
    String rn = feature.getRange().getName();
    if (rn.equals(UIMAConstants.TYPE_BOOLEAN)) {
      Boolean v1 = afs.getBooleanValue(feature);
      if (arg instanceof IBooleanExpression) {
        IBooleanExpression expr = (IBooleanExpression) arg;
        Boolean v2 = expr.getBooleanValue(parent, afs, stream);
        return compare(v1, v2);
      }
    } else if (rn.equals(UIMAConstants.TYPE_INTEGER) || rn.equals(UIMAConstants.TYPE_BYTE)
            || rn.equals(UIMAConstants.TYPE_SHORT) || rn.equals(UIMAConstants.TYPE_LONG)) {
      Integer v1 = afs.getIntValue(feature);
      if (arg instanceof INumberExpression) {
        INumberExpression expr = (INumberExpression) arg;
        Integer v2 = expr.getIntegerValue(parent, afs, stream);
        return compare(v1, v2);
      }
    } else if (rn.equals(UIMAConstants.TYPE_DOUBLE)) {
      Double v1 = afs.getDoubleValue(feature);
      if (arg instanceof INumberExpression) {
        INumberExpression expr = (INumberExpression) arg;
        Double v2 = expr.getDoubleValue(parent, afs, stream);
        return compare(v1, v2);
      }
    } else if (rn.equals(UIMAConstants.TYPE_FLOAT)) {
      Float v1 = afs.getFloatValue(feature);
      if (arg instanceof INumberExpression) {
        INumberExpression expr = (INumberExpression) arg;
        Float v2 = expr.getFloatValue(parent, afs, stream);
        return compare(v1, v2);
      }
    } else if (rn.equals(UIMAConstants.TYPE_STRING)) {
      String v1 = afs.getStringValue(feature);
      if (arg instanceof AbstractStringExpression) {
        AbstractStringExpression expr = (AbstractStringExpression) arg;
        String v2 = expr.getStringValue(parent, afs, stream);
        return compare(v1, v2);
      }
    }
    return false;
  }
View Full Code Here

Examples of org.apache.uima.ruta.expression.bool.IBooleanExpression

        }
      } else if (clazz.equals(String.class) && value instanceof IStringExpression) {
        IStringExpression se = (IStringExpression) value;
        return se.getStringValue(owner, null, null);
      } else if (clazz.equals(Boolean.class) && value instanceof IBooleanExpression) {
        IBooleanExpression be = (IBooleanExpression) value;
        return be.getBooleanValue(owner, null, null);
      }
      if (clazz.equals(RutaWordList.class) && value instanceof LiteralWordListExpression) {
        LiteralWordListExpression lle = (LiteralWordListExpression) value;
        String path = lle.getText();
        RutaWordList wordList = getWordList(path);
View Full Code Here

Examples of org.apache.uima.ruta.expression.bool.IBooleanExpression

    } else if (argExpr instanceof INumberExpression && (range.equals(UIMAConstants.TYPE_FLOAT))) {
      INumberExpression numberExpr = (INumberExpression) argExpr;
      float v = numberExpr.getFloatValue(element.getParent(), a, stream);
      a.setFloatValue(feature, v);
    } else if (argExpr instanceof IBooleanExpression && (range.equals(UIMAConstants.TYPE_BOOLEAN))) {
      IBooleanExpression booleanExpr = (IBooleanExpression) argExpr;
      boolean v = booleanExpr.getBooleanValue(element.getParent(), a, stream);
      a.setBooleanValue(feature, v);
    } else if (argExpr instanceof IBooleanExpression && (range.equals(UIMAConstants.TYPE_BOOLEAN))) {
      IBooleanExpression booleanExpr = (IBooleanExpression) argExpr;
      boolean v = booleanExpr.getBooleanValue(element.getParent(), a, stream);
      a.setBooleanValue(feature, v);
    } else if (argExpr instanceof TypeExpression && !feature.getRange().isPrimitive()) {
      TypeExpression typeExpr = (TypeExpression) argExpr;
      Type t = typeExpr.getType(element.getParent());
      List<AnnotationFS> inWindow = stream.getAnnotationsInWindow(a, t);
View Full Code Here

Examples of org.apache.uima.ruta.expression.bool.IBooleanExpression

          INumberExpression numberExpr = (INumberExpression) expr;
          long v = numberExpr.getIntegerValue(parent, match, element, stream);
          annotationFS.setLongValue(feature, v);
        } else if (rangeName.equals(UIMAConstants.TYPE_BOOLEAN)
                && expr instanceof IBooleanExpression) {
          IBooleanExpression booleanExpr = (IBooleanExpression) expr;
          boolean v = booleanExpr.getBooleanValue(parent, match, element, stream);
          annotationFS.setBooleanValue(feature, v);
        } else if (expr instanceof TypeExpression) {
          TypeExpression typeExpr = (TypeExpression) expr;
          Type t = typeExpr.getType(parent);
          List<AnnotationFS> inWindow = stream.getAnnotationsInWindow(annotationFS, t);
View Full Code Here

Examples of org.apache.uima.ruta.expression.bool.IBooleanExpression

        }
      } else if (clazz.equals(String.class) && value instanceof IStringExpression) {
        IStringExpression se = (IStringExpression) value;
        return se.getStringValue(owner, null, null);
      } else if (clazz.equals(Boolean.class) && value instanceof IBooleanExpression) {
        IBooleanExpression be = (IBooleanExpression) value;
        return be.getBooleanValue(owner, null, null);
      }
      if (clazz.equals(RutaWordList.class) && value instanceof LiteralWordListExpression) {
        LiteralWordListExpression lle = (LiteralWordListExpression) value;
        String path = lle.getText();
        RutaWordList wordList = getWordList(path);
View Full Code Here

Examples of org.apache.uima.ruta.expression.bool.IBooleanExpression

    TypeExpression typeExpr2 = new ReferenceTypeExpression("typeVar");
    typeExprList.add(typeExpr1);
    typeExprList.add(typeExpr2);
    INumberExpression numExpr1 = new SimpleNumberExpression(4);
    INumberExpression numExpr2 = new ReferenceNumberExpression("numVar");
    IBooleanExpression boolExpr1 = new SimpleBooleanExpression(true);
    AbstractStringExpression stringExpr = new SimpleStringExpression("string");
    stringExprList.add(stringExpr);
    exprList.add(typeExpr1);
    WordTableExpression wordTableExpr = new ReferenceWordTableExpression(var);
    WordListExpression wordListExpr = new ReferenceWordListExpression(var);
View Full Code Here

Examples of org.apache.uima.ruta.expression.bool.IBooleanExpression

    s = v.verbalize(numExpr6);
    assertEquals("4.9 * 4 + numVar", s);
   
   
   
    IBooleanExpression boolExpr1 = new SimpleBooleanExpression(true);
    IBooleanExpression boolExpr2 = new SimpleBooleanExpression(false);
    IBooleanExpression boolExpr3 = new ReferenceBooleanExpression(var);
    IBooleanExpression boolExpr4 = new BooleanNumberExpression(numExpr1, "==", numExpr2);
    IBooleanExpression boolExpr5 = new BooleanNumberExpression(numExpr1, "!=", numExpr2);
    IBooleanExpression boolExpr6 = new BooleanNumberExpression(numExpr1, "<=", numExpr2);
    IBooleanExpression boolExpr7 = new BooleanNumberExpression(numExpr1, ">=", numExpr2);
    IBooleanExpression boolExpr8 = new BooleanNumberExpression(numExpr1, "<", numExpr2);
    IBooleanExpression boolExpr9 = new BooleanNumberExpression(numExpr1, ">", numExpr2);
    IBooleanExpression boolExpr10 = new BooleanTypeExpression(typeExpr1, "==", typeExpr2);
    IBooleanExpression boolExpr11 = new BooleanTypeExpression(typeExpr1, "!=", typeExpr2);
   
    s = v.verbalize(boolExpr1);
    assertEquals("true", s);
    s = v.verbalize(boolExpr2);
    assertEquals("false", s);
View Full Code Here

Examples of org.apache.uima.ruta.expression.bool.IBooleanExpression

    TypeExpression typeExpr2 = new ReferenceTypeExpression("typeVar");
    typeExprList.add(typeExpr1);
    typeExprList.add(typeExpr2);
    INumberExpression numExpr1 = new SimpleNumberExpression(4);
    INumberExpression numExpr2 = new ReferenceNumberExpression("numVar");
    IBooleanExpression boolExpr1 = new SimpleBooleanExpression(true);
    IStringExpression stringExpr = new SimpleStringExpression("string");
    stringExprList.add(stringExpr);
    TypeListExpression typeListExpr = new SimpleTypeListExpression(typeExprList);
    StringListExpression stringListExpr = new SimpleStringListExpression(stringExprList);
    AbstractRutaCondition c = null;
View Full Code Here

Examples of org.apache.uima.ruta.expression.bool.IBooleanExpression

    // null is possibly coveredText
    String rn = feature == null ? UIMAConstants.TYPE_STRING : feature.getRange().getName();
    if (rn.equals(UIMAConstants.TYPE_BOOLEAN)) {
      Boolean v1 = afs.getBooleanValue(feature);
      if (arg instanceof IBooleanExpression) {
        IBooleanExpression expr = (IBooleanExpression) arg;
        Boolean v2 = expr.getBooleanValue(parent, afs, stream);
        return compare(v1, v2);
      }
    } else if (rn.equals(UIMAConstants.TYPE_INTEGER) || rn.equals(UIMAConstants.TYPE_BYTE)
            || rn.equals(UIMAConstants.TYPE_SHORT) || rn.equals(UIMAConstants.TYPE_LONG)) {
      Integer v1 = afs.getIntValue(feature);
      if (arg instanceof INumberExpression) {
        INumberExpression expr = (INumberExpression) arg;
        Integer v2 = expr.getIntegerValue(parent, afs, stream);
        return compare(v1, v2);
      }
    } else if (rn.equals(UIMAConstants.TYPE_DOUBLE)) {
      Double v1 = afs.getDoubleValue(feature);
      if (arg instanceof INumberExpression) {
        INumberExpression expr = (INumberExpression) arg;
        Double v2 = expr.getDoubleValue(parent, afs, stream);
        return compare(v1, v2);
      }
    } else if (rn.equals(UIMAConstants.TYPE_FLOAT)) {
      Float v1 = afs.getFloatValue(feature);
      if (arg instanceof INumberExpression) {
        INumberExpression expr = (INumberExpression) arg;
        Float v2 = expr.getFloatValue(parent, afs, stream);
        return compare(v1, v2);
      }
    } else if (rn.equals(UIMAConstants.TYPE_STRING)) {
      String v1 = afs.getCoveredText();
      // null is possibly coveredText
      if (feature != null) {
        v1 = afs.getStringValue(feature);
      }
      if (arg instanceof IStringExpression) {
        IStringExpression expr = (IStringExpression) arg;
        String v2 = expr.getStringValue(parent, afs, stream);
        return compare(v1, v2);
      }
    }
    return false;
  }
View Full Code Here

Examples of org.apache.uima.ruta.expression.bool.IBooleanExpression

            BooleanListExpression ble = (BooleanListExpression) value;
            List<Boolean> list = ble.getList(parent, stream);
            targetEngine.setConfigParameterValue(stringValue, list.toArray());
          } else {
            if (value instanceof IBooleanExpression) {
              IBooleanExpression be = (IBooleanExpression) value;
              Boolean b = be.getBooleanValue(parent, match, element, stream);
              targetEngine.setConfigParameterValue(stringValue, b);
            }
          }
        }
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.