Model . File Input & Output - SeanSpires/Project1-306-Team-Stonks GitHub Wiki

Provides utility to read the input file into data structures for the algorithm to use as well as writing the algorithm output onto a .dot file

Private lists 3 lists are instantiated:

  1. nodeList - List of all nodes (Strings) read from the input file.
  2. taskList - List of all Tasks that will be instantiated from the read input file.
  3. transitionList - List of all transitions that is read from the input file.
Method Purpose
void writeFile(String fileName) This method takes in a String file name and creates a new output file.
The output file, currently, will consist of the tasks from the input file.
void readFile(String fileName) This method takes a file and reads the tasks and its respective weights, storing it in the proper list. Either a lists of tasks or transition tasks.
This method assumes that the input .dot file given will be similar to the test files given.
The method checks if the current line is a transition or a node and sorts it to its respective lists.
void processNodes() This method will iterate through the list of tasks and create a Task object.
void processTransitions() This method will iterate through the list of transition tasks and set the parent and the child node of each tasks.
E.g. 0 -> 2 0 will be the parent task and 2 will be the child task.
void createTask(int nodeNumber, int weight) This method will take an input of the Task's number and its respective weight.
It then creates a new Task and adds it to the list of Tasks.
int getWeightValue(String input) This method will take a String input and parse the string to find the weight of the task. It will return the parsed String as an int
This method assumes that the input .dot file will have the same weight notation.
E.g. [Weight=420]
Boolean isTransition(String s) This method will check if the input line is defining a transition or a Task. It will return true if it is a transition.
E.g 0 [Weight=420]; defines the length of the task.
0 -> 1 [Weight=420]; defines the time it task for the transition between a different processor.
⚠️ **GitHub.com Fallback** ⚠️