Joda Time API

org.joda.time
Interface ReadableTimePeriod

All Superinterfaces:
java.lang.Comparable
All Known Implementing Classes:
TimePeriod

public interface ReadableTimePeriod
extends java.lang.Comparable

Readable interface for a Time period. This interface expresses a time period as its duration in milliseconds.

Author:
Sean Geoghegan, Stephen Colebourne
See Also:
ReadableTimePeriod

Method Summary
 Instant getEndInstant()
          Gets the end of this time period as an Instant.
 long getMillis()
          Gets the length of this time period in milliseconds.
 Instant getStartInstant()
          Gets the start of this time period as an Instant.
 boolean isLongerThan(java.lang.Object other)
          Is the period longer than the period passd in.
 boolean isShorterThan(java.lang.Object other)
          Is the period shorter than the period passed in.
 TimePeriod toTimePeriod()
          Get the value as a simple immutable object.
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

getMillis

public long getMillis()
Gets the length of this time period in milliseconds.

Returns:
the length of the time period as milliseconds.

getStartInstant

public Instant getStartInstant()
Gets the start of this time period as an Instant.

Returns:
the start of the time period.

getEndInstant

public Instant getEndInstant()
Gets the end of this time period as an Instant.

Returns:
the end of the time period.

toTimePeriod

public TimePeriod toTimePeriod()
Get the value as a simple immutable object. This can be useful if you don't trust the implementation of the imterface to be well-behaved, or to get a guaranteed immutable object.

Returns:
the value as a TimePeriod object

isLongerThan

public boolean isLongerThan(java.lang.Object other)
Is the period longer than the period passd in.

Parameters:
other - Another time period to compare to. Accepts periods in the form of another ReadablePeriod, an ISO formated period string or a Long object contain the number of milliseconds in the period.
Returns:
true if the period is longer than the period passed in.

isShorterThan

public boolean isShorterThan(java.lang.Object other)
Is the period shorter than the period passed in.

Parameters:
other - Another time period to compare to. Accepts periods in the form of another ReadablePeriod, an ISO formated period string or a Long object contain the number of milliseconds in the period.
Returns:
true if the period is shorter than the period passed in.

Joda Time API

Copyright © 2001-2003 Stephen Colebourne. All Rights Reserved.