public String getDescription() { if (value == null) return unit; return value.toString()+unit; }
@Override public String getDescription() { return super.getDescription()+" = "+value.toString(); }
public int asInteger() throws UcumException { if (!isWholeNumber()) throw new UcumException("Unable to represent "+toString()+" as an integer"); if (comparesTo(new Decimal(Integer.MIN_VALUE)) < 0) throw new UcumException("Unable to represent "+toString()+" as a signed 8 byte integer"); if (comparesTo(new Decimal(Integer.MAX_VALUE)) > 0) throw new UcumException("Unable to represent "+toString()+" as a signed 8 byte integer"); return Integer.parseInt(asDecimal()); }
private Base pairToQty(Pair p) { return new Quantity().setValue(new BigDecimal(p.getValue().toString())).setSystem("http://unitsofmeasure.org").setCode(p.getCode()).noExtensions(); }
throw new UcumException("Attempt to divide "+toString()+" by zero");
public String getDescription() { if (value == null) return unit; return value.toString()+unit; }
@Override public String getDescription() { return super.getDescription()+" = "+value.toString(); }
public int asInteger() throws UcumException { if (!isWholeNumber()) throw new UcumException("Unable to represent "+toString()+" as an integer"); if (comparesTo(new Decimal(Integer.MIN_VALUE)) < 0) throw new UcumException("Unable to represent "+toString()+" as a signed 8 byte integer"); if (comparesTo(new Decimal(Integer.MAX_VALUE)) > 0) throw new UcumException("Unable to represent "+toString()+" as a signed 8 byte integer"); return Integer.parseInt(asDecimal()); }
throw new UcumException("Attempt to divide "+toString()+" by zero");
private Base pairToQty(Pair p) { return new Quantity().setValue(new BigDecimal(p.getValue().toString())).setSystem("http://unitsofmeasure.org").setCode(p.getCode()).noExtensions(); }