|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.isi.stella.Stella_Object
edu.isi.stella.Quantity
edu.isi.stella.utilities.DimNumber
public class DimNumber
Field Summary | |
---|---|
double |
magnitude
|
Ratio |
pid
|
java.lang.String |
preferredUnits
|
Constructor Summary | |
---|---|
DimNumber()
|
Method Summary | |
---|---|
DimNumber |
absoluteValue()
Computes abs( x ) |
static Stella_Object |
accessDimNumberSlotValue(DimNumber self,
Symbol slotname,
Stella_Object value,
boolean setvalueP)
|
DimNumber |
add(DimNumber y)
Computes x + y |
Quantity |
coerceTo(Stella_Object y)
Coerces y to be a compatible type with x . |
static boolean |
compatibleUnitsP(DimNumber x,
DimNumber y)
Returns TRUE if the units of x and y are compatible. |
static Cons |
degreesToDms(DimNumber d)
Convert decimal degrees to a list of (Degree Minute Second) where Degree and Minute are integer-valued. |
static TimeDuration |
dimToTimeDuration(DimNumber timeValue)
Converts the dimensioned number timeValue to its
equivalent value as a timeDuration object. |
DimNumber |
divide(DimNumber y)
Computes x / y |
DimNumber |
exponentiate(int y)
Computes x ^ y |
java.lang.String |
formatDimNumber(java.lang.String units,
int decimals)
Returns a string representation of x in units with decimals digits. |
Cons |
getBaseMeasures(java.lang.Object[] MV_returnarray)
Returns cons of the base measures for the numerator and denominator of self . |
java.lang.String |
getBaseUnit()
Returns the base units for the dim number. |
double |
getMagnitude(java.lang.String units)
Returns the magnitude of the dim number in the given units. |
Measure |
getMeasure()
Returns the measure for the dim number, if one is defined. |
java.lang.String |
getUnit()
Returns the units for the dim number. |
boolean |
greaterEqualP(Stella_Object y)
Computes x >= y |
boolean |
greaterP(Stella_Object y)
Computes x > y |
int |
hashCode_()
Return a hash code for self (can be negative). |
static Cons |
hoursToHms(DimNumber d)
Convert decimal hours to a list of (Hour Minute Second) where Hour and Minute are integer-valued. |
DimNumber |
invert()
Computes 1 / x |
boolean |
lessEqualP(Stella_Object y)
Computes x <= y |
boolean |
lessP(Stella_Object y)
Computes x < y |
static DimNumber |
makeDimNumber(double magnitude,
java.lang.String units)
|
DimNumber |
modulus(DimNumber y)
Computes the modulus of x and y . |
DimNumber |
multiply(DimNumber y)
Computes x * y |
DimNumber |
negate()
Computes - x |
static DimNumber |
newDimNumber(Ratio pid,
double magnitude)
|
boolean |
objectEqlP(Stella_Object y)
|
static DimNumber |
parseDimNumber(java.lang.String input)
|
Surrogate |
primaryType()
Returns the primary type of self . |
void |
printObject(java.io.PrintStream stream)
|
int |
signum()
Computes the signum of x : -1 if negative, 0 if zero, 1 if positive |
DimNumber |
squareRoot()
Computes the positive square root of x, assuming the units are perfect squares |
DimNumber |
subtract(DimNumber y)
Computes x - y |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public Ratio pid
public double magnitude
public java.lang.String preferredUnits
Constructor Detail |
---|
public DimNumber()
Method Detail |
---|
public static DimNumber parseDimNumber(java.lang.String input)
public static DimNumber makeDimNumber(double magnitude, java.lang.String units)
public static DimNumber newDimNumber(Ratio pid, double magnitude)
public static Cons hoursToHms(DimNumber d)
d
-
public static Cons degreesToDms(DimNumber d)
d
-
public static TimeDuration dimToTimeDuration(DimNumber timeValue)
timeValue
to its
equivalent value as a timeDuration
object. If timeValue
is not
of the appropriate units, an incompatibleUnitsException
is thrown.
timeValue
-
public boolean greaterP(Stella_Object y)
x
> y
greaterP
in class Quantity
y
-
public boolean greaterEqualP(Stella_Object y)
x
>= y
greaterEqualP
in class Quantity
y
-
public boolean lessEqualP(Stella_Object y)
x
<= y
lessEqualP
in class Quantity
y
-
public boolean lessP(Stella_Object y)
x
< y
lessP
in class Quantity
y
-
public DimNumber exponentiate(int y)
x
^ y
y
-
public DimNumber squareRoot()
public DimNumber absoluteValue()
x
)
public DimNumber invert()
x
public DimNumber negate()
x
public DimNumber modulus(DimNumber y)
x
and y
. x
and y
must be compatible
units, and the result has the preferred units of x
.
y
-
public DimNumber divide(DimNumber y)
x
/ y
y
-
public DimNumber multiply(DimNumber y)
x
* y
y
-
public DimNumber subtract(DimNumber y)
x
- y
y
-
public DimNumber add(DimNumber y)
x
+ y
y
-
public int signum()
x
: -1 if negative, 0 if zero, 1 if positive
public int hashCode_()
Stella_Object
self
(can be negative). Two objects that are eqlP
are guaranteed to generate the same hash code. Two objects that are not eqlP
do not necessarily generate different hash codes.
hashCode_
in class Stella_Object
public boolean objectEqlP(Stella_Object y)
objectEqlP
in class Stella_Object
public static boolean compatibleUnitsP(DimNumber x, DimNumber y)
x
and y
are compatible.
x
- y
-
public java.lang.String formatDimNumber(java.lang.String units, int decimals)
x
in units
with decimals
digits.
units
- decimals
-
public Cons getBaseMeasures(java.lang.Object[] MV_returnarray)
self
.
MV_returnarray
-
public Measure getMeasure()
public java.lang.String getBaseUnit()
public java.lang.String getUnit()
getBaseUnit
)
public double getMagnitude(java.lang.String units)
units
-
public Quantity coerceTo(Stella_Object y)
y
to be a compatible type with x
.
If this isn't possible, an exception is thrown. The exception
will be either INCOMPATIBLE-QUANTITY-EXCEPTION or
INCOMPATIBLE-UNITS-EXCEPTION.
coerceTo
in class Quantity
y
-
public void printObject(java.io.PrintStream stream)
printObject
in class Stella_Object
public static Stella_Object accessDimNumberSlotValue(DimNumber self, Symbol slotname, Stella_Object value, boolean setvalueP)
public Surrogate primaryType()
Stella_Object
self
.
Gets defined automatically for every non-abstract subclass of OBJECT.
primaryType
in class Stella_Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |