GridSim 5.0 beta

gridsim.parallel.profile
Class PERange

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

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

This class represents a range of PEs. This is used by allocation policies to keep track of PEs available at a particular time and the PEs allocated to Gridlets. For example, a Gridlet is using a range of PEs (0..4).

Since:
5.0
Author:
Marcos Dias de Assuncao
See Also:
PERangeList

Constructor Summary
PERange(int beginning, int end)
          Creates a new PERange object
 
Method Summary
 PERange clone()
          Returns a clone of this range
 int compareTo(PERange range)
          Compares this range against another range of PEs.
(package private)  PERangeList difference(PERange rangeb)
          Returns the list of ranges resulting from subtracting the given range from this range
 int getBegin()
          Returns the beginning of the range
 int getEnd()
          Returns the end of the range of PEs
 int getNumPE()
          Returns the number of PEs in this range
(package private)  boolean intersect(PERange rangeb)
          Checks whether this range intersects with the given range
(package private)  PERange intersection(PERange rangeb)
          Returns the common range of this range with another
(package private)  void setBegin(int beginning)
          Sets the beginning of the range
(package private)  void setEnd(int end)
          Sets the end of the PE range
 String toString()
          Creates a string representation of this class
 
Methods inherited from class Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PERange

public PERange(int beginning,
               int end)
Creates a new PERange object

Parameters:
beginning - the start of the range of PEs
end - the end of the range
Method Detail

getBegin

public int getBegin()
Returns the beginning of the range

Returns:
the number corresponding to the beginning

getEnd

public int getEnd()
Returns the end of the range of PEs

Returns:
the end of the range

getNumPE

public int getNumPE()
Returns the number of PEs in this range

Returns:
the number of PEs

clone

public PERange clone()
Returns a clone of this range

Overrides:
clone in class Object
Returns:
the cloned range

compareTo

public int compareTo(PERange range)
Compares this range against another range of PEs.

Specified by:
compareTo in interface Comparable<PERange>
Parameters:
range - the range to compare this range with
Returns:
-1 if the beginning of this range is smaller than the other range, 0 if they are the same and 1 the beginning of this range is bigger

toString

public String toString()
Creates a string representation of this class

Overrides:
toString in class Object
Returns:
the string representation

intersection

PERange intersection(PERange rangeb)
Returns the common range of this range with another

Parameters:
rangeb - the second range
Returns:
the common range of PEs

difference

PERangeList difference(PERange rangeb)
Returns the list of ranges resulting from subtracting the given range from this range

Parameters:
rangeb - the range to compare this range against
Returns:
the range corresponding to the difference

intersect

boolean intersect(PERange rangeb)
Checks whether this range intersects with the given range

Parameters:
rangeb - the range to compare this range against
Returns:
true if the two ranges have an intersection or false otherwise.

setBegin

void setBegin(int beginning)
Sets the beginning of the range

Parameters:
beginning - the beginning

setEnd

void setEnd(int end)
Sets the end of the PE range

Parameters:
end - the end of the range

GridSim 5.0 beta

The University of Melbourne, Australia, 2009