Package org.apache.uima.internal.util.rb_trees

Examples of org.apache.uima.internal.util.rb_trees.IntRedBlackTree


    // ContentHandler.
    private XCASDocSerializer(ContentHandler ch, CASImpl cas) {
      super();
      this.ch = ch;
      this.cas = cas;
      this.queued = new IntRedBlackTree();
      this.duplicates = new IntRedBlackTree();
      this.numDuplicates = 0;
      this.dupVectors = new Vector();
      this.queue = new IntStack();
      this.indexedFSs = new IntVector();
      this.indexReps = new IntVector();
View Full Code Here


            XmiSerializationSharedData sharedData, MarkerImpl marker) {
      super();
      this.ch = ch;
      this.eh = eh;
      this.cas = cas;
      this.visited = new IntRedBlackTree();
      this.queue = new IntStack();
      this.indexedFSs = new IntVector();
      // this.sofaTypeCode = cas.getTypeSystemImpl().getTypeCode(CAS.TYPE_NAME_SOFA);
      // this.annotationTypeCode = cas.getTypeSystemImpl().getTypeCode(CAS.TYPE_NAME_ANNOTATION);
      this.listUtils = new ListUtils(cas, logger, eh);
      this.arrayAndListFSs = new IntRedBlackTree();
      this.sharedData = sharedData;
      this.isFiltering = filterTypeSystem != null && filterTypeSystem != cas.getTypeSystemImpl();
      if (marker != null ) {
        if (marker.isValid())
          this.marker = marker;
View Full Code Here

    this.types = new ArrayList<Type>();
    this.types.add(null);
    this.features = new ArrayList<Feature>();
    this.features.add(null);
    this.stringSets = new ArrayList<String[]>();
    this.stringSetMap = new IntRedBlackTree();
    this.componentToArrayTypeMap = new IntRedBlackTree();
    this.arrayToComponentTypeMap = new IntRedBlackTree();
    this.arrayCodeToTypeMap = new RedBlackTree<TypeImpl>();
    this.parents = new IntVector();
    this.parents.add(0);

    this.casMetadata = new CASMetadata(this);
View Full Code Here

    // ContentHandler.
    private XCASDocSerializer(ContentHandler ch, CASImpl cas) {
      super();
      this.ch = ch;
      this.cas = cas;
      this.queued = new IntRedBlackTree();
      this.duplicates = new IntRedBlackTree();
      this.numDuplicates = 0;
      this.dupVectors = new Vector<IntVector>();
      this.queue = new IntStack();
      this.indexedFSs = new IntVector();
      this.indexReps = new IntVector();
View Full Code Here

            XmiSerializationSharedData sharedData, MarkerImpl marker) {
      super();
      this.ch = ch;
      this.eh = eh;
      this.cas = cas;
      this.visited = new IntRedBlackTree();
      this.queue = new IntStack();
      this.indexedFSs = new IntVector();
      // this.sofaTypeCode = cas.getTypeSystemImpl().getTypeCode(CAS.TYPE_NAME_SOFA);
      // this.annotationTypeCode = cas.getTypeSystemImpl().getTypeCode(CAS.TYPE_NAME_ANNOTATION);
      this.listUtils = new ListUtils(cas, logger, eh);
      this.arrayAndListFSs = new IntRedBlackTree();
      this.sharedData = sharedData;
      this.isFiltering = filterTypeSystem != null && filterTypeSystem != cas.getTypeSystemImpl();
      if (marker != null ) {
        if (marker.isValid())
          this.marker = marker;
View Full Code Here

  public int updateFloatList(int addr, List<String> stringValues) throws SAXException  {
    int first = addr;
    int currLength = this.getLength(this.neFloatListType, addr);
    int curNode = addr;
    int prevNode = 0;
    IntRedBlackTree visited = new IntRedBlackTree();
    boolean foundCycle = false;
    int i =0;
   
    //if (currLength != stringValues.size() ) { 
  //   first = createFloatList(stringValues);
  if (currLength < stringValues.size()) {
    while (cas.getHeapValue(curNode) == neFloatListType) {
      if (!visited.put(curNode, curNode)) {
                 foundCycle = true;
                 break;
      }
      float value = Float.parseFloat(stringValues.get(i++));
      cas.setFeatureValue(curNode,floatHeadFeat, value);
      prevNode = curNode;
      curNode = cas.getHeapValue(curNode + cas.getFeatureOffset(floatTailFeat));
    }
    //add nodes for remaining values
    if (i < stringValues.size()) {
      int emptyListFs = curNode;
      //check that first is efloatlisttype
      while (i < stringValues.size()) {
        int newNode = cas.ll_createFS(neFloatListType);
        float value = Float.parseFloat((String) stringValues.get(i++));
        cas.setFeatureValue(newNode,floatHeadFeat, value);
        cas.setFeatureValue(newNode, floatTailFeat, emptyListFs);
        cas.setFeatureValue(prevNode, floatTailFeat, newNode);
        prevNode = newNode;
      }
    }
  } else if (currLength > stringValues.size()) {
    while (cas.getHeapValue(curNode) == neFloatListType && i < stringValues.size()) {
      if (!visited.put(curNode, curNode)) {
                   foundCycle = true;
                   break;
      }
      float value = Float.parseFloat((String) stringValues.get(i++));
      cas.setFeatureValue(curNode,floatHeadFeat, value);
      curNode = cas.getHeapValue(curNode + cas.getFeatureOffset(floatTailFeat));
   
    int finalNode = curNode;
        //loop till we get a FS that is of type eStringListType
        while (cas.getHeapValue(curNode) == neFloatListType) {
          if (!visited.put(curNode, curNode)) {
            foundCycle = true;
            break;
          //TODO throw exc
          }
          curNode = cas.getHeapValue(curNode + cas.getFeatureOffset(floatTailFeat));
        }
        //set the tail feature to eStringListType fs
        cas.setFeatureValue(finalNode, floatTailFeat, curNode);
    } else {
      while (cas.getHeapValue(curNode) == neFloatListType) {
        if (!visited.put(curNode, curNode)) {
           foundCycle = true;
           break;
        }
        float value = Float.parseFloat((String) stringValues.get(i++));
        cas.setFeatureValue(curNode,floatHeadFeat,  CASImpl.float2int(value));
View Full Code Here

 
  public int updateFsList(int addr, List<String> stringValues, IntVector fsAddresses) throws SAXException  {
    int first = addr;
    int currLength = this.getLength(this.neFsListType, addr);
    boolean foundCycle = false;
    IntRedBlackTree visited = new IntRedBlackTree();
    int curNode = addr;
    int prevNode = 0;
   
    //if (currLength != stringValues.size() ) { 
  //   first = createFsList(stringValues, fsAddresses);
    int i=0;
    if (currLength < stringValues.size() ) {   
      while (cas.getHeapValue(curNode) == neFsListType) {
        if (!visited.put(curNode, curNode)) {
               foundCycle = true;
               break;
        }
        int value = Integer.parseInt(stringValues.get(i++));
        cas.setFeatureValue(curNode,fsHeadFeat, value);
        fsAddresses.add(curNode);
        prevNode = curNode;
        curNode = cas.getHeapValue(curNode + cas.getFeatureOffset(fsTailFeat));
      }
      //add nodes for remaining values
      if (i < stringValues.size()) {
        int emptyListFs = curNode;
        //check that first is estringlisttype
        while (i < stringValues.size()) {
          int newNode = cas.ll_createFS(neFsListType);
          int value = Integer.parseInt((String) stringValues.get(i++));
          cas.setFeatureValue(newNode,fsHeadFeat, value);
          fsAddresses.add(newNode);
          cas.setFeatureValue(newNode, fsTailFeat, emptyListFs);
          cas.setFeatureValue(prevNode, fsTailFeat, newNode);
          prevNode = newNode;
        }
      }
    } else if (currLength > stringValues.size()) { 
        while (cas.getHeapValue(curNode) == neFsListType && i < stringValues.size()) {
           if (!visited.put(curNode, curNode)) {
           foundCycle = true;
           break;
         }
           int value = Integer.parseInt((String) stringValues.get(i++));
        fsAddresses.add(curNode);
          cas.setFeatureValue(curNode,fsHeadFeat, value);
         curNode = cas.getHeapValue(curNode + cas.getFeatureOffset(fsTailFeat));
        }
        int finalNode = curNode;
        //loop till we get a FS that is of type eStringListType
        while (cas.getHeapValue(curNode) == neFsListType) {
          if (!visited.put(curNode, curNode)) {
            foundCycle = true;
            break;
          //TODO throw exc
          }
          curNode = cas.getHeapValue(curNode + cas.getFeatureOffset(fsTailFeat));
        }
        //set the tail feature to eStringListType fs
        cas.setFeatureValue(finalNode, fsTailFeat, curNode);
    } else {
      while (cas.getHeapValue(curNode) == neFsListType) {
        if (!visited.put(curNode, curNode)) {
           foundCycle = true;
           break;
        }
        int value = Integer.parseInt((String) stringValues.get(i++));
        cas.setFeatureValue(curNode,fsHeadFeat, value);
View Full Code Here

 
 
  public int updateStringList(int addr, List<String> stringValues) throws SAXException   {
    int first = addr;
    boolean foundCycle = false;
    IntRedBlackTree visited = new IntRedBlackTree();
    int curNode = addr;
    int prevNode = 0;
    int currLength = this.getLength(this.neStringListType, addr);
   
    if (currLength < stringValues.size() ) {   
      int i =0;
    while (cas.getHeapValue(curNode) == neStringListType) {
      if (!visited.put(curNode, curNode)) {
             foundCycle = true;
             break;
      }
      String curValue = cas.getStringForCode(cas.getHeapValue(curNode
                + cas.getFeatureOffset(stringHeadFeat)));
      String newValue = stringValues.get(i++);
        if (!curValue.equals(newValue)) {     
          cas.setFeatureValue(curNode, stringHeadFeat, cas.addString(newValue));
        }
        prevNode = curNode;
      curNode = cas.getHeapValue(curNode + cas.getFeatureOffset(stringTailFeat));
   }
   //extend the list
   if (i < stringValues.size()) {
     int emptyListFs = curNode;
     while (i < stringValues.size()) {
       int newNode = cas.ll_createFS(neStringListType);
       String value = (String) stringValues.get(i++);
       cas.setFeatureValue(newNode, stringHeadFeat, cas.addString(value));
       cas.setFeatureValue(newNode, stringTailFeat, emptyListFs);
       cas.setFeatureValue(prevNode,stringTailFeat, newNode);
       prevNode = newNode;
     }
   }
    } else if (currLength > stringValues.size()) {
      int i=0
      while (cas.getHeapValue(curNode) == neStringListType && i < stringValues.size()) {
       if (!visited.put(curNode, curNode)) {
                foundCycle = true;
                break;
     }
     String curValue = cas.getStringForCode(cas.getHeapValue(curNode
                   + cas.getFeatureOffset(stringHeadFeat)));
     String newValue = (String)stringValues.get(i++);
        if (!curValue.equals(newValue)) {     
           cas.setFeatureValue(curNode, stringHeadFeat, cas.addString(newValue));
        }
     curNode = cas.getHeapValue(curNode + cas.getFeatureOffset(stringTailFeat));
      }
      int finalNode = curNode;
      while (cas.getHeapValue(curNode) == neStringListType) {
      if (!visited.put(curNode, curNode)) {
        foundCycle = true;
        break;
        //TODO throw exc
      }
      curNode = cas.getHeapValue(curNode + cas.getFeatureOffset(stringTailFeat));
      }
      cas.setFeatureValue(finalNode, stringTailFeat, curNode);
    } else {
      int i =0;
      while (cas.getHeapValue(curNode) == neStringListType) {
        if (!visited.put(curNode, curNode)) {
           foundCycle = true;
           break;
        }
        String curValue = cas.getStringForCode(cas.getHeapValue(curNode
                + cas.getFeatureOffset(stringHeadFeat)));
View Full Code Here

    this.types = new ArrayList<Type>();
    this.types.add(null);
    this.features = new ArrayList<Feature>();
    this.features.add(null);
    this.stringSets = new ArrayList<String[]>();
    this.stringSetMap = new IntRedBlackTree();
    this.componentToArrayTypeMap = new IntRedBlackTree();
    this.arrayToComponentTypeMap = new IntRedBlackTree();
    this.arrayCodeToTypeMap = new RedBlackTree<TypeImpl>();
    this.parents = new IntVector();
    this.parents.add(0);

    this.casMetadata = new CASMetadata(this);
View Full Code Here

            XmiSerializationSharedData sharedData, MarkerImpl marker) {
      super();
      this.ch = ch;
      this.eh = eh;
      this.cas = cas;
      this.visited = new IntRedBlackTree();
      this.queue = new IntStack();
      this.indexedFSs = new IntVector();
      // this.sofaTypeCode = cas.getTypeSystemImpl().getTypeCode(CAS.TYPE_NAME_SOFA);
      // this.annotationTypeCode = cas.getTypeSystemImpl().getTypeCode(CAS.TYPE_NAME_ANNOTATION);
      this.listUtils = new ListUtils(cas, logger, eh);
      this.arrayAndListFSs = new IntRedBlackTree();
      this.sharedData = sharedData;
      this.isFiltering = filterTypeSystem != null && filterTypeSystem != cas.getTypeSystemImpl();
      if (marker != null ) {
        if (marker.isValid())
          this.marker = marker;
View Full Code Here

TOP

Related Classes of org.apache.uima.internal.util.rb_trees.IntRedBlackTree

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.