@Override public ComparableQuantity<?> divide(Quantity<?> that) { if (getUnit().equals(that.getUnit())) { return TimeQuantities.getQuantity(value / that.getValue().intValue(), timeUnit); } Unit<?> divUnit = getUnit().divide(that.getUnit()); UnitConverter conv; try { conv = getUnit().getConverterToAny(divUnit); return TimeQuantities.getQuantity(value / conv.convert(that.getValue()).intValue(), timeUnit); } catch (UnconvertibleException e) { // TODO Auto-generated catch block e.printStackTrace(); return TimeQuantities.getQuantity(value / that.getValue().intValue(), timeUnit); } catch (IncommensurableException e) { // TODO Auto-generated catch block e.printStackTrace(); return TimeQuantities.getQuantity(value / that.getValue().intValue(), timeUnit); } }
@Override public ComparableQuantity<?> multiply(Quantity<?> multiplier) { if (getUnit().equals(multiplier.getUnit())) { return TimeQuantities.getQuantity(value * multiplier.getValue().intValue(), timeUnit); } Unit<?> mulUnit = getUnit().multiply(multiplier.getUnit()); UnitConverter conv; try { conv = getUnit().getConverterToAny(mulUnit); return TimeQuantities.getQuantity(value * conv.convert(multiplier.getValue()).intValue(), timeUnit); } catch (UnconvertibleException e) { // TODO Auto-generated catch block e.printStackTrace(); return TimeQuantities.getQuantity(value * multiplier.getValue().intValue(), timeUnit); } catch (IncommensurableException e) { // TODO Auto-generated catch block e.printStackTrace(); return TimeQuantities.getQuantity(value * multiplier.getValue().intValue(), timeUnit); } }
@Override public ComparableQuantity<?> multiply(Quantity<?> multiplier) { if (getUnit().equals(multiplier.getUnit())) { return TimeQuantities.getQuantity(value * multiplier.getValue().intValue(), timeUnit); } Unit<?> mulUnit = getUnit().multiply(multiplier.getUnit()); UnitConverter conv; try { conv = getUnit().getConverterToAny(mulUnit); return TimeQuantities.getQuantity(value * conv.convert(multiplier.getValue()).intValue(), timeUnit); } catch (UnconvertibleException e) { // TODO Auto-generated catch block e.printStackTrace(); return TimeQuantities.getQuantity(value * multiplier.getValue().intValue(), timeUnit); } catch (IncommensurableException e) { // TODO Auto-generated catch block e.printStackTrace(); return TimeQuantities.getQuantity(value * multiplier.getValue().intValue(), timeUnit); } }
@Override public ComparableQuantity<?> divide(Quantity<?> that) { if (getUnit().equals(that.getUnit())) { return TimeQuantities.getQuantity(value / that.getValue().intValue(), timeUnit); } Unit<?> divUnit = getUnit().divide(that.getUnit()); UnitConverter conv; try { conv = getUnit().getConverterToAny(divUnit); return TimeQuantities.getQuantity(value / conv.convert(that.getValue()).intValue(), timeUnit); } catch (UnconvertibleException e) { // TODO Auto-generated catch block e.printStackTrace(); return TimeQuantities.getQuantity(value / that.getValue().intValue(), timeUnit); } catch (IncommensurableException e) { // TODO Auto-generated catch block e.printStackTrace(); return TimeQuantities.getQuantity(value / that.getValue().intValue(), timeUnit); } }
/** * @since 1.0.1 */ @Override public ComparableQuantity<?> divide(Quantity<?> that) { if (getUnit().equals(that.getUnit())) { return TimeQuantities.getQuantity(value / that.getValue().intValue(), timeUnit); } Unit<?> divUnit = getUnit().divide(that.getUnit()); UnitConverter conv; try { conv = getUnit().getConverterToAny(divUnit); return TimeQuantities.getQuantity(value / conv.convert(that.getValue()).intValue(), timeUnit); } catch (UnconvertibleException e) { // TODO Auto-generated catch block e.printStackTrace(); return TimeQuantities.getQuantity(value / that.getValue().intValue(), timeUnit); } catch (IncommensurableException e) { // TODO Auto-generated catch block e.printStackTrace(); return TimeQuantities.getQuantity(value / that.getValue().intValue(), timeUnit); } }
/** * @since 1.0.1 */ @Override public ComparableQuantity<?> divide(Quantity<?> that) { if (getUnit().equals(that.getUnit())) { return TimeQuantities.getQuantity(value / that.getValue().intValue(), timeUnit); } Unit<?> divUnit = getUnit().divide(that.getUnit()); UnitConverter conv; try { conv = getUnit().getConverterToAny(divUnit); return TimeQuantities.getQuantity(value / conv.convert(that.getValue()).intValue(), timeUnit); } catch (UnconvertibleException e) { // TODO Auto-generated catch block e.printStackTrace(); return TimeQuantities.getQuantity(value / that.getValue().intValue(), timeUnit); } catch (IncommensurableException e) { // TODO Auto-generated catch block e.printStackTrace(); return TimeQuantities.getQuantity(value / that.getValue().intValue(), timeUnit); } }
/** * @since 1.0.1 */ @Override public ComparableQuantity<?> multiply(Quantity<?> multiplier) { if (getUnit().equals(multiplier.getUnit())) { return TimeQuantities.getQuantity(value * multiplier.getValue().intValue(), timeUnit); } Unit<?> mulUnit = getUnit().multiply(multiplier.getUnit()); UnitConverter conv; try { conv = getUnit().getConverterToAny(mulUnit); return TimeQuantities.getQuantity(value * conv.convert(multiplier.getValue()).intValue(), timeUnit); } catch (UnconvertibleException e) { // TODO Auto-generated catch block e.printStackTrace(); return TimeQuantities.getQuantity(value * multiplier.getValue().intValue(), timeUnit); } catch (IncommensurableException e) { // TODO Auto-generated catch block e.printStackTrace(); return TimeQuantities.getQuantity(value * multiplier.getValue().intValue(), timeUnit); } }
/** * @since 1.0.1 */ @Override public ComparableQuantity<?> multiply(Quantity<?> multiplier) { if (getUnit().equals(multiplier.getUnit())) { return TimeQuantities.getQuantity(value * multiplier.getValue().intValue(), timeUnit); } Unit<?> mulUnit = getUnit().multiply(multiplier.getUnit()); UnitConverter conv; try { conv = getUnit().getConverterToAny(mulUnit); return TimeQuantities.getQuantity(value * conv.convert(multiplier.getValue()).intValue(), timeUnit); } catch (UnconvertibleException e) { // TODO Auto-generated catch block e.printStackTrace(); return TimeQuantities.getQuantity(value * multiplier.getValue().intValue(), timeUnit); } catch (IncommensurableException e) { // TODO Auto-generated catch block e.printStackTrace(); return TimeQuantities.getQuantity(value * multiplier.getValue().intValue(), timeUnit); } }