/** * Gets the allowed values for a string subtype. * * @param aType * the type, which must be a subtype of uima.cas.String * @param aTypeSystem the type system to use * @return array of allowed values for <code>aType</code> TODO - this should be a method on * Type. */ public static String[] getAllowedValuesForType(Type aType, TypeSystem aTypeSystem) { LowLevelTypeSystem lts = aTypeSystem.getLowLevelTypeSystem(); return lts.ll_getStringSet(lts.ll_getCodeForType(aType)); }
/** * @see org.apache.uima.cas.Type#isPrimitive() */ public boolean isPrimitive() { return !(this.getTypeSystem().getLowLevelTypeSystem().ll_isRefType(this.code)); }
/** * Classify types into FS type, array type etc. For the full list of return types, see the * <code>LowLevelCAS.TYPE_CLASS*</code> constants, as well as the documentation for * {@link LowLevelCAS#ll_getTypeClass(int) LowLevelCAS.ll_getTypeClass(int)}. * * @param type * The type to classify. * @return An integer encoding the the type class. See above. */ public static final int classifyType(Type type) { LowLevelTypeSystem llts = ((TypeImpl) type).getTypeSystem().getLowLevelTypeSystem(); return llts.ll_getTypeClass(llts.ll_getCodeForType(type)); }
/** * Gets the restricted values. * * @param ts the ts * @param type the type * @return the restricted values */ public static String[] getRestrictedValues(TypeSystem ts, Type type) { if (isRestrictedByAllowedValues(ts, type)) { throw new IllegalArgumentException("Type " + type.getName() + " does not defines allowed values!"); } LowLevelTypeSystem lts = ts.getLowLevelTypeSystem(); final int typeCode = lts.ll_getCodeForType(type); return lts.ll_getStringSet(typeCode); }
private void addPartOf(int code) { partOf[code] = partOf[code] + 1; if (!lowMemoryProfile) { int parentCode = getCAS().getTypeSystem().getLowLevelTypeSystem().ll_getParentType(code); if (parentCode > 0) { addPartOf(parentCode); } } }
private void removePartOf(int code) { if (partOf[code] != 0) { partOf[code] = partOf[code] - 1; if (!lowMemoryProfile) { int parentCode = getCAS().getTypeSystem().getLowLevelTypeSystem().ll_getParentType(code); if (parentCode > 0) { removePartOf(parentCode); } } } }
.getTypeSystem().getLowLevelTypeSystem();
/** * Checks if is restricted by allowed values. * * @param ts the ts * @param type the type * @return true, if is restricted by allowed values */ public static boolean isRestrictedByAllowedValues(TypeSystem ts, Type type) { if (ts.getType(CAS.TYPE_NAME_STRING).equals(type) || ts.subsumes(ts.getType(CAS.TYPE_NAME_STRING), type)) { LowLevelTypeSystem lts = ts.getLowLevelTypeSystem(); final int typeCode = lts.ll_getCodeForType(type); String[] strings = lts.ll_getStringSet(typeCode); return strings.length > 0; } else { return false; } }
if (PathValid.ALWAYS == pathValid) { LowLevelTypeSystem llTypeSystem = ((TypeImpl) this.featurePathBaseType) .getTypeSystem().getLowLevelTypeSystem(); this.ll_featurePathElements.add(llTypeSystem .ll_getCodeForFeature(feat));
typeDesc.setName(type.getName()); typeDesc.setSupertypeName(superType.getName()); LowLevelTypeSystem llts = aTypeSystem.getLowLevelTypeSystem(); List<FeatureDescription> featDescs = new ArrayList<FeatureDescription>(); Iterator<Feature> featIterator = type.getFeatures().iterator(); LowLevelTypeSystem lts = aTypeSystem.getLowLevelTypeSystem(); final int typeCode = lts.ll_getCodeForType(type); String[] strings = lts.ll_getStringSet(typeCode);
void copyFeatures(int trgAddr, int srcAddr) throws CASRuntimeException { int typeCode = getHeapValue(trgAddr); if (typeCode != getHeapValue(srcAddr)) { CASRuntimeException e = new CASRuntimeException(CASRuntimeException.INAPPROP_TYPE); // What's that supposed to mean? Internationalized, my foot. // TODO: fix exception argument. // e.addArgument("Type of source and target feature structures do not // match"); throw (e); } // get features to copy int[] featcodes = getTypeSystem().getLowLevelTypeSystem().ll_getAppropriateFeatures(typeCode); for (int i = 0; i < featcodes.length; i++) { // get range type of this feature Feature feature = getTypeSystem().getLowLevelTypeSystem().ll_getFeatureForCode(featcodes[i]); Type rangeType = feature.getRange(); // get feature code int featCode = ((FeatureImpl) feature).getCode(); // get the value for this feature offset in src fs int val = getHeapValue(srcAddr + this.svd.casMetadata.featureOffset[featCode]); // if this is a string, create a new reference in the string // reference heap // and point to the same string as the string feature in src fs. setFeatureValueNotJournaled(trgAddr, featCode, isStringType(rangeType) ? this.getStringHeap().cloneStringReference(val) : getHeapValue(srcAddr + this.svd.casMetadata.featureOffset[featCode])); } }