public boolean getBooleanValue(String name) { return featureStructure.getBooleanValue(getFeature(name)); } }
public boolean match(FeatureStructure fs) { final int max = this.featNames.size() - 1; // The last position in the // path! if (max < 0) { // If the path is empty, we can't get a boolean, and therefore the // constraint is not satisfied. return false; } Feature feat; for (int i = 0; i < max; i++) { feat = fs.getType().getFeatureByBaseName(this.featNames.get(i)); if (feat == null) { return false; } fs = fs.getFeatureValue(feat); } feat = fs.getType().getFeatureByBaseName(this.featNames.get(max)); if (feat == null) { return false; } return this.cons.match(fs.getBooleanValue(feat)); }
@Override public boolean getBooleanValue(MatchContext context, RutaStream stream) { AnnotationFS annotation = context.getAnnotation(); Feature feature = this.fe.getFeature(context, stream); List<AnnotationFS> list = this.getTargetAnnotation(annotation, this.fe, context, stream); Collection<? extends FeatureStructure> featureStructures = this.fe.getFeatureStructures(list, false, context, stream); if (!featureStructures.isEmpty()) { FeatureStructure next = featureStructures.iterator().next(); if (next instanceof AnnotationFS && next != annotation) { feature = this.fe.getFeature(new MatchContext((AnnotationFS) next, context.getElement(), context.getRuleMatch(), context.getDirection()), stream); } return next.getBooleanValue(feature); } return false; }
result = structure.getBooleanValue(feature); } else if (Byte.class.equals(primitiveClass)) { result = structure.getByteValue(feature);
private static void fillFeatures(DebugNameValuePair[] result, int startOffset, FeatureStructure fs, List<Feature> features) { int nbrFeats = features.size(); int i = startOffset; for (int j = 0; j < nbrFeats; j++) { Feature feat = features.get(j); DebugNameValuePair nv = new DebugNameValuePair(feat.getShortName(), null); String rangeTypeName = feat.getRange().getName(); if ("uima.cas.Integer".equals(rangeTypeName)) nv.setValue(Integer.valueOf(fs.getIntValue(feat))); else if ("uima.cas.Float".equals(rangeTypeName)) nv.setValue(Float.valueOf(fs.getFloatValue(feat))); else if ("uima.cas.Boolean".equals(rangeTypeName)) nv.setValue(Boolean.valueOf(fs.getBooleanValue(feat))); else if ("uima.cas.Byte".equals(rangeTypeName)) nv.setValue(Byte.valueOf(fs.getByteValue(feat))); else if ("uima.cas.Short".equals(rangeTypeName)) nv.setValue(Short.valueOf(fs.getShortValue(feat))); else if ("uima.cas.Long".equals(rangeTypeName)) nv.setValue(Long.valueOf(fs.getLongValue(feat))); else if ("uima.cas.Double".equals(rangeTypeName)) nv.setValue(Double.valueOf(fs.getDoubleValue(feat))); else if ("uima.cas.String".equals(rangeTypeName)) nv.setValue(fs.getStringValue(feat)); else nv.setValue(fs.getFeatureValue(feat)); result[i++] = nv; } }
break; case CAS.TYPE_NAME_BOOLEAN: generator.writeBoolean(annotation.getBooleanValue(feature)); break; case CAS.TYPE_NAME_BYTE:
Type type = feature.getRange(); if (type.equals(typeSystem.getType("uima.cas.Boolean"))) return featureStructure.getBooleanValue(feature); else if (type.equals(typeSystem.getType("uima.cas.Double"))) return featureStructure.getDoubleValue(feature);
break; case LowLevelCAS.TYPE_CLASS_BOOLEAN: featurePathValue = Boolean.toString(currentFS.getBooleanValue(feature)); noFurtherElementsPossible = true; break;
break; case LowLevelCAS.TYPE_CLASS_BOOLEAN: featurePathValue = Boolean.toString(currentFS.getBooleanValue(feature)); noFurtherElementsPossible = true; break;
public static <T> T getFeature(FeatureStructure aFS, String aFeatureName) { Feature feature = aFS.getType().getFeatureByBaseName(aFeatureName); if (feature == null) { throw new IllegalArgumentException("Type [" + aFS.getType().getName() + "] has no feature called [" + aFeatureName + "]"); } switch (feature.getRange().getName()) { case CAS.TYPE_NAME_STRING: return (T) aFS.getStringValue(feature); case CAS.TYPE_NAME_BOOLEAN: return (T) (Boolean) aFS.getBooleanValue(feature); case CAS.TYPE_NAME_FLOAT: return (T) (Float) aFS.getFloatValue(feature); case CAS.TYPE_NAME_INTEGER: return (T) (Integer) aFS.getIntValue(feature); default: throw new IllegalArgumentException("Cannot get value of feature [" + feature.getName() + "] with type [" + feature.getRange().getName() + "]"); } }
public static <T> T getFeature(FeatureStructure aFS, String aFeatureName) { Feature feature = aFS.getType().getFeatureByBaseName(aFeatureName); if (feature == null) { throw new IllegalArgumentException("Type [" + aFS.getType().getName() + "] has no feature called [" + aFeatureName + "]"); } switch (feature.getRange().getName()) { case CAS.TYPE_NAME_STRING: return (T) aFS.getStringValue(feature); case CAS.TYPE_NAME_BOOLEAN: return (T) (Boolean) aFS.getBooleanValue(feature); case CAS.TYPE_NAME_FLOAT: return (T) (Float) aFS.getFloatValue(feature); case CAS.TYPE_NAME_INTEGER: return (T) (Integer) aFS.getIntValue(feature); default: throw new IllegalArgumentException("Cannot get value of feature [" + feature.getName() + "] with type [" + feature.getRange().getName() + "]"); } }
ps.setByte(argIdx, anno.getByteValue(feat)); } else if ("uima.cas.Boolean".equals(feat.getRange().getName())) { ps.setBoolean(argIdx, anno.getBooleanValue(feat)); } else if ("uima.cas.String".equals(feat.getRange().getName())) { String trunc = truncateString(anno.getStringValue(feat),
ps.setByte(argIdx, anno.getByteValue(feat)); } else if ("uima.cas.Boolean".equals(feat.getRange().getName())) { ps.setBoolean(argIdx, anno.getBooleanValue(feat)); } else if ("uima.cas.String".equals(feat.getRange().getName())) { String trunc = truncateString(anno.getStringValue(feat),
Boolean v1 = fs.getBooleanValue(feature); if (getArg() instanceof IBooleanExpression) { IBooleanExpression expr = (IBooleanExpression) getArg();
/** * Get the feature value of this {@code Feature} on this annotation */ private static Object getFeatureValue(FeatureStructure aFS, Feature aFeature) { switch (aFeature.getRange().getName()) { case CAS.TYPE_NAME_STRING: return aFS.getFeatureValueAsString(aFeature); case CAS.TYPE_NAME_BOOLEAN: return aFS.getBooleanValue(aFeature); case CAS.TYPE_NAME_FLOAT: return aFS.getFloatValue(aFeature); case CAS.TYPE_NAME_INTEGER: return aFS.getIntValue(aFeature); case CAS.TYPE_NAME_BYTE: return aFS.getByteValue(aFeature); case CAS.TYPE_NAME_DOUBLE: return aFS.getDoubleValue(aFeature); case CAS.TYPE_NAME_LONG: aFS.getLongValue(aFeature); case CAS.TYPE_NAME_SHORT: aFS.getShortValue(aFeature); default: return null; // return aFS.getFeatureValue(aFeature); } }
/** * Get the feature value of this {@code Feature} on this annotation */ private static Object getFeatureValue(FeatureStructure aFS, Feature aFeature) { switch (aFeature.getRange().getName()) { case CAS.TYPE_NAME_STRING: return aFS.getFeatureValueAsString(aFeature); case CAS.TYPE_NAME_BOOLEAN: return aFS.getBooleanValue(aFeature); case CAS.TYPE_NAME_FLOAT: return aFS.getFloatValue(aFeature); case CAS.TYPE_NAME_INTEGER: return aFS.getIntValue(aFeature); case CAS.TYPE_NAME_BYTE: return aFS.getByteValue(aFeature); case CAS.TYPE_NAME_DOUBLE: return aFS.getDoubleValue(aFeature); case CAS.TYPE_NAME_LONG: aFS.getLongValue(aFeature); case CAS.TYPE_NAME_SHORT: aFS.getShortValue(aFeature); default: return null; // return aFS.getFeatureValue(aFeature); } }
newFS.setFloatValue(feature, floatValue); } else if (oldRange.getShortName().equals("Boolean")) { Boolean booleanValue = oldFS.getBooleanValue(oldFeature); newFS.setBooleanValue(feature, booleanValue);
newFS.setFloatValue(feature, floatValue); } else if (oldRange.getShortName().equals("Boolean")) { Boolean booleanValue = oldFS.getBooleanValue(oldFeature); newFS.setBooleanValue(feature, booleanValue);
break; case LowLevelCAS.TYPE_CLASS_BOOLEAN: checkCondidtion = checkBoolean(currentFS.getBooleanValue(feature), condition); noFurtherElementsPossible = true; break;
break; case LowLevelCAS.TYPE_CLASS_BOOLEAN: checkCondidtion = checkBoolean(currentFS.getBooleanValue(feature), condition); noFurtherElementsPossible = true; break;