Java Code Examples for org.apache.uima.cas.impl.TypeImpl#getSuperType()
The following examples show how to use
org.apache.uima.cas.impl.TypeImpl#getSuperType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Jg.java From uima-uimaj with Apache License 2.0 | 5 votes |
/** * Checks if is string subtype. * * @param fd the fd * @return true, if is string subtype */ boolean isStringSubtype(FeatureDescription fd) { if (null != typeSystem) { String rangeTypeName = fd.getRangeTypeName(); TypeImpl rangeType = (TypeImpl) typeSystem.getType(rangeTypeName); return rangeType.getSuperType() == ((TypeSystemImpl)typeSystem).stringType; } return false; }
Example 2
Source File: JsonCasSerializer.java From uima-uimaj with Apache License 2.0 | 5 votes |
private void collectUsedSubtypes() { final TypeImpl[] tiArray = cds.getSortedUsedTypes(); for (TypeImpl ti : tiArray) { // all used types int subtypeCode = ti.getCode(); // loop up the super chain for this type, // add parent -> subtype entries (until try to add one that's already there) for (TypeImpl parent = (TypeImpl) ti.getSuperType(); parent != null; parent = (TypeImpl) parent.getSuperType()) { final int parentCode = parent.getCode(); // next comparator must match the one used for sorting the tiArray // https://issues.apache.org/jira/browse/UIMA-5171 // if parent not contained in tiArray if (Arrays.binarySearch(tiArray, parent, CasSerializerSupport.COMPARATOR_SHORT_TYPENAME) < 0 ) { if (!parentTypesWithNoInstances.contains(parent)) { parentTypesWithNoInstances.add(parent); } } boolean wasAdded = mapType2Subtypes.addSubtype(parentCode, subtypeCode); if (!wasAdded) { break; } subtypeCode = parentCode; } } }