public static Time convertTime(Time value, Unit<ome.units.quantity.Time> ul) { return convertTime(value, ul.getSymbol()); }
/** * FIXME: this should likely take a default so that locations which don't * want an exception can have * * log.warn("Using new PositiveFloat(1.0)!", e); return new * PositiveFloat(1.0); * * or similar. */ public static ome.units.quantity.Time convertTime(Time t) { if (t == null) { return null; } Double v = t.getValue(); String u = t.getUnit().getSymbol(); ome.xml.model.enums.UnitsTime units = makeTimeUnitXML(u); ome.units.unit.Unit<ome.units.quantity.Time> units2 = ome.xml.model.enums.handlers.UnitsTimeEnumHandler .getBaseUnit(units); return new ome.units.quantity.Time(v, units2); }
public static ome.units.quantity.Time makeTimeXML(double d, String unit) { ome.units.unit.Unit<ome.units.quantity.Time> units = ome.xml.model.enums.handlers.UnitsTimeEnumHandler .getBaseUnit(makeTimeUnitXML(unit)); return new ome.units.quantity.Time(d, units); }
@Override public Filterable fillObject(ReverseModelMapper mapper) { ome.model.enums.UnitsTime ut = ome.model.enums.UnitsTime.valueOf(getUnit().toString()); ome.model.units.Time t = new ome.model.units.Time(getValue(), ut); return t; }
@Override public void copyObject(Filterable model, ModelMapper mapper) { if (model instanceof ome.model.units.Time) { ome.model.units.Time t = (ome.model.units.Time) model; this.value = t.getValue(); this.unit = UnitsTime.valueOf(t.getUnit().toString()); } else { throw new IllegalArgumentException( "Time cannot copy from " + (model==null ? "null" : model.getClass().getName())); } }