From b5ac34046857a7e013c14590bcf0f7d3711b2898 Mon Sep 17 00:00:00 2001 From: Rytnix Date: Tue, 31 May 2022 16:40:27 +0530 Subject: [PATCH 1/2] Refactor CPUalgorithms --> MemoryManagementAlgorithms --- ...algorithms.java => MemoryManagementAlgorithms.java} | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) rename src/main/java/com/thealgorithms/others/{CPUalgorithms.java => MemoryManagementAlgorithms.java} (97%) diff --git a/src/main/java/com/thealgorithms/others/CPUalgorithms.java b/src/main/java/com/thealgorithms/others/MemoryManagementAlgorithms.java similarity index 97% rename from src/main/java/com/thealgorithms/others/CPUalgorithms.java rename to src/main/java/com/thealgorithms/others/MemoryManagementAlgorithms.java index 89205f98169f..a5b5d44ea4d1 100644 --- a/src/main/java/com/thealgorithms/others/CPUalgorithms.java +++ b/src/main/java/com/thealgorithms/others/MemoryManagementAlgorithms.java @@ -5,7 +5,7 @@ import java.util.ArrayList; -public abstract class CPUalgorithms { +public abstract class MemoryManagementAlgorithms { /** * Method to allocate memory to blocks according to CPU algorithms. @@ -26,7 +26,7 @@ public abstract class CPUalgorithms { /** * @author Dekas Dimitrios */ -class BestFitCPU extends CPUalgorithms{ +class BestFitCPU extends MemoryManagementAlgorithms { private static final int NO_ALLOCATION = -255; // if a process has been allocated in position -255, @@ -110,7 +110,7 @@ public ArrayList fitProcess(int[] sizeOfBlocks, int[] sizeOfProcesses) /** * @author Dekas Dimitrios */ -class WorstFitCPU extends CPUalgorithms{ +class WorstFitCPU extends MemoryManagementAlgorithms { private static final int NO_ALLOCATION = -255; // if a process has been allocated in position -255, @@ -177,7 +177,7 @@ public ArrayList fitProcess(int[] sizeOfBlocks, int[] sizeOfProcesses) /** * @author Dekas Dimitrios */ -class FirstFitCPU extends CPUalgorithms{ +class FirstFitCPU extends MemoryManagementAlgorithms { private static final int NO_ALLOCATION = -255; // if a process has been allocated in position -255, @@ -236,7 +236,7 @@ public ArrayList fitProcess(int[] sizeOfBlocks, int[] sizeOfProcesses) /** * @author Alexandros Lemonaris */ -class NextFit extends CPUalgorithms{ +class NextFit extends MemoryManagementAlgorithms { private static final int NO_ALLOCATION = -255; // if a process has been allocated in position -255, From 6a792ab006fef8f5a74ff53e192c70dd4e0d49a2 Mon Sep 17 00:00:00 2001 From: Rytnix Date: Tue, 31 May 2022 17:16:08 +0530 Subject: [PATCH 2/2] Refactor CPUalgorithms --> MemoryManagementAlgorithms --- src/test/java/com/thealgorithms/others/BestFitCPUTest.java | 4 ++-- src/test/java/com/thealgorithms/others/FirstFitCPUTest.java | 4 ++-- src/test/java/com/thealgorithms/others/NextFitTest.java | 4 ++-- src/test/java/com/thealgorithms/others/WorstFitCPUTest.java | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/test/java/com/thealgorithms/others/BestFitCPUTest.java b/src/test/java/com/thealgorithms/others/BestFitCPUTest.java index d1ab591655d3..ecc66da69c33 100644 --- a/src/test/java/com/thealgorithms/others/BestFitCPUTest.java +++ b/src/test/java/com/thealgorithms/others/BestFitCPUTest.java @@ -16,7 +16,7 @@ class BestFitCPUTest { int [] sizeOfProcesses; ArrayList memAllocation = new ArrayList<>(); ArrayList testMemAllocation ; - CPUalgorithms bestFit = new BestFitCPU(); + MemoryManagementAlgorithms bestFit = new BestFitCPU(); @Test void testFitForUseOfOneBlock() { @@ -73,4 +73,4 @@ void testFitForMoreBlocksNoFit() { ); assertEquals(testMemAllocation, memAllocation); } -} \ No newline at end of file +} diff --git a/src/test/java/com/thealgorithms/others/FirstFitCPUTest.java b/src/test/java/com/thealgorithms/others/FirstFitCPUTest.java index 45a501c268b0..18dae6807c0e 100644 --- a/src/test/java/com/thealgorithms/others/FirstFitCPUTest.java +++ b/src/test/java/com/thealgorithms/others/FirstFitCPUTest.java @@ -16,7 +16,7 @@ class FirstFitCPUTest { int [] sizeOfProcesses; ArrayList memAllocation = new ArrayList<>(); ArrayList testMemAllocation ; - CPUalgorithms firstFit = new FirstFitCPU(); + MemoryManagementAlgorithms firstFit = new FirstFitCPU(); @Test void testFitForUseOfOneBlock() { @@ -73,4 +73,4 @@ void testFitForMoreBlocksNoFit() { ); assertEquals(testMemAllocation, memAllocation); } -} \ No newline at end of file +} diff --git a/src/test/java/com/thealgorithms/others/NextFitTest.java b/src/test/java/com/thealgorithms/others/NextFitTest.java index 27c17eaf0369..5a9206df7b3b 100644 --- a/src/test/java/com/thealgorithms/others/NextFitTest.java +++ b/src/test/java/com/thealgorithms/others/NextFitTest.java @@ -16,7 +16,7 @@ class NextFitCPUTest { int [] sizeOfProcesses; ArrayList memAllocation = new ArrayList<>(); ArrayList testMemAllocation ; - CPUalgorithms nextFit = new NextFit(); + MemoryManagementAlgorithms nextFit = new NextFit(); @Test void testFitForUseOfOneBlock() { @@ -73,4 +73,4 @@ void testFitForMoreBlocksNoFit() { ); assertEquals(testMemAllocation, memAllocation); } -} \ No newline at end of file +} diff --git a/src/test/java/com/thealgorithms/others/WorstFitCPUTest.java b/src/test/java/com/thealgorithms/others/WorstFitCPUTest.java index cb3f58a4c49a..5e9e2a78347e 100644 --- a/src/test/java/com/thealgorithms/others/WorstFitCPUTest.java +++ b/src/test/java/com/thealgorithms/others/WorstFitCPUTest.java @@ -16,7 +16,7 @@ class WorstFitCPUTest { int [] sizeOfProcesses; ArrayList memAllocation = new ArrayList<>(); ArrayList testMemAllocation ; - CPUalgorithms worstFit = new WorstFitCPU(); + MemoryManagementAlgorithms worstFit = new WorstFitCPU(); @Test void testFitForUseOfOneBlock() { @@ -84,4 +84,4 @@ void testFitBadCase() { ); assertEquals(testMemAllocation, memAllocation); } -} \ No newline at end of file +}