|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.eclipse.stardust.common.Period
public class Period
The Period class is used to handle time periods. A period consists of a
group of 6 numbers, each specifying an amount of units, i.e. 6 months and 3 hours.
The Period also provides convenient methods to perform operations on
Calendars.
| Field Summary | |
|---|---|
static int |
DAYS
Identifier for the number of days field. |
static int |
HOURS
Identifier for the number of hours field. |
static int |
MINUTES
Identifier for the number of minutes field. |
static int |
MONTHS
Identifier for the number of months field. |
static int |
SECONDS
Identifier for the number of seconds field. |
static int |
YEARS
Identifier for the number of years field. |
| Constructor Summary | |
|---|---|
Period(short years,
short months,
short days,
short hours,
short minutes,
short seconds)
Creates a new Period from the given values. |
|
Period(String raw)
Creates a new Period from a string representation. |
|
| Method Summary | |
|---|---|
Calendar |
add(Calendar source)
Adds this period to the provided calendar. |
boolean |
equals(Object o)
|
short |
get(int field)
Gets the value of a specific field of the period. |
int |
hashCode()
|
Calendar |
subtract(Calendar source)
Subtracts this period from the provided calendar. |
String |
toString()
Returns a fixed size String representation of the period, where each field has 6 digits allocated. |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int YEARS
public static final int MONTHS
public static final int DAYS
public static final int HOURS
public static final int MINUTES
public static final int SECONDS
| Constructor Detail |
|---|
public Period(String raw)
Example: "0:6:0:3:0:0" represents a period of
6 months and 3 hours.
raw - the String representation of the period.
public Period(short years,
short months,
short days,
short hours,
short minutes,
short seconds)
years - the number of years contained in the period.months - the number of months contained in the period.days - the number of days contained in the period.hours - the number of hours contained in the period.minutes - the number of minutes contained in the period.seconds - the number of seconds contained in the period.| Method Detail |
|---|
public String toString()
toString in class Objectpublic Calendar add(Calendar source)
source - the reference time.
public Calendar subtract(Calendar source)
source - the reference time.
public short get(int field)
field - one of the identifier constants.
public boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||