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
-
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 intaddTraffic(int wavelength, int bw)Inside a given wavelength, decreases, if possible, the available bandwidth.intamountBWAvailable(int wavelength)Retrieves how much bandwidth is available for a determined wavelength.intfirstWLAvailable()Retrieves the lowest available wavelength in a given WDMLink.intgetBandwidth()intgetFreeWavelengths()Retrieves the number of available wavelengths that have space in the its bandwidth, given WDMLink.doublegetLinkUtilization(int wavelength)doublegetPc()Retrieves Power comsumption of this wavelengths in this linkintgetWavelengths()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.BooleanisWLAvailable(int wavelength)Says whether or not a determined wavelength is available.voidreleaseWavelength(int wavelength)By attributing true to a given wavelength inside the freeWavelengths vector, this function "releases" a wavelength.intremoveTraffic(int wavelength, int bw)Inside a given wavelength, increases, if possible, the available bandwidth.booleanreserveWavelength(int wavelength)By attributing false to a given wavelength inside the freeWavelengths vector, this function "reserves" a wavelength.java.lang.StringtoString()Prints all information related to the Link object.
-
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 addedbw- 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 removedbw- 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:LinkPrints all information related to the Link object.
-