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<IntVector>();
      this.queue = new IntStack();
      this.indexedFSs = new IntVector();
      this.indexReps = new IntVector();
View Full Code Here


    tailFeat = stringTailFeat;
  } else if (isFsListType(type)) {
    neListType = neFsListType;
    tailFeat = fsTailFeat;
  }
  IntRedBlackTree visited = new IntRedBlackTree();
  boolean foundCycle = false;
  // first count length of list so we can allocate array
  int length = 0;
  int curNode = addr;
  while (cas.getHeapValue(curNode) == neListType) {
    if (!visited.put(curNode, curNode)) {
      foundCycle = true;
      break;
    }
    length++;
    curNode = cas.getHeapValue(curNode + cas.getFeatureOffset(tailFeat));
View Full Code Here

  }
  return length;
  }
 
  public String[] intListToStringArray(int addr) throws SAXException {
    IntRedBlackTree visited = new IntRedBlackTree();
    boolean foundCycle = false;
    // first count length of list so we can allocate array
    int length = 0;
    int curNode = addr;
    while (cas.getHeapValue(curNode) == neIntListType) {
      if (!visited.put(curNode, curNode)) {
        foundCycle = true;
        break;
      }
      length++;
      curNode = cas.getHeapValue(curNode + cas.getFeatureOffset(intTailFeat));
View Full Code Here

    return array;
  }

  public String[] floatListToStringArray(int addr) throws SAXException {
    boolean foundCycle = false;
    IntRedBlackTree visited = new IntRedBlackTree();
    // first count length of list so we can allocate array
    int length = 0;
    int curNode = addr;
    while (cas.getHeapValue(curNode) == neFloatListType) {
      if (!visited.put(curNode, curNode)) {
        foundCycle = true;
        break;
      }
      length++;
      curNode = cas.getHeapValue(curNode + cas.getFeatureOffset(floatTailFeat));
View Full Code Here

    return array;
  }

  public String[] stringListToStringArray(int addr) throws SAXException {
    boolean foundCycle = false;
    IntRedBlackTree visited = new IntRedBlackTree();
    // first count length of list so we can allocate array
    int length = 0;
    int curNode = addr;
    while (cas.getHeapValue(curNode) == neStringListType) {
      if (!visited.put(curNode, curNode)) {
        foundCycle = true;
        break;
      }
      length++;
      curNode = cas.getHeapValue(curNode + cas.getFeatureOffset(stringTailFeat));
View Full Code Here

  }

  public String[] fsListToXmiIdStringArray(int addr, XmiSerializationSharedData sharedData)
          throws SAXException {
    boolean foundCycle = false;
    IntRedBlackTree visited = new IntRedBlackTree();
    // first count length of list so we can allocate array
    int length = 0;
    int curNode = addr;
    while (cas.getHeapValue(curNode) == neFsListType) {
      if (!visited.put(curNode, curNode)) {
        foundCycle = true;
        break;
      }
      length++;
      curNode = cas.getHeapValue(curNode + cas.getFeatureOffset(fsTailFeat));
View Full Code Here

    return strArray;
  }

  public int[] fsListToAddressArray(int addr) throws SAXException {
    boolean foundCycle = false;
    IntRedBlackTree visited = new IntRedBlackTree();
    // first count length of list so we can allocate array
    int length = 0;
    int curNode = addr;
    while (cas.getHeapValue(curNode) == neFsListType) {
      if (!visited.put(curNode, curNode)) {
        foundCycle = true;
        break;
      }
      length++;
      curNode = cas.getHeapValue(curNode + cas.getFeatureOffset(fsTailFeat));
View Full Code Here

  public int updateIntList(int addr, List<String> stringValues) throws SAXException  {
    int first = addr;
    int currLength = this.getLength(this.neIntListType, addr);
    int curNode = addr;
    int prevNode = 0;
    IntRedBlackTree visited = new IntRedBlackTree();
    boolean foundCycle = false;
    int i =0;
   
    //if (currLength != stringValues.size() ) { 
  //   first = createIntList(stringValues);
    
    if (currLength < stringValues.size()) {
      while (cas.getHeapValue(curNode) == neIntListType) {
        if (!visited.put(curNode, curNode)) {
                   foundCycle = true;
                   break;
        }
        int value = Integer.parseInt(stringValues.get(i++));
        cas.setFeatureValue(curNode,floatHeadFeat, value);
        prevNode = curNode;
        curNode = cas.getHeapValue(curNode + cas.getFeatureOffset(intTailFeat));
      }
      //add nodes for remaining values
      if (i < stringValues.size()) {
        int emptyListFs = curNode;
        //check that first is eintlisttype
        while (i < stringValues.size()) {
          int newNode = cas.ll_createFS(neIntListType);
          int value = Integer.parseInt((String) stringValues.get(i++));
          cas.setFeatureValue(newNode,intHeadFeat, value);
          cas.setFeatureValue(newNode, intTailFeat, emptyListFs);
          cas.setFeatureValue(prevNode, intTailFeat, newNode);
          prevNode = newNode;
        }
      }
    } else if (currLength > stringValues.size()) {
      while (cas.getHeapValue(curNode) == neIntListType && i < stringValues.size()) {
        if (!visited.put(curNode, curNode)) {
                     foundCycle = true;
                     break;
        }
        float value = Integer.parseInt((String) stringValues.get(i++));
        cas.setFeatureValue(curNode,intHeadFeat, value);
        curNode = cas.getHeapValue(curNode + cas.getFeatureOffset(intTailFeat));
     
      int finalNode = curNode;
        //loop till we get a FS that is of type eStringListType
        while (cas.getHeapValue(curNode) == neIntListType) {
        if (!visited.put(curNode, curNode)) {
          foundCycle = true;
          break;
          //TODO throw exc
        }
        curNode = cas.getHeapValue(curNode + cas.getFeatureOffset(intTailFeat));
        }
        //set the tail feature to eStringListType fs
        cas.setFeatureValue(finalNode, intTailFeat, curNode);  
    } else {
      while (cas.getHeapValue(curNode) == neIntListType) {
        if (!visited.put(curNode, curNode)) {
           foundCycle = true;
           break;
        }
        int value = Integer.parseInt((String) stringValues.get(i++));
        cas.setFeatureValue(curNode,intHeadFeat, value );
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();
      this.queue = new IntStack();
      this.indexedFSs = new IntVector();
      this.indexReps = new IntVector();
View Full Code Here

            XmiSerializationSharedData sharedData) {
      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.ts.getTypeCode(CAS.TYPE_NAME_SOFA);
      // this.annotationTypeCode = cas.ts.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.ts;
    }
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.