public class PredicateEstimator extends PredicateBaseListener
Modifier and Type | Class and Description |
---|---|
static class |
PredicateEstimator.Source |
Modifier and Type | Field and Description |
---|---|
static String |
AND |
static String |
EXP |
static double |
IGNORE |
static String |
MS |
static String |
NCS |
static double |
NCS_CRM |
static String |
OR |
static String |
SRC |
static String |
UK |
static String |
US |
Constructor and Description |
---|
PredicateEstimator(EstimateMap dataMap)
dataMap consist of String Key (Attribute.Value) as Key, Value is Double to represent as %
examples "food.frozenPizza.3" as key, Value is 0.08 represents 8%
|
enterBinaryOperator, enterBitsAnd, enterBitsOr, enterBooleans, enterCheckNull, enterComparison, enterComparisonOperator, enterCountExpr, enterEveryRule, enterExistExpr, enterExistListAnd, enterExistListOr, enterExpParen, enterExpr, enterExpValue, enterFunctionPredicate, enterInComp, enterLogicalOperator, enterLowerExpr, enterNormal, enterNotPredicate, enterNulls, enterNumbers, enterObjectField, enterObjPredicate, enterParenPredicate, enterScript, enterStrings, enterSubstrExpr, enterUnaryOperator, enterUpperExpr, exitBinaryOperator, exitBitsAnd, exitBitsOr, exitBooleans, exitCheckNull, exitComparisonOperator, exitCountExpr, exitEveryRule, exitExistExpr, exitExistListAnd, exitExistListOr, exitExpParen, exitFunctionPredicate, exitLogicalOperator, exitLowerExpr, exitNulls, exitNumbers, exitObjectField, exitObjPredicate, exitParenPredicate, exitScript, exitStrings, exitSubstrExpr, exitUnaryOperator, exitUpperExpr, visitErrorNode, visitTerminal
public static double IGNORE
public static final String AND
public static final String OR
public static final String SRC
public static final String NCS
public static final String MS
public static final String UK
public static final String US
public static final String EXP
public static final double NCS_CRM
public PredicateEstimator(EstimateMap dataMap)
dataMap
- public void walkTree()
public double runEstimate(String queryStr)
queryStr
- - predicate stringpublic EstimateMap getDataMap()
public Stack<PredicateEstimator.Source> getSourceStack()
public void exitExpValue(PredicateParser.ExpValueContext ctx)
PredicateBaseListener
ExpValue
labeled alternative in PredicateParser.expression()
.
The default implementation does nothing.
exitExpValue
in interface PredicateListener
exitExpValue
in class PredicateBaseListener
ctx
- the parse treepublic void exitExpr(@NotNull PredicateParser.ExprContext ctx)
PredicateBaseListener
Expr
labeled alternative in PredicateParser.expression()
.
The default implementation does nothing.
exitExpr
in interface PredicateListener
exitExpr
in class PredicateBaseListener
ctx
- the parse treepublic void exitComparison(PredicateParser.ComparisonContext ctx)
PredicateBaseListener
Comparison
labeled alternative in PredicateParser.objectPredicate()
.
The default implementation does nothing.
exitComparison
in interface PredicateListener
exitComparison
in class PredicateBaseListener
ctx
- the parse treepublic void exitInComp(PredicateParser.InCompContext ctx)
PredicateBaseListener
InComp
labeled alternative in PredicateParser.objectPredicate()
.
The default implementation does nothing.
exitInComp
in interface PredicateListener
exitInComp
in class PredicateBaseListener
ctx
- the parse treepublic void exitNotPredicate(PredicateParser.NotPredicateContext ctx)
PredicateBaseListener
NotPredicate
labeled alternative in PredicateParser.predicate()
.
The default implementation does nothing.
exitNotPredicate
in interface PredicateListener
exitNotPredicate
in class PredicateBaseListener
ctx
- the parse treeprotected PredicateEstimator.Source findSource(String objectId)
protected PredicateEstimator.Source determineSource(PredicateEstimator.Source left, PredicateEstimator.Source right, String operator)
protected PredicateEstimator.Source findAnd(PredicateEstimator.Source left, PredicateEstimator.Source right)
protected PredicateEstimator.Source findOr(PredicateEstimator.Source left, PredicateEstimator.Source right)
public void exitNormal(PredicateParser.NormalContext ctx)
PredicateBaseListener
Normal
labeled alternative in PredicateParser.predicate()
.
The default implementation does nothing.
exitNormal
in interface PredicateListener
exitNormal
in class PredicateBaseListener
ctx
- the parse treeCopyright © 2016. All rights reserved.