You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2013/03/05 15:59:23 UTC
svn commit: r1452829 - in
/uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/main/java/org/apache/uima/internal/util/rb_trees:
IntRBTNode.java IntRedBlackTree.java
Author: schor
Date: Tue Mar 5 14:59:22 2013
New Revision: 1452829
URL: http://svn.apache.org/r1452829
Log:
[UIMA-2498] add copy method to IntRedBlackTree
Modified:
uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/main/java/org/apache/uima/internal/util/rb_trees/IntRBTNode.java
uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/main/java/org/apache/uima/internal/util/rb_trees/IntRedBlackTree.java
Modified: uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/main/java/org/apache/uima/internal/util/rb_trees/IntRBTNode.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/main/java/org/apache/uima/internal/util/rb_trees/IntRBTNode.java?rev=1452829&r1=1452828&r2=1452829&view=diff
==============================================================================
--- uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/main/java/org/apache/uima/internal/util/rb_trees/IntRBTNode.java (original)
+++ uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/main/java/org/apache/uima/internal/util/rb_trees/IntRBTNode.java Tue Mar 5 14:59:22 2013
@@ -596,5 +596,18 @@ class IntRBTNode {
}
return;
}
-
+
+ IntRBTNode copyNode(IntRBTNode parent) {
+ IntRBTNode copyOfNode = new IntRBTNode(key, color, parent, null, null, element);
+ copyOfNode.left = copyNode(copyOfNode, left);
+ copyOfNode.right = copyNode(copyOfNode, right);
+ return copyOfNode;
+ }
+
+ static IntRBTNode copyNode(IntRBTNode parent, IntRBTNode n) {
+ if (null == n) {
+ return null;
+ }
+ return n.copyNode(parent);
+ }
}
Modified: uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/main/java/org/apache/uima/internal/util/rb_trees/IntRedBlackTree.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/main/java/org/apache/uima/internal/util/rb_trees/IntRedBlackTree.java?rev=1452829&r1=1452828&r2=1452829&view=diff
==============================================================================
--- uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/main/java/org/apache/uima/internal/util/rb_trees/IntRedBlackTree.java (original)
+++ uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/main/java/org/apache/uima/internal/util/rb_trees/IntRedBlackTree.java Tue Mar 5 14:59:22 2013
@@ -19,6 +19,7 @@
package org.apache.uima.internal.util.rb_trees;
+
/**
* See the {@link org.apache.uima.internal.util.rb_trees.RedBlackTree RedBlackTree} class. This is a
* specialized instance with ints as elements.
@@ -212,4 +213,12 @@ public class IntRedBlackTree {
return this.root.toArray(offset);
}
+ public IntRedBlackTree copy() {
+ IntRedBlackTree c = new IntRedBlackTree();
+ c.root = (null == root) ? null : root.copyNode(null);
+ c.size = size;
+ return c;
+ }
+
+
}