HostList (cloudsim 3.1-SNAPSHOT API)

org.cloudbus.cloudsim.lists

## Class HostList

- java.lang.Object
- - org.cloudbus.cloudsim.lists.HostList

-     public class HostList
      extends Object

  HostList is a collection of operations on lists of hosts.
  Since:
    CloudSim Toolkit 2.0
  Author:
    Anton Beloglazov

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `HostList()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <T extends Host> T` | `getById(List<T> hostList, int id)` Gets the Machine object for a particular ID.
    `static <T extends Host> T` | `getHostWithFreePe(List<T> hostList)` Gets a Machine with free Pe.
    `static <T extends Host> T` | `getHostWithFreePe(List<T> hostList, int pesNumber)` Gets a Machine with a specified number of free Pe.
    `static <T extends Host> int` | `getNumberOfBusyPes(List<T> hostList)` Gets the total number of `BUSY` PEs for all Machines.
    `static <T extends Host> int` | `getNumberOfFreePes(List<T> hostList)` Gets the total number of `FREE` or non-busy PEs for all Machines.
    `static <T extends Host> int` | `getNumberOfPes(List<T> hostList)` Gets the total number of PEs for all Machines.
    `static <T extends Host> boolean` | `setPeStatus(List<T> hostList, int status, int hostId, int peId)` Sets the particular Pe status on a Machine.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### HostList

          public HostList()

  - ### Method Detail

    - #### getById

          public static <T extends Host> T getById(List<T> hostList,
                                   int id)

      Gets the Machine object for a particular ID.
      Type Parameters:
        `T` - the generic type
      Parameters:
        `hostList` - the host list
        `id` - the host ID
      Returns:
        the Machine object or `null` if no machine exists
      See Also:
        `gridsim.Machine`

    - #### getNumberOfPes

          public static <T extends Host> int getNumberOfPes(List<T> hostList)

      Gets the total number of PEs for all Machines.
      Type Parameters:
        `T` - the generic type
      Parameters:
        `hostList` - the host list
      Returns:
        number of PEs

    - #### getNumberOfFreePes

          public static <T extends Host> int getNumberOfFreePes(List<T> hostList)

      Gets the total number of `FREE` or non-busy PEs for all Machines.
      Type Parameters:
        `T` - the generic type
      Parameters:
        `hostList` - the host list
      Returns:
        number of PEs

    - #### getNumberOfBusyPes

          public static <T extends Host> int getNumberOfBusyPes(List<T> hostList)

      Gets the total number of `BUSY` PEs for all Machines.
      Type Parameters:
        `T` - the generic type
      Parameters:
        `hostList` - the host list
      Returns:
        number of PEs

    - #### getHostWithFreePe

          public static <T extends Host> T getHostWithFreePe(List<T> hostList)

      Gets a Machine with free Pe.
      Type Parameters:
        `T` - the generic type
      Parameters:
        `hostList` - the host list
      Returns:
        a machine object or `null` if not found

    - #### getHostWithFreePe

          public static <T extends Host> T getHostWithFreePe(List<T> hostList,
                                             int pesNumber)

      Gets a Machine with a specified number of free Pe.
      Type Parameters:
        `T` - the generic type
      Parameters:
        `hostList` - the host list
        `pesNumber` - the pes number
      Returns:
        a machine object or `null` if not found

    - #### setPeStatus

          public static <T extends Host> boolean setPeStatus(List<T> hostList,
                                             int status,
                                             int hostId,
                                             int peId)

      Sets the particular Pe status on a Machine.
      Type Parameters:
        `T` - the generic type
      Parameters:
        `hostList` - the host list
        `status` - Pe status, either `Pe.FREE` or `Pe.BUSY`
        `hostId` - the host id
        `peId` - the pe id
      Returns:
        `true` if the Pe status has changed, `false` otherwise (Machine id or Pe id might not be exist)

Copyright © 2013 The Cloud Computing and Distributed Systems (CLOUDS) Laboratory, The University of Melbourne. All Rights Reserved.