Class BlockingRegion
java.lang.Object
QueueNet.BlockingRegion
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.
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
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected doublethe size of memory that are currently allocatedprotected double[]the size of memory that are currently allocated for each classprotected doublethe number of jobs that are currently accommodatedprotected double[]the number of jobs that are currently accommodated for each classprotected boolean[]true if the specified class has a constraintprotected boolean[]true if the specified class has a memory constraintprotected double[]protected double[]protected double[]protected boolean[]true if the specified class in excess must be droppedprotected booleantrue if there is a global constraintprotected booleantrue if there is a global memory constraintprotected List<BlockingRegion.GroupInfo> protected NetNodereference to the fictitious station which controls arrivals to the blocking regionprotected doublethe maximum number of jobs that can be accommodatedprotected double[]the maximum number of jobs that can be accommodated for each classprotected doublethe maximum size of memory that can be allocatedprotected double[]the maximum size of memory that can be allocated for each classprotected StringThe name of the blocking regionprotected QueueNetworkthe queue network the region belongs toprotected String[]the name of the nodes contained in the blocking regionprotected NetNode[]the nodes contained in the blocking regionprotected Simulationthe simulation -
Constructor Summary
ConstructorsConstructorDescriptionBlockingRegion(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 Summary
Modifier and TypeMethodDescriptionbooleanbelongsToRegion(String nodeName) Tells whether a node is contained in the blocking regionbooleanbelongsToRegion(NetNode node) Tells whether a node is contained in the blocking regionvoiddecreaseOccupation(JobClass jobClass) Decreases the number of jobs currently inside the region.doubleGets the number of jobs currently inside the blocking regiondoublegetActualOccupation(JobClass jobClass) Gets the number of jobs of the specified class currently inside the blocking regionbooleangetClassDrop(int classIndex) Gets the drop property relative to a class constraint: if true, jobs in excess of this class will be droppedbooleangetClassDrop(JobClass jobClass) Gets the drop property relative to a class constraint: if true, jobs in excess of this class will be droppeddouble[]Returns the class soft deadlines.double[]Returns the class weights.Gets the fictitious station that controls arrivals to the blocking regiondoubleReturns the max capacity.getName()Gets the name of the blocking regiongetRegionNode(String nodeName) Returns a node, if contained in the blocking regionString[]Gets the names of the region nodesbooleanTrue if there is a global constraintvoidincreaseOccupation(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.booleanTells whether the region is blocked for this class or has enough place for a job of this class.voidsetInputStation(NetNode inputStation) Sets the input station of the blocking regionvoidvoid
-
Field Details
-
name
The name of the blocking region -
sim
the simulation -
network
the queue network the region belongs to -
regionNodeNames
the name of the nodes contained in the blocking region -
regionNodes
the nodes contained in the blocking region -
inputStation
reference to the fictitious station which controls arrivals to the blocking region -
maxCapacity
protected double maxCapacitythe maximum number of jobs that can be accommodated -
maxMemory
protected double maxMemorythe maximum size of memory that can be allocated -
maxCapacityPerClass
protected double[] maxCapacityPerClassthe maximum number of jobs that can be accommodated for each class -
maxMemoryPerClass
protected double[] maxMemoryPerClassthe maximum size of memory that can be allocated for each class -
actualOccupation
protected double actualOccupationthe number of jobs that are currently accommodated -
actualMemoryOccupation
protected double actualMemoryOccupationthe size of memory that are currently allocated -
actualOccupationPerClass
protected double[] actualOccupationPerClassthe number of jobs that are currently accommodated for each class -
actualMemoryOccupationPerClass
protected double[] actualMemoryOccupationPerClassthe size of memory that are currently allocated for each class -
dropClass
protected boolean[] dropClasstrue if the specified class in excess must be dropped -
globalConstraintDefined
protected boolean globalConstraintDefinedtrue if there is a global constraint -
globalMemoryConstraintDefined
protected boolean globalMemoryConstraintDefinedtrue if there is a global memory constraint -
classConstraintDefined
protected boolean[] classConstraintDefinedtrue if the specified class has a constraint -
classMemoryConstraintDefined
protected boolean[] classMemoryConstraintDefinedtrue if the specified class has a memory constraint -
classWeights
protected double[] classWeights -
classSizes
protected double[] classSizes -
classSoftDeadlines
protected double[] classSoftDeadlines -
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
Gets the number of jobs of the specified class currently inside the blocking region- Parameters:
jobClass- the specified class- Returns:
- the resulting double
-
increaseOccupation
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
Decreases the number of jobs currently inside the region. -
getClassDrop
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
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
Gets the name of the blocking region -
getRegionNodeNames
Gets the names of the region nodes -
belongsToRegion
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
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
-
getInputStation
Gets the fictitious station that controls arrivals to the blocking region- Returns:
- the fictitious station that controls arrivals to the blocking region
-
setInputStation
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
-
setSizeMeasure
-