Class Util

java.lang.Object
org.cloudbus.cloudsim.util.Util

public final class Util
extends Object
A class with general purpose utilities.
Since:
CloudSim Plus 6.0.0
Author:
Manoel Campos da Silva Filho
  • Method Summary

    Modifier and Type Method Description
    static void printProgress​(int current, int total)
    Prints a progress bar at the command line for any general process represented by several tasks (steps).
    static void printProgress​(int current, int total, boolean progressBarInNewLine)
    Prints a progress bar at the command line for any general process represented by several tasks (steps).
    static void sleep​(long millis)
    Makes the current thread to sleep for a given amount ot milliseconds.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • sleep

      public static void sleep​(long millis)
      Makes the current thread to sleep for a given amount ot milliseconds.
      Parameters:
      millis - the time to sleep in milliseconds
    • printProgress

      public static void printProgress​(int current, int total)
      Prints a progress bar at the command line for any general process represented by several tasks (steps). The bar is updated at the current line. If nothing is printed between updates, the bar is shown at the same place. You can use it like the sample below:
       
      
       final int total = 100;
       for (int i = 0; i <= total; i++) {
           Util.sleep(120); //simulates some task (use your own code here)
           Util.printProgress(i, total);
       }
       
       
      Parameters:
      current - the index of the current finished task (step)
      total - the total number of tasks (steps)
      See Also:
      printProgress(int, int, boolean)
    • printProgress

      public static void printProgress​(int current, int total, boolean progressBarInNewLine)
      Prints a progress bar at the command line for any general process represented by several tasks (steps). You can use it like the sample below:
       
      
       final int total = 100;
       for (int i = 0; i <= total; i++) {
           Util.sleep(120); //simulates some task (use your own code here)
           Util.printProgress(i, total);
       }
       
       
      Parameters:
      current - the index of the current finished task (step)
      total - the total number of tasks (steps)
      progressBarInNewLine - indicates if the progress bar will be printed in a new line or not
      See Also:
      printProgress(int, int)