GridSim 5.0 beta

gridsim
Class MachineList

Object
  extended by AbstractCollection<E>
      extended by AbstractList<E>
          extended by AbstractSequentialList<E>
              extended by LinkedList<Machine>
                  extended by MachineList
All Implemented Interfaces:
Serializable, Cloneable, Iterable<Machine>, Collection<Machine>, Deque<Machine>, List<Machine>, Queue<Machine>

public class MachineList
extends LinkedList<Machine>

GridSim MachineList simulates a collection of machines. It is up to the GridSim users to define the connectivity among the machines in a collection. Therefore, this class can be instantiated to model a simple LAN to cluster to WAN.

Since:
GridSim Toolkit 1.0
Author:
Manzur Murshed and Rajkumar Buyya
See Also:
Serialized Form
Invariant:
$none

Field Summary
 
Fields inherited from class AbstractList
modCount
 
Constructor Summary
MachineList()
           
 
Method Summary
 int getByteSize()
          Gets the byte size of this class
 Machine getMachine(int id)
          Gets the Machine object for a particular ID
 Machine getMachineInPos(int index)
          Gets the machine in a given position in the list.
 Machine getMachineWithFreePE()
          Gets a Machine with free PE
 Machine getMachineWithFreePE(int numPE)
          Gets a Machine with a specified number of free PE
 int getNumBusyPE()
          Gets the total number of BUSY PEs for all Machines
 int getNumFreePE()
          Gets the total number of FREE or non-busy PEs for all Machines
 int getNumPE()
          Gets the total number of PEs for all Machines
 boolean setStatusPE(boolean status, int machineID, int peID)
          Sets the particular PE status on a Machine
 
Methods inherited from class LinkedList
add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, descendingIterator, element, get, getFirst, getLast, indexOf, lastIndexOf, listIterator, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, remove, remove, remove, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence, set, size, toArray, toArray
 
Methods inherited from class AbstractSequentialList
iterator
 
Methods inherited from class AbstractList
equals, hashCode, listIterator, removeRange, subList
 
Methods inherited from class AbstractCollection
containsAll, isEmpty, removeAll, retainAll, toString
 
Methods inherited from class Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface List
containsAll, equals, hashCode, isEmpty, iterator, listIterator, removeAll, retainAll, subList
 
Methods inherited from interface Deque
iterator
 

Constructor Detail

MachineList

public MachineList()
Method Detail

getMachine

public Machine getMachine(int id)
Gets the Machine object for a particular ID

Parameters:
id - the machine ID
Returns:
the Machine object or null if no machine exists
See Also:
Machine
Pre Condition:
id >= 0
Post Condition:
$none

getNumPE

public int getNumPE()
Gets the total number of PEs for all Machines

Returns:
number of PEs
Pre Condition:
$none
Post Condition:
$result >= 0

getNumFreePE

public int getNumFreePE()
Gets the total number of FREE or non-busy PEs for all Machines

Returns:
number of PEs
Pre Condition:
$none
Post Condition:
$result >= 0

getNumBusyPE

public int getNumBusyPE()
Gets the total number of BUSY PEs for all Machines

Returns:
number of PEs
Pre Condition:
$none
Post Condition:
$result >= 0

getMachineWithFreePE

public Machine getMachineWithFreePE()
Gets a Machine with free PE

Returns:
a machine object or null if not found
Pre Condition:
$none
Post Condition:
$none

getMachineWithFreePE

public Machine getMachineWithFreePE(int numPE)
Gets a Machine with a specified number of free PE

Parameters:
numPE - number of free PE
Returns:
a machine object or null if not found
Pre Condition:
$none
Post Condition:
$none

setStatusPE

public boolean setStatusPE(boolean status,
                           int machineID,
                           int peID)
Sets the particular PE status on a Machine

Parameters:
status - PE status, either PE.FREE or PE.BUSY
machineID - Machine ID
peID - PE id
Returns:
true if the PE status has changed, false otherwise (Machine id or PE id might not be exist)
Pre Condition:
machineID >= 0, peID >= 0
Post Condition:
$none

getByteSize

public int getByteSize()
Gets the byte size of this class

Returns:
the byte size
Pre Condition:
$none
Post Condition:
$result >= 0

getMachineInPos

public Machine getMachineInPos(int index)
Gets the machine in a given position in the list.

Parameters:
index - a position index in the list
Returns:
the Machine object

GridSim 5.0 beta

The University of Melbourne, Australia, 2009