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 2016/02/10 17:23:26 UTC
svn commit: r1729639 -
/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIndexComparatorImpl.java
Author: schor
Date: Wed Feb 10 16:23:25 2016
New Revision: 1729639
URL: http://svn.apache.org/viewvc?rev=1729639&view=rev
Log:
[UIMA-4664] have index comparators share keyspecs and directions when copying them.
Modified:
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIndexComparatorImpl.java
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIndexComparatorImpl.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIndexComparatorImpl.java?rev=1729639&r1=1729638&r2=1729639&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIndexComparatorImpl.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIndexComparatorImpl.java Wed Feb 10 16:23:25 2016
@@ -39,10 +39,10 @@ public class FSIndexComparatorImpl imple
private Type type;
// the Feature or Linear Type Order, as an ordered collection, one per key
- private final List<Object> keySpecs = new ArrayList<Object>(); // Feature or LinearTypeOrder
+ private final List<Object> keySpecs; // Feature or LinearTypeOrder
// Standard or Reverse
- private final List<Integer> directions = new ArrayList<Integer>();
+ private final List<Integer> directions;
// // FEATURE_KEY or TYPE_ORDER_KEY
// private IntVector keyTypeVector;
@@ -50,6 +50,14 @@ public class FSIndexComparatorImpl imple
// Public only for testing purposes.
public FSIndexComparatorImpl() {
this.type = null;
+ this.keySpecs = new ArrayList<Object>();
+ this.directions = new ArrayList<Integer>();
+ }
+
+ private FSIndexComparatorImpl(Type type, List<Object> keySpecs, List<Integer> directions) {
+ this.type = type;
+ this.keySpecs = keySpecs;
+ this.directions = directions;
}
private boolean checkType(Type t) {
@@ -135,7 +143,7 @@ public class FSIndexComparatorImpl imple
* @param comp the other comparator to compare to
* @return true if they're the same comparator
*/
- public boolean equalsWithoutType(FSIndexComparatorImpl comp) {
+ boolean equalsWithoutType(FSIndexComparatorImpl comp) {
final int max = this.getNumberOfKeys();
if (max != comp.getNumberOfKeys()) {
return false;
@@ -184,13 +192,8 @@ public class FSIndexComparatorImpl imple
return true;
}
-
public synchronized FSIndexComparatorImpl copy() {
- FSIndexComparatorImpl copy = new FSIndexComparatorImpl();
- copy.type = this.type;
- copy.directions.addAll(this.directions);
- copy.keySpecs.addAll(this.keySpecs);
- return copy;
+ return new FSIndexComparatorImpl(type, keySpecs, directions);
}
/**