} else if (CAS.TYPE_NAME_INTEGER.equals(rangeTypeName)) {
Assert.assertEquals(fs1.getIntValue(feat1), fs2.getIntValue(feat2));
} else if (CAS.TYPE_NAME_FLOAT.equals(rangeTypeName)) {
Assert.assertEquals(fs1.getFloatValue(feat1), fs2.getFloatValue(feat2), 0);
} else if (CAS.TYPE_NAME_STRING_ARRAY.equals(rangeTypeName)) {
StringArrayFS arrayFS1 = (StringArrayFS) fs1.getFeatureValue(feat1);
StringArrayFS arrayFS2 = (StringArrayFS) fs2.getFeatureValue(feat2);
if ((arrayFS1 == null) && (arrayFS2 == null)) {
// ok
} else {
Assert.assertEquals(arrayFS1.size(), arrayFS2.size());
for (int j = 0; j < arrayFS1.size(); j++) {
// Temporary workaround for UIMA-2490 - null and "" string values
String s1 = arrayFS1.get(j);
String s2 = arrayFS2.get(j);
if ((s1 == null) && (s2 != null) && (s2.length() == 0)) {
continue;
}
if ((s2 == null) && (s1 != null) && (s1.length() == 0)) {
continue;
}
Assert.assertEquals(arrayFS1.get(j), arrayFS2.get(j));
}
}
} else if (CAS.TYPE_NAME_INTEGER_ARRAY.equals(rangeTypeName)) {
IntArrayFS arrayFS1 = (IntArrayFS) fs1.getFeatureValue(feat1);
IntArrayFS arrayFS2 = (IntArrayFS) fs2.getFeatureValue(feat2);
if ((arrayFS1 == null) && (arrayFS2 == null)) {
// ok
} else {
Assert.assertEquals(arrayFS1.size(), arrayFS2.size());
for (int j = 0; j < arrayFS1.size(); j++) {
Assert.assertEquals(arrayFS1.get(j), arrayFS2.get(j));
}
}
} else if (CAS.TYPE_NAME_FLOAT_ARRAY.equals(rangeTypeName)) {
FloatArrayFS arrayFS1 = (FloatArrayFS) fs1.getFeatureValue(feat1);
FloatArrayFS arrayFS2 = (FloatArrayFS) fs2.getFeatureValue(feat2);
if ((arrayFS1 == null) && (arrayFS2 == null)) {
// ok
} else {
Assert.assertEquals(arrayFS1.size(), arrayFS2.size());
for (int j = 0; j < arrayFS1.size(); j++) {
Assert.assertEquals(arrayFS1.get(j), arrayFS2.get(j), 0);
}
}
} else if (CAS.TYPE_NAME_FS_ARRAY.equals(rangeTypeName)) {
ArrayFS arrayFS1 = (ArrayFS) fs1.getFeatureValue(feat1);
ArrayFS arrayFS2 = (ArrayFS) fs2.getFeatureValue(feat2);
if ((arrayFS1 == null) && (arrayFS2 == null)) {
// ok
} else {
Assert.assertEquals(arrayFS1.size(), arrayFS2.size());
for (int j = 0; j < arrayFS1.size(); j++) {
assertEquals(arrayFS1.get(j), arrayFS2.get(j), visited);
}
}
} else // single feature value
{
FeatureStructure fsVal1 = fs1.getFeatureValue(feat1);