|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.prozima.time.TimePeriod
public class TimePeriod
Immutable class which represents a period of time beginning at a specific time of the day and lasting a specific duration. This class has no concept of Date, only a time period during the day.
| Constructor Summary | |
|---|---|
TimePeriod(int inStart,
int inDuration)
Create a time period. |
|
| Method Summary | |
|---|---|
TimePeriod |
clone()
|
int |
compareTo(TimePeriod inOther)
A TimePeriod is less than (earlier than) another if it starts before the other. |
boolean |
contains(TimePeriod inOther)
Check if this time period totally contains another time period. |
boolean |
equals(java.lang.Object inObject)
|
int |
getDuration()
Get the duration of a time period in minutes. |
int |
getEndInMins()
Get the end time of a time period. |
java.util.List<TimePeriod> |
getNonOverlaps(TimePeriod inOther)
Get TimePeriods that represents the non-overlapping parts of this period and another TimePeriod. |
TimePeriod |
getOverlap(TimePeriod inOther)
Get a TimePeriod that represents the overlap between this period and another TimePeriod. |
static java.util.List<TimePeriod> |
getOverlappingPeriods(java.util.List<TimePeriod> inPeriodsA,
java.util.List<TimePeriod> inPeriodsB)
Generates a List of TimePeriods which represent the overlapping periods of two Lists of TimePeriods. |
int |
getStartInMins()
Get the start time of a time period. |
int |
hashCode()
|
static boolean |
listsEqual(java.util.List<TimePeriod> inPeriodsA,
java.util.List<TimePeriod> inPeriodsB)
Compare two lists of TimePeriods to see if they are the same. |
boolean |
overlaps(TimePeriod inOther)
Check if two time periods overlap each other. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public TimePeriod(int inStart,
int inDuration)
inStart - Starting time of the time period. Expressed in minutes
since midnight 00:00. e.g. 1am == 60, 3am == 180.inDuration - Duration of the time period in minutes. zero or negative duration is impossible.| Method Detail |
|---|
public TimePeriod clone()
throws java.lang.CloneNotSupportedException
clone in class java.lang.Objectjava.lang.CloneNotSupportedExceptionpublic int compareTo(TimePeriod inOther)
compareTo in interface java.lang.Comparable<TimePeriod>inOther - Other TimePeriod object. Cannot be null.public boolean contains(TimePeriod inOther)
inOther - Another time period. Cannot be null.
public boolean equals(java.lang.Object inObject)
equals in class java.lang.Objectpublic int getDuration()
public int getEndInMins()
public java.util.List<TimePeriod> getNonOverlaps(TimePeriod inOther)
inOther - Another TimePeriod. Cannot be null.
public TimePeriod getOverlap(TimePeriod inOther)
inOther - Another TimePeriod. Cannot be null.
public static final java.util.List<TimePeriod> getOverlappingPeriods(java.util.List<TimePeriod> inPeriodsA,
java.util.List<TimePeriod> inPeriodsB)
inPeriodsA - List of TimePeriods. Cannot be null.inPeriodsB - Other List of TimePeriods. Cannot be null.
java.lang.NullPointerException - thrown if one of the input parameters is null.public int getStartInMins()
public int hashCode()
hashCode in class java.lang.Object
public static boolean listsEqual(java.util.List<TimePeriod> inPeriodsA,
java.util.List<TimePeriod> inPeriodsB)
inPeriodsA - List of TimePeriods. Cannot be null.inPeriodsB - List of TimePeriods. Cannot be null.
public boolean overlaps(TimePeriod inOther)
inOther - Another time period. Cannot be null.
public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||