public Pressure(double d, String u) { this.value = d; this.unit = UnitsPressure.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.Pressure convert(Pressure 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.UnitsPressure.valueOf( t.getUnit().toString()).getSymbol(); ome.xml.model.enums.UnitsPressure units = makeXMLUnit(u); ome.units.unit.Unit<ome.units.quantity.Pressure> units2 = ome.xml.model.enums.handlers.UnitsPressureEnumHandler .getBaseUnit(units); return new ome.units.quantity.Pressure(v, units2); }
public Pressure(double d, Unit<ome.units.quantity.Pressure> unit) { this(d, UnitsPressure.bySymbol(unit.getSymbol())); }
/** * Copy constructor that converts the given {@link omero.model.Pressure} * based on the given ome.model enum */ public PressureI(double d, ome.model.enums.UnitsPressure ul) { this(d, UnitsPressure.valueOf(ul.toString())); }
public PressureI(double d, Unit<ome.units.quantity.Pressure> unit) { this(d, ome.model.enums.UnitsPressure.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.Pressure convertPressure(Pressure t) { if (t == null) { return null; } Double v = t.getValue(); String u = t.getUnit().getSymbol(); ome.xml.model.enums.UnitsPressure units = makePressureUnitXML(u); ome.units.unit.Unit<ome.units.quantity.Pressure> units2 = ome.xml.model.enums.handlers.UnitsPressureEnumHandler .getBaseUnit(units); return new ome.units.quantity.Pressure(v, units2); }
@Override public void copyObject(Filterable model, ModelMapper mapper) { if (model instanceof ome.model.units.Pressure) { ome.model.units.Pressure t = (ome.model.units.Pressure) model; this.value = t.getValue(); this.unit = UnitsPressure.valueOf(t.getUnit().toString()); } else { throw new IllegalArgumentException( "Pressure cannot copy from " + (model==null ? "null" : model.getClass().getName())); } }
public Pressure(ome.units.quantity.Pressure value) { this(value.value().doubleValue(), UnitsPressure.bySymbol(value.unit().getSymbol())); }
@Override public Filterable fillObject(ReverseModelMapper mapper) { ome.model.enums.UnitsPressure ut = ome.model.enums.UnitsPressure.valueOf(getUnit().toString()); ome.model.units.Pressure t = new ome.model.units.Pressure(getValue(), ut); return t; }
/** * Convert a Bio-Formats {@link Length} to an OMERO Length. */ public PressureI(ome.units.quantity.Pressure value) { ome.model.enums.UnitsPressure internal = ome.model.enums.UnitsPressure.bySymbol(value.unit().getSymbol()); UnitsPressure ul = UnitsPressure.valueOf(internal.toString()); setValue(value.value().doubleValue()); setUnit(ul); }