public Power(double d, String u) { this.value = d; this.unit = UnitsPower.valueOf(u); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((unit == null) ? 0 : unit.hashCode()); long temp; temp = Double.doubleToLongBits(value); result = prime * result + (int) (temp ^ (temp >>> 32)); return result; }
/** * 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.Power convert(Power t) { if (t == null) { return null; } Double v = t.getValue(); // Use the code/symbol-mapping in the ome.model.enums files // to convert to the specification value. String u = ome.model.enums.UnitsPower.valueOf( t.getUnit().toString()).getSymbol(); ome.xml.model.enums.UnitsPower units = makeXMLUnit(u); ome.units.unit.Unit<ome.units.quantity.Power> units2 = ome.xml.model.enums.handlers.UnitsPowerEnumHandler .getBaseUnit(units); return new ome.units.quantity.Power(v, units2); }
public Power(double d, Unit<ome.units.quantity.Power> unit) { this(d, UnitsPower.bySymbol(unit.getSymbol())); }
/** * Copy constructor that converts the given {@link omero.model.Power} * based on the given ome.model enum */ public PowerI(double d, ome.model.enums.UnitsPower ul) { this(d, UnitsPower.valueOf(ul.toString())); }
public PowerI(double d, Unit<ome.units.quantity.Power> unit) { this(d, ome.model.enums.UnitsPower.bySymbol(unit.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.Power convertPower(Power t) { if (t == null) { return null; } Double v = t.getValue(); String u = t.getUnit().getSymbol(); ome.xml.model.enums.UnitsPower units = makePowerUnitXML(u); ome.units.unit.Unit<ome.units.quantity.Power> units2 = ome.xml.model.enums.handlers.UnitsPowerEnumHandler .getBaseUnit(units); return new ome.units.quantity.Power(v, units2); }
@Override public void copyObject(Filterable model, ModelMapper mapper) { if (model instanceof ome.model.units.Power) { ome.model.units.Power t = (ome.model.units.Power) model; this.value = t.getValue(); this.unit = UnitsPower.valueOf(t.getUnit().toString()); } else { throw new IllegalArgumentException( "Power cannot copy from " + (model==null ? "null" : model.getClass().getName())); } }
public Power(ome.units.quantity.Power value) { this(value.value().doubleValue(), UnitsPower.bySymbol(value.unit().getSymbol())); }
@Override public Filterable fillObject(ReverseModelMapper mapper) { ome.model.enums.UnitsPower ut = ome.model.enums.UnitsPower.valueOf(getUnit().toString()); ome.model.units.Power t = new ome.model.units.Power(getValue(), ut); return t; }
/** * Convert a Bio-Formats {@link Length} to an OMERO Length. */ public PowerI(ome.units.quantity.Power value) { ome.model.enums.UnitsPower internal = ome.model.enums.UnitsPower.bySymbol(value.unit().getSymbol()); UnitsPower ul = UnitsPower.valueOf(internal.toString()); setValue(value.value().doubleValue()); setUnit(ul); }