private boolean retainType(Type type, List<Type> retainList, TypeSystem typeSystem) { for (Type each : retainList) { if (typeSystem.subsumes(each, type)) { return true; } } return false; }
private boolean retainType(Type type, List<Type> retainList, TypeSystem typeSystem) { for (Type each : retainList) { if (typeSystem.subsumes(each, type)) { return true; } } return false; }
@Override public boolean apply(Type t) { return ts.subsumes(annotationType, t); } };
private boolean isAnnotationType(Type t, TypeSystem ts) { return ts.subsumes(annotationType, t); }
private static boolean isListType(TypeSystem aTS, Type aType) { return aTS.subsumes(aTS.getType(CAS.TYPE_NAME_LIST_BASE), aType); }
private boolean checkType(AnnotationFS anno) { if (targetType == null) { return true; } return ts.subsumes(targetType, anno.getType()); } }
private boolean checkType(AnnotationFS anno) { if (targetType == null) { return true; } return ts.subsumes(targetType, anno.getType()); } }
public static boolean isValidType(Type type, TypeSystem typeSystem) { String typeName = type.getName(); for (String handledType : HANDLED_TYPES) { if (typeName.equals(handledType)) return true; } // see section 2.3.4 of UIMA References if (typeSystem.subsumes(typeSystem.getType("uima.cas.String"), type)) return true; if (typeSystem.subsumes(typeSystem.getType("uima.tcas.Annotation"), type)) return true; return false; }
boolean isSubTypeOfAnnotation(TypeDescription td) { if (null == cas) return false; Type type = typeSystem.getType(td.getName()); if (null == type) // happens when type hasn't been defined return false; return typeSystem.subsumes(tcasAnnotationType, type); }
private Builder<?> createBuilder(Type type) { Builder<?> result; if (ts.subsumes(uimaAnnotationType, type)) { result = CompositeMatcher.builderForAnnotation(type); } else { result = CompositeMatcher.builderForFS(type); } return result; } }
/** * Checks if is sub type of annotation. * * @param td the td * @return true, if is sub type of annotation */ boolean isSubTypeOfAnnotation(TypeDescription td) { if (null == cas) return false; Type type = typeSystem.getType(td.getName()); if (null == type) // happens when type hasn't been defined return false; return typeSystem.subsumes(tcasAnnotationType, type); }
public boolean isAnnotationType(Type t) { return getTypeSystem().subsumes(getAnnotationType(), t); }
public static Collection<TOP> create(FSList aList, Type type) { TypeSystem ts = aList.getCAS().getTypeSystem(); List<FeatureStructure> data = new ArrayList<FeatureStructure>(); FSList i = aList; while (i instanceof NonEmptyFSList) { NonEmptyFSList l = (NonEmptyFSList) i; TOP value = l.getHead(); if (value != null && (type == null || ts.subsumes(type, value.getType()))) { data.add(l.getHead()); } i = l.getTail(); } return asList(data.toArray(new TOP[data.size()])); }
String getJavaRangeType(FeatureDescription fd) { String rangeTypeNameCAS = fd.getRangeTypeName(); if (null != typeSystem) { Type rangeCasType = typeSystem.getType(rangeTypeNameCAS); if (typeSystem.subsumes(casStringType, rangeCasType)) { // type is a subtype of string, make its java type = to string return "String"; } } return getJavaName(rangeTypeNameCAS); }
public static Set<FeatureStructure> getNonIndexedFSes(CAS aCas) { TypeSystem ts = aCas.getTypeSystem(); Set<FeatureStructure> allIndexedFS = collectIndexed(aCas); Set<FeatureStructure> allReachableFS = collectReachable(aCas); // Remove all that are indexed allReachableFS.removeAll(allIndexedFS); // Remove all that are not annotations allReachableFS.removeIf(fs -> !ts.subsumes(aCas.getAnnotationType(), fs.getType())); // All that is left are non-index annotations return allReachableFS; }
public static Set<FeatureStructure> getNonIndexedFSes(CAS aCas) { TypeSystem ts = aCas.getTypeSystem(); Set<FeatureStructure> allIndexedFS = collectIndexed(aCas); Set<FeatureStructure> allReachableFS = collectReachable(aCas); // Remove all that are indexed allReachableFS.removeAll(allIndexedFS); // Remove all that are not annotations allReachableFS.removeIf(fs -> !ts.subsumes(aCas.getAnnotationType(), fs.getType())); // All that is left are non-index annotations return allReachableFS; }
public static Set<FeatureStructure> getNonIndexedFSes(CAS aCas) { TypeSystem ts = aCas.getTypeSystem(); Set<FeatureStructure> allIndexedFS = collectIndexed(aCas); Set<FeatureStructure> allReachableFS = collectReachable(aCas); // Remove all that are indexed allReachableFS.removeAll(allIndexedFS); // Remove all that are not annotations allReachableFS.removeIf(fs -> !ts.subsumes(aCas.getAnnotationType(), fs.getType())); // All that is left are non-index annotations return allReachableFS; }
private boolean isEmptyList(LowLevelCAS cas, int type) { Type candidateType = cas.ll_getTypeSystem().ll_getTypeForCode(type); TypeSystem typeSystem = ((CASImpl) cas).getTypeSystem(); boolean isEmpty = false; for (int i = 0; i < this.emptyListTypes.length && (!isEmpty); i++) { isEmpty = typeSystem.subsumes(this.emptyListTypes[i], candidateType); } return isEmpty; }
/** * Convenience method to iterator over all annotations of a given type. * * @param cas * the CAS containing the type system. * @param type * the type. * @return A collection of the selected type. * @see <a href="package-summary.html#SortOrder">Order of selected feature structures</a> */ @SuppressWarnings({ "unchecked", "rawtypes" }) public static Collection<AnnotationFS> select(final CAS cas, final Type type) { if (!cas.getTypeSystem().subsumes(cas.getAnnotationType(), type)) { throw new IllegalArgumentException("Type [" + type.getName() + "] is not an annotation type"); } return (Collection) FSCollectionFactory.create(cas.getAnnotationIndex(type)); }
@Override public boolean match(FeatureStructure ref, FeatureStructure cand) { if (!subtypeMatch) { return ref.getType().equals(cand.getType()); } else { TypeSystem ts = ref.getCAS().getTypeSystem(); return ts.subsumes(ref.getType(), cand.getType()); } }