Package org.apache.uima.cas.impl

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


      CAS cas1 = CasCreationUtils.createCas(aed);
      cas1.setDocumentText("foo");
      CASCompleteSerializer ser = Serialization.serializeCASComplete((CASMgr) cas1);

      CAS tcas2 = CasCreationUtils.createCas(new TypeSystemDescription_impl(), null, null);
      CASImpl cas2 = ((CASImpl) tcas2).getBaseCAS();
      tcas2.setDocumentText("bar");

      // reinit
      //  This uses cas2 which only has a base type system to start,
      //    and loads it from a complete serialization which has other new types
      cas2.reinit(ser);
      CAS tcas3 = cas2.getCurrentView();

      assertTrue(tcas2 == tcas3);
      assertNotNull(cas1.getTypeSystem().getType("Test.ArrayType"));
      assertNotNull(tcas3.getTypeSystem().getType("Test.ArrayType"));
     
      TypeSystemImpl ts = (TypeSystemImpl)cas2.getTypeSystem();
      Type arrayType = ts.getType("Test.ArrayType");
      Feature arrayFeat = arrayType.getFeatureByBaseName("arrayFeature");
      TypeImpl featRange = (TypeImpl)(arrayFeat.getRange());
    
      assertTrue(ts.ll_isArrayType(featRange.getCode()));
View Full Code Here


    }
    return this.fSTreeModel.getCas().getStringForCode((int) this.addr);
  }

  private String getValueString() {
    CASImpl cas = this.fSTreeModel.getCas();
    switch (this.nodeClass) {
      case INT_FS:
      case BYTE_FS:
      case SHORT_FS: {
        return Long.toString(this.addr);
      }
      case FLOAT_FS: {
        return Float.toString(CASImpl.int2float((int) this.addr));
      }
      case BOOL_FS: {
        return (0 == this.addr) ? "false" : "true";
      }
      case LONG_FS: {
        return Long.toString(this.addr);
      }
      case DOUBLE_FS: {
        return Double.toString(CASImpl.long2double(this.addr));
      }
      case STRING_FS: {
        if (this.addr == LowLevelCAS.NULL_FS_REF) {
          return getNullString();
        }
        String s = cas.getStringForCode((int) this.addr);
        // Check if we need to shorten the string for display purposes
        String s1 = shortenString(s);
        // Remember if string is shortened
        this.isShortenedString = (s != s1);
        return "\"" + escapeLt(s1) + "\"";
      }
      case ARRAY_FS: {
        if (cas.getHeapValue((int) this.addr) == LowLevelCAS.NULL_FS_REF) {
          return getNullString();
        }
        return "<font color=blue>" + getType().getName() + "</font>["
                + cas.ll_getArraySize((int) this.addr) + "]";
      }
      case STD_FS: {
        if (cas.getHeapValue((int) this.addr) == LowLevelCAS.NULL_FS_REF) {
          return getNullString();
        }
        return "<font color=blue>" + getType().getName() + "</font>";
      }
    }
View Full Code Here

  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

        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(file);
          XMLizable specifier = UIMAFramework.getXMLParser().parse(in);
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.