public void TestR7() { "Demonstrating Requirement #7".title('='); WriteLine(); "Adding elements to db".title(); WriteLine(); for (int i = 0; i < 3; i++) { DBElement<string, List<string>> elem = new DBElement<string, List<string>>(); elem.name = "element"; elem.descr = "test element"; elem.timeStamp = new DateTime(2015,10,(2+i)); elem.children.AddRange(new List<string> { "one", "two", "three" }); elem.payload = new List<string>{ "elem's payload1","payload2","payload 3"}; elem.showEnumerableElement(); WriteLine(); enum_db.insert((12345+i).ToString(), elem); } "current DB status:".title(); enum_db.showEnumerableDB(); IQuery<string, DBElement<string, List<string>>> i_query = new DBEngine<string, DBElement<string, List<string>>>(); QueryEngine<string, DBElement<string, List<string>>> qe = new QueryEngine<string, DBElement<string, List<string>>>(enum_db); QueryPredicate qp = new QueryPredicate(); qp.key_value_search(enum_db, out i_query, qe); WriteLine(); qp.key_children_search(enum_db, out i_query, qe); WriteLine(); qp.pattern_matching(enum_db, out i_query, qe, "12345"); WriteLine(); qp.pattern_matching(enum_db, out i_query, qe); WriteLine(); qp.metadata_string(enum_db, out i_query, qe); WriteLine(); DateTime start = new DateTime(2015, 10, 4); DateTime end = new DateTime(2015, 10, 5); qp.date_time_specific(enum_db, out i_query, qe, start, end); WriteLine(); qp.default_date_time_specific(enum_db, out i_query, qe, start); WriteLine(); }
static void Main(string[] args) { DBEngine<string, DBElement<string, List<string>>> db = new DBEngine<string, DBElement<string, List<string>>>(); for (int i = 0; i < 3; i++) { DBElement<string, List<string>> elem = new DBElement<string, List<string>>(); elem.name = "element"; elem.descr = "test element"; elem.timeStamp = new DateTime(2015, 10, (2 + i)); elem.children.AddRange(new List<string> { "element1", "element2", "element3" }); elem.payload = new List<string> { "elem's payload1", "elem's payload2" }; elem.showEnumerableElement(); WriteLine(); db.insert("element"+(12345 + i).ToString(), elem); } for (int i = 0; i < 3; i++) { DBElement <string, List<string>> elem = new DBElement<string, List<string>>(); elem.name = "db data"; elem.descr = "db data description"; elem.timeStamp = DateTime.Now; elem.children.AddRange(new List<string> { "element12345", "element12346", "element12347" }); elem.payload = new List<string> { "elem's payload1", "elem's payload2" }; elem.showEnumerableElement(); WriteLine(); db.insert("element"+(i+1).ToString(), elem); } IQuery<string, DBElement<string, List<string>>> i_query = new DBEngine<string, DBElement<string, List<string>>>(); QueryEngine<string, DBElement<string, List<string>>> qe = new QueryEngine<string, DBElement<string, List<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(); }