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 2017/09/30 19:06:20 UTC
svn commit: r1810230 - in /uima/uimaj/trunk/uimaj-core/src:
main/java/org/apache/uima/cas/impl/FeatureStructureImpl.java
test/java/org/apache/uima/cas/test/SubiteratorTest.java
Author: schor
Date: Sat Sep 30 19:06:20 2017
New Revision: 1810230
URL: http://svn.apache.org/viewvc?rev=1810230&view=rev
Log:
no jira - comment change only
Modified:
uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImpl.java
uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/SubiteratorTest.java
Modified: uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImpl.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImpl.java?rev=1810230&r1=1810229&r2=1810230&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImpl.java (original)
+++ uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImpl.java Sat Sep 30 19:06:20 2017
@@ -385,6 +385,12 @@ public abstract class FeatureStructureIm
private static final String refNamePrefix = "#";
+ /**
+ * map from int (the FS) to Strings
+ * 3 states: key not in map
+ * key in map, value of string = "seen once"
+ * key in map, value of string = #nnnn when value seen more than once
+ */
private RedBlackTree<String> tree;
private IntSet seen;
@@ -479,6 +485,8 @@ public abstract class FeatureStructureIm
public void prettyPrint(int indent, int incr, StringBuffer buf, boolean useShortNames, String s,
PrintReferences printRefs) {
+ final Type stringType = this.getCASImpl().getTypeSystem().getType(CAS.TYPE_NAME_STRING);
+
indent += incr;
final int printInfo = printRefs.printInfo(this.getAddress());
if (printInfo != PrintReferences.NO_LABEL) {
@@ -498,6 +506,7 @@ public abstract class FeatureStructureIm
buf.append(" \"" + s + "\"");
}
buf.append('\n');
+
CommonAuxArrayFSImpl arrayFS = null;
LowLevelTypeSystem llts = this.getCASImpl().ll_getTypeSystem();
final int typeClass = this.getCASImpl().ll_getTypeClass(llts.ll_getCodeForType(this.getType()));
@@ -607,17 +616,21 @@ public abstract class FeatureStructureIm
buf.append(feat.getShortName() + ": ");
approp = feat.getRange();
// System.out.println("Range type: " + approp);
- if (approp.equals(this.getCASImpl().getTypeSystem().getType(CAS.TYPE_NAME_STRING))
- || (this.getCAS().getTypeSystem().getParent(approp) != null && this.getCAS()
- .getTypeSystem().getParent(approp).equals(
- this.getCASImpl().getTypeSystem().getType(CAS.TYPE_NAME_STRING)))) {
+
+ // test if range is string type, or sub-string type (whose super type is string type)
+ if (approp.equals(stringType)
+ || (this.getCAS().getTypeSystem().getParent(approp) != null &&
+ this.getCAS().getTypeSystem().getParent(approp).equals(stringType))) {
stringVal = getStringValue(feat);
if (stringVal == null) {
- stringVal = "<null>";
+ buf.append("<null>");
} else {
- stringVal = "\"" + stringVal + "\"";
+ buf.append('"');
+ buf.append(stringVal);
+ buf.append('"');
}
- buf.append(stringVal + "\n");
+ buf.append('\n');
+
} else if (!approp.isPrimitive()) {
Exception e = null;
try {
Modified: uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/SubiteratorTest.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/SubiteratorTest.java?rev=1810230&r1=1810229&r2=1810230&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/SubiteratorTest.java (original)
+++ uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/SubiteratorTest.java Sat Sep 30 19:06:20 2017
@@ -117,6 +117,7 @@ public class SubiteratorTest extends Tes
Annotation sentence = jcas.getAnnotationIndex(Sentence.class).iterator().next();
FSIterator<Token> tokenIterator = tokenIndex.subiterator(sentence);
Annotation token = tokenIndex.iterator().next();
+ // debug token.toString();
tokenIterator.moveTo(token); //throws ClassCastException
// check unambiguous iterator creation