\r
protected Set<Unit<?>> units = new HashSet<Unit<?>>();\r
\r
- @SuppressWarnings("unchecked")\r
- UnitPreference( Unit u[] ){\r
- for ( Unit uu : u )\r
+ UnitPreference( Unit<?> u[] ){\r
+ for ( Unit<?> uu : u )\r
units.add(uu);\r
}\r
\r
@SuppressWarnings("unchecked")\r
- public Unit getPreferredUnit(Unit u){\r
+ public <T extends Quantity> Unit<T> getPreferredUnit(Unit<T> u){\r
if ( units.contains(u) )\r
return u;\r
- for( Unit ret : units ){\r
+ for( Unit<?> ret : units ){\r
if ( ret.isCompatible(u) ){\r
- return ret;\r
+ return (Unit<T>) ret;\r
}\r
}\r
return u;\r
}\r
}\r
\r
- @SuppressWarnings("unchecked")\r
public static <T extends Quantity> String approx(Amount<T> a) {\r
if (a == null)\r
return "NULL";\r