|
JScience v3.3 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.lang.Number
javax.measure.quantities.Scalar<Q>
public class Scalar<Q extends Quantity>
This class represents a simple quantity implementation, that is completely specified by its magnitude and has no direction.
Instances of this class are immutable
| Constructor Summary | |
|---|---|
Scalar(double amount,
Unit<Q> unit)
Creates a scalar quantity of specified amount stated in the specified unit. |
|
| Method Summary | |
|---|---|
int |
compareTo(Quantity<Q> that)
Compares the value of this quantity to the specified quantity value both stated using the same unit. |
double |
doubleValue()
Returns the amount as a double. |
double |
doubleValue(Unit<Q> unit)
Returns the estimated value of this quantity stated in the specified unit as a double. |
boolean |
equals(java.lang.Object that)
Compares this scalar against the specified object. |
float |
floatValue()
Returns the amount as a float. |
double |
getAmount()
Returns the amount stated in this scalar quantity unit. |
Unit<Q> |
getUnit()
Returns the unit used for this scalar quantity. |
int |
hashCode()
Returns the hash code for this scalar. |
int |
intValue()
Returns the amount as an int. |
long |
longValue()
Returns the amount as a long. |
long |
longValue(Unit<Q> unit)
Returns the estimated value of this quantity stated in the specified unit as a long. |
| Methods inherited from class java.lang.Number |
|---|
byteValue, shortValue |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Scalar(double amount,
Unit<Q> unit)
amount - the quantity amount stated in the specified unit.unit - the unit used to specified the amount| Method Detail |
|---|
public final double getAmount()
unit.
public final Unit<Q> getUnit()
public final double doubleValue(Unit<Q> unit)
Quantitydouble.
doubleValue in interface Quantity<Q extends Quantity>unit - the unit in which the measurement value is stated.
double.
public final long longValue(Unit<Q> unit)
throws java.lang.ArithmeticException
Quantitylong.
longValue in interface Quantity<Q extends Quantity>unit - the unit in which the measurement value is stated.
long.
java.lang.ArithmeticException - if this quantity cannot be represented
as a long number in the specified unit.public int compareTo(Quantity<Q> that)
compareTo in interface java.lang.Comparable<Quantity<Q extends Quantity>>that - the quantity to compare with.
public final int intValue()
int.
This may involve rounding or truncation.
intValue in class java.lang.Numberint.public final long longValue()
long.
This may involve rounding or truncation.
longValue in class java.lang.Numberlong.public final float floatValue()
float.
This may involve rounding.
floatValue in class java.lang.Numberfloat.public final double doubleValue()
double.
doubleValue in class java.lang.Numberdouble.public boolean equals(java.lang.Object that)
equals in class java.lang.Objectthat - the object to compare with.
true if the objects are the same;
false otherwise.public int hashCode()
hashCode in class java.lang.Object
|
JScience v3.3 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||