Package application.model.database
Class GliderDBReader
java.lang.Object
application.model.database.DatabaseReader
application.model.database.GliderDBReader
public class GliderDBReader extends DatabaseReader
Reads the OT / Generations / HROT / whatever glider database.
Example Usage:
Example Usage:
GliderDBReader reader = new GliderDBReader("new-gliders.db.txt");
System.out.println(reader.getEntries(-1, 1, 2, null, null, null));
-
Constructor Summary
Constructors Constructor Description GliderDBReader(java.io.File file)Constructs the database from a file -
Method Summary
Modifier and Type Method Description voidcanoniseDB(java.io.File newFile)Canonises the database (removes duplicates)java.util.List<GliderDBEntry>getEntries(int period, int dx, int dy, RuleFamily minRule, RuleFamily maxRule, java.util.Comparator<GliderDBEntry> sorter)Gets entries from the glider db
-
Constructor Details
-
GliderDBReader
public GliderDBReader(java.io.File file)Constructs the database from a file- Parameters:
file- The file containing the database
-
-
Method Details
-
getEntries
public java.util.List<GliderDBEntry> getEntries(int period, int dx, int dy, RuleFamily minRule, RuleFamily maxRule, java.util.Comparator<GliderDBEntry> sorter) throws java.io.FileNotFoundExceptionGets entries from the glider db- Parameters:
period- The period to look fordx- The displacement x to look fordy- The displacement y to look forminRule- The min rulemaxRule- The max rulesorter- How should the entries be sorted?- Returns:
- Returns the entries in a list
- Throws:
java.io.FileNotFoundException- Thrown when the database file cannot be found
-
canoniseDB
public void canoniseDB(java.io.File newFile) throws java.io.IOExceptionCanonises the database (removes duplicates)- Parameters:
newFile- The new file for the database- Throws:
java.io.IOException- Thrown when there is an issue reading or writing to the file
-