public abstract class Conversion extends Object
Conversion
(usually of type Conversion.Add
or
Conversion.Mul
is returned from the evaluation.Modifier and Type | Class and Description |
---|---|
static class |
Conversion.Add
Sums all
Conversion instances via BigDecimal.add(BigDecimal) . |
static class |
Conversion.Int
Simply is a representation of a possibly large integer.
|
static class |
Conversion.Mul
Multiplies all
Conversion instances via
BigDecimal.multiply(BigDecimal) . |
static class |
Conversion.Pow
Exponentiates two
Conversion instances via
BigDecimal.pow(int) . |
static class |
Conversion.Rat
Divides two
Conversion instances via
BigDecimal.divide(BigDecimal, MathContext) . |
static class |
Conversion.Sym
Simply represents the variable of the source unit so that
Conversion.Sym.convert(double) just returns the value passed in. |
Modifier and Type | Field and Description |
---|---|
protected Conversion[] |
conversions
Conversions, if any, which are passed into the constructor
of this instance.
|
Constructor and Description |
---|
Conversion(Conversion... conversions)
Primary constructor for a
Conversion object. |
Modifier and Type | Method and Description |
---|---|
static Conversion |
Add(Conversion... conversions)
Static helper for creating
Conversion.Add instances. |
abstract BigDecimal |
convert(double original)
Primary operator for
Conversion instances. |
static Conversion |
Int(long i)
Static helper for creating
Conversion.Int instances. |
static Conversion |
Int(String i)
Static helper for creating
Conversion.Int instances. |
static Conversion |
Mul(Conversion... conversions)
Static helper for creating
Conversion.Mul instances. |
static Conversion |
Pow(long num,
int den)
Static helper for creating
Conversion.Pow instances. |
static Conversion |
Rat(Conversion... conversions)
Static helper for creating
Conversion.Rat instances. |
static Conversion |
Rat(long num,
long den)
Static helper for creating
Conversion.Rat instances. |
static Conversion |
Sym(String sym)
Static helper for creating
Conversion.Sym instances. |
protected final Conversion[] conversions
Integer
rather than
an Conversion.Int
.public Conversion(Conversion... conversions)
Conversion
object. No processing
happens during constructor. Instead, the convert(double)
method will handle descending through the recursive structure.conversions
- can be empty.public static Conversion Add(Conversion... conversions)
Conversion.Add
instances.public static Conversion Int(long i)
Conversion.Int
instances.public static Conversion Int(String i)
Conversion.Int
instances.public static Conversion Mul(Conversion... conversions)
Conversion.Mul
instances.public static Conversion Pow(long num, int den)
Conversion.Pow
instances.public static Conversion Rat(long num, long den)
Conversion.Rat
instances.public static Conversion Rat(Conversion... conversions)
Conversion.Rat
instances.public static Conversion Sym(String sym)
Conversion.Sym
instances.public abstract BigDecimal convert(double original)
Conversion
instances.original
- A unit value which is to be processed through the
tree-like representation of this equation. Only Conversion.Sym
objects
will actually use the "original" value.BigDecimal
result from the calculation. If this value
maps to Double.NEGATIVE_INFINITY
or
Double.POSITIVE_INFINITY
, then a BigResult
exception
should be thrown before returning to clients.
Version: 5.2.8-ice35-b57
Copyright © 2017 The University of Dundee & Open Microscopy Environment. All Rights Reserved.