To run this program:
Write "gradle run --args="<path to an input file> <path to an output file>" in terminal.
Example: gradle run --args="input.txt output.txt"
Some tests for external testing are in the directory named data.
The first string of the clause will be considered as a string of 2 Ints divided by ' ' (RAM size and maximum number of a possible appeal). The second string of the clause will be considered as a list of Ints divided by ' ' (appeals). There shouldn't be any empty strings between the clauses.
3 5
1 2 3 4 5 1 3 5 2 1
3 5
1 2 3 4 5 1 3 5 2 1
3 5
1 2 3 4 5 5 4 3 2 1
Output data for a clause will begin with string: "Clause :". Output data for an algorithm will begin with string: "<Name of the algorithm (FIFO, LRU or OPT)>: replacements" Then there will be a string for each appeal in the clause.
String: "Add in frame" means that the page with this number has been added in an empty frame with this number. String: "Replace with in frame" means that current page replaced a page in the frame with this number. String: ": The needed page is in memory." means that the needed page is in memory at the moment.
Clause 1:
FIFO: 8 replacements
Add 1 in 1 frame
Add 2 in 2 frame
Add 3 in 3 frame
Replace 1 with 4 in 1 frame
Replace 2 with 5 in 2 frame
Replace 3 with 1 in 3 frame
Replace 4 with 3 in 1 frame
5: The needed page is in memory
Replace 5 with 2 in 2 frame
1: The needed page is in memory
LRU: 9 replacements
Add 1 in 1 frame
Add 2 in 2 frame
Add 3 in 3 frame
Replace 1 with 4 in 1 frame
Replace 2 with 5 in 2 frame
Replace 3 with 1 in 3 frame
Replace 4 with 3 in 1 frame
5: The needed page is in memory
Replace 1 with 2 in 3 frame
Replace 3 with 1 in 1 frame
OPT: 6 replacements
Add 1 in 1 frame
Add 2 in 2 frame
Add 3 in 3 frame
Replace 2 with 4 in 2 frame
Replace 4 with 5 in 2 frame
1: The needed page is in memory
3: The needed page is in memory
5: The needed page is in memory
Replace 5 with 2 in 2 frame
1: The needed page is in memory