Package org.apache.uima.cas

Examples of org.apache.uima.cas.FeatureStructure


      throw e;
    }
    if (isAnnot) {
      getLowLevelCAS().ll_setIntValue(addr, ts.annotSofaFeatCode, this.getSofaRef());
    }
    final FeatureStructure newFS = ll_getFSForRef(addr);
    return newFS;
  }
View Full Code Here


    return aSofa;
  }

  SofaFS createSofa(String sofaName, String mimeType) {
    final int addr = ll_createFS(this.svd.casMetadata.ts.sofaTypeCode);
    final FeatureStructure sofa = ll_getFSForRef(addr);
    addSofa(sofa, sofaName, mimeType);
    return (SofaFS) sofa;
  }
View Full Code Here

  }

  SofaFS createInitialSofa(String mimeType) {
    final TypeSystemImpl ts = this.svd.casMetadata.ts;
    final int addr = ll_createFS(ts.sofaTypeCode);
    final FeatureStructure sofa = ll_getFSForRef(addr);
//    final int llsofa = getLowLevelCAS().ll_getFSRef(sofa);
    getLowLevelCAS().ll_setIntValue(/*llsofa*/addr, ts.sofaNumFeatCode, 1);
    addSofa(sofa, CAS.NAME_DEFAULT_SOFA, mimeType);
    registerInitialSofa();
    this.mySofaRef = /*((FeatureStructureImpl)sofa).getAddress()*/ addr;
View Full Code Here

      return null;
    }
    if (this.svd.useFSCache) {
      // FS object cache code.
      // ***** NOTE: This code has not been maintained and may not work ******
      FeatureStructure fs = null;
      try {
        fs = this.svd.fsArray[fsRef];
      } catch (ArrayIndexOutOfBoundsException e) {
        // Do nothing.  Code below will expand array as needed.
      }
View Full Code Here

      CASRuntimeException e = new CASRuntimeException(CASRuntimeException.INVALID_BASE_CAS_METHOD,
          new String[] { "createAnnotation(Type, int, int)" });
      throw e;
    }
    final TypeSystemImpl ts = this.svd.casMetadata.ts;
    FeatureStructure fs = createFS(type);
    final int addr = ll_getFSRef(fs);
    // setSofaFeat(addr, this.mySofaRef); // already done by createFS
    setFeatureValue(addr, ts.startFeatCode, begin);
    // setStartFeat(addr, begin);
    setFeatureValue(addr, ts.endFeatCode, end);
View Full Code Here

            break;
          } else {
            result.add(afs);
          }
        } else {
          FeatureStructure value = afs.getFeatureValue(feature);
          afs = (AnnotationFS) value;
        }
      }
      if (!(this instanceof FeatureMatchExpression)) {
        if(stream.isVisible(afs)) {
View Full Code Here

     * @return the children
     */
    public Object[] getChildren(Object parentElement) {
      Collection<Object> childs = new LinkedList<Object>();

      FeatureStructure featureStructure;

      if (parentElement instanceof ModelFeatureStructure) {
        featureStructure = ((ModelFeatureStructure) parentElement).getStructre();
      } else if (parentElement instanceof FeatureValue) {
        FeatureValue value = (FeatureValue) parentElement;

        if (parentElement instanceof StringArray) {
          StringArray array = (StringArray) parentElement;
          return array.toArray();
        }

        featureStructure = (FeatureStructure) value.getValue();
      } else {
        assert false : "Unexpected element!";

        return new Object[] {};
      }

      Type type = featureStructure.getType();

      Vector featureTypes = type.getAppropriateFeatures();

      Iterator featuresItertor = featureTypes.iterator();

View Full Code Here

      // inserts a new feature strucutre of current type
      if (mCurrentType == null) {
        return;
      }

      FeatureStructure newFeatureStructure = mCAS.createFS(mCurrentType);

      mCAS.getIndexRepository().addFS(newFeatureStructure);

      mFSList.refresh();
    }
View Full Code Here

      return featureValue.getFeature().getShortName();
    }
    else if (element instanceof IAdaptable) {

      FeatureStructure structure = null;

      if (((IAdaptable) element).getAdapter(AnnotationFS.class) != null) {
        structure = (AnnotationFS) ((IAdaptable) element)
                .getAdapter(AnnotationFS.class);
      }

      if (structure == null) {
        structure = (FeatureStructure) ((IAdaptable) element).getAdapter(FeatureStructure.class);
      }

      return structure.getType().getShortName() + " (id=" +
          ((FeatureStructureImpl) structure).getAddress() + ")";
    }
    else {
      assert false : "Unexpected element!";
View Full Code Here

      if (featureValue.getFeature().getRange().isPrimitive()) {
        cell.setText(featureValue.getFeatureStructure().getFeatureValueAsString(
                featureValue.getFeature()));
      }
      else {
        FeatureStructure value = (FeatureStructure) featureValue.getValue();

        if (value == null) {
          cell.setText("null");
        } else {
          cell.setText("[" + value.getType().getShortName() + "]");
        }
      }
    }
    else if (element instanceof ArrayValue) {

      ArrayValue value = (ArrayValue) element;

      // if primitive array
      if (value.getFeatureStructure() instanceof CommonArrayFS ||
              value.getFeatureStructure() instanceof StringArrayFS) {
        cell.setText(value.get().toString());
      }
      else if (value.getFeatureStructure() instanceof ArrayFS) {
        ArrayFS array = (ArrayFS) value.getFeatureStructure();

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

        if (fs == null) {
          cell.setText("null");
        }
        else {
          cell.setText("[" + fs.getType().getShortName() + "]");
        }
      }
      else {
        throw new TaeError("Unexpected array type!");
      }
View Full Code Here

TOP

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

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.