Package net.starype.quiz.api.parser
Class TrackedDatabase
- java.lang.Object
-
- net.starype.quiz.api.parser.TrackedDatabase
-
- All Implemented Interfaces:
IndexDatabase
public class TrackedDatabase extends java.lang.Object implements IndexDatabase
ClassTrackedDatabasedefines an IndexDatabase created from a list of files. Each files is parsed using anFileParserand then registered in the Database.SerializedIOcan then be used to save the current state of the database into a unique binary file and therefore prevent the parsing of every file every time we launch the program. Each tracked file is automatically compared to the file present in the database and if any difference is noticed the file is parsed again.
Example of usage:DBTable table = new DBTable.Builder() .registerArgument("arg1") .registerArgument("arg2") .registerIndexedArguments("name") .registerIndexedArguments("index") .create(); TrackedDatabase db = new TrackedDatabase.Builder().setIO(io) .setParser(parser) .setTable(table) .setTrackedDirectory("../path/to/tracked/directory") .create(); db.sync();For further information about the query seeIndexDatabase
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTrackedDatabase.Builder
-
Method Summary
Modifier and Type Method Description java.util.List<DBEntry>query(IndexQuery query)voidsync()
-
-
-
Method Detail
-
sync
public void sync()
-
query
public java.util.List<DBEntry> query(IndexQuery query)
- Specified by:
queryin interfaceIndexDatabase
-
-