GridSim 5.0 beta

gridsim.parallel.profile
Class PERangeList

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

public class PERangeList
extends Object
implements Cloneable, Iterable<PERange>

This class represents a list of PERange's. This is used to represent the ranges of PEs used by a Gridlet and by the allocation policies to create a profile of ranges available at particular simulation times.

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

Constructor Summary
PERangeList()
          Default constructor.
PERangeList(int stPE, int fnPE)
          Creates a new PERangeList object.
 
Method Summary
 boolean add(PERange range)
          Adds a new PE range to the PERangeList
 boolean addAll(PERangeList l)
          Adds a list of PE ranges to the PERangeList
 void clear()
          Removes all ranges from this list of ranges
 PERangeList clone()
          Returns a clone of this list of ranges
 boolean equals(PERangeList other)
           
 int getHighestPE()
          Returns the greatest PE number in this list.
 int getLowestPE()
          Returns the smallest PE number in this list.
 int getNumPE()
          Returns the number of PEs in this list
 PERangeList intersection(PERangeList listb)
          Identifies the intersections between lists of ranges
 Iterator<PERange> iterator()
          Returns an iterator for this list.
 void mergePERanges()
          Merges PE ranges: e.g.
 void remove(PERangeList list)
          Removes the ranges provided from this list.
 PERangeList selectPEs(int reqPE)
          Selects a range to be used by a Gridlet.
 int size()
          Returns the number of PE ranges in this list.
 void sortRanges()
          Sorts the ranges in this list of ranges
 String toString()
          Creates an String representation of this list
 
Methods inherited from class Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PERangeList

public PERangeList()
Default constructor.


PERangeList

public PERangeList(int stPE,
                   int fnPE)
Creates a new PERangeList object.

Parameters:
stPE - the initial PE for this range.
fnPE - the final PE for this range.
Method Detail

getNumPE

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

Returns:
the number of PEs

mergePERanges

public void mergePERanges()
Merges PE ranges: e.g. [3-5],[5-8],[10-20] => [3-8],[10-20].


clone

public PERangeList clone()
Returns a clone of this list of ranges

Overrides:
clone in class Object
Returns:
the cloned list

add

public boolean add(PERange range)
Adds a new PE range to the PERangeList

Parameters:
range - the range to be added to the list
Returns:
true if the range has been added; false otherwise.

addAll

public boolean addAll(PERangeList l)
Adds a list of PE ranges to the PERangeList

Parameters:
l - the list of ranges to be added to the list
Returns:
true if the ranges have been added; false otherwise.

clear

public void clear()
Removes all ranges from this list of ranges


sortRanges

public void sortRanges()
Sorts the ranges in this list of ranges


size

public int size()
Returns the number of PE ranges in this list.

Returns:
the number of PE ranges.

getLowestPE

public int getLowestPE()
Returns the smallest PE number in this list.

Returns:
the smallest PE number of -1 if not found.

getHighestPE

public int getHighestPE()
Returns the greatest PE number in this list.

Returns:
the greatest PE number of -1 if not found.

toString

public String toString()
Creates an String representation of this list

Overrides:
toString in class Object
Returns:
the string representation

iterator

public Iterator<PERange> iterator()
Returns an iterator for this list.

Specified by:
iterator in interface Iterable<PERange>
Returns:
an iterator for the ranges in this list.

intersection

public PERangeList intersection(PERangeList listb)
Identifies the intersections between lists of ranges

Parameters:
listb - the second list
Returns:
a list containing the intersection between the lists

remove

public void remove(PERangeList list)
Removes the ranges provided from this list.

Parameters:
list - the ranges to be removed from this list.

equals

public boolean equals(PERangeList other)

selectPEs

public PERangeList selectPEs(int reqPE)
Selects a range to be used by a Gridlet.

Parameters:
reqPE - the number of PEs required.
Returns:
the range to be allocated or null if no range suitable is found.

GridSim 5.0 beta

The University of Melbourne, Australia, 2009