...
Code Block |
---|
S → SS S → (S) S → () S → key KEY KEY → operator OPERATOR OPERATOR → value VALUE OPERATOR → value VALUE → value VALUE VALUE → value VALUE → and AND VALUE → or OR AND → S OR → S |
Psuedocode
TSymbolType
A representation for an enum that declares the type of a TSymbol.
Code Block | ||
---|---|---|
| ||
enum TSymbolType {
CONJUNCTION = 1,
KEY = 2,
VALUE = 3
}
|
TSymbol
A representation for a Symbol that can be passed over the wire via Thrift. Once passed over the wire, the server uses information about the symbol type to parse the string representation of the symbol to an actual object.
Code Block | ||
---|---|---|
| ||
struct TSymbol {
1:required TSymbolType type;
2:required string symbol;
}
|
TCriteria
A representation for a Criteria that can be passed over the wire via Thrift. Once passed over the write, the server goes through the list of TSymbols and converts them to actual Symbol objects which can then be used in the shunting-yard algorithm.
Code Block | ||
---|---|---|
| ||
struct TCriteria {
1:required list<TSymbol> symbols
}
|
Criteria
A wrapper around an in-order collection of symbols. A Criteria is generated from the completion of a state machine that comprises a builder.
...
A marker interface to indicate an object that can be included in a Criteria
Code Block |
---|
interface Symbol {} //marker interface |
Conjunction
An enum that represents the possible conjunction symbols.Criteria
Code Block |
---|
enum Conjunction implementsinterface Symbol { AND, OR; } |
...
} //marker interface |
Note |
---|
Each subclass implementation of the Symbol interface should have some public static method that allows the creation of an Object in that class from a string parameter. |
Conjunction
An enum that represents the possible parenthesis conjunction symbols.
Code Block |
---|
enum ParenthesisConjunction implements Symbol { LEFTAND, RIGHTOR; } |
Key
A symbol that represents a "key" in a Criteria.
...