lejos.realtime
Class SporadicParameters

java.lang.Object
  extended by lejos.realtime.SchedulingParameters
      extended by lejos.realtime.ReleaseParameters
          extended by lejos.realtime.AperiodicParameters
              extended by lejos.realtime.SporadicParameters
All Implemented Interfaces:
Cloneable

public class SporadicParameters
extends AperiodicParameters

Author:
Team iRboT

Field Summary
static String mitViolationExceptnew
           
static String mitViolationIgnore
           
static String mitViolationReplace
           
static String mitViolationSave
           
 
Fields inherited from class lejos.realtime.AperiodicParameters
arrivalTimeQueueOverflowExcept, arrivalTimeQueueOverflowIgnore, arrivalTimeQueueOverflowReplace, arrivalTimeQueueOverflowSave
 
Constructor Summary
SporadicParameters(RelativeTime minInterarrival)
          Create a SporadicParameters object.
SporadicParameters(RelativeTime minInterarrival, RelativeTime cost, RelativeTime deadline, AsyncEventHandler overrunHandler, AsyncEventHandler missHandler)
          Create a SporadicParameters object.
 
Method Summary
 RelativeTime getMinimumInterarrival()
          Gets the minimum interarrival time.
 String getMitViolationBehavior()
          Gets the arrival time queue behavior in the event of a minimum interarrival time violation.
 boolean setIfFeasible(RelativeTime cost, RelativeTime deadline)
          This method first performs a feasibility analysis using the new cost, and deadline as replacements for the matching attributes of this.
 boolean setIfFeasible(RelativeTime interarrival, RelativeTime cost, RelativeTime deadline)
          This method first performs a feasibility analysis using the new interarrival, cost and deadline attributes as replacements for the matching attributes of this.
 void setMinimumInterarrival(RelativeTime minimum)
          Set the minimum interarrival time.
 void setMitViolationBehavior(String behavior)
          Sets the behavior of the arrival time queue in the case where the new arrival time is closer to the previous arrival time than the minimum interarrival time given in this.
 
Methods inherited from class lejos.realtime.AperiodicParameters
getArrivalTimeQueueOverflowBehavior, getInitialArrivalTimeQueueLength, setArrivalTimeQueueOverflowBehavior, setDeadline, setInitialArrivalTimeQueueLength
 
Methods inherited from class lejos.realtime.ReleaseParameters
clone, getCost, getCostOverrunHandler, getDeadline, getDeadlineMissHandler, setCost, setCostOverrunHandler, setDeadlineMissHandler
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mitViolationExceptnew

public static final String mitViolationExceptnew
See Also:
Constant Field Values

mitViolationIgnore

public static final String mitViolationIgnore
See Also:
Constant Field Values

mitViolationSave

public static final String mitViolationSave
See Also:
Constant Field Values

mitViolationReplace

public static final String mitViolationReplace
See Also:
Constant Field Values
Constructor Detail

SporadicParameters

public SporadicParameters(RelativeTime minInterarrival)
Create a SporadicParameters object. This constructor is equivalent to: SporadicParameters(minInterarrival, null, null, null, null)

Parameters:
mit - The release times of the schedulable object will occur no closer than this interval. This time object is treated as if it were copied. Changes to mit will not effect the SporadicParameters object. There is no default value. If minInterarrival is null an illegal argument exception is thrown.
Throws:
IllegalArgumentException - Thrown if minInterarrival is null or its time value is not greater than zero.
IllegalAssignmentError - Thrown if minInterarrival cannot be stored in this. Since: 1.0.1

SporadicParameters

public SporadicParameters(RelativeTime minInterarrival,
                          RelativeTime cost,
                          RelativeTime deadline,
                          AsyncEventHandler overrunHandler,
                          AsyncEventHandler missHandler)
Create a SporadicParameters object.

Parameters:
minInterarrival - The release times of the schedulable object will occur no closer than this interval. This time object is treated as if it were copied. Changes to minInterarrival will not effect the SporadicParameters object. There is no default value. If minInterarrival is null an illegal argument exception is thrown.
cost - Processing time per release. On implementations which can measure the amount of time a schedulable object is executed, this value is the maximum amount of time a schedulable object receives per release. On implementations which cannot measure execution time, this value is used as a hint to the feasibility algorithm. On such systems it is not possible to determine when any particular object exceeds cost. If null, the default value is a new instance of RelativeTime(0,0).
deadline - The latest permissible completion time measured from the release time of the associated invocation of the schedulable object. For a minimum implementation for purposes of feasibility analysis, the deadline is equal to the minimum interarrival interval. Other implementations may use this parameter to compute execution eligibility. If null, the default value is a new instance of RelativeTime(mit).
overrunHandler - This handler is invoked if an invocation of the schedulable object exceeds cost. Not required for minimum implementation. If null no overrun handler will be used.
missHandler - This handler is invoked if the run() method of the schedulable object is still executing after the deadline has passed. Although minimum implementations do not consider deadlines in feasibility calculations, they must recognize variable deadlines and invoke the miss handler as appropriate. If null, no deadline miss handler will be used.
Throws:
IllegalArgumentException - Thrown if minInterarrival is null or its time value is not greater than zero, or the time value of cost is less than zero, or the time value of deadline is not greater than zero.
IllegalAssignmentError - Thrown if minInterarrival, cost, deadline, overrunHandler or missHandler cannot be stored in this.
Method Detail

setMitViolationBehavior

public void setMitViolationBehavior(String behavior)
Sets the behavior of the arrival time queue in the case where the new arrival time is closer to the previous arrival time than the minimum interarrival time given in this. Values of behavior are compared using reference equality (==) not value equality (equals()).

Parameters:
behavior - A string representing the behavior.
Throws:
IllegalArgumentException - Thrown if behavior is not one of the final MIT violation behavior values defined in this class.

getMitViolationBehavior

public String getMitViolationBehavior()
Gets the arrival time queue behavior in the event of a minimum interarrival time violation.

Returns:
The minimum interarrival time violation behavior as a string.

setIfFeasible

public boolean setIfFeasible(RelativeTime cost,
                             RelativeTime deadline)
This method first performs a feasibility analysis using the new cost, and deadline as replacements for the matching attributes of this. If the resulting system is feasible, the method replaces the current scheduling characteristics, of this with the new scheduling characteristics.

Overrides:
setIfFeasible in class AperiodicParameters
Parameters:
cost - The proposed cost. to determine when any particular object exceeds cost. If null, the default value is a new instance of RelativeTime(0,0).
deadline - The proposed deadline. If null, the default value is a new instance of RelativeTime(mit).
Returns:
True, if the resulting system is feasible and the changes are made. False, if the resulting system is not feasible and no changes are made.
Throws:
IllegalArgumentException - Thrown if the time value of cost is less than zero, or the time value of deadline is less than or equal to zero, or the values are incompatible with the scheduler for any of the schedulable objects which are presently using this parameter object.
IllegalAssignmentError - Thrown if cost or deadline cannot be stored in this.

setIfFeasible

public boolean setIfFeasible(RelativeTime interarrival,
                             RelativeTime cost,
                             RelativeTime deadline)
This method first performs a feasibility analysis using the new interarrival, cost and deadline attributes as replacements for the matching attributes of this. If the resulting system is feasible the method replaces the current attributes with the new ones. Changes to a SporadicParameters instance effect subsequent arrivals.

Parameters:
interarrival - The proposed interarrival time. There is no default value. If minInterarrival is null an illegal argument exception is thrown.
cost - The proposed cost. If null, the default value is a new instance of RelativeTime(0,0).
deadline - The proposed deadline. If null, the default value is a new instance of RelativeTime(mit).
Returns:
True, if the resulting system is feasible and the changes are made. False, if the resulting system is not feasible and no changes are made.
Throws:
IllegalArgumentException - Thrown if minInterarrival is null or its time value is not greater than zero, or the time value of cost is less than zero, or the time value of deadline is not greater than zero.
IllegalAssignmentError - Thrown if interarrival, cost or deadline cannot be stored in this.

getMinimumInterarrival

public RelativeTime getMinimumInterarrival()
Gets the minimum interarrival time.

Returns:
The minimum interarrival time.

setMinimumInterarrival

public void setMinimumInterarrival(RelativeTime minimum)
Set the minimum interarrival time.

Parameters:
minimum - The release times of the schedulable object will occur no closer than this interval.
Throws:
IllegalArgumentException - Thrown if minimum is null or its time value is not greater than zero.
IllegalAssignmentError - Thrown if minimum cannot be stored in this.