org.jikesrvm.compilers.opt.instrsched
Class ResourceReservation

java.lang.Object
  extended by org.jikesrvm.compilers.opt.instrsched.ResourceReservation

final class ResourceReservation
extends Object

Describes a reservation on a particular resource. A reservation is for a continuous period of time. Used in OperatorClass.

See Also:
OperatorClass

Field Summary
(package private)  int duration
          Duration of Use.
private  int rclass
          Resource Class.
(package private)  int start
          Start Time.
 
Constructor Summary
ResourceReservation(int rclass, int duration)
          Creates a new reservation for specified resource class starting at 0 with given duration.
ResourceReservation(int rclass, int start, int duration)
          Creates a new reservation for specified resource class starting at specified time with given duration.
 
Method Summary
private  int compareTo(ResourceReservation r)
          Compares this reservation with another reservation.
 boolean conflicts(ResourceReservation rsrv)
          Checks whether this reservation conflicts with specified reservation.
 boolean equals(Object o)
          Compares this object against the specified object.
 boolean isGlobal()
          Checks whether this reservation is for all available units of the class.
 int rclass()
          The resource class of this reservation.
static void sort(ResourceReservation[] usage)
          Sorts an array of reservations in accordance with internal ordering.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rclass

private final int rclass
Resource Class.


start

final int start
Start Time.


duration

final int duration
Duration of Use.

Constructor Detail

ResourceReservation

public ResourceReservation(int rclass,
                           int duration)
Creates a new reservation for specified resource class starting at 0 with given duration.

Parameters:
rclass - resource class
duration - duration
See Also:
ResourceReservation(int,int,int)

ResourceReservation

public ResourceReservation(int rclass,
                           int start,
                           int duration)
Creates a new reservation for specified resource class starting at specified time with given duration.

Parameters:
rclass - resource class
start - start time
duration - duration
Method Detail

rclass

public int rclass()
The resource class of this reservation.

Returns:
resource class of this reservation

isGlobal

public boolean isGlobal()
Checks whether this reservation is for all available units of the class.

Returns:
true if it's a global reservation, false otherwise

compareTo

private int compareTo(ResourceReservation r)
Compares this reservation with another reservation.

Parameters:
r - the other reservation
Returns:
a negative int if this is less than the other reservation, a positive int if this is greater than the other and zero if they are equal

sort

public static void sort(ResourceReservation[] usage)
Sorts an array of reservations in accordance with internal ordering.

Parameters:
usage - array of reservations

equals

public boolean equals(Object o)
Compares this object against the specified object.

Overrides:
equals in class Object
Parameters:
o - The object to compare with
Returns:
true if the objects are the same; false otherwise.

conflicts

public boolean conflicts(ResourceReservation rsrv)
Checks whether this reservation conflicts with specified reservation.

Parameters:
rsrv - the reservation to check
Returns:
true if the reservations conflict; false otherwise.