1 9 package org.jscience.physics.units; 10 11 import org.jscience.physics.quantities.Quantity; 12 13 42 class TransformedUnit<Q extends Quantity> extends DerivedUnit<Q> { 43 44 51 protected TransformedUnit(Unit<? super Q> parentUnit, Converter toParentUnit) { 52 while (parentUnit instanceof TransformedUnit) { 53 toParentUnit = parentUnit._toParentUnit.concatenate(toParentUnit); 54 parentUnit = parentUnit._parentUnit; 55 } 56 _parentUnit = parentUnit; 57 _toParentUnit = toParentUnit; 58 } 59 60 protected boolean equalsImpl(Object that) { 62 return (that instanceof TransformedUnit) 63 && (((TransformedUnit) that)._parentUnit == _parentUnit) 64 && ((TransformedUnit) that)._toParentUnit.equals(_toParentUnit); 65 } 66 67 protected int hashCodeImpl() { 69 return _parentUnit.hashCode() + _toParentUnit.hashCode(); 70 } 71 72 protected final Unit<? super Q> getParentUnitImpl() { 74 return _parentUnit; 75 } 76 77 protected final Converter toParentUnitImpl() { 79 return _toParentUnit; 80 } 81 82 private static final long serialVersionUID = 1L; 83 } | Popular Tags |