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:
 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
    void canoniseDB​(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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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.FileNotFoundException
      Gets entries from the glider db
      Parameters:
      period - The period to look for
      dx - The displacement x to look for
      dy - The displacement y to look for
      minRule - The min rule
      maxRule - The max rule
      sorter - 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.IOException
      Canonises 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