Author: schor Date: Tue Feb 16 22:27:29 2016 New Revision: 1730760 URL: http://svn.apache.org/viewvc?rev=1730760&view=rev Log: [UIMA-4674] some of the computation during commit depends on the commit (locked) flag being false, so move the setting of this to the end of commit. Also make one method public - the one that returns the type array size.
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java?rev=1730760&r1=1730759&r2=1730760&view=diff ============================================================================== --- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java (original) +++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java Tue Feb 16 22:27:29 2016 @@ -675,7 +675,7 @@ public class TypeSystemImpl implements T return LEAST_FEATURE_CODE; } - final int getTypeArraySize() { + public final int getTypeArraySize() { return getNumberOfTypes() + getSmallestType(); } @@ -1307,7 +1307,6 @@ public class TypeSystemImpl implements T if (this.locked) { return this; // might be called multiple times, but only need to do once } - this.locked = true; // because subsumes depends on it // and generator initialization uses subsumes // this.numCommittedTypes = this.getNumberOfTypes(); // do before @@ -1346,6 +1345,7 @@ public class TypeSystemImpl implements T fsClassRegistry = new FSClassRegistry(this, true); computeAdjustedFeatureOffsets(topType, 0, 0); + this.locked = true; return this; } // of sync block } @@ -2380,7 +2380,21 @@ public class TypeSystemImpl implements T return result; } + // debug - compare two type systems, print first different type + public static void compareTs(TypeSystem t1, TypeSystem t2) { + TypeSystemImpl ts1 = (TypeSystemImpl) t1; + TypeSystemImpl ts2 = (TypeSystemImpl) t2; + if (ts1.types.size() != ts2.types.size()) { + System.out.format("ts1 size: %,d ts2 size: %d%n", ts1.types.size(), ts2.types.size()); + } + for (int i = 1; i < ts1.types.size(); i++) { + if (ts1.types.get(i).hashCode() != ts2.types.get(i).hashCode()) { + System.out.format("ts1 type: %s%n%nts2 type: %s%n", ts1.types.get(i), ts2.types.get(i)); + } + } + System.out.println("done"); + } @Override public boolean equals(Object obj) {