/** * Return the list of all types subsumed by the input type. Note: the list does not include the * type itself. * * @param type * Input type. * @return The list of types subsumed by <code>type</code>. */ @Override public List<Type> getProperlySubsumedTypes(Type type) { List<Type> subList = new ArrayList<Type>(); Iterator<Type> typeIt = getTypeIterator(); while (typeIt.hasNext()) { Type t = typeIt.next(); if (type != t && subsumes(type, t)) { subList.add(t); } } return subList; }
/** * adds generator for type and all its subtypes. Because of this, call this on supertypes first, * then subtypes (otherwise subtypes will be overwritten by generators for the supertypes). * * @param type * the CAS type * @param fsFactory * the object having a createFS method in it for this type */ synchronized void addClassForType(Type type, FSGenerator<?> fsFactory) { Iterator<Type> it = this.ts.getTypeIterator(); TypeImpl sub; while (it.hasNext()) { sub = (TypeImpl) it.next(); if (this.ts.subsumes(type, sub)) { this.generators[sub.getCode()] = fsFactory; } } }
private static int[] addTypes(TypeSystemImpl tsSrc, TypeSystemImpl tsTgt) { Map<TypeImpl, TypeImpl> mSrc2Tgt = new LinkedHashMap<TypeImpl, TypeImpl>(); for (Iterator<Type> it = tsSrc.getTypeIterator(); it.hasNext();) { TypeImpl tSrc = (TypeImpl) it.next(); TypeImpl tTgt = (TypeImpl) tsTgt.getType(tSrc.getName()); if (tTgt != null) { mSrc2Tgt.put(tSrc, tTgt); } } int[] r = new int[tsSrc.getNumberOfTypes() + 1]; // type codes are numbered starting with 1 for (Entry<TypeImpl, TypeImpl> e : mSrc2Tgt.entrySet()) { r[e.getKey().getCode()] = e.getValue().getCode(); } return r; }
Iterator<Type> it = cds.tsi.getTypeIterator(); while (it.hasNext()) { TypeImpl t = (TypeImpl) it.next();