void TestR7() { "Demonstrating Requirement #7".title('='); WriteLine(); "Adding elements to db".title(); WriteLine(); for (int i = 0; i < 3; i++) { DBElement<int, string> elem = new DBElement<int, string>(); elem.name = "element"; elem.descr = "test element"; elem.timeStamp = new DateTime(2015,10,(2+i)); elem.children.AddRange(new List<int> { 1, 2, 3 }); elem.payload = "elem's payload"; elem.showElement(); WriteLine(); db.insert(12345+i, elem); } "current DB status:".title(); db.showDB(); IQuery<int, DBElement<int, string>> i_query = new DBEngine<int, DBElement<int, string>>(); QueryEngine<int, DBElement<int, string>> qe = new QueryEngine<int, DBElement<int, string>>(db); QueryPredicate qp = new QueryPredicate(); qp.key_value_search(db, i_query, qe); WriteLine(); qp.key_children_search(db, i_query, qe); WriteLine(); qp.pattern_matching(db, i_query, qe); WriteLine(); qp.default_pattern_matching(db, i_query, qe); WriteLine(); qp.metadata_string(db, i_query, qe); WriteLine(); qp.date_time_specific(db, i_query, qe); WriteLine(); qp.default_date_time_specific(db,i_query, qe); WriteLine(); }
static void Main(string[] args) { DBEngine<int, DBElement<int, string>> db = new DBEngine<int, DBElement<int, string>>(); for (int i = 0; i < 3; i++) { DBElement<int, string> elem = new DBElement<int, string>(); elem.name = "element"; elem.descr = "test element"; elem.timeStamp = new DateTime(2015, 10, (2 + i)); elem.children.AddRange(new List<int> { 1, 2, 3 }); elem.payload = "elem's payload"; elem.showElement(); WriteLine(); db.insert(12345 + i, elem); } for (int i = 0; i < 3; i++) { DBElement<int, string> elem = new DBElement<int, string>(); elem.name = "db data"; elem.descr = "db data description"; elem.timeStamp = DateTime.Now; elem.children.AddRange(new List<int> { 12345, 12346, 12347 }); elem.payload = "elem's payload"; elem.showElement(); WriteLine(); db.insert(i+1, elem); } IQuery<int, DBElement<int, string>> i_query = new DBEngine<int, DBElement<int, string>>(); QueryEngine<int, DBElement<int, string>> qe = new QueryEngine<int, DBElement<int, string>>(db); //<---- creating a query predicate object and calling each query on given test database ---> QueryPredicate qp = new QueryPredicate(); qp.key_value_search(db, i_query, qe); WriteLine(); qp.key_children_search(db, i_query, qe); WriteLine(); qp.pattern_matching(db, i_query, qe); WriteLine(); qp.default_pattern_matching(db, i_query, qe); WriteLine(); qp.metadata_string(db, i_query, qe); WriteLine(); qp.date_time_specific(db, i_query, qe); WriteLine(); qp.default_date_time_specific(db, i_query, qe); WriteLine(); }