Package net.sf.basedb.util.units
Class UnitCache.CacheKey
java.lang.Object
net.sf.basedb.util.units.UnitCache.CacheKey
- All Implemented Interfaces:
Comparable<UnitCache.CacheKey>
- Enclosing class:
- UnitCache
Units are cached by (quantity,symbol) combination. This
class is used as keys to the cache and overrides the
equals and hashcode methods to makes sure that
two keys with the same quantity and symbol are considered
equal.
This class also implements the comparable interface so that it is possible to sort units in the order of their symbols. If two symbols are equal the one with the lowes quantity id is sorted first.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
boolean
int
hashCode()
From the Object class ---------------------
-
Field Details
-
quantityId
private final int quantityId -
symbol
-
-
Constructor Details
-
CacheKey
CacheKey(int quantityId, String symbol)
-
-
Method Details
-
hashCode
public int hashCode()From the Object class --------------------- -
equals
-
compareTo
- Specified by:
compareTo
in interfaceComparable<UnitCache.CacheKey>
-