|
JSR-275 - Measurements and Units Specification | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.measure.Measure<V,Q>
public abstract class Measure<V,Q extends Quantity>
This class represents the result of a measurement stated in a known unit.
This class can represents any kind of measure (scalar, vector, statistical).
A factory method for numerical quantities (java.lang.Number
)
is provided
.
Constructor Summary | |
---|---|
protected |
Measure(V value,
Unit<Q> unit)
Creates a measure for the specified value stated in the specified unit. |
Method Summary | ||
---|---|---|
int |
compareTo(Measurable<Q> that)
Compares this measure with the one specified independently of the measurement units. |
|
boolean |
equals(java.lang.Object obj)
Compares this measure against the specified object for strict equality (same unit and amount). |
|
Unit<Q> |
getUnit()
Returns the measurement unit of this measure. |
|
V |
getValue()
Returns the measurement value of this measure. |
|
int |
hashCode()
Returns the hash code for this scalar. |
|
java.lang.String |
toString()
Returns the String representation of this measure. |
|
static
|
valueOf(N value,
Unit<Q> unit)
Returns the measure for the specified numerical quantity. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface javax.measure.Measurable |
---|
doubleValue, longValue |
Constructor Detail |
---|
protected Measure(V value, Unit<Q> unit)
Method Detail |
---|
public static <N extends java.lang.Number,Q extends Quantity> Measure<N,Q> valueOf(N value, Unit<Q> unit)
value
- the measurement value.unit
- the measurement unit.public final V getValue()
public final Unit<Q> getUnit()
public int compareTo(Measurable<Q> that)
compareTo
in interface java.lang.Comparable<Measurable<Q extends Quantity>>
that
- the quantity to compare with.
public boolean equals(java.lang.Object obj)
compareTo(javax.measure.Measurable)
method should be used.
equals
in class java.lang.Object
obj
- the object to compare with.
true
if both objects are identical (same
unit and same amount); false
otherwise.public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
String
representation of this measure.
toString
in class java.lang.Object
this.getValue() + " " + this.getUnit()
|
JSR-275 - Measurements and Units Specification | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |