GridSim 5.0 beta

gridsim.parallel.reservation
Class Reservation

Object
  extended by Reservation
All Implemented Interfaces:
Cloneable, Comparable<Reservation>

public class Reservation
extends Object
implements Cloneable, Comparable<Reservation>

This class represents a reservation and its properties.

Since:
5.0
Author:
Marcos Dias de Assuncao

Constructor Summary
Reservation(int userID)
          Allocates a new Reservation object
Reservation(String userName)
          Allocates a new Reservation object
 
Method Summary
 Reservation clone()
          Returns a clone of this object
 int compareTo(Reservation reservation)
          Compares this reservation with the specified reservation for order.
 boolean copy(Reservation obj)
          Copy the object.
 int getDurationTime()
          Gets this object's duration time in seconds
 String getEntityName()
          Gets this object's owner name
 double getFinishTime()
          Gets this object's finish time in seconds
 int getID()
          Gets this object's reservation ID
 int getNumPE()
          Gets this object's number of PEs.
 Collection<TimeSlot> getReservationOptions()
          Gets the reservation options given by the Grid resource
 int getResourceID()
          Gets this object's resource ID.
 double getStartTime()
          Gets this object's start time in seconds
 ReservationStatus getStatus()
          Gets the status of this reservation
 double getSubmissionTime()
          Returns the time of submission of this reservation
 int getUserID()
          Gets this object's owner ID
 boolean setDurationTime(int duration)
          Sets the duration time (unit in seconds) for this reservation.
 boolean setNumPE(int numPE)
          Sets the number of PEs (Processing Elements) required by this reservation
 void setReservationOptions(Collection<TimeSlot> resOptions)
          Sets the reservation options given by the Grid resource
 boolean setResourceID(int id)
          Sets the resource ID for sending this reservation object.
 boolean setStartTime(double startTime)
          Sets the start time (in seconds) for this reservation.
 void setStatus(ReservationStatus status)
          Sets the status of this reservation.
 boolean setSubmissionTime(double time)
          Sets the time of submission of this reservation
 String toString()
          Creates a string representation of the reservation for debugging purposes.
 
Methods inherited from class Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Reservation

public Reservation(String userName)
Allocates a new Reservation object

Parameters:
userName - an entity name that owns this reservation object

Reservation

public Reservation(int userID)
Allocates a new Reservation object

Parameters:
userID - an entity ID that owns this reservation object
Method Detail

setSubmissionTime

public boolean setSubmissionTime(double time)
Sets the time of submission of this reservation

Parameters:
time - the submission time
Returns:
true if the time has been set or false otherwise.

getSubmissionTime

public double getSubmissionTime()
Returns the time of submission of this reservation

Returns:
the submission time

copy

public boolean copy(Reservation obj)
Copy the object. All the values are copied into this object. If the object is null, then copy failed.

Parameters:
obj - a Reservation object
Returns:
true if successful, false otherwise

setStartTime

public boolean setStartTime(double startTime)
Sets the start time (in seconds) for this reservation.

Parameters:
startTime - the reservation start time in seconds
Returns:
true if successful, false otherwise

setDurationTime

public boolean setDurationTime(int duration)
Sets the duration time (unit in seconds) for this reservation.

Parameters:
duration - the reservation duration time. Time unit is in seconds.
Returns:
true if successful, false otherwise
Pre Condition:
duration > 0

setNumPE

public boolean setNumPE(int numPE)
Sets the number of PEs (Processing Elements) required by this reservation

Parameters:
numPE - number of PEs required
Returns:
true if successful, false otherwise
Pre Condition:
numPE > 0

getUserID

public int getUserID()
Gets this object's owner ID

Returns:
a user ID that owns this reservation object

getEntityName

public String getEntityName()
Gets this object's owner name

Returns:
a user name that owns this reservation object

getStartTime

public double getStartTime()
Gets this object's start time in seconds

Returns:
the reservation start time in seconds

getFinishTime

public double getFinishTime()
Gets this object's finish time in seconds

Returns:
the reservation finish time in seconds

getDurationTime

public int getDurationTime()
Gets this object's duration time in seconds

Returns:
the reservation duration time in seconds

getNumPE

public int getNumPE()
Gets this object's number of PEs.

Returns:
the reservation number of PEs requested

getResourceID

public int getResourceID()
Gets this object's resource ID.

Returns:
a resource ID

setResourceID

public boolean setResourceID(int id)
Sets the resource ID for sending this reservation object.

Parameters:
id - a resource ID
Returns:
true if successful, false otherwise
Pre Condition:
id > 0

setStatus

public void setStatus(ReservationStatus status)
Sets the status of this reservation.

Parameters:
status - this reservation status

getStatus

public ReservationStatus getStatus()
Gets the status of this reservation

Returns:
this reservation current status

getID

public int getID()
Gets this object's reservation ID

Returns:
a reservation ID

getReservationOptions

public Collection<TimeSlot> getReservationOptions()
Gets the reservation options given by the Grid resource

Returns:
the reservation options

setReservationOptions

public void setReservationOptions(Collection<TimeSlot> resOptions)
Sets the reservation options given by the Grid resource

Parameters:
resOptions - the reservation options object

clone

public Reservation clone()
Returns a clone of this object

Overrides:
clone in class Object
Returns:
a cloned reservation object

compareTo

public int compareTo(Reservation reservation)
Compares this reservation with the specified reservation for order. Returns a negative integer, zero, or a positive integer as this reservation is less than, equal to, or greater than the specified reservation.

Specified by:
compareTo in interface Comparable<Reservation>
Parameters:
reservation - the reservation against which this reservation has to be compared
Returns:
a negative number, zero or positive number if this reservation is smaller, equals or greater respectively than the provided reservation

toString

public String toString()
Creates a string representation of the reservation for debugging purposes.

Overrides:
toString in class Object
Returns:
a string representation of this reservation.

GridSim 5.0 beta

The University of Melbourne, Australia, 2009