lejos.realtime
Class ReleaseParameters

java.lang.Object
  extended by lejos.realtime.SchedulingParameters
      extended by lejos.realtime.ReleaseParameters
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
AperiodicParameters, PeriodicParameters

public class ReleaseParameters
extends SchedulingParameters

This ReleaseParameters class is an equivalent of the ReleaseParameters class in RTSJ.

Author:
Team iRboT

Constructor Summary
ReleaseParameters()
          Create a new instance of ReleaseParameters.
ReleaseParameters(RelativeTime cost, RelativeTime deadline, AsyncEventHandler overrunHandler, AsyncEventHandler missHandler)
          Create a new instance of ReleaseParameters with the given parameter values.
 
Method Summary
 Object clone()
          Return a clone of this.
 RelativeTime getCost()
           
 AsyncEventHandler getCostOverrunHandler()
           
 RelativeTime getDeadline()
           
 AsyncEventHandler getDeadlineMissHandler()
           
 void setCost(RelativeTime cost)
           
 void setCostOverrunHandler(AsyncEventHandler overrunHandler)
           
 void setDeadline(RelativeTime deadline)
           
 void setDeadlineMissHandler(AsyncEventHandler missHandler)
           
 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 all schedulable objects associated with this release parameters object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReleaseParameters

public ReleaseParameters()
Create a new instance of ReleaseParameters. This constructor creates a default ReleaseParameters object, i.e., it is equivalent to ReleaseParameters(null, null, null, null).


ReleaseParameters

public ReleaseParameters(RelativeTime cost,
                         RelativeTime deadline,
                         AsyncEventHandler overrunHandler,
                         AsyncEventHandler missHandler)
Create a new instance of ReleaseParameters with the given parameter values.

Parameters:
cost - Processing time units 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. There is no default for deadline in this class. The default must be determined by the subclasses.
overrunHandler - This handler is invoked if an invocation of the schedulable object exceeds cost. In the minimum implementation overrunHandler is ignored. If null, no application event handler is executed on cost overrun.
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 application event handler is executed on the miss deadline condition.
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.
IllegalAssignmentError - Thrown if cost, deadline, overrunHandler, or missHandler cannot be stored in this.
Method Detail

clone

public Object clone()
Return a clone of this. This method should behave effectively as if it constructed a new object with clones of the high-resolution time values of this. The new object is in the current allocation context clone does not copy any associations from this and it does not implicitly bind the new object to a SO. The new object has clones of all high-resolution time values (deep copy). References to event handlers are copied (shallow copy.)

Returns:
The new copy of the Object

getCost

public RelativeTime getCost()

setCost

public void setCost(RelativeTime cost)

getDeadline

public RelativeTime getDeadline()

setDeadline

public void setDeadline(RelativeTime deadline)

getDeadlineMissHandler

public AsyncEventHandler getDeadlineMissHandler()

setDeadlineMissHandler

public void setDeadlineMissHandler(AsyncEventHandler missHandler)

getCostOverrunHandler

public AsyncEventHandler getCostOverrunHandler()

setCostOverrunHandler

public void setCostOverrunHandler(AsyncEventHandler overrunHandler)

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 all schedulable objects associated with this release parameters object. If the resulting system is feasible, the method replaces the current scheduling characteristics of this release parameters object with the new scheduling characteristics. The change in the release characteristics, including the timing of the change, of any associated schedulable objects will take place under the control of their schedulers.

Parameters:
cost - The proposed cost. Equivalent to RelativeTime(0,0) if null. (A new instance of RelativeTime is created in the memory area containing this ReleaseParameters instance). If null, the default value is a new instance of RelativeTime(0,0).
deadline - The proposed deadline. If null, the default value is new instance of RelativeTime(period).
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.