com.rubecula.jquantity
Class ValueType

java.lang.Object
  |
  +--java.lang.Number
        |
        +--com.rubecula.jquantity.BaseNumber
              |
              +--com.rubecula.jquantity.Manifest
                    |
                    +--com.rubecula.jquantity.ValueType
All Implemented Interfaces:
Arithmetical, Auditable, java.lang.Comparable, Fuzzy, Integral, Presentable, java.io.Serializable

public final class ValueType
extends Manifest

This public final class extends Manifest to define types for Values.

Version:
$Revision: 1.2 $
Author:
Robin Hillyard
See Also:
Serialized Form

Field Summary
(package private) static ValueType $Angle
           
(package private) static ValueType $ClassExp
           
(package private) static ValueType $ClassLog
           
(package private) static java.lang.String[] $ClassNamesFull
           
(package private) static ValueType $ClassNone
           
(package private) static ValueType $ClassReal
           
(package private) static ValueType $Exp
           
(package private) static ValueType $Log
           
(package private) static ValueType $None
           
(package private) static ValueType $RealAbs
           
(package private) static ValueType $RealAngle
           
(package private) static ValueType $RealRel
           
(package private) static java.lang.String[] $TypeNamesBrief
           
(package private) static java.lang.String[] $TypeNamesFull
           
(package private) static ValueType COMPLEX_POLAR
           
(package private) static int Conversion_arctanTimes2
           
(package private) static int Conversion_exp
           
(package private) static int Conversion_log
           
(package private) static int Conversion_none
          Constants defined for conversion operations.
(package private) static int Conversion_product
           
(package private) static int Conversion_quotient
           
(package private) static int Conversion_RealAbs
           
(package private) static int Conversion_RealRel
           
(package private) static int Conversion_special
           
(package private) static int Conversion_tanThetaBy2
           
 
Fields inherited from class com.rubecula.jquantity.Manifest
$__1, $0, $1, $10, $10L, $2, $3
 
Fields inherited from interface com.rubecula.jquantity.Fuzzy
$DistGaussian, $DistInvalid, $DistNone, $DistUniform, $Names
 
Constructor Summary
ValueType(int type)
          Constructor to create a new ValueType based on value type.
 
Method Summary
 boolean absBoundType()
          Method to determine if this type goes with absolute bounds in a TValue.
 java.lang.String audit(java.lang.String label)
          Method to return a detailed string from an object for debugging purposes.
 boolean canCast(ValueType to)
          Method returns true if it is legal to cast a value of type from to type to Identities are considered uncastable Note that casting always changes the effective value, without changing the correponding value shown
(package private)  int conversion(ValueType newType)
           
(package private)  ValueType getCastingType()
           
 java.lang.String getIdentifier()
          Method to get the specific identifier for an object.
(package private)  ValueType getTypeClass()
           
(package private)  boolean hasSameClass(ValueType other)
          Method to determine of two ValueTypes are of same class.
 boolean isAngular()
          Convenience method to determine if this ValueType is of class Angle or Real Angle.
 boolean isExp()
          Convenience method to determine if this ValueType is of class Exp.
 boolean isLogAngle()
          Convenience method to determine if this ValueType is of class Log.
 boolean isReal()
          Convenience method to determine if this ValueType is of class Real.
 java.lang.String toString()
          This is the default toString method for all BaseNumbers.
static ValueType valueOf(java.lang.String type)
          Get a ValueType based on a string representation.
 
Methods inherited from class com.rubecula.jquantity.Manifest
audit, audit, compareTo, compareTo, compareTo, difference, doubleValue, factored, floatValue, intValue, isInfinite, isInteger, isPowerOfTen, isUnity, longValue, makePresentableInstance, minus, pow, present, product, scaled, signum, sum, toBigInteger
 
Methods inherited from class com.rubecula.jquantity.BaseNumber
abs, bestModel, BestModel, Characteristic, compareTo, getBound, getBoundAbs, getModel, impartFuzziness, isEqual, isExact, isUncertain, isZero, present, test, test, valueOfLog10, Wrap
 
Methods inherited from class java.lang.Number
byteValue, shortValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.rubecula.jquantity.Integral
isExact, isZero
 

Field Detail

$TypeNamesBrief

static final java.lang.String[] $TypeNamesBrief

$TypeNamesFull

static final java.lang.String[] $TypeNamesFull

$ClassNamesFull

static final java.lang.String[] $ClassNamesFull

$None

static final ValueType $None

$Angle

static final ValueType $Angle

$Log

static final ValueType $Log

$RealAngle

static final ValueType $RealAngle

$RealAbs

static final ValueType $RealAbs

$RealRel

static final ValueType $RealRel

$Exp

static final ValueType $Exp

$ClassNone

static final ValueType $ClassNone

$ClassReal

static final ValueType $ClassReal

$ClassLog

static final ValueType $ClassLog

$ClassExp

static final ValueType $ClassExp

COMPLEX_POLAR

static final ValueType COMPLEX_POLAR

Conversion_none

static final int Conversion_none
Constants defined for conversion operations. These are used by class Value.

See Also:
Constant Field Values

Conversion_exp

static final int Conversion_exp
See Also:
Constant Field Values

Conversion_tanThetaBy2

static final int Conversion_tanThetaBy2
See Also:
Constant Field Values

Conversion_log

static final int Conversion_log
See Also:
Constant Field Values

Conversion_arctanTimes2

static final int Conversion_arctanTimes2
See Also:
Constant Field Values

Conversion_RealRel

static final int Conversion_RealRel
See Also:
Constant Field Values

Conversion_RealAbs

static final int Conversion_RealAbs
See Also:
Constant Field Values

Conversion_quotient

static final int Conversion_quotient
See Also:
Constant Field Values

Conversion_product

static final int Conversion_product
See Also:
Constant Field Values

Conversion_special

static final int Conversion_special
See Also:
Constant Field Values
Constructor Detail

ValueType

public ValueType(int type)
Constructor to create a new ValueType based on value type.

Parameters:
type - an integer to distinguish types.
Method Detail

valueOf

public static ValueType valueOf(java.lang.String type)
Get a ValueType based on a string representation.

Parameters:
type - the string form of the type.
Returns:
the type corresponding to string type.

isReal

public boolean isReal()
Convenience method to determine if this ValueType is of class Real.

Returns:
true if type class of this is ClassReal.

isLogAngle

public boolean isLogAngle()
Convenience method to determine if this ValueType is of class Log.

Returns:
true if type class of this is ClassLog.

isAngular

public boolean isAngular()
Convenience method to determine if this ValueType is of class Angle or Real Angle.

Returns:
true if type of this is either #Angle or #RealAngle.

isExp

public boolean isExp()
Convenience method to determine if this ValueType is of class Exp.

Returns:
true if type class of this is ClassExp.

hasSameClass

final boolean hasSameClass(ValueType other)
Method to determine of two ValueTypes are of same class.

Parameters:
other - the ValueType to compare.
Returns:
true if this and other belong to same class.

getTypeClass

final ValueType getTypeClass()

getCastingType

final ValueType getCastingType()

conversion

final int conversion(ValueType newType)

canCast

public final boolean canCast(ValueType to)
Method returns true if it is legal to cast a value of type from to type to Identities are considered uncastable Note that casting always changes the effective value, without changing the correponding value shown

Parameters:
to - the type to which a Value might be cast.
Returns:
true if a Typed object of type this can be cast to type to.

absBoundType

public final boolean absBoundType()
Method to determine if this type goes with absolute bounds in a TValue.

Returns:
true if the type is None, Angle, Log, RealAbs or RealAngle.

toString

public java.lang.String toString()
Description copied from class: BaseNumber
This is the default toString method for all BaseNumbers. Specific classes will override as appropriate.

Overrides:
toString in class Manifest
Returns:
"ValueType: " followed by the identifier.

getIdentifier

public java.lang.String getIdentifier()
Method to get the specific identifier for an object.

Specified by:
getIdentifier in interface Auditable
Overrides:
getIdentifier in class Manifest
Returns:
String: the identifier.

audit

public java.lang.String audit(java.lang.String label)
Method to return a detailed string from an object for debugging purposes.

Specified by:
audit in interface Auditable
Overrides:
audit in class Manifest
Parameters:
label - String: the label to associate with the data
Returns:
the detailed string.