Package org.apache.uima.cas

Examples of org.apache.uima.cas.ArrayFS


    else if (element instanceof ArrayValue) {

      ArrayValue value = (ArrayValue) element;

      if (value.getFeatureStructure() instanceof ArrayFS) {
        ArrayFS array = (ArrayFS) value.getFeatureStructure();

        FeatureStructure fs = array.get(value.slot());

        if (fs == null) {
          cell.setText("null");
        }
        else {
View Full Code Here


    FeatureStructure baseFS = fs.getFeatureValue(f);
    Feature baseFeat = baseFS.getType().getFeatureByBaseName(ExplainConstants.VALUE);
    matched = baseFS.getBooleanValue(baseFeat);

    f = fs.getType().getFeatureByBaseName(ExplainConstants.CONDITIONS);
    ArrayFS value = (ArrayFS) fs.getFeatureValue(f);
    if (value != null) {
      FeatureStructure[] fsarray = value.toArray();
      for (FeatureStructure each : fsarray) {
        Feature eachFeat = each.getType().getFeatureByBaseName(ExplainConstants.VALUE);
        boolean eachValue = each.getBooleanValue(eachFeat);
        matched &= eachValue;
      }
View Full Code Here

      parent.addChild(blockNode);
      processBlockRuleApply(fs, blockNode, ts, offset, onlyRules);
    }
    Feature feature = blockApplyType.getFeatureByBaseName(ExplainConstants.INNER_APPLY);
    FeatureStructure featureValue = fs.getFeatureValue(feature);
    ArrayFS value = (ArrayFS) featureValue;
    FeatureStructure[] fsarray = value.toArray();
    for (FeatureStructure each : fsarray) {
      if (!onlyRules) {
        buildTree(each, blockNode, ts, offset, onlyRules);
      } else {
        buildTree(each, parent, ts, offset, onlyRules);
View Full Code Here

    }
    RuleApplyNode ruleNode = new RuleApplyNode(parent, fs, ts);
    parent.setBlockRuleApply(ruleNode);

    Feature feature = ruleApplyType.getFeatureByBaseName(ExplainConstants.RULES);
    ArrayFS value = (ArrayFS) fs.getFeatureValue(feature);
    if (value == null)
      return;
    FeatureStructure[] fsarray = value.toArray();

    MatchedRootNode matched = new MatchedRootNode(ruleNode, ts);
    FailedRootNode failed = new FailedRootNode(ruleNode, ts);
    ruleNode.addChild(matched);
    ruleNode.addChild(failed);

    for (FeatureStructure eachRuleMatch : fsarray) {
      Feature f = eachRuleMatch.getType().getFeatureByBaseName(ExplainConstants.MATCHED);
      boolean matchedValue = eachRuleMatch.getBooleanValue(f);
      if (matchedValue) {
        buildTree(eachRuleMatch, matched, ts, offset, onlyRules);
      } else {
        buildTree(eachRuleMatch, failed, ts, offset, onlyRules);
      }

      Feature df = eachRuleMatch.getType().getFeatureByBaseName(ExplainConstants.DELEGATES);
      if (df != null) {
        ArrayFS dv = (ArrayFS) eachRuleMatch.getFeatureValue(df);
        if (dv != null) {
          FeatureStructure[] da = dv.toArray();
          for (FeatureStructure delegateFS : da) {
            buildTree(delegateFS, ruleNode, ts, offset, onlyRules);
          }
        }
      }
View Full Code Here

    }
    RuleApplyNode ruleNode = new RuleApplyNode(parent, fs, ts);
    parent.addChild(ruleNode);

    Feature feature = ruleApplyType.getFeatureByBaseName(ExplainConstants.RULES);
    ArrayFS value = (ArrayFS) fs.getFeatureValue(feature);
    FeatureStructure[] fsarray = value.toArray();

    MatchedRootNode matched = new MatchedRootNode(ruleNode, ts);
    FailedRootNode failed = new FailedRootNode(ruleNode, ts);
    ruleNode.addChild(matched);
    ruleNode.addChild(failed);

    for (FeatureStructure eachRuleMatch : fsarray) {
      Feature f = eachRuleMatch.getType().getFeatureByBaseName(ExplainConstants.MATCHED);
      boolean matchedValue = eachRuleMatch.getBooleanValue(f);
      if (matchedValue) {
        buildTree(eachRuleMatch, matched, ts, offset, onlyRules);
      } else {
        buildTree(eachRuleMatch, failed, ts, offset, onlyRules);
      }

      Feature df = eachRuleMatch.getType().getFeatureByBaseName(ExplainConstants.DELEGATES);
      if (df != null) {
        ArrayFS dv = (ArrayFS) eachRuleMatch.getFeatureValue(df);
        if (dv != null) {
          FeatureStructure[] da = dv.toArray();
          for (FeatureStructure delegateFS : da) {
            buildTree(delegateFS, ruleNode, ts, offset, onlyRules);
          }
        }
      }
View Full Code Here

    RuleElementRootNode remRoot = new RuleElementRootNode(matchNode, ts);
    matchNode.addChild(remRoot);

    Feature feature = ruleMatchType.getFeatureByBaseName(ExplainConstants.ELEMENTS);
    ArrayFS value = (ArrayFS) fs.getFeatureValue(feature);
    if (value != null) {
      FeatureStructure[] fsarray = value.toArray();
      for (FeatureStructure each : fsarray) {
        buildTree(each, remRoot, ts, offset, onlyRules);
      }
    }
  }
View Full Code Here

          TypeSystem ts, int offset, boolean onlyRules) {
    RuleElementMatchesNode remsNode = new RuleElementMatchesNode(parent, fs, ts);
    parent.addChild(remsNode);

    Feature feature = ruleElementMatchesType.getFeatureByBaseName(ExplainConstants.MATCHES);
    ArrayFS value = (ArrayFS) fs.getFeatureValue(feature);
    FeatureStructure[] fsarray = value.toArray();
    for (FeatureStructure each : fsarray) {
      buildTree(each, remsNode, ts, offset, onlyRules);
    }
  }
View Full Code Here

    Feature feature = ruleElementMatchType.getFeatureByBaseName(ExplainConstants.BASE_CONDITION);
    FeatureStructure base = fs.getFeatureValue(feature);
    buildTree(base, remNode, ts, offset, onlyRules);

    feature = ruleElementMatchType.getFeatureByBaseName(ExplainConstants.CONDITIONS);
    ArrayFS value = (ArrayFS) fs.getFeatureValue(feature);
    if (value != null) {
      FeatureStructure[] fsarray = value.toArray();
      for (FeatureStructure each : fsarray) {
        buildTree(each, remNode, ts, offset, onlyRules);
      }
    }
    feature = fs.getType().getFeatureByBaseName(ExplainConstants.ELEMENTS);
    value = (ArrayFS) fs.getFeatureValue(feature);
    if (value != null) {
      FeatureStructure[] fsarray = value.toArray();
      for (FeatureStructure each : fsarray) {
        buildTree(each, remNode, ts, offset, onlyRules);
      }
    }
  }
View Full Code Here

          TypeSystem ts, int offset, boolean onlyRules) {
    ConditionNode condNode = new ConditionNode(parent, fs, ts);
    parent.addChild(condNode);

    Feature feature = evaluatedConditionType.getFeatureByBaseName(ExplainConstants.CONDITIONS);
    ArrayFS value = (ArrayFS) fs.getFeatureValue(feature);
    if (value != null) {
      FeatureStructure[] fsarray = value.toArray();
      for (FeatureStructure each : fsarray) {
        buildTree(each, condNode, ts, offset, onlyRules);
      }
    }
  }
View Full Code Here

    if (f.getRange().isArray()) {
      // handle all kinds of arrays
      FeatureStructure featureValue = featureStructure.getFeatureValue(f);
      // ArrayFS is a special kind of CommonArrayFS
      if (featureValue instanceof ArrayFS) {
        ArrayFS array = (ArrayFS) featureValue;
        if (array != null) {
          String text = "Array" + "[" + array.size() + "]";
          PrimitiveFeatureTreeNode arrayNode = new PrimitiveFeatureTreeNode(this, f, text);
          parent.addChild(arrayNode);
          int size = array.size();
          for (int i = 0; i < size; i++) {
            FeatureStructure fs = array.get(i);
            if (fs instanceof FeatureStructure) {
              Type fsType = fs.getType();
              if (expandable(fsType, parentTypes)) {
                ITreeNode fsNode;
                if (fs instanceof AnnotationFS) {
                  AnnotationFS faa = (AnnotationFS) fs;
                  fsNode = new AnnotationTreeNode(arrayNode, faa, parentTypes);
                } else {
                  fsNode = new TypeTreeNode(arrayNode, fsType);
                }
                arrayNode.addChild(fsNode);
              }
            }
          }
        }
      } else if (featureValue instanceof CommonArrayFS) {
        // handle all other kind of CommonArrayFS nodes (ArrayFS handled above)
        CommonArrayFS array = (CommonArrayFS) featureValue;
        String text = "[" + StringUtils.join(array.toStringArray(), ", ") + "]";
        parent.addChild(new ArrayFeatureTreeNode(this, f, text));
      }
    } else if (f.getRange().isPrimitive()) {
      if ("uima.cas.AnnotationBase:sofa".equals(f.getName())) {
      } else {
View Full Code Here

TOP

Related Classes of org.apache.uima.cas.ArrayFS

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.