scheduler-simulator

git clone git://git.codymlewis.com/scheduler-simulator.git
Log | Files | Refs | README

commit f7dd573c8e6a86ea028ffb1733740dad5b918b16
parent 2e311318fa23b8c137e9f29b9eb8fd745ab48437
Author: Cody Lewis <cody@codymlewis.com>
Date:   Thu,  5 Sep 2019 13:40:21 +1000

Output refinement

Diffstat:
MA1.java | 10++++++++--
MDispatcher.java | 2+-
2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/A1.java b/A1.java @@ -19,7 +19,7 @@ public class A1 { System.exit(1); } - String[] dispatcherNames = {"FCFS", "RR", "FB", "NRR"}; + String[] dispatcherNames = {"FCFS", "RR", "FB (constant)", "NRR"}; Dispatcher[] dispatchers = new Dispatcher[dispatcherNames.length]; for (int i = 0; i < dispatcherNames.length; ++i) { @@ -31,7 +31,13 @@ public class A1 { System.out.println("Summary"); System.out.println("Algorithm\tAverage Turnaround Time\tAverage Waiting Time"); for (int i = 0; i < dispatcherNames.length; ++i) { - System.out.format("%s\t\t%s\n", dispatcherNames[i], dispatchers[i].summary()); + String algName; + if (dispatcherNames[i].length() > 8) { + algName = String.format("%s\t", dispatcherNames[i]); + } else { + algName = String.format("%s\t\t", dispatcherNames[i]); + } + System.out.format("%s%s\n", algName, dispatchers[i].summary()); } System.exit(0); diff --git a/Dispatcher.java b/Dispatcher.java @@ -132,7 +132,7 @@ public class Dispatcher { return new RR(switchProcessTime); case "NRR": return new NRR(switchProcessTime); - case "FB": + case "FB (constant)": return new FB(switchProcessTime); default: return new FCFS(switchProcessTime);