Package org.apache.uima.cas.impl

Examples of org.apache.uima.cas.impl.CASImpl


  int getArrayPos() {
    return this.arrayElem;
  }

  Type getType() {
    CASImpl cas = this.fSTreeModel.getCas();
    return cas.getTypeSystemImpl().ll_getTypeForCode(cas.getHeapValue((int) this.addr));
  }
View Full Code Here


    CASImpl cas = this.fSTreeModel.getCas();
    return cas.getTypeSystemImpl().ll_getTypeForCode(cas.getHeapValue((int) this.addr));
  }

  public boolean isAnnotation() {
    CASImpl cas = this.fSTreeModel.getCas();
    if (this.nodeClass != STD_FS || this.addr == 0) {
      return false;
    }
    if (cas.getTypeSystem().subsumes(cas.getAnnotationType(), getType())) {
      if (cas == ((AnnotationFS) cas.createFS((int) this.addr)).getView()) {
        return true;
      }
    }
    return false;
  }
View Full Code Here

    }
    return false;
  }

  public int getStart() {
    CASImpl cas = this.fSTreeModel.getCas();
    if (isAnnotation()) {
      final FeatureImpl feat1 = (FeatureImpl) cas.getBeginFeature();
      return cas.getHeapValue((int) this.addr + cas.getFeatureOffset(feat1.getCode()));
    }
    return -1;
  }
View Full Code Here

    }
    return -1;
  }

  public int getEnd() {
    CASImpl cas = this.fSTreeModel.getCas();
    if (isAnnotation()) {
      final FeatureImpl feat1 = (FeatureImpl) cas.getEndFeature();
      return cas.getHeapValue((int) this.addr + cas.getFeatureOffset(feat1.getCode()));
    }
    return -1;
  }
View Full Code Here

      CAS localCas = jcas.getCas();
      assertTrue(localCas == this.cas);
      LowLevelCAS ll_cas = jcas.getLowLevelCas();
      assertTrue(ll_cas == this.cas);
      CASImpl casImpl = jcas.getCasImpl();
      assertTrue(casImpl == this.cas);
      TOP_Type type = jcas.getType(org.apache.uima.jcas.tcas.Annotation.type);
      assertTrue(type instanceof org.apache.uima.jcas.tcas.Annotation_Type);
      type = jcas.getType(Annotation.typeIndexID);
      assertTrue(type instanceof Annotation_Type);
View Full Code Here

    throw new UnsupportedOperationException();
  }
   

  public void copyToArray(int srcOffset, String[] dest, int destOffset, int length) {
    CASImpl ll = jcasType.casImpl;
    ll.checkArrayBounds(addr, srcOffset, length);
    for (int i = 0; i < length; i++) {
      dest[i + destOffset] = ll.ll_getFSForRef(ll.ll_getRefArrayValue(this.addr, i + srcOffset)).toString();
    }
  }
View Full Code Here

      Object[] initargs = new Object[2];
      JCasImpl jcasView = null;
      // this funny logic is because although the annotationView should always be set if
      // a type is a subtype of annotation, it isn't always set if an application uses low-level
      // api's. Rather than blow up, we limp along.
      CASImpl maybeAnnotationView = null;
      if (isSubtypeOfAnnotationBase) {
        final int sofaNbr = getSofaNbr(addr, casView);
        if (sofaNbr > 0) {
          maybeAnnotationView = (CASImpl) casView.getView(sofaNbr);
        }
      }
      final CASImpl view = (null != maybeAnnotationView) ? maybeAnnotationView : casView;

      try {
        jcasView = (JCasImpl) view.getJCas();
      } catch (CASException e1) {
        logAndThrow(e1, jcasView);
      }

      // Return eq fs instance if already created
View Full Code Here

      CAS localCas = jcas.getCas();
      assertTrue(localCas == this.cas);
      LowLevelCAS ll_cas = jcas.getLowLevelCas();
      assertTrue(ll_cas == this.cas);
      CASImpl casImpl = jcas.getCasImpl();
      assertTrue(casImpl == this.cas);
      TOP_Type type = jcas.getType(org.apache.uima.jcas.tcas.Annotation.type);
      assertTrue(type instanceof org.apache.uima.jcas.tcas.Annotation_Type);
      type = jcas.getType(Annotation.typeIndexID);
      assertTrue(type instanceof Annotation_Type);
View Full Code Here

        progressMonitor.beginTask("", 5);
        progressMonitor.subTask("Output going to '" + outputDirectory + "'");
        progressMonitor.subTask(getString("ReadingDescriptorAndCreatingTypes",
                new Object[] { inputFile }));
        // code to read xml and make cas type instance
        CASImpl casLocal = null;
        // handle classpath
        try {
          XMLInputSource in = new XMLInputSource(url);
          XMLizable specifier = UIMAFramework.getXMLParser().parse(in);
View Full Code Here

  /*
   * (Internal) create a new instance of TOP (or subclass of TOP) in Java and Cas, and make them
   * correspond.
   */
  public TOP(JCas jcas) {
    CASImpl casImpl = (CASImpl)jcas.getCas();
    this.jcasType = jcas.getType(getTypeIndexID());
    if (null == jcasType) {
      CASRuntimeException e = new CASRuntimeException(CASRuntimeException.JCAS_TYPE_NOT_IN_CAS,
          new String[] { this.getClass().getName() });
      throw e;
    }
    boolean isSubtypeOfAnnotationBase = casImpl.isSubtypeOfAnnotationBaseType(jcasType.casTypeCode);
    if (isSubtypeOfAnnotationBase &&
        (casImpl.getBaseCAS() == casImpl)) {
      throw new CASRuntimeException(CASRuntimeException.DISALLOW_CREATE_ANNOTATION_IN_BASE_CAS,
          new String[] { this.getClass().getName() });
    }
    this.addr = jcasType.ll_cas.ll_createFS(jcasType.casTypeCode);
    jcas.putJfsFromCaddr(addr, this);
   
    if (casImpl.isSubtypeOfAnnotationBaseType(jcasType.casTypeCode)) {
      casImpl.setSofaFeat(addr, casImpl.getSofaRef());
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.uima.cas.impl.CASImpl

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.