public ElectricPotential(double d, String u) { this.value = d; this.unit = UnitsElectricPotential.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.ElectricPotential convert(ElectricPotential 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.UnitsElectricPotential.valueOf( t.getUnit().toString()).getSymbol(); ome.xml.model.enums.UnitsElectricPotential units = makeXMLUnit(u); ome.units.unit.Unit<ome.units.quantity.ElectricPotential> units2 = ome.xml.model.enums.handlers.UnitsElectricPotentialEnumHandler .getBaseUnit(units); return new ome.units.quantity.ElectricPotential(v, units2); }
public ElectricPotentialI(double d, Unit<ome.units.quantity.ElectricPotential> unit) { this(d, ome.model.enums.UnitsElectricPotential.bySymbol(unit.getSymbol())); }
public static ElectricPotential convertElectricPotential(ElectricPotential value, String target) { String source = value.getUnit().getSymbol(); if (target.equals(source)) { return value; } throw new RuntimeException(String.format( "%f %s cannot be converted to %s", value.getValue(), value.getUnit().getSymbol(), source)); }
/** * Copy constructor that converts the given {@link omero.model.ElectricPotential} * based on the given ome.model enum */ public ElectricPotentialI(double d, ome.model.enums.UnitsElectricPotential ul) { this(d, UnitsElectricPotential.valueOf(ul.toString())); }
public ElectricPotential(double d, Unit<ome.units.quantity.ElectricPotential> unit) { this(d, UnitsElectricPotential.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.ElectricPotential convertElectricPotential(ElectricPotential t) { if (t == null) { return null; } Double v = t.getValue(); String u = t.getUnit().getSymbol(); ome.xml.model.enums.UnitsElectricPotential units = makeElectricPotentialUnitXML(u); ome.units.unit.Unit<ome.units.quantity.ElectricPotential> units2 = ome.xml.model.enums.handlers.UnitsElectricPotentialEnumHandler .getBaseUnit(units); return new ome.units.quantity.ElectricPotential(v, units2); }
@Override public void copyObject(Filterable model, ModelMapper mapper) { if (model instanceof ome.model.units.ElectricPotential) { ome.model.units.ElectricPotential t = (ome.model.units.ElectricPotential) model; this.value = t.getValue(); this.unit = UnitsElectricPotential.valueOf(t.getUnit().toString()); } else { throw new IllegalArgumentException( "ElectricPotential cannot copy from " + (model==null ? "null" : model.getClass().getName())); } }
/** * Copy constructor that converts the given {@link omero.model.ElectricPotential} * based on the given ome-xml enum */ public ElectricPotentialI(ElectricPotential value, Unit<ome.units.quantity.ElectricPotential> ul) throws BigResult { this(value, ome.model.enums.UnitsElectricPotential.bySymbol(ul.getSymbol()).toString()); }
public ElectricPotential(ome.units.quantity.ElectricPotential value) { this(value.value().doubleValue(), UnitsElectricPotential.bySymbol(value.unit().getSymbol())); }
@Override public Filterable fillObject(ReverseModelMapper mapper) { ome.model.enums.UnitsElectricPotential ut = ome.model.enums.UnitsElectricPotential.valueOf(getUnit().toString()); ome.model.units.ElectricPotential t = new ome.model.units.ElectricPotential(getValue(), ut); return t; }
/** * Convert a Bio-Formats {@link Length} to an OMERO Length. */ public ElectricPotentialI(ome.units.quantity.ElectricPotential value) { ome.model.enums.UnitsElectricPotential internal = ome.model.enums.UnitsElectricPotential.bySymbol(value.unit().getSymbol()); UnitsElectricPotential ul = UnitsElectricPotential.valueOf(internal.toString()); setValue(value.value().doubleValue()); setUnit(ul); }