Number/ Unit).
Mass m = DefaultQuantityFactory.getInstance(Mass.class).create(23.0, KILOGRAM); // 23.0 kg
Time m = DefaultQuantityFactory.getInstance(Time.class).create(124, MILLI(SECOND)); // 124 ms
| Modifier and Type | Field and Description |
|---|---|
| private static final Map | |
| pack-priv static final java. | |
| pack-priv static final Map | |
| pack-priv static final java. | |
| private final Unit | systemUnit
The system unit for quantities created by this factory. |
| private final Class | type
The type of the quantities created by this factory. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public Quantity | create(Number
the numeric value stated in the specified unit value, Unit<Q> the unit unit)Implements javax. Returns the quantity for the specified number stated in the specified unit. |
| public Quantity | |
| private static <Q extends Quantity | |
| public boolean | equals(Object
the reference object with which to compare. obj)Overrides java. Indicates whether some other object is "equal to" this one. |
| public static < The type of the quantity Q extends Quantity | Returns: the quantity factory for the specified typethe quantity type type)Returns the default instance for the specified quantity type. |
| public Unit | getSystemUnit()
Implements javax. Returns the system unit for quantities produced by this factory or |
| public int | |
| public String |
| CLASS_TO_SYSTEM_UNIT | back to summary |
|---|---|
private static final Map<Class<T>, Unit<Q extends Quantity<Q>>> CLASS_TO_SYSTEM_UNIT
| |
| DEFAULT_LOG_LEVEL | back to summary |
|---|---|
| pack-priv static final java. | |
| INSTANCES | back to summary |
|---|---|
pack-priv static final Map<Class<T>, QuantityFactory<Q extends Quantity<Q>>> INSTANCES
| |
| LOGGER | back to summary |
|---|---|
| pack-priv static final java. | |
| systemUnit | back to summary |
|---|---|
| private final Unit<Q> systemUnit The system unit for quantities created by this factory. | |
| type | back to summary |
|---|---|
| private final Class<Q> type The type of the quantities created by this factory. | |
| DefaultQuantityFactory | back to summary |
|---|---|
private DefaultQuantityFactory(Class<Q> quantity)
| |
| create | back to summary |
|---|---|
| public Quantity Implements javax. Doc from javax. Returns the quantity for the specified number stated in the specified unit. | |
| create | back to summary |
|---|---|
| public Quantity Implements javax. Doc from javax. Returns the quantity for the specified number stated in the specified unit and scale. | |
| createNewFactoryInstance | back to summary |
|---|---|
| private static <Q extends Quantity | |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
| |
| getInstance | back to summary |
|---|---|
| public static <Q extends Quantity Returns the default instance for the specified quantity type.
| |
| getSystemUnit | back to summary |
|---|---|
| public Unit Implements javax. Doc from javax. Returns the system unit for quantities produced by this factory or Because the system unit is unique by quantity type, it can be be used to identify the quantity given the unit. For example:
static boolean isAngularSpeed(Unit<?> unit) {
return unit.getSystemUnit().equals(RADIAN.divide(SECOND));
}
assert isAngularSpeed(REVOLUTION.divide(MINUTE)); // Returns true.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |