|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.lang.Number
|
+--com.rubecula.jquantity.BaseNumber
|
+--com.rubecula.jquantity.MutableNumber
|
+--com.rubecula.jquantity.Rational
|
+--com.rubecula.jquantity.Value
This public class extends Rational by adding a type.
This class is used to represent [dimensionless, non-complex] values. Value is either precise or has known, ie. bound, precision. There are two "values" which pertain to an instance of Value:
| Nested Class Summary | |
class |
Value.ValueException
|
| Nested classes inherited from class com.rubecula.jquantity.Rational |
Rational.RValueException |
| Field Summary | |
(package private) static Value |
$1
|
(package private) static Value |
$2
|
(package private) static Value |
$Half
|
(package private) static Value |
$Pi
|
| Fields inherited from class com.rubecula.jquantity.Rational |
_Denominator, _Estimate, _Numerator, $_2Pi, $_c, $_degF, $_degR, $_Degree2Radian, $_Pi_12, $_Pi_2, $_Pi_4, $_Tan15Deg, $_Tan30Deg, $0, $1_2, $10, $12, $3, $6, $E, $Infinity, $MaxInt, $NaN, $Rt2, $Rt3, $Rt5, $S_Rt2, $S_Rt3, $S_Rt5 |
| Fields inherited from class com.rubecula.jquantity.MutableNumber |
$__1 |
| Fields inherited from interface com.rubecula.jquantity.Fuzzy |
$DistGaussian, $DistInvalid, $DistNone, $DistUniform, $Names |
| Constructor Summary | |
Value(Rational value)
Constructor for a Value to extend an Rational with type RealAbs. |
|
Value(Rational value,
ValueType type)
Alternative (almost primary) constructor for a Value. |
|
| Method Summary | |
boolean |
absBound()
|
void |
add(BaseNumber that)
MUTATING Instance method to add another Arithmetical into this object. |
(package private) Value |
arctanTimes2(ValueType newType)
|
Trigonometrical |
arctanX2()
Method to evaluate the arctangent function. |
java.lang.String |
audit(java.lang.String label)
Method to return a detailed string from an arithmetical object for debugging purposes. |
void |
cast(ValueType type)
MUTATING METHOD! This method sets the type of the object to be type. |
Value |
casted(ValueType type)
This method yields a copy of this but cast to be of type type. |
protected void |
cftest(java.io.PrintStream out,
Integral check)
|
protected void |
cftest(java.io.PrintStream out,
java.lang.Object check)
|
java.lang.Object |
clone()
Creates and returns a copy of this object. |
int |
compareTo(Integral val)
Compares this Value with the specified Integral. |
int |
compareTo(Value that)
Compares this Rational with the specified Rational. |
(package private) boolean |
congruent(Value that)
|
void |
convert()
MUTATING METHOD! This method sets the type of the object to be type $RealAbs. |
void |
convert(ValueType type)
MUTATING METHOD! This method sets the type of the object to be type. |
Value |
converted()
This method yields a copy of this but converted to be of type ValueType.$RealAbs. |
Value |
converted(ValueType type)
This method yields a copy of this but converted to be of type type. |
protected BaseNumber |
difference(BaseNumber subtrahend)
Method to yield the difference of this less a BaseNumber (subtrahend). |
(package private) Value |
difference(Value x)
|
(package private) Value |
difference(Value x,
ValueType context)
|
Value |
differenceValue(Value subtrahend)
Method to yield the difference of this less a BaseNumber (subtrahend). |
void |
divide(BaseNumber divisor)
MUTATING method to replace this by the quotient of this over divisor. |
(package private) double |
doubleValue(boolean forceRealContext)
|
Trigonometrical |
exp()
Method to evaluate the exponential function. |
(package private) Value |
exp(ValueType newType)
Method for raising e to the power of this Value. |
(package private) Value |
fold(Value limit)
Method to force this into a specific range. |
(package private) Value |
forceTypeReal()
Method to form a version of this such that the type is Real (Rel or Abs). |
(package private) static Value |
FullCircles(int n)
|
(package private) Value |
gcd(Value that)
|
double |
getBoundAbs(boolean absolute)
|
double |
getRealValue()
This method is used to get the the true value of this. |
ValueType |
getType()
Method to get the type of this object. |
ValueType |
getTypeClass()
Method to get the type class of this object. |
int |
hashCode()
|
boolean |
hasSameClass(Rational other)
|
boolean |
hasSameClass(ValueType type)
|
Divisible |
inverse()
Method to yield the reciprocal of this and return it as the result. |
Value |
inverseValue()
|
(package private) boolean |
isEqual(Value that)
|
boolean |
isExp()
Conventience method to determine if this ValueType is of class Exp. |
boolean |
isLogAngle()
Conventience method to determine if this ValueType is of class Log. |
(package private) boolean |
isParallel(Value that)
|
boolean |
isReal()
Method to determine if this is real-typed. |
Trigonometrical |
log()
Method to evaluate the natural log function. |
(package private) Value |
log(ValueType newType)
|
static void |
main(java.lang.String[] args)
Main method for testing this class. |
Value |
minusValue()
Method to yield a copy of this but with the sign changed. |
void |
multiply(BaseNumber factor)
MUTATING Instance method to multiply another BaseNumber into this object. |
void |
multiply(Value factor)
MUTATING Instance method to multiply another Value into this object. |
static Presentable |
Parse(Presentation x)
Create a WholeNumber from a Presentation and return it as a Presentable. |
(package private) int |
places()
|
protected BaseNumber |
pow(int power)
Method to raise this to the power power return the result. |
(package private) Value |
power(int index)
|
(package private) Value |
power(Value power)
|
(package private) int |
precisionPlaces()
|
Presentation |
present(AttrMap attributes)
Convert this Presentable object into a Presentation, according to the set of attributes provided. |
Value |
productValue(Value multiplicand)
Method to multiply multiplicand to this and return their product as the result. |
Value |
quotientValue(Value divisor)
|
void |
raiseToPower(int x)
MUTATING Instance method to raise this to power x. |
(package private) Value |
rootValue(int p)
|
void |
scale(double factor)
MUTATING Instance method to multiply this by a scale factor. |
void |
scale(long x)
MUTATING Instance method to multiply this by a scale factor. |
void |
setType(ValueType type)
Method to set the type of this object. |
Value |
sign(BaseNumber that)
|
(package private) Value |
sqrt()
|
(package private) Value |
square()
|
Value |
sum(BaseNumber addend,
ValueType context)
Method to add addend to this and return their sum as the result. |
Value |
sum(Value that,
ValueType context)
Method to add addend to this and return their sum as the result. |
Value |
sumValue(BaseNumber addend)
Method to add addend to this and return their sum as the result. |
Trigonometrical |
tan_theta_2()
Method to evaluate the tangent function. |
(package private) Value |
tanThetaBy2(ValueType newType)
|
protected void |
test(java.io.PrintStream out,
Value check)
|
protected void |
test(java.io.PrintStream out,
Value check,
java.lang.String label)
|
(package private) void |
timesTenToPower(int power)
|
(package private) Rational |
toRational()
Method to narrows this object to a Rational, converting to a real context if necessary. |
java.lang.String |
toString()
This is the default toString method for all BaseNumbers. |
(package private) java.lang.String |
toString(int style)
|
static Value |
toValue(NumberPresentation presentation)
Factory method to create a non-angular Value from a NumberPresentation. |
static Value |
toValue(NumberPresentation presentation,
boolean angle)
Factory method to create a (possibly angular) Value from a NumberPresentation. |
(package private) static Value |
TwentyfourthCircles(int n)
|
void |
updateRealEstimate()
MUTATING METHOD! This method does not affect the critical values of this object. |
static Value |
valueOfPowerOfTen(int x)
|
| Methods inherited from class com.rubecula.jquantity.MutableNumber |
factored, forcePositive, getIdentifier, isLong, product, setIdentifier, setIdentifierPost, setIdentifierPre, sum, test |
| Methods inherited from class com.rubecula.jquantity.BaseNumber |
abs, audit, audit, bestModel, BestModel, Characteristic, compareTo, impartFuzziness, isEqual, isUncertain, isZero, present, test, test, valueOfLog10, Wrap |
| Methods inherited from class java.lang.Number |
byteValue, shortValue |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
static final Value $Pi
static final Value $2
static final Value $1
static final Value $Half
| Constructor Detail |
public Value(Rational value,
ValueType type)
value - the object which will effectively be extended.type - the type of the new object from the list:
None,Angle,Log,RealAngle,RealAbs,RealRel,Exp.public Value(Rational value)
value - Rational: the object which will effectively be extended.| Method Detail |
public static Presentable Parse(Presentation x)
x - A presentation which should be parsed to form a Presentable.
public java.lang.Object clone()
clone in class RationalRationalException - : Rational not Cloneable (should be impossible)Cloneablepublic void setType(ValueType type)
setType in interface Typedtype - the new type for this.public ValueType getType()
getType in interface Typedpublic ValueType getTypeClass()
getTypeClass in interface Typedpublic boolean isReal()
isReal in interface Typedpublic void cast(ValueType type)
cast in interface Typedtype - the new type.public void convert(ValueType type)
convert in interface Typedtype - the new type.public double getRealValue()
getRealValue in interface Typedpublic void updateRealEstimate()
updateRealEstimate in interface Typedpublic java.lang.String audit(java.lang.String label)
audit in interface Auditableaudit in class Rationallabel - the label to associate with the data.
public void add(BaseNumber that)
add in interface Arithmutableadd in class Rationalthat - the addend.
public void multiply(BaseNumber factor)
throws InvalidOperandException
multiply in interface Arithmutablemultiply in class Rationalfactor - the multiplicand.
InvalidOperandException - if that is not compatible with the multiply operation.public void scale(long x)
scale in interface Arithmutablescale in class Rationalx - the scale factor.public void raiseToPower(int x)
raiseToPower in interface ArithmutableraiseToPower in class Rationalx - the number of times this should be multiplied by itself.
protected BaseNumber difference(BaseNumber subtrahend)
throws InvalidOperandException
difference in class BaseNumbersubtrahend - the number to subtract from this.
InvalidOperandException - if that is not compatible with the
difference operation.protected BaseNumber pow(int power)
pow in class Rationalpower - the exponent for this.
public void multiply(Value factor)
throws InvalidOperandException
if this is real,
then multiply the stored value by factor converted to type of
this;
else if factor is real,
then #multiply(BaseNumber) by factor;
else if both instances have same class and that class is log/angle,
then add the stored value of factor into this;
else
convert this to a real and (recursively) multiply by factor.
factor - the multiplicand.
InvalidOperandException - if that is not compatible with the
multiply operation.public void convert()
public Value minusValue()
public Value sum(BaseNumber addend,
ValueType context)
addend - the number to add to this.context - the context (a ValueType) in which the sum is to be performed.
public Value sum(Value that,
ValueType context)
that - the number to add to this.context - the context (a ValueType) in which the sum is to be performed.
public Value sumValue(BaseNumber addend)
addend - the number to add to this.
public Value differenceValue(Value subtrahend)
subtrahend - the number to subtract from this.
public Value productValue(Value multiplicand)
multiplicand - the number to add to this.
public void scale(double factor)
scale in class Rationalfactor - the scale factor.
public void divide(BaseNumber divisor)
throws InvalidOperandException
divide in class Rationaldivisor - the value to be divided into this.
InvalidOperandException - if that is not compatible with the
divide operation.public Divisible inverse()
inverse in interface Divisibleinverse in class Rationalpublic Value converted(ValueType type)
type - the new type.
public Value converted()
public Value casted(ValueType type)
type - the type to be forced in.
public Value quotientValue(Value divisor)
public int compareTo(Value that)
that - Rational to which this Rational is to be compared.
public int compareTo(Integral val)
compareTo in class Rationalval - Integral to which this Integral is to be compared.
final boolean congruent(Value that)
final boolean isEqual(Value that)
final double doubleValue(boolean forceRealContext)
throws JQuantityException
JQuantityExceptionpublic Trigonometrical exp()
exp in interface Trigonometricalexp in class Rationalpublic Trigonometrical log()
log in interface Trigonometricallog in class Rationalpublic Trigonometrical arctanX2()
arctanX2 in interface TrigonometricalarctanX2 in class Rationalpublic Trigonometrical tan_theta_2()
tan_theta_2 in interface Trigonometricaltan_theta_2 in class Rational
final Value arctanTimes2(ValueType newType)
throws JQuantityException
JQuantityException
final Value exp(ValueType newType)
throws JQuantityException
newType - The required type for the new object.
JQuantityException
final Value gcd(Value that)
throws JQuantityException
JQuantityExceptionpublic double getBoundAbs(boolean absolute)
public boolean hasSameClass(Rational other)
public boolean hasSameClass(ValueType type)
public boolean isLogAngle()
public boolean isExp()
public boolean absBound()
public int hashCode()
hashCode in class Rationalpublic final Value inverseValue()
final boolean isParallel(Value that)
throws JQuantityException
JQuantityException
final Value log(ValueType newType)
throws JQuantityException
JQuantityException
final int places()
throws JQuantityException
places in class RationalJQuantityException
final Value power(int index)
throws JQuantityException
JQuantityException
final Value power(Value power)
throws JQuantityException
JQuantityExceptionpublic final Value sign(BaseNumber that)
final Value sqrt()
throws JQuantityException
JQuantityException
final Value rootValue(int p)
throws JQuantityException
JQuantityExceptionvoid timesTenToPower(int power)
timesTenToPower in class Rational
final Value difference(Value x,
ValueType context)
throws JQuantityException
JQuantityException
final Value difference(Value x)
throws JQuantityException
JQuantityException
Value fold(Value limit)
throws JQuantityException
limit - defines the range (-limit < magnitude <= +limit).
JQuantityException - Value.fold(Value): cannot fold by different type.
final Value tanThetaBy2(ValueType newType)
throws JQuantityException
JQuantityExceptionfinal Rational toRational()
final Value forceTypeReal()
final int precisionPlaces()
throws JQuantityException
JQuantityException
final Value square()
throws JQuantityException
JQuantityExceptionfinal java.lang.String toString(int style)
public final java.lang.String toString()
BaseNumber
toString in class Rational
public Presentation present(AttrMap attributes)
throws PresentationException
Rational
present in interface Presentablepresent in class Rationalattributes - the map of attributes required for the resulting
presentation.
PresentationException - if unable to parse appropriately.public static Value valueOfPowerOfTen(int x)
public static Value toValue(NumberPresentation presentation,
boolean angle)
throws JQuantityException
presentation - the representation of desired Value.angle - whether the new Value is angular or not.
JQuantityException
public static Value toValue(NumberPresentation presentation)
throws JQuantityException
presentation - the representation of desired Value.
JQuantityExceptionstatic final Value TwentyfourthCircles(int n)
static final Value FullCircles(int n)
protected void cftest(java.io.PrintStream out,
java.lang.Object check)
protected void cftest(java.io.PrintStream out,
Integral check)
protected void test(java.io.PrintStream out,
Value check,
java.lang.String label)
protected void test(java.io.PrintStream out,
Value check)
public static void main(java.lang.String[] args)
args - String[] : the command line options.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||