pulse - the web application framework Get pulse at SourceForge.net. Fast, secure and Free Open Source software downloads Ohloh project report for pulse-java

org.torweg.pulse.util.time
Class DurationSplitter

java.lang.Object
  extended by org.torweg.pulse.util.time.DurationSplitter

public final class DurationSplitter
extends java.lang.Object

Utility class for splitting a Duration by a Period.

NOTE: The DurationSplitter will operate on a Duration levelled with the given Period.

Version:
$Revision: 1417 $
Author:
Daniel Dietz

Field Summary
static long MAX_SIZE
          The maximum number of Durations for the DurationSplitter: 1000000.
 
Constructor Summary
DurationSplitter(Duration duration, Period period)
          Creates a new DurationSplitter with given levelledDuration and the given resolution.
 
Method Summary
 java.util.Set<Duration> getDurations()
          Returns the durations.
 Duration getLevelledDuration()
          Returns the "levelled" Duration.
 Duration getRawDuration()
          Returns the "raw" Duration.
 Period getSplitPeriod()
          Returns the split Period.
 int size()
          Returns the size of the underlying split-result durations.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_SIZE

public static final long MAX_SIZE
The maximum number of Durations for the DurationSplitter: 1000000.

See Also:
Constant Field Values
Constructor Detail

DurationSplitter

public DurationSplitter(Duration duration, Period period)
Creates a new DurationSplitter with given levelledDuration and the given resolution.

Parameters:
duration - the Duration
period - the Period
Throws:
java.lang.NullPointerException - if either the given Duration or the given Period is null
TimeUtilityException - if the approximated split size as calculated by Period.approximateSplitSize(levelledDuration) will exceed DurationSplitter.MAX_SIZE
Method Detail

getLevelledDuration

public Duration getLevelledDuration()
Returns the "levelled" Duration.

Returns:
the "levelled" Duration

getRawDuration

public Duration getRawDuration()
Returns the "raw" Duration.

Returns:
the "raw" Duration

getSplitPeriod

public Period getSplitPeriod()
Returns the split Period.

Returns:
the split Period

getDurations

public java.util.Set<Duration> getDurations()
Returns the durations.

Returns:
the split result - Set&lt;Duration&gt;

size

public int size()
Returns the size of the underlying split-result durations.

Returns:
the size