public void addFeatures()

in uimaj-ep-cev/src/main/java/org/apache/uima/cev/data/tree/CEVFSTreeNode.java [70:114]


  public void addFeatures(ICEVTreeNode parent, Feature f, FeatureStructure featureStructure) {
    if (f.getRange().isArray()) {
      FeatureStructure featureValue = featureStructure.getFeatureValue(f);
      if (featureValue instanceof ArrayFS) {
        ArrayFS array = (ArrayFS) featureValue;
        if (array != null) {
          String text = "Array" + "[" + array.size() + "]";
          CEVFeatureTreeNode arrayNode = new CEVFeatureTreeNode(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();
              ICEVTreeNode fsNode;
              if (fs instanceof AnnotationFS) {
                AnnotationFS faa = (AnnotationFS) fs;
                fsNode = new CEVAnnotationTreeNode(arrayNode, faa);
              } else {
                fsNode = new CEVTypeTreeNode(arrayNode, fsType);
              }
              arrayNode.addChild(fsNode);

              // List<Feature> features = fs.getType().getFeatures();
              // for (Feature feature : features) {
              // addFeatures(fsNode, feature, fs);
              // }
            }
          }
        }
      }
    } else if (f.getRange().isPrimitive()) {
      if ("uima.cas.AnnotationBase:sofa".equals(f.getName())) {
      } else {
        parent.addChild(new CEVFeatureTreeNode(this, f, featureStructure.getFeatureValueAsString(f)));
      }
    } else if (f.getRange() instanceof Type) {
      FeatureStructure featureValue = featureStructure.getFeatureValue(f);
      if (featureValue instanceof AnnotationFS) {
        parent.addChild(new CEVAnnotationTreeNode(this, ((AnnotationFS) featureValue)));
      }
    }
  }