Package jsl.modeling.elements
Class Schedule.ScheduleItem<T>
- java.lang.Object
-
- jsl.modeling.elements.Schedule.ScheduleItem<T>
-
- Type Parameters:
T
- a general message or other object that can be associated with the ScheduleItem
- All Implemented Interfaces:
java.lang.Comparable<Schedule.ScheduleItem>
- Enclosing class:
- Schedule
public class Schedule.ScheduleItem<T> extends java.lang.Object implements java.lang.Comparable<Schedule.ScheduleItem>
A ScheduleItem represents an item on a Schedule. It has a start time, relative to the start of the Schedule and a duration. If more than one schedule item needs to start at the same time, then a priority can be provided to determine the ordering (smallest priority goes first).
-
-
Constructor Summary
Constructors Constructor Description ScheduleItem(double startTime, double duration, int priority, T message)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Schedule.ScheduleItem item)
Returns a negative integer, zero, or a positive integer if this object is less than, equal to, or greater than the specified object.double
getDuration()
double
getEndTime()
long
getId()
T
getMessage()
java.lang.String
getName()
int
getPriority()
Schedule
getSchedule()
double
getStartTime()
void
setName(java.lang.String name)
java.lang.String
toString()
-
-
-
Constructor Detail
-
ScheduleItem
public ScheduleItem(double startTime, double duration, int priority, T message)
-
-
Method Detail
-
getName
public java.lang.String getName()
-
setName
public void setName(java.lang.String name)
-
getMessage
public T getMessage()
-
getStartTime
public double getStartTime()
-
getDuration
public final double getDuration()
-
getEndTime
public final double getEndTime()
-
getPriority
public final int getPriority()
-
getId
public final long getId()
-
getSchedule
public final Schedule getSchedule()
-
toString
public final java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
compareTo
public final int compareTo(Schedule.ScheduleItem item)
Returns a negative integer, zero, or a positive integer if this object is less than, equal to, or greater than the specified object.Natural ordering: time, then priority, then order of creation
Lower time, lower priority, lower order of creation goes first
Throws ClassCastException if the specified object's type prevents it from begin compared to this object.
Throws RuntimeException if the id's of the objects are the same, but the references are not when compared with equals.
Note: This class may have a natural ordering that is inconsistent with equals.
- Specified by:
compareTo
in interfacejava.lang.Comparable<T>
- Parameters:
item
- The event to compare this event to- Returns:
- Returns a negative integer, zero, or a positive integer if this object is less than, equal to, or greater than the specified object.
-
-