@Test public void testDouble() { Entity e = new Entity(jCas); e.setConfidence(0.5); e.addToIndexes(); Feature feature = e.getType().getFeatureByBaseName("confidence"); NewFeatureUtils.setPrimitive(e, feature, 1.0); assertEquals(1.0, e.getDoubleValue(feature), 0.0); }
public static void setPrimitive( final BaleenAnnotation annotation, final Feature feature, final Object value) { if (value == null) { return; } switch (feature.getRange().getName()) { case CAS.TYPE_NAME_STRING: annotation.setStringValue(feature, value.toString()); break; case CAS.TYPE_NAME_INTEGER: annotation.setIntValue(feature, ((Number) value).intValue()); break; case CAS.TYPE_NAME_FLOAT: annotation.setFloatValue(feature, ((Number) value).floatValue()); break; case CAS.TYPE_NAME_BOOLEAN: annotation.setBooleanValue(feature, (boolean) value); break; case CAS.TYPE_NAME_BYTE: annotation.setByteValue(feature, (byte) value); break; case CAS.TYPE_NAME_SHORT: annotation.setShortValue(feature, ((Number) value).shortValue()); break; case CAS.TYPE_NAME_LONG: annotation.setLongValue(feature, ((Number) value).longValue()); break; case CAS.TYPE_NAME_DOUBLE: annotation.setDoubleValue(feature, ((Number) value).doubleValue()); break; default: break; } }
NewFeatureUtils { public static void setPrimitive( final BaleenAnnotation annotation, final Feature feature, final Object value) { if (value == null) { return; } switch (feature.getRange().getName()) { case CAS.TYPE_NAME_STRING: annotation.setStringValue(feature, value.toString()); break; case CAS.TYPE_NAME_INTEGER: annotation.setIntValue(feature, ((Number) value).intValue()); break; case CAS.TYPE_NAME_FLOAT: annotation.setFloatValue(feature, ((Number) value).floatValue()); break; case CAS.TYPE_NAME_BOOLEAN: annotation.setBooleanValue(feature, (boolean) value); break; case CAS.TYPE_NAME_BYTE: annotation.setByteValue(feature, (byte) value); break; case CAS.TYPE_NAME_SHORT: annotation.setShortValue(feature, ((Number) value).shortValue()); break; case CAS.TYPE_NAME_LONG: annotation.setLongValue(feature, ((Number) value).longValue()); break; case CAS.TYPE_NAME_DOUBLE: annotation.setDoubleValue(feature, ((Number) value).doubleValue()); break; default: break; } } }
NewFeatureUtils { public static void setPrimitive( final BaleenAnnotation annotation, final Feature feature, final Object value) { if (value == null) { return; } switch (feature.getRange().getName()) { case CAS.TYPE_NAME_STRING: annotation.setStringValue(feature, value.toString()); break; case CAS.TYPE_NAME_INTEGER: annotation.setIntValue(feature, ((Number) value).intValue()); break; case CAS.TYPE_NAME_FLOAT: annotation.setFloatValue(feature, ((Number) value).floatValue()); break; case CAS.TYPE_NAME_BOOLEAN: annotation.setBooleanValue(feature, (boolean) value); break; case CAS.TYPE_NAME_BYTE: annotation.setByteValue(feature, (byte) value); break; case CAS.TYPE_NAME_SHORT: annotation.setShortValue(feature, ((Number) value).shortValue()); break; case CAS.TYPE_NAME_LONG: annotation.setLongValue(feature, ((Number) value).longValue()); break; case CAS.TYPE_NAME_DOUBLE: annotation.setDoubleValue(feature, ((Number) value).doubleValue()); break; default: break; } } private  NewFeatureUtils(); }
NewFeatureUtils { public static void setPrimitive( final BaleenAnnotation annotation, final Feature feature, final Object value) { if (value == null) { return; } switch (feature.getRange().getName()) { case CAS.TYPE_NAME_STRING: annotation.setStringValue(feature, value.toString()); break; case CAS.TYPE_NAME_INTEGER: annotation.setIntValue(feature, ((Number) value).intValue()); break; case CAS.TYPE_NAME_FLOAT: annotation.setFloatValue(feature, ((Number) value).floatValue()); break; case CAS.TYPE_NAME_BOOLEAN: annotation.setBooleanValue(feature, (boolean) value); break; case CAS.TYPE_NAME_BYTE: annotation.setByteValue(feature, (byte) value); break; case CAS.TYPE_NAME_SHORT: annotation.setShortValue(feature, ((Number) value).shortValue()); break; case CAS.TYPE_NAME_LONG: annotation.setLongValue(feature, ((Number) value).longValue()); break; case CAS.TYPE_NAME_DOUBLE: annotation.setDoubleValue(feature, ((Number) value).doubleValue()); break; default: break; } } private  NewFeatureUtils(); static void setPrimitive(
      final BaleenAnnotation annotation, final Feature feature, final Object value); static void setPrimitiveArray(
      final JCas jCas,
      final BaleenAnnotation annotation,
      final Feature feature,
      final Object value); }
NewFeatureUtils { public static void setPrimitive( final BaleenAnnotation annotation, final Feature feature, final Object value) { if (value == null) { return; } switch (feature.getRange().getName()) { case CAS.TYPE_NAME_STRING: annotation.setStringValue(feature, value.toString()); break; case CAS.TYPE_NAME_INTEGER: annotation.setIntValue(feature, ((Number) value).intValue()); break; case CAS.TYPE_NAME_FLOAT: annotation.setFloatValue(feature, ((Number) value).floatValue()); break; case CAS.TYPE_NAME_BOOLEAN: annotation.setBooleanValue(feature, (boolean) value); break; case CAS.TYPE_NAME_BYTE: annotation.setByteValue(feature, (byte) value); break; case CAS.TYPE_NAME_SHORT: annotation.setShortValue(feature, ((Number) value).shortValue()); break; case CAS.TYPE_NAME_LONG: annotation.setLongValue(feature, ((Number) value).longValue()); break; case CAS.TYPE_NAME_DOUBLE: annotation.setDoubleValue(feature, ((Number) value).doubleValue()); break; default: break; } } private  NewFeatureUtils(); static void setPrimitive(
      final BaleenAnnotation annotation, final Feature feature, final Object value); static void setPrimitiveArray(
      final JCas jCas,
      final BaleenAnnotation annotation,
      final Feature feature,
      final Object value);  }