GridSim 5.0 beta

gridsim
Class ARObject

Object
  extended by ARObject

public class ARObject
extends Object

ARObject class represents a reservation object and its properties. AdvanceReservation class creates an object of this class, then pass it to a resource. When a resource or its scheduler agrees to accept this reservation, then it will set an unique reservation ID and expiry time.

Since:
GridSim Toolkit 3.0
Author:
Anthony Sulistio
Invariant:
$none

Constructor Summary
ARObject(ARObject obj)
          Copy constructor.
ARObject(int userID)
          Allocates a new ARObject object, with a default time zone from GridSim.getSimulationCalendar() method.
ARObject(int userID, double timeZone)
          Allocates a new ARObject object.
ARObject(String userName)
          Allocates a new ARObject object, with a default time zone from GridSim.getSimulationCalendar() method.
ARObject(String userName, double timeZone)
          Allocates a new ARObject object.
 
Method Summary
 void addTotalGridlet(int num)
          Adds the number of Gridlets executed by this reservation.
 boolean copy(ARObject obj)
          Copy the object.
static int getByteSize()
          Determines the size of ARObject object
 int getDurationTime()
          Gets this object's duration time in seconds
 String getEntityName()
          Gets this object's owner name
 long getExpiryTime()
          Gets this object's expiry time
 int getNumPE()
          Gets this object's number of PEs.
 int getReservationID()
          Gets this object's reservation ID
 int getResourceID()
          Gets this object's resource ID.
 long getStartTime()
          Gets this object's start time in milliseconds
 int getStatus()
          Gets the status of this reservation
 double getTimeZone()
          Gets this object's time zone based on GMT
 int getTotalGridlet()
          Gets the total Gridlet executed by this reservation
 int getTransactionID()
          Gets this object's transaction ID
 int getUserID()
          Gets this object's owner ID
 boolean hasCommitted()
          Checks whether this reservation object has committed or not.
 void reduceTotalGridlet()
          Reduces total Gridlet executed by this reservation by one.
 void setCommitted()
          Sets this object into a committed state.
 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 setReservation(int id, long expiryTime)
          Sets a reservation's attributes upon acceptance by a resource.
 boolean setResourceID(int id)
          Sets the resource ID for sending this reservation object.
 boolean setStartTime(long startTime)
          Sets the start time (in milliseconds) for this reservation.
 void setStatus(int status)
          Sets the status of this reservation.
 boolean setTimeZone(double time)
          Sets this reservation's time zone based on GMT.
 boolean setTransactionID(int id)
          Sets a transaction ID for this reservation.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ARObject

public ARObject(ARObject obj)
Copy constructor. If the given object is null, then no values will be copied.

Parameters:
obj - ARObject object
Pre Condition:
obj != null
Post Condition:
$none

ARObject

public ARObject(String userName)
Allocates a new ARObject object, with a default time zone from GridSim.getSimulationCalendar() method. If the Calendar object is null, then the time zone will be GMT+0.

Parameters:
userName - an entity name that owns this reservation object
See Also:
GridSim.getSimulationCalendar()
Pre Condition:
userName != null
Post Condition:
$none

ARObject

public ARObject(String userName,
                double timeZone)
Allocates a new ARObject object. If the time zone is invalid, then by default, it will be GMT+0.

Parameters:
userName - an entity name that owns this reservation object
timeZone - local time zone of a user that owns this reservation. Time zone should be of range [GMT-12 ... GMT+13]
Pre Condition:
userName != null, $none
Post Condition:
$none

ARObject

public ARObject(int userID,
                double timeZone)
Allocates a new ARObject object. If the time zone is invalid, then by default, it will be GMT+0.

Parameters:
userID - an entity ID that owns this reservation object
timeZone - local time zone of a user that owns this reservation. Time zone should be of range [GMT-12 ... GMT+13]
Pre Condition:
userID > 0
Post Condition:
$none

ARObject

public ARObject(int userID)
Allocates a new ARObject object, with a default time zone from GridSim.getSimulationCalendar() method. If the Calendar object is null, then the time zone will be GMT+0.

Parameters:
userID - an entity ID that owns this reservation object
See Also:
GridSim.getSimulationCalendar()
Pre Condition:
userID > 0
Post Condition:
$none
Method Detail

getByteSize

public static int getByteSize()
Determines the size of ARObject object

Returns:
the size of this object
Pre Condition:
$none
Post Condition:
$result > 0

copy

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

Parameters:
obj - an ARObject object
Returns:
true if successful, false otherwise
Pre Condition:
obj != null
Post Condition:
$none

setTransactionID

public boolean setTransactionID(int id)
Sets a transaction ID for this reservation.

Parameters:
id - a transaction ID
Returns:
true if successul, false otherwise
Pre Condition:
id > 0
Post Condition:
$none

setStartTime

public boolean setStartTime(long startTime)
Sets the start time (in milliseconds) for this reservation. The start time should be greater than simulation init time defined in GridSim.init(int, Calendar, boolean)

Parameters:
startTime - the reservation start time in milliseconds
Returns:
true if successul, false otherwise
See Also:
GridSim.init(int, Calendar, boolean)
Pre Condition:
startTime > 0
Post Condition:
$none

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 successul, false otherwise
Pre Condition:
duration > 0
Post Condition:
$none

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 successul, false otherwise
Pre Condition:
numPE > 0
Post Condition:
$none

setResourceID

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

Parameters:
id - a resource ID
Returns:
true if successul, false otherwise
Pre Condition:
id > 0
Post Condition:
$none

setTimeZone

public boolean setTimeZone(double time)
Sets this reservation's time zone based on GMT.

Parameters:
time - a valid time zone based on GMT
Returns:
true if successul, false otherwise
Pre Condition:
$none
Post Condition:
$none

getUserID

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

Returns:
a user ID that owns this reservation object
Pre Condition:
$none
Post Condition:
$none

getEntityName

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

Returns:
a user name that owns this reservation object or null if invalid
Pre Condition:
$none
Post Condition:
$none

getTransactionID

public int getTransactionID()
Gets this object's transaction ID

Returns:
a transaction ID
Pre Condition:
$none
Post Condition:
$none

getStartTime

public long getStartTime()
Gets this object's start time in milliseconds

Returns:
the reservation start time in milliseconds
Pre Condition:
$none
Post Condition:
$none

getDurationTime

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

Returns:
the reservation duration time in seconds
Pre Condition:
$none
Post Condition:
$none

getNumPE

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

Returns:
the reservation number of PEs requested
Pre Condition:
$none
Post Condition:
$none

getResourceID

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

Returns:
a resource ID
Pre Condition:
$none
Post Condition:
$none

getTimeZone

public double getTimeZone()
Gets this object's time zone based on GMT

Returns:
a time zone based on GMT
Pre Condition:
$none
Post Condition:
$none

getTotalGridlet

public int getTotalGridlet()
Gets the total Gridlet executed by this reservation

Returns:
total Gridlet
Pre Condition:
$none
Post Condition:
$none

addTotalGridlet

public void addTotalGridlet(int num)
Adds the number of Gridlets executed by this reservation. This method is done by a resource's scheduler.

Parameters:
num - number of Gridlets
Pre Condition:
num > 0
Post Condition:
$none

reduceTotalGridlet

public void reduceTotalGridlet()
Reduces total Gridlet executed by this reservation by one. This method is done by a resource's scheduler.

Pre Condition:
$none
Post Condition:
$none

setReservation

public void setReservation(int id,
                           long expiryTime)
Sets a reservation's attributes upon acceptance by a resource. This method is mainly used by ARPolicy object.

Parameters:
id - an unique reservation id
expiryTime - the reservation expiry time
Pre Condition:
id > 0, expiryTime > 0
Post Condition:
$none

setStatus

public void setStatus(int status)
Sets the status of this reservation. This method can be used by both ARPolicy and AdvanceReservation object.

Parameters:
status - this reservation status
Pre Condition:
$none
Post Condition:
$none

setCommitted

public void setCommitted()
Sets this object into a committed state. This method can be used by both ARPolicy and AdvanceReservation object.

Pre Condition:
$none
Post Condition:
$none

getStatus

public int getStatus()
Gets the status of this reservation

Returns:
this reservation current status
Pre Condition:
$none
Post Condition:
$none

getReservationID

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

Returns:
a reservation ID
Pre Condition:
$none
Post Condition:
$none

getExpiryTime

public long getExpiryTime()
Gets this object's expiry time

Returns:
expiry time
Pre Condition:
$none
Post Condition:
$none

hasCommitted

public boolean hasCommitted()
Checks whether this reservation object has committed or not.

Returns:
true if this object has committed, false otherwise
Pre Condition:
$none
Post Condition:
$none

GridSim 5.0 beta

The University of Melbourne, Australia, 2009