/** * Static helper for creating {@link Int} instances. */ public static Conversion Int(String i) { return new Int(i); }
/** * Static helper for creating {@link Rat} instances. */ public static Conversion Rat(Conversion... conversions) { return new Rat(conversions); }
/** * Static helper for creating {@link Mul} instances. */ public static Conversion Mul(Conversion...conversions) { return new Mul(conversions); }
/** * Determines the color corresponding to the passed value. * * @param value The value to handle. * @return */ private static int[] determineColor(Length value) { if (value == null) return null; if (rangeBlue(value.getValue())) return newBlueColor(); if (rangeGreen(value.getValue())) return newGreenColor(); if (rangeRed(value.getValue())) return newRedColor(); return null; }
public BigDecimal convert(double original) { BigDecimal big = BigDecimal.ZERO; for (Conversion c : conversions) { big = big.add(c.convert(original)); } return big; }
/** * Static helper for creating {@link Sym} instances. */ public static Conversion Sym(String sym) { return new Sym(sym); }
/** * Static helper for creating {@link Add} instances. */ public static Conversion Add(Conversion...conversions) { return new Add(conversions); }
/** * Static helper for creating {@link Pow} instances. */ public static Conversion Pow(long num, int den) { return new Pow(num, den); }
@Override public void setParameterValues(Properties parameters) { String units = parameters.getProperty("unit"); this.units = UNITS.valueOf(units); }
public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException { String value = rs.getString(names[0]); if (!rs.wasNull()) { return units.fromdbvalue(value); } return null; }
public void nullSafeSet(PreparedStatement ps, Object obj, int index) throws HibernateException, SQLException { if (obj == null) { // Note: units.sqlType shouldn't be used since this // doesn't actually get registered with the PG driver // (apparently). Instead we use the official Types.OTHER ps.setObject(index, null, Types.OTHER); } else { ps.setObject(index, units.todbvalue(obj), Types.OTHER); } }
public static Power convertPower(Power value, Unit<ome.units.quantity.Power> ul) { return convertPower(value, ul.getSymbol()); }
public static Frequency convertFrequency(Frequency value, Unit<ome.units.quantity.Frequency> ul) { return convertFrequency(value, ul.getSymbol()); }
public static ElectricPotential convertElectricPotential(ElectricPotential value, Unit<ome.units.quantity.ElectricPotential> ul) { return convertElectricPotential(value, ul.getSymbol()); }
public static Temperature convertTemperature(Temperature value, Unit<ome.units.quantity.Temperature> ul) { return convertTemperature(value, ul.getSymbol()); }
public static Length convertLength(Length value, Unit<ome.units.quantity.Length> ul) { return convertLength(value, ul.getSymbol()); }
public BigDecimal convert(double original) { BigDecimal big = BigDecimal.ONE; for (Conversion c : conversions) { big = big.multiply(c.convert(original)); } return big; } }
/** * Static helper for creating {@link Int} instances. */ public static Conversion Int(long i) { return new Int(i); }
/** * Static helper for creating {@link Rat} instances. */ public static Conversion Rat(long num, long den) { return new Rat(num, den); }