org.ojalgo.type
Class TypeUtils

java.lang.Object
  extended by org.ojalgo.type.TypeUtils

public abstract class TypeUtils
extends Object


Field Summary
static NumberContext EQUALS_NUMBER_CONTEXT
          The default NumberContext used with various Object.equals(Object) implementations.
static long HOURS_PER_CENTURY
           
static long MILLIS_PER_HOUR
           
static SimpleDateFormat SQL_DATE_FORMAT
           
static SimpleDateFormat SQL_TIME_FORMAT
           
static SimpleDateFormat SQL_TIMESTAMP_FORMAT
           
 
Method Summary
static String format(String aMessagePattern, Object... someArgs)
          Compatible with slf4j.
static GregorianCalendar getHundredYearsAgo()
           
static BigDecimal getImpliedAmount(QuantityPriceAmountStructure aQuantityPriceAmount)
           
static BigDecimal getImpliedPrice(QuantityPriceAmountStructure aQuantityPriceAmount)
           
static BigDecimal getImpliedQuantity(QuantityPriceAmountStructure aQuantityPriceAmount)
           
static GregorianCalendar getThousandYearsAgo()
           
static GregorianCalendar getThousandYearsFromNow()
           
static boolean isZero(double aVal)
           
static boolean isZero(double aVal, double aTolerance)
           
static Date makeSqlDate(long aTimeInMillis)
           
static Time makeSqlTime(long aTimeInMillis)
           
static Timestamp makeSqlTimestamp(long aTimeInMillis)
           
static BigDecimal toBigDecimal(Number aNumber)
          If the input Number is a BigDecimal it is passed through unaltered.
static BigDecimal toBigDecimal(Number aNumber, NumberContext aContext)
           
static ComplexNumber toComplexNumber(Number aNumber)
           
static String toHexString(Color aColor)
          The way colours are specified in html pages.
static RationalNumber toRationalNumber(Number aNumber)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EQUALS_NUMBER_CONTEXT

public static final NumberContext EQUALS_NUMBER_CONTEXT
The default NumberContext used with various Object.equals(Object) implementations.


HOURS_PER_CENTURY

public static final long HOURS_PER_CENTURY
See Also:
Constant Field Values

MILLIS_PER_HOUR

public static final long MILLIS_PER_HOUR
See Also:
Constant Field Values

SQL_DATE_FORMAT

public static final SimpleDateFormat SQL_DATE_FORMAT

SQL_TIME_FORMAT

public static final SimpleDateFormat SQL_TIME_FORMAT

SQL_TIMESTAMP_FORMAT

public static final SimpleDateFormat SQL_TIMESTAMP_FORMAT
Method Detail

format

public static String format(String aMessagePattern,
                            Object... someArgs)
Compatible with slf4j. {} in the message pattern will be replaced by the arguments.


getHundredYearsAgo

public static final GregorianCalendar getHundredYearsAgo()

getImpliedAmount

public static BigDecimal getImpliedAmount(QuantityPriceAmountStructure aQuantityPriceAmount)

getImpliedPrice

public static BigDecimal getImpliedPrice(QuantityPriceAmountStructure aQuantityPriceAmount)

getImpliedQuantity

public static BigDecimal getImpliedQuantity(QuantityPriceAmountStructure aQuantityPriceAmount)

getThousandYearsAgo

public static final GregorianCalendar getThousandYearsAgo()

getThousandYearsFromNow

public static final GregorianCalendar getThousandYearsFromNow()

isZero

public static boolean isZero(double aVal)

isZero

public static boolean isZero(double aVal,
                             double aTolerance)

makeSqlDate

public static Date makeSqlDate(long aTimeInMillis)

makeSqlTime

public static Time makeSqlTime(long aTimeInMillis)

makeSqlTimestamp

public static Timestamp makeSqlTimestamp(long aTimeInMillis)

toBigDecimal

public static BigDecimal toBigDecimal(Number aNumber)
If the input Number is a BigDecimal it is passed through unaltered. Otherwise an equivalent BigDecimal is created.

Parameters:
aNumber - Any Number
Returns:
A corresponding BigDecimal

toBigDecimal

public static BigDecimal toBigDecimal(Number aNumber,
                                      NumberContext aContext)

toComplexNumber

public static ComplexNumber toComplexNumber(Number aNumber)

toHexString

public static String toHexString(Color aColor)
The way colours are specified in html pages.


toRationalNumber

public static RationalNumber toRationalNumber(Number aNumber)