Holger's
Java API

com.antelmann.calendar
Class TimeInterval.Converter

java.lang.Object
  extended by com.antelmann.calendar.TimeInterval.Converter
All Implemented Interfaces:
UnitConverter
Enclosing class:
TimeInterval

public static class TimeInterval.Converter
extends Object
implements UnitConverter


Constructor Summary
TimeInterval.Converter(boolean useDecimals)
          constructs the converter for use with eithe double- or long-based conversion
 
Method Summary
 Measurable convert(Measurable m, Unit targetUnit)
          converts the given measurable into the target unit and returns the resulting measurable
 Number convert(TimeInterval unit, Number number, TimeInterval target)
          converts either based on double (if useDecimals is true) or long
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeInterval.Converter

public TimeInterval.Converter(boolean useDecimals)
constructs the converter for use with eithe double- or long-based conversion

Parameters:
useDecimals - if true, double-precision is used for conversion; otherwise, long values are used.
Method Detail

convert

public Measurable convert(Measurable m,
                          Unit targetUnit)
                   throws IllegalArgumentException,
                          UnsupportedOperationException
Description copied from interface: UnitConverter
converts the given measurable into the target unit and returns the resulting measurable

Specified by:
convert in interface UnitConverter
Parameters:
m - the original measurable to be converted
targetUnit - the desired unit
Returns:
a measurable that embeds the target unit and a number that corresponds
Throws:
IllegalArgumentException - if this converter cannot handle any of the given units
UnsupportedOperationException - if the units of the given measurable and the target unit are not convertible

convert

public Number convert(TimeInterval unit,
                      Number number,
                      TimeInterval target)
converts either based on double (if useDecimals is true) or long



(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads