From 2c60fc182e55e23dffa15fbba25e3fa8dc62e62c Mon Sep 17 00:00:00 2001 From: Zach Date: Wed, 20 Oct 2021 19:28:18 +1100 Subject: [PATCH] Commit 1 --- A3.java | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++ Process.java | 19 ++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 Process.java diff --git a/A3.java b/A3.java index e69de29..6fa5941 100644 --- a/A3.java +++ b/A3.java @@ -0,0 +1,55 @@ +import java.util.*; +import java.io.*; + +public class A3 { + + public static void main(String[] args){ + A3 system = new A3(); + system.run("30 3 process1.txt process2.txt process3.txt"); //For TESTING Only + //system.run(args[0]); + } + + public void run(String input) + { + LinkedList processList; + int frames = 0; + int quantum = 0; + + String[] inputStrings; + inputStrings = input.split(" "); + + for (int i = 0; i < inputStrings.length; i++) + { + System.out.println(inputStrings[i]); + } + //readFile(input); + } + + public void readFile(String input) + { + Scanner fileReader; //Scanner to read the file. + File dataSet;// = new File(fileNameInput); + //Process importedProcess = new Process(); + + dataSet = new File(input); + //Try and open file. If it works, procede. + try { + fileReader = new Scanner(dataSet); + //Progress through each line in the text file + while(fileReader.hasNextLine()) + { + String line = fileReader.nextLine(); + } + fileReader.close(); + } + + //If the file isn't found, throw a hissy fit. + catch (FileNotFoundException e) { + System.out.println("File not found."); + System.exit(0); + //e.printStackTrace(); //Optional, shows more data. + } + + // return importedProcess; + } +} \ No newline at end of file diff --git a/Process.java b/Process.java new file mode 100644 index 0000000..1d1f08a --- /dev/null +++ b/Process.java @@ -0,0 +1,19 @@ +import java.util.LinkedList; + +public class Process { + + //private LinkedList pageRequest; + + public Process(){ + } + + // public Process(LinkedList pageRequestInput) + // { + // pageRequest = pageRequestInput; + // } + + // public void addPageRequest(int input) + // { + // pageRequest.add(input); + // } +}