@Override public Object unwrap(Value value) throws RepositoryException { return value.getDouble(); } @Override
@Override public Object unwrap(Value value) throws RepositoryException { return value.getDouble(); } @Override
@Override public Object unwrap(Value value) throws RepositoryException { return value.getDouble(); } @Override
@Override protected Double getValue(Value value) throws RepositoryException { return value.getDouble(); }
/** * @see Property#getDouble() */ public double getDouble() throws ValueFormatException, RepositoryException { return getValue().getDouble(); }
/** * @see Property#getDouble() */ public double getDouble() throws ValueFormatException, RepositoryException { return getValue().getDouble(); }
/** * Returns the double value of this property. Implemented as * getValue().getDouble(). * * {@inheritDoc} */ public double getDouble() throws RepositoryException { return getValue().getDouble(); }
public double getDouble() throws ValueFormatException, RepositoryException { if (values.length > 1) { throw new ValueFormatException(); } return values[0].getDouble(); }
/** * Test the persistence of a property modified with an double parameter and * saved from the Session */ public void testDoubleSession() throws RepositoryException { property1.setValue(value); superuser.save(); assertEquals("Double node property not saved", value.getDouble(), property1.getValue().getDouble(), 0); }
/** * tests the conversion from a Double to a String Value */ public void testGetString() throws RepositoryException { Value val = PropertyUtil.getValue(prop); String str = val.getString(); String otherStr = Double.toString(val.getDouble()); assertEquals("Conversion from Double value to String value is not correct.", str, otherStr); }
private Object getValue(Value value) throws RepositoryException { switch (value.getType()) { case PropertyType.BOOLEAN: return Boolean.valueOf(value.getBoolean()); case PropertyType.LONG: return Long.valueOf(value.getLong()); case PropertyType.DOUBLE: return Double.valueOf(value.getDouble()); case PropertyType.STRING: default: return value.getString(); } }
/** * tests conversion from Double type to Date type */ public void testGetDate() throws RepositoryException { Value val = PropertyUtil.getValue(prop); Calendar calendar = val.getDate(); assertEquals("Conversion from Double value to Date value is not correct.", calendar.getTimeInMillis(), new Double(val.getDouble()).longValue()); }
/** * tests the conversion from a Double to a Long Value */ public void testGetLong() throws RepositoryException { Value val = PropertyUtil.getValue(prop); long l = val.getLong(); long ll = new Double(val.getDouble()).longValue(); assertTrue("Conversion from Double value to Long value is not correct.", l == ll); }
/** * Tests conversion from Long type to Double type. */ public void testGetDouble() throws RepositoryException { Value val = PropertyUtil.getValue(prop); double d = val.getDouble(); assertEquals("Conversion from Long value to Double value is not correct.", new Long(val.getLong()).doubleValue(), d, 0d); }
/** * Tests conversion from Date type to Double type. */ public void testGetDouble() throws RepositoryException { Value val = PropertyUtil.getValue(prop); double d = val.getDouble(); long mili = val.getDate().getTimeInMillis(); assertEquals("Conversion from a Date value to a Double value " + "returns a different number of miliseconds.", mili, (long) d); }
public boolean apply(User user) { try { Value[] weight = user.getProperty("profile/weight"); return weight != null && weight.length == 1 && weight[0].getDouble() > 2000.0; } catch (RepositoryException e) { fail(e.getMessage()); } return false; } });
public boolean evaluate(User user) { try { Value[] weight = user.getProperty("profile/weight"); return weight != null && weight.length == 1 && weight[0].getDouble() > 2000.0; } catch (RepositoryException e) { fail(e.getMessage()); } return false; } });
public boolean evaluate(User user) { try { Value[] cute = user.getProperty("profile/cute"); Value[] weight = user.getProperty("profile/weight"); return cute != null && cute.length == 1 && cute[0].getBoolean() && weight != null && weight.length == 1 && weight[0].getDouble() > 1000.0; } catch (RepositoryException e) { fail(e.getMessage()); } return false; } });
public boolean apply(User user) { try { Value[] cute = user.getProperty("profile/cute"); Value[] weight = user.getProperty("profile/weight"); return cute != null && cute.length == 1 && cute[0].getBoolean() && weight != null && weight.length == 1 && weight[0].getDouble() > 1000.0; } catch (RepositoryException e) { fail(e.getMessage()); } return false; } });
@Test public void testCreateValueDouble() throws Exception { Value v = syncCtx.createValue(Double.valueOf(1.1)); assertNotNull(v); assertEquals(PropertyType.DOUBLE, v.getType()); assertEquals(1.1, v.getDouble(), 0); v = syncCtx.createValue(Float.NaN); assertNotNull(v); assertEquals(PropertyType.DOUBLE, v.getType()); assertEquals(Float.NaN, v.getDouble(), 0); }