本文整理汇总了Java中com.espertech.esper.epl.enummethod.dot.ExprLambdaGoesNode类的典型用法代码示例。如果您正苦于以下问题:Java ExprLambdaGoesNode类的具体用法?Java ExprLambdaGoesNode怎么用?Java ExprLambdaGoesNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ExprLambdaGoesNode类属于com.espertech.esper.epl.enummethod.dot包,在下文中一共展示了ExprLambdaGoesNode类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getExprNodesLibFunc
import com.espertech.esper.epl.enummethod.dot.ExprLambdaGoesNode; //导入依赖的package包/类
public static List<ExprNode> getExprNodesLibFunc(EsperEPL2GrammarParser.LibFunctionArgsContext ctx, Map<Tree, ExprNode> astExprNodeMap) {
if (ctx == null) {
return Collections.emptyList();
}
List<EsperEPL2GrammarParser.LibFunctionArgItemContext> args = ctx.libFunctionArgItem();
if (args == null || args.isEmpty()) {
return Collections.emptyList();
}
List<ExprNode> parameters = new ArrayList<ExprNode>(args.size());
for (EsperEPL2GrammarParser.LibFunctionArgItemContext arg : args) {
if (arg.expressionLambdaDecl() != null) {
List<String> lambdaparams = getLambdaGoesParams(arg.expressionLambdaDecl());
ExprLambdaGoesNode goes = new ExprLambdaGoesNode(lambdaparams);
ExprNode lambdaExpr = ASTExprHelper.exprCollectSubNodes(arg.expressionWithNamed(), 0, astExprNodeMap).get(0);
goes.addChildNode(lambdaExpr);
parameters.add(goes);
} else {
ExprNode parameter = ASTExprHelper.exprCollectSubNodes(arg.expressionWithNamed(), 0, astExprNodeMap).get(0);
parameters.add(parameter);
}
}
return parameters;
}
示例2: getExprNodesLibFunc
import com.espertech.esper.epl.enummethod.dot.ExprLambdaGoesNode; //导入依赖的package包/类
public static List<ExprNode> getExprNodesLibFunc(int start, Tree parent, Map<Tree, ExprNode> astExprNodeMap) {
List<ExprNode> parameters = new ArrayList<ExprNode>();
int exprNum = start;
while (exprNum < parent.getChildCount()) {
if (parent.getChild(exprNum).getType() == EsperEPL2Ast.GOES) {
ExprLambdaGoesNode goes = getLambdaGoes(parent.getChild(exprNum));
ExprNode lambdaExpr = astExprNodeMap.remove(parent.getChild(++exprNum));
goes.addChildNode(lambdaExpr);
parameters.add(goes);
}
else {
ExprNode parameter = astExprNodeMap.remove(parent.getChild(exprNum));
if (parameter != null) {
parameters.add(parameter);
}
}
exprNum++;
}
return parameters;
}
示例3: getProvidedFootprint
import com.espertech.esper.epl.enummethod.dot.ExprLambdaGoesNode; //导入依赖的package包/类
public static DotMethodFPProvided getProvidedFootprint(List<ExprNode> parameters) {
List<DotMethodFPProvidedParam> paramsList = new ArrayList<DotMethodFPProvidedParam>();
for (ExprNode node : parameters) {
if (!(node instanceof ExprLambdaGoesNode)) {
paramsList.add(new DotMethodFPProvidedParam(0, node.getForge().getEvaluationType(), node));
continue;
}
ExprLambdaGoesNode goesNode = (ExprLambdaGoesNode) node;
paramsList.add(new DotMethodFPProvidedParam(goesNode.getGoesToNames().size(), null, goesNode));
}
return new DotMethodFPProvided(paramsList.toArray(new DotMethodFPProvidedParam[paramsList.size()]));
}
示例4: isVisit
import com.espertech.esper.epl.enummethod.dot.ExprLambdaGoesNode; //导入依赖的package包/类
public boolean isVisit(ExprNode exprNode) {
if (exprNode instanceof ExprLambdaGoesNode) {
return false;
}
if (isVisitAggregateNodes) {
return true;
}
return !(exprNode instanceof ExprAggregateNode);
}
示例5: isVisit
import com.espertech.esper.epl.enummethod.dot.ExprLambdaGoesNode; //导入依赖的package包/类
public boolean isVisit(ExprNode exprNode) {
if (exprNode instanceof ExprLambdaGoesNode) {
return false;
}
if (isVisitAggregateNodes) {
return true;
}
return !(exprNode instanceof ExprAggregateNode);
}
示例6: getValidatedSubtree
import com.espertech.esper.epl.enummethod.dot.ExprLambdaGoesNode; //导入依赖的package包/类
/**
* Validates the expression node subtree that has this
* node as root. Some of the nodes of the tree, including the
* root, might be replaced in the process.
*
* @param origin validate origin
* @param exprNode node
* @param validationContext context
* @return the root node of the validated subtree, possibly
* different than the root node of the unvalidated subtree
* @throws ExprValidationException when the validation fails
*/
public static ExprNode getValidatedSubtree(ExprNodeOrigin origin, ExprNode exprNode, ExprValidationContext validationContext) throws ExprValidationException {
if (exprNode instanceof ExprLambdaGoesNode) {
return exprNode;
}
try {
return getValidatedSubtreeInternal(exprNode, validationContext, true);
} catch (ExprValidationException ex) {
try {
String text;
if (exprNode instanceof ExprSubselectNode) {
ExprSubselectNode subselect = (ExprSubselectNode) exprNode;
text = getSubqueryInfoText(subselect.getSubselectNumber() - 1, subselect);
} else {
text = toExpressionStringMinPrecedenceSafe(exprNode);
if (text.length() > 40) {
String shortened = text.substring(0, 35);
text = shortened + "...(" + text.length() + " chars)";
}
text = "'" + text + "'";
}
throw new ExprValidationException("Failed to validate " +
origin.getClauseName() +
" expression " +
text + ": " +
ex.getMessage(), ex);
} catch (RuntimeException rtex) {
log.debug("Failed to render nice validation message text: " + rtex.getMessage(), rtex);
throw ex;
}
}
}
示例7: getLambdaGoes
import com.espertech.esper.epl.enummethod.dot.ExprLambdaGoesNode; //导入依赖的package包/类
private static ExprLambdaGoesNode getLambdaGoes(Tree child) {
List<String> parameters = new ArrayList<String>();
if (child.getChild(0).getType() == EsperEPL2Ast.IDENT) {
parameters.add(child.getChild(0).getText());
}
else {
parameters = getIdentList(child.getChild(0));
}
return new ExprLambdaGoesNode(parameters);
}
示例8: getProvidedFootprint
import com.espertech.esper.epl.enummethod.dot.ExprLambdaGoesNode; //导入依赖的package包/类
public static DotMethodFPProvided getProvidedFootprint(List<ExprNode> parameters) {
List<DotMethodFPProvidedParam> paramsList = new ArrayList<DotMethodFPProvidedParam>();
for (ExprNode node : parameters) {
if (!(node instanceof ExprLambdaGoesNode)) {
paramsList.add(new DotMethodFPProvidedParam(0, node.getExprEvaluator().getType(), node));
continue;
}
ExprLambdaGoesNode goesNode = (ExprLambdaGoesNode) node;
paramsList.add(new DotMethodFPProvidedParam(goesNode.getGoesToNames().size(), null, goesNode));
}
return new DotMethodFPProvided(paramsList.toArray(new DotMethodFPProvidedParam[paramsList.size()]));
}
示例9: getValidatedSubtree
import com.espertech.esper.epl.enummethod.dot.ExprLambdaGoesNode; //导入依赖的package包/类
/**
* Validates the expression node subtree that has this
* node as root. Some of the nodes of the tree, including the
* root, might be replaced in the process.
* @throws com.espertech.esper.epl.expression.ExprValidationException when the validation fails
* @return the root node of the validated subtree, possibly
* different than the root node of the unvalidated subtree
*/
public static ExprNode getValidatedSubtree(ExprNode exprNode, ExprValidationContext validationContext) throws ExprValidationException
{
if (exprNode instanceof ExprLambdaGoesNode) {
return exprNode;
}
return getValidatedSubtreeInternal(exprNode, validationContext, true);
}
示例10: isVisit
import com.espertech.esper.epl.enummethod.dot.ExprLambdaGoesNode; //导入依赖的package包/类
public boolean isVisit(ExprNode exprNode)
{
if (exprNode instanceof ExprLambdaGoesNode) {
return false;
}
if (isVisitAggregateNodes)
{
return true;
}
return (!(exprNode instanceof ExprAggregateNode));
}
示例11: getValidatedSubtreeInternal
import com.espertech.esper.epl.enummethod.dot.ExprLambdaGoesNode; //导入依赖的package包/类
private static ExprNode getValidatedSubtreeInternal(ExprNode exprNode, ExprValidationContext validationContext, boolean isTopLevel) throws ExprValidationException {
ExprNode result = exprNode;
if (exprNode instanceof ExprLambdaGoesNode) {
return exprNode;
}
for (int i = 0; i < exprNode.getChildNodes().length; i++) {
ExprNode childNode = exprNode.getChildNodes()[i];
if (childNode instanceof ExprDeclaredOrLambdaNode) {
ExprDeclaredOrLambdaNode node = (ExprDeclaredOrLambdaNode) childNode;
if (node.validated()) {
continue;
}
}
ExprNode childNodeValidated = getValidatedSubtreeInternal(childNode, validationContext, false);
exprNode.setChildNode(i, childNodeValidated);
}
try {
ExprNode optionalReplacement = exprNode.validate(validationContext);
if (optionalReplacement != null) {
return getValidatedSubtreeInternal(optionalReplacement, validationContext, isTopLevel);
}
} catch (ExprValidationException e) {
if (exprNode instanceof ExprIdentNode) {
ExprIdentNode identNode = (ExprIdentNode) exprNode;
try {
result = resolveStaticMethodOrField(identNode, e, validationContext);
} catch (ExprValidationException ex) {
e = ex;
result = resolveAsStreamName(identNode, e, validationContext);
}
} else {
throw e;
}
}
// For top-level expressions check if we perform audit
if (isTopLevel) {
if (validationContext.isExpressionAudit()) {
return (ExprNode) ExprNodeProxy.newInstance(validationContext.getStreamTypeService().getEngineURIQualifier(), validationContext.getStatementName(), result);
}
} else {
if (validationContext.isExpressionNestedAudit() && !(result instanceof ExprIdentNode) && !(ExprNodeUtilityCore.isConstantValueExpr(result))) {
return (ExprNode) ExprNodeProxy.newInstance(validationContext.getStreamTypeService().getEngineURIQualifier(), validationContext.getStatementName(), result);
}
}
return result;
}
示例12: getValidatedSubtreeInternal
import com.espertech.esper.epl.enummethod.dot.ExprLambdaGoesNode; //导入依赖的package包/类
private static ExprNode getValidatedSubtreeInternal(ExprNode exprNode, ExprValidationContext validationContext, boolean isTopLevel) throws ExprValidationException
{
ExprNode result = exprNode;
if (exprNode instanceof ExprLambdaGoesNode) {
return exprNode;
}
for (int i = 0; i < exprNode.getChildNodes().size(); i++)
{
ExprNode childNode = exprNode.getChildNodes().get(i);
if (childNode instanceof ExprDeclaredOrLambdaNode) {
ExprDeclaredOrLambdaNode node = (ExprDeclaredOrLambdaNode) childNode;
if (node.validated()) {
continue;
}
}
ExprNode childNodeValidated = getValidatedSubtreeInternal(childNode, validationContext, false);
exprNode.getChildNodes().set(i, childNodeValidated);
}
try
{
exprNode.validate(validationContext);
}
catch(ExprValidationException e)
{
if (exprNode instanceof ExprIdentNode)
{
ExprIdentNode identNode = (ExprIdentNode) exprNode;
try
{
result = resolveStaticMethodOrField(identNode, e, validationContext);
}
catch(ExprValidationException ex)
{
e = ex;
result = resolveAsStreamName(identNode, e, validationContext);
}
}
else
{
throw e;
}
}
// For top-level expressions check if we perform audit
if (isTopLevel) {
if (validationContext.isExpressionAudit()) {
return (ExprNode) ExprNodeProxy.newInstance(validationContext.getStreamTypeService().getEngineURIQualifier(), validationContext.getStatementName(), result);
}
}
else {
if (validationContext.isExpressionNestedAudit() && !(result instanceof ExprIdentNode) && !(ExprNodeUtility.isConstantValueExpr(result))) {
return (ExprNode) ExprNodeProxy.newInstance(validationContext.getStreamTypeService().getEngineURIQualifier(), validationContext.getStatementName(), result);
}
}
return result;
}
示例13: resolveSingleRowPluginFunc
import com.espertech.esper.epl.enummethod.dot.ExprLambdaGoesNode; //导入依赖的package包/类
public static ExprNodeUtilSingleRowMethodDesc resolveSingleRowPluginFunc(String className, String methodName, List<ExprNode> parameters, MethodResolutionService methodResolutionService, boolean allowWildcard, final EventType wildcardType, String resolvedExpression, boolean configuredAsSingleRow) throws ExprValidationException {
Class[] paramTypes = new Class[parameters.size()];
ExprEvaluator[] childEvals = new ExprEvaluator[parameters.size()];
int count = 0;
boolean allConstants = true;
for(ExprNode childNode : parameters)
{
if (childNode instanceof ExprLambdaGoesNode) {
throw new ExprValidationException("Unexpected lambda-expression encountered as parameter to UDF or static method '" + methodName + "'");
}
if (childNode instanceof ExprNumberSetWildcardMarker) {
if (wildcardType == null || !allowWildcard) {
throw new ExprValidationException("Failed to resolve wildcard parameter to a given event type");
}
childEvals[count] = new ExprEvaluator() {
public Object evaluate(EventBean[] eventsPerStream, boolean isNewData, ExprEvaluatorContext context) {
return eventsPerStream[0].getUnderlying();
}
public Class getType() {
return wildcardType.getUnderlyingType();
}
public Map<String, Object> getEventType() throws ExprValidationException {
return null;
}
};
paramTypes[count] = wildcardType.getUnderlyingType();
allConstants = false;
count++;
continue;
}
ExprEvaluator eval = childNode.getExprEvaluator();
childEvals[count] = eval;
paramTypes[count] = eval.getType();
count++;
if (!(childNode.isConstantResult()))
{
allConstants = false;
}
}
// Try to resolve the method
final FastMethod staticMethod;
Method method;
try
{
method = methodResolutionService.resolveMethod(className, methodName, paramTypes);
FastClass declaringClass = FastClass.create(Thread.currentThread().getContextClassLoader(), method.getDeclaringClass());
staticMethod = declaringClass.getMethod(method);
}
catch(Exception e)
{
String message;
if (configuredAsSingleRow) {
message = e.getMessage();
}
else {
message = "Failed to resolve '" + resolvedExpression + "' to a property, single-row function, script, stream or class name";
}
throw new ExprValidationException(message, e);
}
return new ExprNodeUtilSingleRowMethodDesc(allConstants, paramTypes, childEvals, method, staticMethod);
}