JScience v2.0

org.jscience.physics.quantities
Class Quantity.Factory<Q extends Quantity>

java.lang.Object
  extended by javolution.realtime.ObjectFactory<T>
      extended by javolution.realtime.RealtimeObject.Factory<Q>
          extended by org.jscience.physics.quantities.Quantity.Factory<Q>
Enclosing class:
Quantity

public abstract static class Quantity.Factory<Q extends Quantity>
extends RealtimeObject.Factory<Q>

This inner-class represents the factory producing quantity instances. Quantity instances.


Constructor Summary
protected Quantity.Factory()
          Default constructor.
protected Quantity.Factory(Unit<Q> unit)
          Creates a new factory and associates it to the specified unit.
 
Method Summary
 Quantity.Factory<Q> useFor(Unit unit)
          Maps the specified unit to this factory.
 
Methods inherited from class javolution.realtime.RealtimeObject.Factory
newPool, object
 
Methods inherited from class javolution.realtime.ObjectFactory
cleanup, create, currentPool, heapPool, newObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Quantity.Factory

protected Quantity.Factory()
Default constructor.


Quantity.Factory

protected Quantity.Factory(Unit<Q> unit)
Creates a new factory and associates it to the specified unit.

Parameters:
unit - the unit to which this factory is used for.
See Also:
useFor(Unit)
Method Detail

useFor

public Quantity.Factory<Q> useFor(Unit unit)
Maps the specified unit to this factory. Quantities having the specified unit will be automatically produced by this factory.

Parameters:
unit - the unit mapped to this factory.
Returns:
this
Throws:
java.lang.IllegalArgumentException - if the unit is already associated to another factory.

JScience v2.0

Copyright © 2005 JScience.