@Test(expectedExceptions = IllegalArgumentException.class) public void shouldThrowOnDuplicateDimensions() { AlarmSubExpression.of("avg(hpcs.compute{metric_name=cpu, device=1, instance_id=5, instance_uuid=4, instance_id=4}) > 5"); }
@JsonCreator public static AlarmSubExpression of(String expression) { AlarmExpressionParser parser = new AlarmExpressionParser(new CommonTokenStream( new AlarmExpressionLexer(new ANTLRInputStream(expression)))); parser.removeErrorListeners(); parser.addErrorListener(new AlarmExpressionErrorListener()); parser.setBuildParseTree(true); ParserRuleContext tree = parser.start(); AlarmSubExpressionListener listener = new AlarmSubExpressionListener(true); ParseTreeWalker walker = new ParseTreeWalker(); walker.walk(listener, tree); return (AlarmSubExpression) listener.getElements().get(0); }
AlarmSubExpression implements Serializable { @JsonCreator public static AlarmSubExpression of(String expression) { AlarmExpressionParser parser = new AlarmExpressionParser(new CommonTokenStream( new AlarmExpressionLexer(new ANTLRInputStream(expression)))); parser.removeErrorListeners(); parser.addErrorListener(new AlarmExpressionErrorListener()); parser.setBuildParseTree(true); ParserRuleContext tree = parser.start(); AlarmSubExpressionListener listener = new AlarmSubExpressionListener(true); ParseTreeWalker walker = new ParseTreeWalker(); walker.walk(listener, tree); return (AlarmSubExpression) listener.getElements().get(0); } }
AlarmSubExpression implements Serializable { @JsonCreator public static AlarmSubExpression of(String expression) { AlarmExpressionParser parser = new AlarmExpressionParser(new CommonTokenStream( new AlarmExpressionLexer(new ANTLRInputStream(expression)))); parser.removeErrorListeners(); parser.addErrorListener(new AlarmExpressionErrorListener()); parser.setBuildParseTree(true); ParserRuleContext tree = parser.start(); AlarmSubExpressionListener listener = new AlarmSubExpressionListener(true); ParseTreeWalker walker = new ParseTreeWalker(); walker.walk(listener, tree); return (AlarmSubExpression) listener.getElements().get(0); } AlarmSubExpression(AggregateFunction function,
                            MetricDefinition metricDefinition,
                            AlarmOperator operator,
                            double threshold,
                            int period,
                            int periods);  AlarmSubExpression(AggregateFunction function,
                            MetricDefinition metricDefinition,
                            AlarmOperator operator,
                            double threshold,
                            int period,
                            int periods,
                            boolean deterministic);   AlarmSubExpression(); }
AlarmSubExpression implements Serializable { @JsonCreator public static AlarmSubExpression of(String expression) { AlarmExpressionParser parser = new AlarmExpressionParser(new CommonTokenStream( new AlarmExpressionLexer(new ANTLRInputStream(expression)))); parser.removeErrorListeners(); parser.addErrorListener(new AlarmExpressionErrorListener()); parser.setBuildParseTree(true); ParserRuleContext tree = parser.start(); AlarmSubExpressionListener listener = new AlarmSubExpressionListener(true); ParseTreeWalker walker = new ParseTreeWalker(); walker.walk(listener, tree); return (AlarmSubExpression) listener.getElements().get(0); } AlarmSubExpression(AggregateFunction function,
                            MetricDefinition metricDefinition,
                            AlarmOperator operator,
                            double threshold,
                            int period,
                            int periods);  AlarmSubExpression(AggregateFunction function,
                            MetricDefinition metricDefinition,
                            AlarmOperator operator,
                            double threshold,
                            int period,
                            int periods,
                            boolean deterministic);   AlarmSubExpression(); @JsonCreator static AlarmSubExpression of(String expression); @Override boolean equals(Object obj); boolean evaluate(double value); @JsonIgnore String getExpression(); AggregateFunction getFunction(); MetricDefinition getMetricDefinition(); AlarmOperator getOperator(); int getPeriod(); int getPeriods(); double getThreshold(); boolean isDeterministic(); @Override int hashCode(); void setFunction(AggregateFunction function); void setMetricDefinition(MetricDefinition metricDefinition); void setOperator(AlarmOperator operator); void setPeriod(int period); void setPeriods(int periods); void setThreshold(double threshold); void setDeterministic(final boolean deterministic); @Override String toString(); }
AlarmSubExpression implements Serializable { @JsonCreator public static AlarmSubExpression of(String expression) { AlarmExpressionParser parser = new AlarmExpressionParser(new CommonTokenStream( new AlarmExpressionLexer(new ANTLRInputStream(expression)))); parser.removeErrorListeners(); parser.addErrorListener(new AlarmExpressionErrorListener()); parser.setBuildParseTree(true); ParserRuleContext tree = parser.start(); AlarmSubExpressionListener listener = new AlarmSubExpressionListener(true); ParseTreeWalker walker = new ParseTreeWalker(); walker.walk(listener, tree); return (AlarmSubExpression) listener.getElements().get(0); } AlarmSubExpression(AggregateFunction function,
                            MetricDefinition metricDefinition,
                            AlarmOperator operator,
                            double threshold,
                            int period,
                            int periods);  AlarmSubExpression(AggregateFunction function,
                            MetricDefinition metricDefinition,
                            AlarmOperator operator,
                            double threshold,
                            int period,
                            int periods,
                            boolean deterministic);   AlarmSubExpression(); @JsonCreator static AlarmSubExpression of(String expression); @Override boolean equals(Object obj); boolean evaluate(double value); @JsonIgnore String getExpression(); AggregateFunction getFunction(); MetricDefinition getMetricDefinition(); AlarmOperator getOperator(); int getPeriod(); int getPeriods(); double getThreshold(); boolean isDeterministic(); @Override int hashCode(); void setFunction(AggregateFunction function); void setMetricDefinition(MetricDefinition metricDefinition); void setOperator(AlarmOperator operator); void setPeriod(int period); void setPeriods(int periods); void setThreshold(double threshold); void setDeterministic(final boolean deterministic); @Override String toString(); static final int DEFAULT_PERIOD; static final int DEFAULT_PERIODS; static final boolean DEFAULT_DETERMINISTIC; }