com.arcadedb.query.sql.parser.ExpressionStatement Maven / Gradle / Ivy
/* Generated By:JJTree: Do not edit this line. ExpressionStatement.java Version 7.0 */
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=true,NODE_PREFIX=,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
package com.arcadedb.query.sql.parser;
import com.arcadedb.query.sql.executor.CommandContext;
import com.arcadedb.query.sql.executor.InternalResultSet;
import com.arcadedb.query.sql.executor.ResultInternal;
import com.arcadedb.query.sql.executor.ResultSet;
import java.util.*;
public class ExpressionStatement extends SimpleExecStatement {
protected Expression expression;
public ExpressionStatement(int id) {
super(id);
}
@Override
public ResultSet executeSimple(CommandContext ctx) {
InternalResultSet result = new InternalResultSet();
Object expResult = expression.execute(new ResultInternal(), ctx);
ResultInternal item = new ResultInternal();
item.setProperty("result", expResult);
result.add(item);
return result;
}
@Override
public boolean executionPlanCanBeCached() {
return false;
}
@Override
public Statement copy() {
final ExpressionStatement result = new ExpressionStatement(-1);
result.expression = expression.copy();
return result;
}
@Override
public void toString(Map params, StringBuilder builder) {
expression.toString(params, builder);
}
@Override
public boolean refersToParent() {
return expression.refersToParent();
}
@Override
public boolean equals(final Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
final ExpressionStatement that = (ExpressionStatement) o;
return Objects.equals(expression, that.expression);
}
@Override
public int hashCode() {
return Objects.hash(expression);
}
}
/* JavaCC - OriginalChecksum=7950423e8448333ff7387185a030d8c1 (do not edit this line) */
© 2015 - 2024 Weber Informatics LLC | Privacy Policy