|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.xj.anylogic.engine.Schedule<V>
V - the type of schedule valuespublic class Schedule<V extends java.io.Serializable>
Schedule class. Allows to track moments specified using time table with some
period. Also, annual and single exceptions may be added to the schedule.
Schedule provides 4 types of information:
getValue()
getTimeOfValue(), getDateOfValue()
getNextValue()
getTimeOfNextValue(), getDateOfNextValue(),
getTimeoutToNextValue()
time of type double: data is
retrieved for the provided model time. In case of
+/-infinity or
NaN argument value, getValue* and
getDate* methods return null, and getTime*
and getTimeout* methods return Double.NaN
date of type Date: data
is retrieved for the provided model date. In case of
null argument value, getValue* and
getDate* methods return null, and getTime*
and getTimeout* methods return Double.NaN
getTimeOfNextValue()
method instead of getTimeoutToNextValue() because of possible
numeric calculation errors). Create the timeout event
which occurs once at the time:
schedule.getTimeOfValue() == time() ? time() : schedule.getTimeOfNextValue()
and has the following action code:
// ...your custom actions are here...
event.restartTo( schedule.getTimeOfNextValue() );
| Constructor Summary | |
|---|---|
Schedule(Utilities owner,
boolean calendarType,
int firstDayOfWeek,
long period,
long timeUnits,
java.lang.Long snapTo,
V defaultValue,
long[] starts,
long[] ends,
java.lang.Object[] values,
boolean glueIntervals,
boolean[] exceptionsAnnually,
boolean singleThreadMode)
Creates new schedule object |
|
| Method Summary | |
|---|---|
java.util.Date |
getDateOfNextValue()
Returns the model date of the next change moment in the schedule. |
java.util.Date |
getDateOfNextValue(java.util.Date date)
Returns the model date of the schedule change moment next to the given model date. |
java.util.Date |
getDateOfNextValue(double time)
Returns the model date of the schedule change moment next to the given model time. |
java.util.Date |
getDateOfValue()
Returns the model date the current value of the schedule has been held since. |
java.util.Date |
getDateOfValue(java.util.Date date)
Returns the model date of the schedule change moment of the value corresponding to the given model date. |
java.util.Date |
getDateOfValue(double time)
Returns the model date of the schedule change moment of the value corresponding to the given model time. |
V |
getNextValue()
Returns the value of the next change moment in the schedule. |
V |
getNextValue(java.util.Date date)
Returns the value of the schedule change moment next to the given model date. |
V |
getNextValue(double time)
Returns the value of the schedule change moment next to the given model time. |
double |
getTimeOfNextValue()
Returns the model time of the next change moment in the schedule. |
double |
getTimeOfNextValue(java.util.Date date)
Returns the model time of the schedule change moment next to the given model date. |
double |
getTimeOfNextValue(double time)
Returns the model time of the schedule change moment next to the given model time. |
double |
getTimeOfValue()
Returns the model time the current value of the schedule has been held since. |
double |
getTimeOfValue(java.util.Date date)
Returns the model time of the schedule change moment of the value corresponding to the given model date. |
double |
getTimeOfValue(double time)
Returns the model time of the schedule change moment of the value corresponding to the given model time. |
double |
getTimeoutToNextValue()
Returns timeout to the next change moment in the schedule, measured in the model time units from the current model time. |
double |
getTimeoutToNextValue(java.util.Date date)
Returns timeout to the schedule change moment next to the given model date, measured in the model time units from that
model date. |
double |
getTimeoutToNextValue(double time)
Returns timeout to the schedule change moment next to the given time, measured in the model time units from that
time. |
long |
getTimeUnits()
Returns time units of the schedule |
V |
getValue()
Returns the value corresponding to the current model time |
V |
getValue(java.util.Date date)
Returns the value of the schedule corresponding to the given model date. |
V |
getValue(double time)
Returns the value of the schedule corresponding to the given model time. |
void |
restoreOwner(java.lang.Object owner)
This method normally should not be called by user This method restores owner of this object This method is used in snapshot saving/loading Note, that some objects may support several owners (e.g. of different types) |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Schedule(Utilities owner,
boolean calendarType,
int firstDayOfWeek,
long period,
long timeUnits,
java.lang.Long snapTo,
V defaultValue,
long[] starts,
long[] ends,
java.lang.Object[] values,
boolean glueIntervals,
boolean[] exceptionsAnnually,
boolean singleThreadMode)
owner - active object or experiment owning the schedulecalendarType - if true then schedule works with calendar
dates. For example, if you create a schedule for 8:00-17:00 each day
- these times will be preserved even during the days of Daylight Saving Time
switching.false, "1 day" will be treated as
24*60*60 seconds - this is good for modeling the behavior
of some automatic machines which don't watch at the wall-clock during
e.g. self-maintenance procedures.firstDayOfWeek - the first day of the week, this parameter is actually
used when calendarType == true and timeUnit is
weekperiod - recurrence period of the schedule, measured in milliseconds.
Milliseconds may be actual - if calendarType is
false, and hypothetical - if true, which means that
1000*60*60*24 milliseconds denotes one day independently on
Daylight Saving Time switching.timeUnits - time units of the schedule, one of TIME_UNIT_*
constantssnapTo - the absolute date (if calendarType==true) or the
number of milliseconds from the zero model time
(if calendarType==false) which points to the start of some period.
All schedule periods are cloned, started from the given time moment in both directions.defaultValue - the value used when there is no interval defined in the schedulestarts - start times of intervals, measured in milliseconds from the beginning
of the period (milliseconds may be actual - if calendarType is
false, and hypothetical - if true, which means that
1000*60*60*24 milliseconds denotes one day independently on
Daylight Saving Time switching).
This array may also contain starts of exceptions (see exceptionsAnnually
parameter)ends - end times of intervals, the same description as for startsvalues - values for intervalsglueIntervals - if true then intersecting intervals with
the same 'value' will be merged, e.g. two intervals "Day1 18:00-24:00 value=5" and
"Day2 00:00-02:00 value=5" will be treated as one interval
"Day1 18:00 - Day2 02:00 value=5"exceptionsAnnually - the array of exception flags (true
means annual exception, false - single occurrence),
may be empty. The number of exceptions equals the length of
exceptionsAnnually array. The exceptions are read
from starts, ends, values arrays. Exceptions data is
located in the tails of these arrays. Note that for exceptions,
starts and ends arrays contain absolute dates
encoded as long numbers (see Date.getTime()).singleThreadMode - this parameter indicates whether schedule
will work in single thread environment or will be used by multiple
concurrent threads. This parameter is usually set to true
for schedules inside active objects and experiment which don't
allow parallel execution (e.g. simulation experiment). But for schedules,
located in optimization and parameter variation experiment which allow
parallel execution this parameter should be set to false.| Method Detail |
|---|
public long getTimeUnits()
TIME_UNIT_*
constantspublic double getTimeoutToNextValue()
+infinitypublic double getTimeoutToNextValue(double time)
time, measured in the model time units from that
time.+/-infinity or
NaN argument value, returns Double.NaN
time or +infinitypublic double getTimeoutToNextValue(java.util.Date date)
date, measured in the model time units from that
model date.null argument value, returns Double.NaN
date or +infinitypublic double getTimeOfNextValue()
+infinitypublic double getTimeOfNextValue(double time)
time.+/-infinity or
NaN argument value, returns Double.NaN
time or +infinitypublic double getTimeOfNextValue(java.util.Date date)
date.null argument value, returns Double.NaN
date or +infinitypublic java.util.Date getDateOfNextValue()
null
nullpublic java.util.Date getDateOfNextValue(double time)
time.null.+/-infinity or
NaN argument value, returns null
time or nullpublic java.util.Date getDateOfNextValue(java.util.Date date)
date.null.null argument value, returns null
date or nullpublic V getNextValue()
null
nullpublic V getNextValue(double time)
time.null.+/-infinity or
NaN argument value, returns null
time or nullpublic V getNextValue(java.util.Date date)
date.null.null argument value, returns null
date or nullpublic double getTimeOfValue()
-infinitypublic double getTimeOfValue(double time)
time.time), the method returns negative infinity.+/-infinity or
NaN argument value, returns Double.NaN
time or
-infinitypublic double getTimeOfValue(java.util.Date date)
date.date), the method returns negative infinity.null argument value, returns Double.NaN
date or
-infinitypublic java.util.Date getDateOfValue()
null
nullpublic java.util.Date getDateOfValue(double time)
time.time), the method returns null.+/-infinity or
NaN argument value, returns null
time or nullpublic java.util.Date getDateOfValue(java.util.Date date)
date.date), the method returns null.null argument value, returns null
date or nullpublic V getValue()
public V getValue(double time)
time.+/-infinity or
NaN argument value, returns null
time - the model time
timepublic V getValue(java.util.Date date)
date.null argument value, returns null
date - the model date
datepublic java.lang.String toString()
toString in class java.lang.Objectpublic void restoreOwner(java.lang.Object owner)
com.xj.anylogic.engine.internal.Child
restoreOwner in interface com.xj.anylogic.engine.internal.Childowner - owner of this object, usually ActiveObject,
Experiment or
ShapeGroup
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||