From 82b4b36f9708fb91a415f9f90b305f659ee7fa6f Mon Sep 17 00:00:00 2001 From: Zane Dunnings <zldunn@umich.edu> Date: Sat, 7 Apr 2018 15:30:16 -0400 Subject: [PATCH] added back tuple class --- util/DataStructureLib/tuple.cpp | 78 +++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 util/DataStructureLib/tuple.cpp diff --git a/util/DataStructureLib/tuple.cpp b/util/DataStructureLib/tuple.cpp new file mode 100644 index 0000000..2583aad --- /dev/null +++ b/util/DataStructureLib/tuple.cpp @@ -0,0 +1,78 @@ +// +// Created by Zane Dunnings on 3/17/18. +// + +// Outline of query language from Prof. Nicole Hamilton, University of Michigan 03/15/2018 +//31 lines +#include<string> +#include<vector> +#include "../../parser/Parser.h" +//#include "../../constraintSolver/ISRAnd.h" +using namespace std; + + +class Token + { +public: + Token() + :text(""), end( true ), OR( false ), AND( false ){} + Token( string input ) + :text( input ), end( false ), OR( false ), AND( false ) + { + if(input == "-OR-" ) + OR = true; + else if(input == "-AND-") + AND=true; + } + //TODO: This is for scaling to add more ISR types + string text; + bool OR; + bool AND; + bool end; + }; + +enum TupleType + { + PhraseTupleType, + OrTupleType, + AndTupleType, + NotTupleType, + SearchTupleType + }; + +class Tuple + { +public: + + Token object; + vector<Tuple *> Next; + TupleType Type; + //ISR *Compile( ); + Tuple( ) + : object( Token() ), Type( AndTupleType ) {} + Tuple( Token input ) + : object( input ), Type( AndTupleType ) + { + if(input.AND) + Type = AndTupleType; + else if (input.OR) + Type = OrTupleType; + else + Type = PhraseTupleType; + } + Tuple( TupleType type) + : object( Token( ) ), Type( type ) + { + switch( type ) + { + case( AndTupleType ): + object = Token("-AND-"); + break; + case( OrTupleType ): + object = Token("-OR-"); + default: + break; + } + } + + }; \ No newline at end of file -- GitLab