Skip to content

Instantly share code, notes, and snippets.

@acompa
Created August 11, 2012 17:12
Show Gist options
  • Save acompa/3325820 to your computer and use it in GitHub Desktop.
Save acompa/3325820 to your computer and use it in GitHub Desktop.
private ReplacementAlgorithm selectReplacementAlgorithm(String choice) {
if (choice.matches("N")) {
return new NRUAlgorithm();
} else if (choice.matches("l")) {
return new LRUAlgorithm();
} else if (choice.matches("r")) {
return new RandomAlgorithm();
} else if (choice.matches("f")) {
return new FIFOAlgorithm();
} else if (choice.matches("s")) {
return new SecondChanceAlgorithm();
} else if (choice.matches("C")) {
return new VirtualClockAlgorithm(this.frames);
} else if (choice.matches("c")) {
return new PhysicalClockAlgorithm(this.frames);
} else if (choice.matches("A")) {
return new VirtualAgingAlgorithm();
} else {
return new PhysicalAgingAlgorithm();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment