@@ -25,16 +25,25 @@ public abstract ArrayList<Integer> fitProcess(
2525 int [] sizeOfBlocks ,
2626 int [] sizeOfProcesses
2727 );
28+
29+ /**
30+ * A constant value used to indicate that an allocation has not been made.
31+ * This value is used as a sentinel value to represent that no allocation has been made
32+ * when allocating space in an array or other data structure.
33+ * The value is -255 and is marked as protected and final to ensure that it cannot be modified
34+ * from outside the class and that its value remains consistent throughout the program execution.
35+ *
36+ * @author: Ishan Makadia (github.com/intrepid-ishan)
37+ * @version: April 06, 2023
38+ */
39+ protected static final int NO_ALLOCATION = -255 ;
2840}
2941
3042/**
3143 * @author Dekas Dimitrios
3244 */
3345class BestFitCPU extends MemoryManagementAlgorithms {
3446
35- private static final int NO_ALLOCATION = -255 ; // if a process has been allocated in position -255,
36-
37- // it means that it has not been actually allocated.
3847
3948 /**
4049 * Method to find the maximum valued element of an array filled with
@@ -115,10 +124,6 @@ public ArrayList<Integer> fitProcess(
115124 */
116125class WorstFitCPU extends MemoryManagementAlgorithms {
117126
118- private static final int NO_ALLOCATION = -255 ; // if a process has been allocated in position -255,
119-
120- // it means that it has not been actually allocated.
121-
122127 /**
123128 * Method to find the index of the memory block that is going to fit the
124129 * given process based on the worst fit algorithm.
@@ -179,9 +184,6 @@ public ArrayList<Integer> fitProcess(
179184 */
180185class FirstFitCPU extends MemoryManagementAlgorithms {
181186
182- private static final int NO_ALLOCATION = -255 ; // if a process has been allocated in position -255,
183-
184- // it means that it has not been actually allocated.
185187
186188 /**
187189 * Method to find the index of the memory block that is going to fit the
@@ -237,8 +239,6 @@ public ArrayList<Integer> fitProcess(
237239 */
238240class NextFit extends MemoryManagementAlgorithms {
239241
240- private static final int NO_ALLOCATION = -255 ; // if a process has been allocated in position -255,
241- // it means that it has not been actually allocated.
242242 private int counter = 0 ; // variable that keeps the position of the last registration into the memory
243243
244244 /**
0 commit comments