001package gudusoft.gsqlparser.ir.logical.rex; 002 003import gudusoft.gsqlparser.ir.common.SourceAnchor; 004import gudusoft.gsqlparser.ir.logical.RexNode; 005import gudusoft.gsqlparser.ir.logical.RexNodeVisitor; 006 007import java.util.Collections; 008import java.util.List; 009 010/** 011 * Function/operator call expression. 012 */ 013public final class RexCall extends RexNode { 014 private final String operator; 015 private final List<RexNode> operands; 016 private final boolean vendorSpecific; 017 018 public RexCall(String operator, List<RexNode> operands, SourceAnchor anchor) { 019 this(operator, operands, false, anchor); 020 } 021 022 public RexCall(String operator, List<RexNode> operands, boolean vendorSpecific, SourceAnchor anchor) { 023 super(RexKind.CALL, anchor); 024 this.operator = operator; 025 this.operands = operands != null ? Collections.unmodifiableList(operands) : Collections.<RexNode>emptyList(); 026 this.vendorSpecific = vendorSpecific; 027 } 028 029 public String getOperator() { return operator; } 030 public List<RexNode> getOperands() { return operands; } 031 public boolean isVendorSpecific() { return vendorSpecific; } 032 033 @Override 034 public <R> R accept(RexNodeVisitor<R> visitor) { return visitor.visitCall(this); } 035 036 @Override 037 public String toString() { return operator + "(" + operands.size() + " args)"; } 038}