Class BlockingRegion

java.lang.Object
QueueNet.BlockingRegion

public class BlockingRegion extends Object
This class represents a blocking region, that is a region with a finite capacity.
The constraint can be global (the constraint is shared, i.e. relative to the total occupation of jobs, without considering their own job class) or relative to each class (in this case it may happen that the jobs of one class are blocked, while the job of another one are not blocked).
If other jobs arrive when the region has already reached one or more constraints, the jobs may be blocked or dropped. Each class can decide its own drop strategy, which will be used when a constraint (global or class) is violated.
Each class can have a different weight, i.e. jobs of different class may require different capacity.
Author:
Stefano Omini
  • Field Details

    • name

      protected String name
      The name of the blocking region
    • sim

      protected Simulation sim
      the simulation
    • network

      protected QueueNetwork network
      the queue network the region belongs to
    • regionNodeNames

      protected String[] regionNodeNames
      the name of the nodes contained in the blocking region
    • regionNodes

      protected NetNode[] regionNodes
      the nodes contained in the blocking region
    • inputStation

      protected NetNode inputStation
      reference to the fictitious station which controls arrivals to the blocking region
    • maxCapacity

      protected double maxCapacity
      the maximum number of jobs that can be accommodated
    • maxMemory

      protected double maxMemory
      the maximum size of memory that can be allocated
    • maxCapacityPerClass

      protected double[] maxCapacityPerClass
      the maximum number of jobs that can be accommodated for each class
    • maxMemoryPerClass

      protected double[] maxMemoryPerClass
      the maximum size of memory that can be allocated for each class
    • actualOccupation

      protected double actualOccupation
      the number of jobs that are currently accommodated
    • actualMemoryOccupation

      protected double actualMemoryOccupation
      the size of memory that are currently allocated
    • actualOccupationPerClass

      protected double[] actualOccupationPerClass
      the number of jobs that are currently accommodated for each class
    • actualMemoryOccupationPerClass

      protected double[] actualMemoryOccupationPerClass
      the size of memory that are currently allocated for each class
    • dropClass

      protected boolean[] dropClass
      true if the specified class in excess must be dropped
    • globalConstraintDefined

      protected boolean globalConstraintDefined
      true if there is a global constraint
    • globalMemoryConstraintDefined

      protected boolean globalMemoryConstraintDefined
      true if there is a global memory constraint
    • classConstraintDefined

      protected boolean[] classConstraintDefined
      true if the specified class has a constraint
    • classMemoryConstraintDefined

      protected boolean[] classMemoryConstraintDefined
      true if the specified class has a memory constraint
    • classWeights

      protected double[] classWeights
    • classSizes

      protected double[] classSizes
    • classSoftDeadlines

      protected double[] classSoftDeadlines
    • groupInfo

      protected List<BlockingRegion.GroupInfo> groupInfo
  • Constructor Details

    • BlockingRegion

      public BlockingRegion(String regionName, double maxCapacity, double maxMemory, double[] maxCapacityPerClass, double[] maxMemoryPerClass, boolean[] drop, double[] classWeights, double[] classSizes, double[] classSoftDeadlines, String[] groupNames, double[] maxCapacityPerGroup, double[] maxMemoryPerGroup, List<List<Integer>> groupClassIndexLists, Simulation sim, String[] regionNodeNames)
      Creates a blocking region with global, class and group constraints
  • Method Details

    • hasGlobalConstraint

      public boolean hasGlobalConstraint()
      True if there is a global constraint
    • getActualOccupation

      public double getActualOccupation()
      Gets the number of jobs currently inside the blocking region
    • getActualOccupation

      public double getActualOccupation(JobClass jobClass)
      Gets the number of jobs of the specified class currently inside the blocking region
      Parameters:
      jobClass - the specified class
      Returns:
      the resulting double
    • increaseOccupation

      public void increaseOccupation(JobClass jobClass)
      Increases both the number of total jobs currently inside the region and also the number of jobs of the specified class currently inside the region.
    • decreaseOccupation

      public void decreaseOccupation(JobClass jobClass)
      Decreases the number of jobs currently inside the region.
    • getClassDrop

      public boolean getClassDrop(JobClass jobClass)
      Gets the drop property relative to a class constraint: if true, jobs in excess of this class will be dropped
    • getClassDrop

      public boolean getClassDrop(int classIndex)
      Gets the drop property relative to a class constraint: if true, jobs in excess of this class will be dropped
    • isBlocked

      public boolean isBlocked(JobClass jobClass)
      Tells whether the region is blocked for this class or has enough place for a job of this class.
      Parameters:
      jobClass - the job class
      Returns:
      true if blocked, false if other capacity is available
    • getName

      public String getName()
      Gets the name of the blocking region
    • getRegionNodeNames

      public String[] getRegionNodeNames()
      Gets the names of the region nodes
    • belongsToRegion

      public boolean belongsToRegion(String nodeName)
      Tells whether a node is contained in the blocking region
      Parameters:
      nodeName - the name of the node
      Returns:
      true if the specified node is contained in the region
    • belongsToRegion

      public boolean belongsToRegion(NetNode node)
      Tells whether a node is contained in the blocking region
      Parameters:
      node - the NetNode object
      Returns:
      true if the specified node is contained in the region
    • getRegionNode

      public NetNode getRegionNode(String nodeName)
      Returns a node, if contained in the blocking region
      Parameters:
      nodeName - the name of the node
      Returns:
      the NetNode object if the specified node is contained in the region, null otherwise
    • getInputStation

      public NetNode getInputStation()
      Gets the fictitious station that controls arrivals to the blocking region
      Returns:
      the fictitious station that controls arrivals to the blocking region
    • setInputStation

      public void setInputStation(NetNode inputStation)
      Sets the input station of the blocking region
      Parameters:
      inputStation - the input station of the blocking region
    • getClassWeights

      public double[] getClassWeights()
      Returns the class weights.
      Returns:
      Returns the classWeights.
    • getClassSoftDeadlines

      public double[] getClassSoftDeadlines()
      Returns the class soft deadlines.
      Returns:
      Returns classSoftDeadlines.
    • getMaxCapacity

      public double getMaxCapacity()
      Returns the max capacity.
      Returns:
      Returns the maxCapacity.
    • setWeightMeasure

      public void setWeightMeasure(Measure wm)
    • setSizeMeasure

      public void setSizeMeasure(Measure sm)