edu.iris.Fissures.model
Class QuantityImpl
java.lang.Object
edu.iris.Fissures.Quantity
edu.iris.Fissures.model.QuantityImpl
- All Implemented Interfaces:
- java.io.Serializable, org.omg.CORBA.portable.IDLEntity, org.omg.CORBA.portable.Streamable, org.omg.CORBA.portable.StreamableValue, org.omg.CORBA.portable.ValueBase
- Direct Known Subclasses:
- TimeInterval
public class QuantityImpl
- extends edu.iris.Fissures.Quantity
QuantityImpl.java
Created: Wed Sep 1 17:43:50 1999
- See Also:
- Serialized Form
Field Summary |
protected java.text.NumberFormat |
format
|
Fields inherited from class edu.iris.Fissures.Quantity |
the_units, value |
Methods inherited from class edu.iris.Fissures.Quantity |
_read, _truncatable_ids, _type, _write |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
format
protected java.text.NumberFormat format
QuantityImpl
protected QuantityImpl()
QuantityImpl
public QuantityImpl(double f,
edu.iris.Fissures.Unit the_unit)
createEmpty
public static java.io.Serializable createEmpty()
createQuantityImpl
public static QuantityImpl createQuantityImpl(edu.iris.Fissures.Quantity q)
setDecimalFormat
public void setDecimalFormat(java.lang.String format)
- Sets the format using a java DecimalFormat.
- Parameters:
format
- - See Also:
http://java.sun.com/j2se/1.5.0/docs/api/java/text/DecimalFormat.html
setFormat
public void setFormat(java.text.NumberFormat format)
formatValue
public java.lang.String formatValue(java.lang.String format)
getValue
public double getValue()
getValue
public double getValue(UnitImpl unit)
setValue
protected void setValue(double value)
get_value
public double get_value()
getUnit
public UnitImpl getUnit()
setUnit
protected void setUnit(UnitImpl unit)
get_unit
public UnitImpl get_unit()
convertTo
public QuantityImpl convertTo(UnitImpl newUnit)
- converts this Quantity into the given units.
- Throws:
java.lang.IllegalArgumentException
- if the given units are
not compatible.
add
public QuantityImpl add(QuantityImpl q)
subtract
public QuantityImpl subtract(QuantityImpl q)
multiplyBy
public QuantityImpl multiplyBy(QuantityImpl q)
divideBy
public QuantityImpl divideBy(QuantityImpl q)
multiplyBy
public QuantityImpl multiplyBy(double f)
divideBy
public QuantityImpl divideBy(double f)
abs
public QuantityImpl abs()
inverse
public QuantityImpl inverse()
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
greaterThan
public boolean greaterThan(QuantityImpl q)
greaterThanEqual
public boolean greaterThanEqual(QuantityImpl q)
lessThan
public boolean lessThan(QuantityImpl q)
lessThanEqual
public boolean lessThanEqual(QuantityImpl q)
hashCode
public int hashCode()
- Overrides:
hashCode
in class java.lang.Object
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in class java.lang.Object
main
public static void main(java.lang.String[] args)