public Canonical convert(Term term) throws UcumException { return normalise(" ", term); }
public Canonical convert(Term term) throws UcumException { return normalise(" ", term); }
while (t != null) { if (t.getComp() instanceof Term) { Canonical temp = normalise(indent+" ", (Term) t.getComp()); if (div) { result.divideValue(temp.getValue()); } else if (t.getComp() instanceof Symbol) { Symbol o = (Symbol) t.getComp(); Canonical temp = normalise(indent, o); if (div) { result.divideValue(temp.getValue());
private Canonical expandDefinedUnit(String indent, DefinedUnit unit) throws UcumException { String u = unit.getValue().getUnit(); if (unit.isSpecial()) { if (!handlers.exists(unit.getCode())) throw new UcumException("Not handled yet (special unit)"); else u = handlers.get(unit.getCode()).getUnits(); } Term t = new ExpressionParser(model).parse(u); debug(indent, "now handle", t); Canonical result = normalise(indent+" ", t); result.multiplyValue(unit.getValue().getValue()); return result; }
while (t != null) { if (t.getComp() instanceof Term) { Canonical temp = normalise(indent+" ", (Term) t.getComp()); if (div) { result.divideValue(temp.getValue()); } else if (t.getComp() instanceof Symbol) { Symbol o = (Symbol) t.getComp(); Canonical temp = normalise(indent, o); if (div) { result.divideValue(temp.getValue());
private Canonical expandDefinedUnit(String indent, DefinedUnit unit) throws UcumException { String u = unit.getValue().getUnit(); if (unit.isSpecial()) { if (!handlers.exists(unit.getCode())) throw new UcumException("Not handled yet (special unit)"); else u = handlers.get(unit.getCode()).getUnits(); } Term t = new ExpressionParser(model).parse(u); debug(indent, "now handle", t); Canonical result = normalise(indent+" ", t); result.multiplyValue(unit.getValue().getValue()); return result; }