Package ons

Class EONLink

java.lang.Object
ons.Link
ons.EONLink

public class EONLink
extends Link
The Elastic Optical Network (EON) Link represents a Fiberlink in an optical network divided by slots.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected Core[] cores  

    Fields inherited from class ons.Link

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

    Constructors 
    Constructor Description
    EONLink​(int id, int src, int dst, double delay, double weight, int numSlots, int guardband)  
    EONLink​(int id, int src, int dst, double delay, double weight, int numSlots, int guardband, int cores)  
  • Method Summary

    Modifier and Type Method Description
    boolean areSlotsAvaiable​(int begin, int end)
    Checks for available slots considering the guard band.
    boolean areSlotsAvaiable​(int core, int begin, int end)
    Checks for available slots considering the guard band.
    int[] bestFit​(int requiredSlots)
    The best fit slot alocation.
    int[] bestFit​(int core, int requiredSlots)
    The best fit slot alocation.
    void changeCore​(int firstSlot, int lastSlot, Core oldCore, Core newCore)
    Change the spectrum core
    void changeSpectrum​(int oldfirstSlot, int oldlastSlot, int newfirstSlot, int newlastSlot)
    Change the spectrum frequency in this link.
    void changeSpectrum​(int core, int oldfirstSlot, int oldlastSlot, int newfirstSlot, int newlastSlot)
    Change the spectrum frequency in this core.
    int[] exactFit​(int requiredSlots)
    The exact fit slot alocation.
    int[] exactFit​(int core, int requiredSlots)
    The exact fit slot alocation.
    int[] findLightpath​(int core, long lp)
    Retrieves the lightpath slot position.
    int[] findLightpath​(long lp)
    Retrieves the lightpath slot position.
    int[] firstExactFit​(int requiredSlots)
    The first exact fit slot alocation.
    int[] firstExactFit​(int core, int requiredSlots)
    The first exact fit slot alocation.
    int[] firstFit​(int requiredSlots)
    The first fit slot alocation.
    int[] firstFit​(int core, int requiredSlots)
    The first fit slot alocation.
    int getAvaiableSlots()
    Retrieves the slots available in this link.
    int getAvaiableSlots​(int core)
    Retrieves the slots available in this link core.
    int[] getAvailableCore​(int firstSlot, int lastSlot, Core core)
    Retrieves the Cores in this link has the same spectrum available of this core
    Core[] getCores()  
    double getExFragmentationRate()
    Retrieves the External Fragmentation Rate of this link
    double getExFragmentationRate​(int core)
    Retrieves the External Fragmentation Rate of this core
    int getFirstSlotAvailable​(int requiredSlots)
    Retrieves the first slot available to accommodate this requisition.
    int getFirstSlotAvailable​(int core, int requiredSlots)
    Retrieves the first slot available to accommodate this requisition.
    long getFirstUsedSlot()
    Retrieves the First used slot in this Link;
    long getFirstUsedSlot​(int core)
    Retrieves the First used slot in this Core;
    int[] getfreeBlocks()
    Returns all free blocks in this link.
    int[] getfreeBlocks​(int core)
    Returns all free blocks in this core.
    int[] getfreeBlocksToIndex​(int start, int end)
    Returns all free blocks to a final index on this link.
    int[] getfreeBlocksToIndex​(int core, int start, int end)
    Returns all free blocks to a final index on this core.
    int[] getfreeBlocksWithGB()
    Returns all free blocks in this core (Here he considers the guard band as a free block).
    int[] getfreeBlocksWithGB​(int core)
    Returns all free blocks in this core (Here he considers the guard band as a free block).The number returned is the first slot to this block.
    int[] getfreeRequiredSlotsBlocks​(int requiredSlots)
    Returns all free blocks that fit into the required slots in this link.
    int[] getfreeRequiredSlotsBlocks​(int core, int requiredSlots)
    Returns all free blocks that fit into the required slots in this core.
    int[] getfreeRequiredSlotsBlocksToIndex​(int requiredSlots, int start, int end)
    Returns all free blocks that fit into the required slots to a final index on this link.
    int[] getfreeRequiredSlotsBlocksToIndex​(int core, int requiredSlots, int start, int end)
    Returns all free blocks that fit into the required slots to a final index on this core.
    int getGuardband()
    Retrieves the guardband size in this link.
    int getGuardband​(int core)
    Retrieves the guardband size in this link core.
    int getLastSlotBlock​(int firstSlotBlock)
    Retrieves the last available slot of this block.
    int getLastSlotBlock​(int core, int firstSlotBlock)
    Retrieves the last available slot of this block.
    int getLastSlotBlockWithGB​(int firstSlotBlock)
    Retrieves the last available slot of this block (Here he considers the guard band as a free block)
    int getLastSlotBlockWithGB​(int core, int firstSlotBlock)
    Retrieves the last available slot of this block (Here he considers the guard band as a free block)
    int getLastSlotOccupiedBlock​(int firstSlotBlock)
    Retrieves the last occupied slot of this block.
    int getLastSlotOccupiedBlock​(int core, int firstSlotBlock)
    Retrieves the last occupied slot of this block.
    long getLastUsedSlot()
    Retrieves the Last used slot in this Link;
    long getLastUsedSlot​(int core)
    Retrieves the Last used slot in this Core;
    long getLeftSlot​(int slot)
    Retrieves the left slot given this position slot.
    long getLeftSlot​(int core, int slot)
    Retrieves the left slot given this position slot.
    java.util.ArrayList<java.lang.Integer> getLengthFreeBlock()
    Retrieves the length of all free blocks in this link
    java.util.ArrayList<java.lang.Integer> getLengthFreeBlock​(int core)
    Retrieves the length of all free blocks in this core
    long getLightpathId​(int index)
    Retrieve the lightpath id in this index
    long getLightpathId​(int core, int index)
    Retrieve the lightpath id in this index from this core
    java.util.ArrayList<java.lang.Long> getLightpaths()
    Retrieve all lightpaths ids from this link
    java.util.ArrayList<java.lang.Long> getLightpaths​(int core)
    Retrieve all lightpath ids from this core
    double getMouraFragmentationRate()
    Retrieves the Moura Fragmentation Rate of this link
    double getMouraFragmentationRate​(int core)
    Retrieves the Moura Fragmentation Rate of this core
    int getNumCores()  
    int getNumSlots()
    Retrieves the number of slots in this link.
    int getNumSlots​(int core)
    Retrieves the number of slots in this link core.
    int[] getOccupiedBlocks()
    Returns all occupied blocks in this core (Here he considers the guard band as a free block).
    int[] getOccupiedBlocks​(int core)
    Returns all occupied in this core (Here he considers the guard band as a free block).The number returned is the first slot to this block.
    int[] getOccupiedLightPathsBlocks()
    Returns all occupied LightPaths blocks in this link (Here he considers the guard band as a free block).
    int[] getOccupiedLightPathsBlocks​(int core)
    Returns all occupied LightPaths blocks in this core (Here he considers the guard band as a free block).
    double getRelativeFragmentationRate​(int requiredSlots)
    Retrieves the Relative Fragmentation Rate of this link based on required slots
    double getRelativeFragmentationRate​(int core, int requiredSlots)
    Retrieves the Relative Fragmentation Rate of this core based on required slots
    long getRightSlot​(int slot)
    Retrieves the right slot given this position slot.
    long getRightSlot​(int core, int slot)
    Retrieves the right slot given this position slot.
    double getSC()
    Retrieves the Spectrum Compactness (SC) in this Link.
    double getSC​(int core)
    Retrieves the Spectrum Compactness (SC) in this Core.
    java.util.ArrayList<java.lang.Integer> getSlotsAvailable​(int requiredSlots)
    Retrieves the set of slots available given a minimum size.
    java.util.ArrayList<java.lang.Integer> getSlotsAvailable​(int core, int requiredSlots)
    Retrieves the set of slots available given a minimum size.
    java.util.TreeSet<java.lang.Integer> getSlotsAvailableGlobal​(int requiredSlots)
    Retrieves the set of slots available in optical grooming or not given a minimum size.
    java.util.TreeSet<java.lang.Integer> getSlotsAvailableGlobal​(int core, int requiredSlots)
    Retrieves the set of slots available in optical grooming or not given a minimum size.
    int[] getSlotsAvailableGlobalToArray​(int requiredSlots)
    Retrieves the set of slots available in optical grooming or not given a minimum size [but in array of 'int'].
    int[] getSlotsAvailableGlobalToArray​(int core, int requiredSlots)
    Retrieves the set of slots available in optical grooming or not given a minimum size [but in array of 'int'].
    java.util.TreeSet<java.lang.Integer> getSlotsAvailableOG​(int requiredSlots)
    Retrieves the set of slots available in optical grooming given a minimum size.
    java.util.TreeSet<java.lang.Integer> getSlotsAvailableOG​(int core, int requiredSlots)
    Retrieves the set of slots available in optical grooming given a minimum size.
    int[] getSlotsAvailableOGToArray​(int requiredSlots)
    Retrieves the set of slots available in optical grooming given a minimum size [but in array of 'int'].
    int[] getSlotsAvailableOGToArray​(int core, int requiredSlots)
    Retrieves the set of slots available in optical grooming given a minimum size [but in array of 'int'].
    int[] getSlotsAvailableToArray​(int requiredSlots)
    Retrieves the set of slots available given a minimum size [but in array of 'int'].
    int[] getSlotsAvailableToArray​(int core, int requiredSlots)
    Retrieves the set of slots available given a minimum size [but in array of 'int'].
    int getUsedSlots()
    Retrieves the used slots in this link.
    int getUsedSlots​(int core)
    Retrieves the used slots in this link core.
    boolean hasAvailableCore​(int firstSlot, int lastSlot, Core core)
    Retrieves if another Core in this link has the same spectrum available of this core
    boolean hasSlotsAvaiable​(int requiredSlots)
    Check if there is available slots to accommodate the request int this link.
    boolean hasSlotsAvaiable​(int core, int requiredSlots)
    Check if there is available slots to accommodate the request in this core.
    boolean hasThisLightPath​(int core, long id)
    Check if this lightpath is this core
    boolean hasThisLightPath​(long id)
    Check if this lightpath is this link
    boolean isOpticalGrooming​(int core, long lp)
    Retrieves if this lightpath is in optical grooming.
    boolean isOpticalGrooming​(long lp)
    Retrieves if this lightpath is in optical grooming.
    int[] lastExactFit​(int requiredSlots)
    The last exact fit slot alocation.
    int[] lastExactFit​(int core, int requiredSlots)
    The last exact fit slot alocation.
    int[] lastFit​(int requiredSlots)
    The last fit slot alocation.
    int[] lastFit​(int core, int requiredSlots)
    The last fit slot alocation.
    boolean leftExtend​(int core, int requiredSlots, long lp)
    Examine whether it is possible to extend lightpath to left.
    boolean leftExtend​(int requiredSlots, long lp)
    Examine whether it is possible to extend lightpath to left.
    int maxSizeAvaiable()
    Retrieves the max size of contiguous slots available.
    int maxSizeAvaiable​(int core)
    Retrieves the max size of contiguous slots available.
    int minSizeAvaiable()
    Retrieves the minimun size of contiguous slots available.
    int minSizeAvaiable​(int core)
    Retrieves the minimun size of contiguous slots available.
    void printEndLink()
    Print the latest 10 slots of this link, for debug.
    void printLink()
    Print this link for debug.
    boolean pushpull​(int oldfirstSlot, int oldlastSlot, int newfirstSlot, int newlastSlot)
    Verify that it's possible push-pull in this link.
    boolean pushpull​(int core, int oldfirstSlot, int oldlastSlot, int newfirstSlot, int newlastSlot)
    Verify that it's possible push-pull in this core.
    int[] randomFit​(int requiredSlots)
    The random fit slot alocation.
    int[] randomFit​(int core, int requiredSlots)
    The random fit slot alocation.
    int rangeFree​(int requiredSlots)
    Retrieves the number of requests for C size that can be satisfied.
    int rangeFree​(int core, int requiredSlots)
    Retrieves the number of requests for C size that can be satisfied.
    int rangeFreeSimultaneous​(int requiredSlots)
    Retrieves the number of simultaneous requests for C size that can be satisfied.
    int rangeFreeSimultaneous​(int core, int requiredSlots)
    Retrieves the number of simultaneous requests for C size that can be satisfied.
    void releaseSlots​(int begin, int end)
    Release slots from this link.
    void releaseSlots​(int core, int begin, int end)
    Release slots from this core.
    void releaseSlotsInOpticalGrooming​(int begin, int end)
    Release slots from this link belonging to a tunnel.
    void releaseSlotsInOpticalGrooming​(int core, int begin, int end)
    Release slots from this core belonging to a tunnel.
    void reserveSlots​(int core, long id, int begin, int end)
    Reserve slots (with guard band) in this link, ie reserve lightpath.
    void reserveSlots​(long id, int begin, int end)
    Reserve slots (with guard band) in this link, ie reserve lightpath.
    void reserveSlotsInOpticalGrooming​(int core, long id, int begin, int end)
    Reserve slots (with guard band only the lightpath is on the edge) in this link, ie reserve lightpath using optical grooming technique.
    void reserveSlotsInOpticalGrooming​(long id, int begin, int end)
    Reserve slots (with guard band only the lightpath is on the edge) in this link, ie reserve lightpath using optical grooming technique.
    boolean rightExtend​(int core, int requiredSlots, long lp)
    Examine whether it is possible to extend lightpath to right.
    boolean rightExtend​(int requiredSlots, long lp)
    Examine whether it is possible to extend lightpath to right.
    int[] tbsa​(int requiredSlots)
    Spectrum Alocation TBSA (Traffic Balancing Spectrum Assignment).
    int[] tbsa​(int core, int requiredSlots)
    Spectrum Alocation TBSA (Traffic Balancing Spectrum Assignment).
    java.lang.String toString()
    Retrieves the information of this link

    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
  • Field Details

  • Constructor Details

    • EONLink

      public EONLink​(int id, int src, int dst, double delay, double weight, int numSlots, int guardband)
    • EONLink

      public EONLink​(int id, int src, int dst, double delay, double weight, int numSlots, int guardband, int cores)
  • Method Details

    • getCores

      public Core[] getCores()
    • getNumCores

      public int getNumCores()
    • getGuardband

      public int getGuardband()
      Retrieves the guardband size in this link.
      Returns:
      the guardband size
    • getGuardband

      public int getGuardband​(int core)
      Retrieves the guardband size in this link core.
      Parameters:
      core - core id
      Returns:
      the guardband size
    • getNumSlots

      public int getNumSlots()
      Retrieves the number of slots in this link.
      Returns:
      the number of slots in this link
    • getNumSlots

      public int getNumSlots​(int core)
      Retrieves the number of slots in this link core.
      Parameters:
      core - core id
      Returns:
      the number of slots in this link
    • getAvaiableSlots

      public int getAvaiableSlots()
      Retrieves the slots available in this link.
      Returns:
      the number slots available
    • getAvaiableSlots

      public int getAvaiableSlots​(int core)
      Retrieves the slots available in this link core.
      Parameters:
      core - core id
      Returns:
      the number slots available
    • getUsedSlots

      public int getUsedSlots()
      Retrieves the used slots in this link.
      Returns:
      the number used slots
    • getUsedSlots

      public int getUsedSlots​(int core)
      Retrieves the used slots in this link core.
      Parameters:
      core - core id
      Returns:
      the number used slots
    • hasSlotsAvaiable

      public boolean hasSlotsAvaiable​(int requiredSlots)
      Check if there is available slots to accommodate the request int this link.
      Parameters:
      requiredSlots - the request slots
      Returns:
      true if can be accommodate, false otherwise
    • hasSlotsAvaiable

      public boolean hasSlotsAvaiable​(int core, int requiredSlots)
      Check if there is available slots to accommodate the request in this core.
      Parameters:
      core - core id
      requiredSlots - the request slots
      Returns:
      true if can be accommodate, false otherwise
    • getFirstSlotAvailable

      public int getFirstSlotAvailable​(int requiredSlots)
      Retrieves the first slot available to accommodate this requisition. for this link
      Parameters:
      requiredSlots - the required slots
      Returns:
      the first slot available to accommodate this requisition
    • getFirstSlotAvailable

      public int getFirstSlotAvailable​(int core, int requiredSlots)
      Retrieves the first slot available to accommodate this requisition. for this core
      Parameters:
      core - core id
      requiredSlots - the required slots
      Returns:
      the first slot available to accommodate this requisition
    • getSlotsAvailable

      public java.util.ArrayList<java.lang.Integer> getSlotsAvailable​(int requiredSlots)
      Retrieves the set of slots available given a minimum size. for this link
      Parameters:
      requiredSlots - the required slots of set
      Returns:
      the set with first slots available to 'requiredSlots'
    • getSlotsAvailable

      public java.util.ArrayList<java.lang.Integer> getSlotsAvailable​(int core, int requiredSlots)
      Retrieves the set of slots available given a minimum size. for this core
      Parameters:
      core - id core
      requiredSlots - the required slots of set
      Returns:
      the set with first slots available to 'requiredSlots'
    • getSlotsAvailableOG

      public java.util.TreeSet<java.lang.Integer> getSlotsAvailableOG​(int requiredSlots)
      Retrieves the set of slots available in optical grooming given a minimum size. for this link
      Parameters:
      requiredSlots - the required slots of set
      Returns:
      the set with first slots available in optical grooming to 'requiredSlots'
    • getSlotsAvailableOG

      public java.util.TreeSet<java.lang.Integer> getSlotsAvailableOG​(int core, int requiredSlots)
      Retrieves the set of slots available in optical grooming given a minimum size. for this core
      Parameters:
      core - core id
      requiredSlots - the required slots of set
      Returns:
      the set with first slots available in optical grooming to 'requiredSlots'
    • getSlotsAvailableGlobal

      public java.util.TreeSet<java.lang.Integer> getSlotsAvailableGlobal​(int requiredSlots)
      Retrieves the set of slots available in optical grooming or not given a minimum size. for this link
      Parameters:
      requiredSlots - the required slots of set
      Returns:
      the set with first slots available in optical grooming or not to 'requiredSlots'
    • getSlotsAvailableGlobal

      public java.util.TreeSet<java.lang.Integer> getSlotsAvailableGlobal​(int core, int requiredSlots)
      Retrieves the set of slots available in optical grooming or not given a minimum size. for this core
      Parameters:
      core - core id
      requiredSlots - the required slots of set
      Returns:
      the set with first slots available in optical grooming or not to 'requiredSlots'
    • getSlotsAvailableToArray

      public int[] getSlotsAvailableToArray​(int requiredSlots)
      Retrieves the set of slots available given a minimum size [but in array of 'int']. for this link
      Parameters:
      requiredSlots - the required slots of set
      Returns:
      the array with first slots available to 'requiredSlots'
    • getSlotsAvailableToArray

      public int[] getSlotsAvailableToArray​(int core, int requiredSlots)
      Retrieves the set of slots available given a minimum size [but in array of 'int']. for this core
      Parameters:
      core - core id
      requiredSlots - the required slots of set
      Returns:
      the array with first slots available to 'requiredSlots'
    • getSlotsAvailableOGToArray

      public int[] getSlotsAvailableOGToArray​(int requiredSlots)
      Retrieves the set of slots available in optical grooming given a minimum size [but in array of 'int']. for this link
      Parameters:
      requiredSlots - the required slots of set
      Returns:
      the array with first slots available in optical grooming to 'requiredSlots'
    • getSlotsAvailableOGToArray

      public int[] getSlotsAvailableOGToArray​(int core, int requiredSlots)
      Retrieves the set of slots available in optical grooming given a minimum size [but in array of 'int']. for this core
      Parameters:
      core - core id
      requiredSlots - the required slots of set
      Returns:
      the array with first slots available in optical grooming to 'requiredSlots'
    • getSlotsAvailableGlobalToArray

      public int[] getSlotsAvailableGlobalToArray​(int requiredSlots)
      Retrieves the set of slots available in optical grooming or not given a minimum size [but in array of 'int']. for this link
      Parameters:
      requiredSlots - the required slots of set
      Returns:
      the array with first slots available in optical grooming or not to 'requiredSlots'
    • getSlotsAvailableGlobalToArray

      public int[] getSlotsAvailableGlobalToArray​(int core, int requiredSlots)
      Retrieves the set of slots available in optical grooming or not given a minimum size [but in array of 'int']. for this core
      Parameters:
      core - core id
      requiredSlots - the required slots of set
      Returns:
      the array with first slots available in optical grooming or not to 'requiredSlots'
    • areSlotsAvaiable

      public boolean areSlotsAvaiable​(int begin, int end)
      Checks for available slots considering the guard band. for this link
      Parameters:
      begin - the begin slot
      end - the end slot
      Returns:
      true if is avaiable slots, false otherwise
    • areSlotsAvaiable

      public boolean areSlotsAvaiable​(int core, int begin, int end)
      Checks for available slots considering the guard band. for this core
      Parameters:
      core - core id
      begin - the begin slot
      end - the end slot
      Returns:
      true if is avaiable slots, false otherwise
    • reserveSlots

      public void reserveSlots​(long id, int begin, int end)
      Reserve slots (with guard band) in this link, ie reserve lightpath. for this link
      Parameters:
      id - the id of lightpath reserved
      begin - the begin of lightpath
      end - the end of lightpath
    • reserveSlots

      public void reserveSlots​(int core, long id, int begin, int end)
      Reserve slots (with guard band) in this link, ie reserve lightpath. for this core
      Parameters:
      core - core id
      id - the id of lightpath reserved
      begin - the begin of lightpath
      end - the end of lightpath
    • reserveSlotsInOpticalGrooming

      public void reserveSlotsInOpticalGrooming​(long id, int begin, int end)
      Reserve slots (with guard band only the lightpath is on the edge) in this link, ie reserve lightpath using optical grooming technique. for this link
      Parameters:
      id - the id of lightpath reserved
      begin - the begin of lightpath
      end - the end of lightpath
    • reserveSlotsInOpticalGrooming

      public void reserveSlotsInOpticalGrooming​(int core, long id, int begin, int end)
      Reserve slots (with guard band only the lightpath is on the edge) in this link, ie reserve lightpath using optical grooming technique. for this core
      Parameters:
      core - core id
      id - the id of lightpath reserved
      begin - the begin of lightpath
      end - the end of lightpath
    • releaseSlots

      public void releaseSlots​(int begin, int end)
      Release slots from this link. Examines the corresponding guard bands
      Parameters:
      begin - the begin
      end - the end
    • releaseSlots

      public void releaseSlots​(int core, int begin, int end)
      Release slots from this core. Examines the corresponding guard bands
      Parameters:
      core - core id
      begin - the begin
      end - the end
    • releaseSlotsInOpticalGrooming

      public void releaseSlotsInOpticalGrooming​(int begin, int end)
      Release slots from this link belonging to a tunnel. Examines the corresponding guard bands in the edges
      Parameters:
      begin - the begin
      end - the end
    • releaseSlotsInOpticalGrooming

      public void releaseSlotsInOpticalGrooming​(int core, int begin, int end)
      Release slots from this core belonging to a tunnel. Examines the corresponding guard bands in the edges
      Parameters:
      core - core id
      begin - the begin
      end - the end
    • maxSizeAvaiable

      public int maxSizeAvaiable()
      Retrieves the max size of contiguous slots available. for this link
      Returns:
      the max size of contiguous slots available
    • maxSizeAvaiable

      public int maxSizeAvaiable​(int core)
      Retrieves the max size of contiguous slots available. for this core
      Parameters:
      core - core id
      Returns:
      the max size of contiguous slots available
    • minSizeAvaiable

      public int minSizeAvaiable()
      Retrieves the minimun size of contiguous slots available. for this link
      Returns:
      the minimun size of contiguous slots available
    • minSizeAvaiable

      public int minSizeAvaiable​(int core)
      Retrieves the minimun size of contiguous slots available. for this core
      Parameters:
      core - core id
      Returns:
      the minimun size of contiguous slots available
    • hasThisLightPath

      public boolean hasThisLightPath​(long id)
      Check if this lightpath is this link
      Parameters:
      id - the id of lightpath
      Returns:
      if it is true, false otherwise
    • hasThisLightPath

      public boolean hasThisLightPath​(int core, long id)
      Check if this lightpath is this core
      Parameters:
      core - core id
      id - the id of lightpath
      Returns:
      if it is true, false otherwise
    • toString

      public java.lang.String toString()
      Retrieves the information of this link
      Specified by:
      toString in class Link
      Returns:
      the string information
    • printLink

      public void printLink()
      Print this link for debug.
    • printEndLink

      public void printEndLink()
      Print the latest 10 slots of this link, for debug.
    • findLightpath

      public int[] findLightpath​(long lp)
      Retrieves the lightpath slot position. for this link
      Parameters:
      lp - the id of lightpath
      Returns:
      the array[2] with begin position and end position
    • findLightpath

      public int[] findLightpath​(int core, long lp)
      Retrieves the lightpath slot position. for this core
      Parameters:
      core - core id
      lp - the id of lightpath
      Returns:
      the array[2] with begin position and end position
    • leftExtend

      public boolean leftExtend​(int requiredSlots, long lp)
      Examine whether it is possible to extend lightpath to left. for this link
      Parameters:
      requiredSlots - the number of slots to be extend to left
      lp - the lightpath id
      Returns:
      true if is possible, false otherwise
    • leftExtend

      public boolean leftExtend​(int core, int requiredSlots, long lp)
      Examine whether it is possible to extend lightpath to left. for this core
      Parameters:
      core - core id
      requiredSlots - the number of slots to be extend to left
      lp - the lightpath id
      Returns:
      true if is possible, false otherwise
    • rightExtend

      public boolean rightExtend​(int requiredSlots, long lp)
      Examine whether it is possible to extend lightpath to right. for this link
      Parameters:
      requiredSlots - the number of slots to be extend to right
      lp - the lightpath id
      Returns:
      true if is possible, false otherwise
    • rightExtend

      public boolean rightExtend​(int core, int requiredSlots, long lp)
      Examine whether it is possible to extend lightpath to right. for this core
      Parameters:
      core - core id
      requiredSlots - the number of slots to be extend to right
      lp - the lightpath id
      Returns:
      true if is possible, false otherwise
    • isOpticalGrooming

      public boolean isOpticalGrooming​(long lp)
      Retrieves if this lightpath is in optical grooming. for this link
      Parameters:
      lp - the lightpath id
      Returns:
      true if this is in optical grooming, false otherwise
    • isOpticalGrooming

      public boolean isOpticalGrooming​(int core, long lp)
      Retrieves if this lightpath is in optical grooming. for this core
      Parameters:
      core - core id
      lp - the lightpath id
      Returns:
      true if this is in optical grooming, false otherwise
    • getLeftSlot

      public long getLeftSlot​(int slot)
      Retrieves the left slot given this position slot. for this link
      Parameters:
      slot - the slot position
      Returns:
      the id in left position
    • getLeftSlot

      public long getLeftSlot​(int core, int slot)
      Retrieves the left slot given this position slot. for this core
      Parameters:
      core - core id
      slot - the slot position
      Returns:
      the id in left position
    • getRightSlot

      public long getRightSlot​(int slot)
      Retrieves the right slot given this position slot. for this link
      Parameters:
      slot - the slot position
      Returns:
      the id in right position
    • getRightSlot

      public long getRightSlot​(int core, int slot)
      Retrieves the right slot given this position slot. for this core
      Parameters:
      core - core id
      slot - the slot position
      Returns:
      the id in right position
    • rangeFreeSimultaneous

      public int rangeFreeSimultaneous​(int requiredSlots)
      Retrieves the number of simultaneous requests for C size that can be satisfied. for this link
      Parameters:
      requiredSlots - C = required slots
      Returns:
      number of simultaneous requests for 'requiredSlots' size that can be satisfied
    • rangeFreeSimultaneous

      public int rangeFreeSimultaneous​(int core, int requiredSlots)
      Retrieves the number of simultaneous requests for C size that can be satisfied. for this core
      Parameters:
      core - core id
      requiredSlots - C = required slots
      Returns:
      number of simultaneous requests for 'requiredSlots' size that can be satisfied
    • rangeFree

      public int rangeFree​(int requiredSlots)
      Retrieves the number of requests for C size that can be satisfied. for this link
      Parameters:
      requiredSlots - C = required slots
      Returns:
      number of simultaneous requests for 'requiredSlots' size that can be satisfied
    • rangeFree

      public int rangeFree​(int core, int requiredSlots)
      Retrieves the number of requests for C size that can be satisfied. for this core
      Parameters:
      core - core id
      requiredSlots - C = required slots
      Returns:
      number of simultaneous requests for 'requiredSlots' size that can be satisfied
    • getExFragmentationRate

      public double getExFragmentationRate()
      Retrieves the External Fragmentation Rate of this link
      Returns:
      the External Fragmentation Rate of this link
    • getExFragmentationRate

      public double getExFragmentationRate​(int core)
      Retrieves the External Fragmentation Rate of this core
      Parameters:
      core - core id
      Returns:
      the External Fragmentation Rate of this core
    • getRelativeFragmentationRate

      public double getRelativeFragmentationRate​(int requiredSlots)
      Retrieves the Relative Fragmentation Rate of this link based on required slots
      Parameters:
      requiredSlots - to calculates the Relative Fragmentation Rate
      Returns:
      the Relative Fragmentation Rate of this link based on required slots
    • getRelativeFragmentationRate

      public double getRelativeFragmentationRate​(int core, int requiredSlots)
      Retrieves the Relative Fragmentation Rate of this core based on required slots
      Parameters:
      core - core id
      requiredSlots - to calculates the Relative Fragmentation Rate
      Returns:
      the Relative Fragmentation Rate of this core based on required slots
    • getMouraFragmentationRate

      public double getMouraFragmentationRate()
      Retrieves the Moura Fragmentation Rate of this link
      Returns:
      the Moura Fragmentation Rate of this link
    • getMouraFragmentationRate

      public double getMouraFragmentationRate​(int core)
      Retrieves the Moura Fragmentation Rate of this core
      Parameters:
      core - core id
      Returns:
      the Moura Fragmentation Rate of this core
    • firstFit

      public int[] firstFit​(int requiredSlots)
      The first fit slot alocation. for this link
      Parameters:
      requiredSlots - number of slots required for first fit
      Returns:
      the array with first slots available to 'requiredSlots'
    • firstFit

      public int[] firstFit​(int core, int requiredSlots)
      The first fit slot alocation. for this core
      Parameters:
      core - core id
      requiredSlots - number of slots required for first fit
      Returns:
      the array with first slots available to 'requiredSlots'
    • lastFit

      public int[] lastFit​(int requiredSlots)
      The last fit slot alocation. for this link
      Parameters:
      requiredSlots - number of slots required for last fit
      Returns:
      the array with last slots available to 'requiredSlots'
    • lastFit

      public int[] lastFit​(int core, int requiredSlots)
      The last fit slot alocation. for this core
      Parameters:
      core - core id
      requiredSlots - number of slots required for last fit
      Returns:
      the array with last slots available to 'requiredSlots'
    • randomFit

      public int[] randomFit​(int requiredSlots)
      The random fit slot alocation. for this link
      Parameters:
      requiredSlots - number of slots required for random fit
      Returns:
      the array with random slots available to 'requiredSlots'
    • randomFit

      public int[] randomFit​(int core, int requiredSlots)
      The random fit slot alocation. for this core
      Parameters:
      core - core id
      requiredSlots - number of slots required for random fit
      Returns:
      the array with random slots available to 'requiredSlots'
    • exactFit

      public int[] exactFit​(int requiredSlots)
      The exact fit slot alocation. for this link
      Parameters:
      requiredSlots - number of slots required for exact fit
      Returns:
      the array with exact slots available to 'requiredSlots'
    • exactFit

      public int[] exactFit​(int core, int requiredSlots)
      The exact fit slot alocation. for this core
      Parameters:
      core - core id
      requiredSlots - number of slots required for exact fit
      Returns:
      the array with exact slots available to 'requiredSlots'
    • bestFit

      public int[] bestFit​(int requiredSlots)
      The best fit slot alocation. for this link
      Parameters:
      requiredSlots - number of slots required for best fit
      Returns:
      the array with exact slots available to 'requiredSlots'
    • bestFit

      public int[] bestFit​(int core, int requiredSlots)
      The best fit slot alocation. for this core
      Parameters:
      core - core id
      requiredSlots - number of slots required for best fit
      Returns:
      the array with exact slots available to 'requiredSlots'
    • firstExactFit

      public int[] firstExactFit​(int requiredSlots)
      The first exact fit slot alocation. for this link
      Parameters:
      requiredSlots - number of slots required for first exact fit
      Returns:
      the array with exact slots available to 'requiredSlots'
    • firstExactFit

      public int[] firstExactFit​(int core, int requiredSlots)
      The first exact fit slot alocation. for this core
      Parameters:
      core - core id
      requiredSlots - number of slots required for first exact fit
      Returns:
      the array with exact slots available to 'requiredSlots'
    • lastExactFit

      public int[] lastExactFit​(int requiredSlots)
      The last exact fit slot alocation. for this link
      Parameters:
      requiredSlots - number of slots required for last exact fit
      Returns:
      the array with exact slots available to 'requiredSlots'
    • lastExactFit

      public int[] lastExactFit​(int core, int requiredSlots)
      The last exact fit slot alocation. for this core
      Parameters:
      core - core id
      requiredSlots - number of slots required for last exact fit
      Returns:
      the array with exact slots available to 'requiredSlots'
    • tbsa

      public int[] tbsa​(int requiredSlots)
      Spectrum Alocation TBSA (Traffic Balancing Spectrum Assignment). Beyranvand, H. and Salehi, J. (2013). A quality-of-transmission aware dynamic routing and spectrum assignment scheme for future elastic optical networks. Journal of Lightwave Technology, 31(18):3043–3054.
      Parameters:
      requiredSlots - number of slots required
      Returns:
      the array with slots available to 'requiredSlots'
    • tbsa

      public int[] tbsa​(int core, int requiredSlots)
      Spectrum Alocation TBSA (Traffic Balancing Spectrum Assignment). Beyranvand, H. and Salehi, J. (2013). A quality-of-transmission aware dynamic routing and spectrum assignment scheme for future elastic optical networks. Journal of Lightwave Technology, 31(18):3043–3054. For this core
      Parameters:
      core - core id
      requiredSlots - number of slots required
      Returns:
      the array with slots available to 'requiredSlots'
    • getLengthFreeBlock

      public java.util.ArrayList<java.lang.Integer> getLengthFreeBlock()
      Retrieves the length of all free blocks in this link
      Returns:
      an ArrayList-Integer- object containing the length of all free blocks in this link
    • getLengthFreeBlock

      public java.util.ArrayList<java.lang.Integer> getLengthFreeBlock​(int core)
      Retrieves the length of all free blocks in this core
      Parameters:
      core - core id
      Returns:
      an ArrayList-Integer- object containing the length of all free blocks in this link
    • getfreeBlocks

      public int[] getfreeBlocks()
      Returns all free blocks in this link. The number returned is the first slot to this block.
      Returns:
    • getfreeBlocks

      public int[] getfreeBlocks​(int core)
      Returns all free blocks in this core. The number returned is the first slot to this block.
      Parameters:
      core - core id
      Returns:
    • getfreeBlocksWithGB

      public int[] getfreeBlocksWithGB()
      Returns all free blocks in this core (Here he considers the guard band as a free block). The number returned is the first slot to this block.
      Returns:
    • getfreeBlocksWithGB

      public int[] getfreeBlocksWithGB​(int core)
      Returns all free blocks in this core (Here he considers the guard band as a free block).The number returned is the first slot to this block.
      Parameters:
      core - core id
      Returns:
    • getOccupiedBlocks

      public int[] getOccupiedBlocks()
      Returns all occupied blocks in this core (Here he considers the guard band as a free block). The number returned is the first slot to this block.
      Returns:
    • getOccupiedBlocks

      public int[] getOccupiedBlocks​(int core)
      Returns all occupied in this core (Here he considers the guard band as a free block).The number returned is the first slot to this block.
      Parameters:
      core - core id
      Returns:
    • getOccupiedLightPathsBlocks

      public int[] getOccupiedLightPathsBlocks()
      Returns all occupied LightPaths blocks in this link (Here he considers the guard band as a free block). The number returned is the first slot to this block.
      Returns:
    • getOccupiedLightPathsBlocks

      public int[] getOccupiedLightPathsBlocks​(int core)
      Returns all occupied LightPaths blocks in this core (Here he considers the guard band as a free block).
      Parameters:
      core - core id
      Returns:
    • getfreeBlocksToIndex

      public int[] getfreeBlocksToIndex​(int start, int end)
      Returns all free blocks to a final index on this link. The number returned is the first slot to this block.
      Parameters:
      start - start index
      end - end index
      Returns:
    • getfreeBlocksToIndex

      public int[] getfreeBlocksToIndex​(int core, int start, int end)
      Returns all free blocks to a final index on this core. The number returned is the first slot to this block.
      Parameters:
      core - core id
      start - start index
      end - end index
      Returns:
    • getfreeRequiredSlotsBlocks

      public int[] getfreeRequiredSlotsBlocks​(int requiredSlots)
      Returns all free blocks that fit into the required slots in this link. The number returned is the first slot to this block.
      Parameters:
      requiredSlots - number of slots required
      Returns:
    • getfreeRequiredSlotsBlocks

      public int[] getfreeRequiredSlotsBlocks​(int core, int requiredSlots)
      Returns all free blocks that fit into the required slots in this core. The number returned is the first slot to this block.
      Parameters:
      core - core id
      requiredSlots - number of slots required
      Returns:
    • getfreeRequiredSlotsBlocksToIndex

      public int[] getfreeRequiredSlotsBlocksToIndex​(int requiredSlots, int start, int end)
      Returns all free blocks that fit into the required slots to a final index on this link. The number returned is the first slot to this block.
      Parameters:
      requiredSlots - number of slots required
      start - start index
      end - end index
      Returns:
    • getfreeRequiredSlotsBlocksToIndex

      public int[] getfreeRequiredSlotsBlocksToIndex​(int core, int requiredSlots, int start, int end)
      Returns all free blocks that fit into the required slots to a final index on this core. The number returned is the first slot to this block.
      Parameters:
      core - core id
      requiredSlots - number of slots required
      start - start index
      end - end index
      Returns:
    • getLastSlotBlock

      public int getLastSlotBlock​(int firstSlotBlock)
      Retrieves the last available slot of this block. for this link
      Parameters:
      firstSlotBlock - the first slot of this block
      Returns:
      the last of this block
    • getLastSlotBlock

      public int getLastSlotBlock​(int core, int firstSlotBlock)
      Retrieves the last available slot of this block. for this core
      Parameters:
      core - core id
      firstSlotBlock - the first slot of this block
      Returns:
      the last of this block
    • getLastSlotBlockWithGB

      public int getLastSlotBlockWithGB​(int firstSlotBlock)
      Retrieves the last available slot of this block (Here he considers the guard band as a free block)
      Parameters:
      firstSlotBlock - the first slot of this block
      Returns:
      the last of this block
    • getLastSlotBlockWithGB

      public int getLastSlotBlockWithGB​(int core, int firstSlotBlock)
      Retrieves the last available slot of this block (Here he considers the guard band as a free block)
      Parameters:
      firstSlotBlock - the first slot of this block
      Returns:
      the last of this block
    • getLastSlotOccupiedBlock

      public int getLastSlotOccupiedBlock​(int firstSlotBlock)
      Retrieves the last occupied slot of this block. for this link
      Parameters:
      firstSlotBlock - the first slot of this block
      Returns:
      the last of this block
    • getLastSlotOccupiedBlock

      public int getLastSlotOccupiedBlock​(int core, int firstSlotBlock)
      Retrieves the last occupied slot of this block. for this core
      Parameters:
      core - core id
      firstSlotBlock - the first slot of this block
      Returns:
      the last of this block
    • pushpull

      public boolean pushpull​(int oldfirstSlot, int oldlastSlot, int newfirstSlot, int newlastSlot)
      Verify that it's possible push-pull in this link.
      Parameters:
      oldfirstSlot - the first slot of the old lightpath
      oldlastSlot - the last slot of the old lightpath
      newfirstSlot - the first slot of the new lightpath
      newlastSlot - the last slot of the new lightpath
      Returns:
      true if is possible to do push-pull or false otherwise
    • pushpull

      public boolean pushpull​(int core, int oldfirstSlot, int oldlastSlot, int newfirstSlot, int newlastSlot)
      Verify that it's possible push-pull in this core.
      Parameters:
      core - core id
      oldfirstSlot - the first slot of the old lightpath
      oldlastSlot - the last slot of the old lightpath
      newfirstSlot - the first slot of the new lightpath
      newlastSlot - the last slot of the new lightpath
      Returns:
      true if is possible to do push-pull or false otherwise
    • getSC

      public double getSC()
      Retrieves the Spectrum Compactness (SC) in this Link. YONGLI ZHAO, LIYAZHOU HU, RUIJIE ZHU, XIAOSONG YU, XINBO WANG and JIE ZHANG. Crosstalk-Aware Spectrum Defragmentation Based on Spectrum Compactness in Space Division Multiplexing Enabled Elastic Optical Networks With Multicore Fiber. IEEE Access, 2018
      Returns:
      the Spectrum Compactness (SC) in this Link
    • getSC

      public double getSC​(int core)
      Retrieves the Spectrum Compactness (SC) in this Core. YONGLI ZHAO, LIYAZHOU HU, RUIJIE ZHU, XIAOSONG YU, XINBO WANG and JIE ZHANG. Crosstalk-Aware Spectrum Defragmentation Based on Spectrum Compactness in Space Division Multiplexing Enabled Elastic Optical Networks With Multicore Fiber. IEEE Access, 2018
      Parameters:
      core - the core id
      Returns:
      the Spectrum Compactness (SC) in this Core
    • getFirstUsedSlot

      public long getFirstUsedSlot()
      Retrieves the First used slot in this Link;
      Returns:
      the First used slot in this Link;
    • getFirstUsedSlot

      public long getFirstUsedSlot​(int core)
      Retrieves the First used slot in this Core;
      Parameters:
      core - the core id
      Returns:
      the First used slot in this Core;
    • getLastUsedSlot

      public long getLastUsedSlot()
      Retrieves the Last used slot in this Link;
      Returns:
      the Last used slot in this Link;
    • getLastUsedSlot

      public long getLastUsedSlot​(int core)
      Retrieves the Last used slot in this Core;
      Parameters:
      core - the id core
      Returns:
      the Last used slot in this Core;
    • getLightpaths

      public java.util.ArrayList<java.lang.Long> getLightpaths()
      Retrieve all lightpaths ids from this link
      Returns:
      all lightpaths ids from this link
    • getLightpaths

      public java.util.ArrayList<java.lang.Long> getLightpaths​(int core)
      Retrieve all lightpath ids from this core
      Parameters:
      core - the core id
      Returns:
      all lightpath ids from this core
    • getLightpathId

      public long getLightpathId​(int index)
      Retrieve the lightpath id in this index
      Parameters:
      index - index slot in this link
      Returns:
      the lightpath id in this index
    • getLightpathId

      public long getLightpathId​(int core, int index)
      Retrieve the lightpath id in this index from this core
      Parameters:
      core - the core id
      index - slot in this core
      Returns:
      the lightpath id in this index from this core
    • hasAvailableCore

      public boolean hasAvailableCore​(int firstSlot, int lastSlot, Core core)
      Retrieves if another Core in this link has the same spectrum available of this core
      Parameters:
      firstSlot - the first slot of the core
      lastSlot - the last slot of the core
      core - the analyzed core
      Returns:
      true if another Core in this link has the same spectrum available of this core, false otherwise
    • getAvailableCore

      public int[] getAvailableCore​(int firstSlot, int lastSlot, Core core)
      Retrieves the Cores in this link has the same spectrum available of this core
      Parameters:
      firstSlot - the first slot of the core
      lastSlot - the last slot of the core
      core - the analyzed core
      Returns:
      the Cores in this link has the same spectrum available of this core
    • changeCore

      public void changeCore​(int firstSlot, int lastSlot, Core oldCore, Core newCore)
      Change the spectrum core
      Parameters:
      firstSlot - the first slot of the core
      lastSlot - the last slot of the core
      oldCore - the old core
      newCore - the new core
    • changeSpectrum

      public void changeSpectrum​(int oldfirstSlot, int oldlastSlot, int newfirstSlot, int newlastSlot)
      Change the spectrum frequency in this link.
      Parameters:
      oldfirstSlot - the first slot of the old lightpath
      oldlastSlot - the last slot of the old lightpath
      newfirstSlot - the first slot of the new lightpath
      newlastSlot - the last slot of the new lightpath
    • changeSpectrum

      public void changeSpectrum​(int core, int oldfirstSlot, int oldlastSlot, int newfirstSlot, int newlastSlot)
      Change the spectrum frequency in this core.
      Parameters:
      core - the id core
      oldfirstSlot - the first slot of the old lightpath
      oldlastSlot - the last slot of the old lightpath
      newfirstSlot - the first slot of the new lightpath
      newlastSlot - the last slot of the new lightpath