|
JADE v6.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.dautelle.realtime.ObjectFactory
com.dautelle.math.numbers.RealtimeNumber.Factory
com.dautelle.physics.Quantity.Factory
This inner-class represents the
ObjectFactory
producing
Quantity
instances.
Field Summary |
Fields inherited from class com.dautelle.realtime.ObjectFactory |
MAX |
Constructor Summary | |
protected |
Quantity.Factory(Unit systemUnit)
Creates a new factory producing quantities whose nature is identified by the specified system unit. |
Method Summary | |
java.lang.Object |
create()
Returns a new quantity product of this factory. |
static Quantity.Factory |
getInstance(Unit unit)
Returns the Quantity.Factory producing quantities identified
by the specified unit. |
Unit |
getUnit()
Returns the system unit for the Quantity instances created
by this Quantity.Factory . |
protected Quantity |
newQuantity()
This method should be overriden by sub-classes to return a new instance allocated on the heap. |
Quantity |
quantity(Quantity quantity)
Returns an instance of this factory equivalent to the specified quantity. |
Quantity |
rangeApprox(double min,
double max)
Returns the quantity corresponding to the specified approximate range. |
Quantity |
rangeExact(double min,
double max)
Returns the quantity corresponding to the specified exact range. |
void |
showInstancesAs(Unit outputUnit)
Shows instances of this factory in the specified output unit (context-local). |
Quantity.Factory |
useFor(Unit unit)
Maps the specified unit to this Quantity.Factory . |
Methods inherited from class com.dautelle.math.numbers.RealtimeNumber.Factory |
newPool, object |
Methods inherited from class com.dautelle.realtime.ObjectFactory |
cleanup, currentPool, heapPool |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected Quantity.Factory(Unit systemUnit)
systemUnit
- the system unit for the quantities produced by
this factory.
java.lang.IllegalArgumentException
- if the specified unit is not a
system unit.
java.lang.IllegalArgumentException
- if another factory already
produces the same quantities.Method Detail |
public static Quantity.Factory getInstance(Unit unit)
Quantity.Factory
producing quantities identified
by the specified unit.
unit
- the unit identifying the factory to return.
public final Unit getUnit()
Quantity
instances created
by this Quantity.Factory
.
public Quantity.Factory useFor(Unit unit)
Quantity.Factory
.
This method allows for additional units to be mapped to this
Quantity.Factory
. For example:Factory.getInstance(Unit.valueOf("1/s")).useFor(SI.HERTZ);Typically, such additional mapping is the responsibility of the physical models (e.g.
StandardModel
for the mapping of SI derived units).
unit
- the unit being mapped to this Quantity.Factory
.
java.lang.IllegalArgumentException
- if this factory's unit and
the specified unit are not compatible.public void showInstancesAs(Unit outputUnit)
outputUnit
- the output unit for instances of this
Quantity.Factory
.PhysicalModel.current()
,
LocalContext
protected Quantity newQuantity()
Note: This method should never be called directly.
Allocation of a new quantity amounting to nothing
should be performed using create()
.
public final java.lang.Object create()
create
in class ObjectFactory
public final Quantity quantity(Quantity quantity)
quantity
- the quantity reference.
ConversionException
- if the current model does not allow the
specified quantity to be stated in this factory's system
unit.public final Quantity rangeExact(double min, double max)
min
- the minimum amount stated in this factory system unit.max
- the maximum amount stated in this factory system unit.
public final Quantity rangeApprox(double min, double max)
min
- the minimum amount stated in this factory system unit.max
- the maximum amount stated in this factory system unit.
|
JADE v6.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |