Package ons

Class WDMLink

java.lang.Object
ons.Link
ons.WDMLink

public class WDMLink
extends Link
The Wavelength Division Multiplexing (WDM) Link represents a Fiberlink in an optical network.
  • Field Summary

    Fields inherited from class ons.Link

    delay, dst, id, src, weight
  • Constructor Summary

    Constructors 
    Constructor Description
    WDMLink​(int id, int src, int dst, double delay, double weight, int wavelengths, int bw, double pc)  
  • Method Summary

    Modifier and Type Method Description
    int addTraffic​(int wavelength, int bw)
    Inside a given wavelength, decreases, if possible, the available bandwidth.
    int amountBWAvailable​(int wavelength)
    Retrieves how much bandwidth is available for a determined wavelength.
    int firstWLAvailable()
    Retrieves the lowest available wavelength in a given WDMLink.
    int getBandwidth()  
    int getFreeWavelengths()
    Retrieves the number of available wavelengths that have space in the its bandwidth, given WDMLink.
    double getLinkUtilization​(int wavelength)  
    double getPc()
    Retrieves Power comsumption of this wavelengths in this link
    int getWavelengths()
    Retrieves the number of available wavelengths for a given WDMLink.
    int[] hasBWAvailable​(int bw)
    Retrieves the list of wavelengths that have a determined amount of bandwidth available.
    int[] hasWLAvailable()
    Retrieves the list of all available wavelengths in a given WDMLink.
    java.lang.Boolean isWLAvailable​(int wavelength)
    Says whether or not a determined wavelength is available.
    void releaseWavelength​(int wavelength)
    By attributing true to a given wavelength inside the freeWavelengths vector, this function "releases" a wavelength.
    int removeTraffic​(int wavelength, int bw)
    Inside a given wavelength, increases, if possible, the available bandwidth.
    boolean reserveWavelength​(int wavelength)
    By attributing false to a given wavelength inside the freeWavelengths vector, this function "reserves" a wavelength.
    java.lang.String toString()
    Prints all information related to the Link object.

    Methods inherited from class ons.Link

    getDelay, getDestination, getID, getSource, getWeight, setWeight

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • WDMLink

      public WDMLink​(int id, int src, int dst, double delay, double weight, int wavelengths, int bw, double pc)
  • Method Details

    • getBandwidth

      public int getBandwidth()
    • getPc

      public double getPc()
      Retrieves Power comsumption of this wavelengths in this link
      Returns:
      power comsumption transponder in W
    • getWavelengths

      public int getWavelengths()
      Retrieves the number of available wavelengths for a given WDMLink.
      Returns:
      the value of the WDMLink's wavelengths attribute
    • isWLAvailable

      public java.lang.Boolean isWLAvailable​(int wavelength)
      Says whether or not a determined wavelength is available.
      Parameters:
      wavelength - the index number of the wavelength that will be checked for availability in the WDMLink's freeWavelengths vector
      Returns:
      true if the wavelength is available
    • hasWLAvailable

      public int[] hasWLAvailable()
      Retrieves the list of all available wavelengths in a given WDMLink.
      Returns:
      list of available wavelengths
    • firstWLAvailable

      public int firstWLAvailable()
      Retrieves the lowest available wavelength in a given WDMLink.
      Returns:
      first true item in the freeWavelengths vector
    • amountBWAvailable

      public int amountBWAvailable​(int wavelength)
      Retrieves how much bandwidth is available for a determined wavelength.
      Parameters:
      wavelength - for which available bandwidth will be verified
      Returns:
      amount of available bandwidth
    • hasBWAvailable

      public int[] hasBWAvailable​(int bw)
      Retrieves the list of wavelengths that have a determined amount of bandwidth available.
      Parameters:
      bw - the minimum bandwidth required
      Returns:
      vector of integers with the retrieved wavelengths
    • reserveWavelength

      public boolean reserveWavelength​(int wavelength)
      By attributing false to a given wavelength inside the freeWavelengths vector, this function "reserves" a wavelength.
      Parameters:
      wavelength - value of the wavelength to be reserved
      Returns:
      true if operation was successful, or false otherwise
    • releaseWavelength

      public void releaseWavelength​(int wavelength)
      By attributing true to a given wavelength inside the freeWavelengths vector, this function "releases" a wavelength.
      Parameters:
      wavelength - value of the wavelength to be released
    • addTraffic

      public int addTraffic​(int wavelength, int bw)
      Inside a given wavelength, decreases, if possible, the available bandwidth. Therefore, this is equivalent to adding traffic to the network.
      Parameters:
      wavelength - value of the wavelength where traffic will be added
      bw - amount of bandwidth to be allocated
      Returns:
      the remaining available bandwidth after operation
    • removeTraffic

      public int removeTraffic​(int wavelength, int bw)
      Inside a given wavelength, increases, if possible, the available bandwidth. Therefore, this is equivalent to removing traffic from the network.
      Parameters:
      wavelength - value of the wavelength from where traffic will be removed
      bw - amount of bandwidth to be released
      Returns:
      the remaining available bandwidth after operation
    • getLinkUtilization

      public double getLinkUtilization​(int wavelength)
    • getFreeWavelengths

      public int getFreeWavelengths()
      Retrieves the number of available wavelengths that have space in the its bandwidth, given WDMLink.
      Returns:
      the number of avaiable free wavelengths
    • toString

      public java.lang.String toString()
      Description copied from class: Link
      Prints all information related to the Link object.
      Specified by:
      toString in class Link
      Returns:
      string containing all the values of the link's parameters.