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
ClassTrackedDatabase
defines an IndexDatabase created from a list of files. Each files is parsed using anFileParser
and then registered in the Database.SerializedIO
can 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 class
TrackedDatabase.Builder
-
Method Summary
Modifier and Type Method Description java.util.List<DBEntry>
query(IndexQuery query)
void
sync()
-
-
-
Method Detail
-
sync
public void sync()
-
query
public java.util.List<DBEntry> query(IndexQuery query)
- Specified by:
query
in interfaceIndexDatabase
-
-