/* Generated By:JJTree: Do not edit this line. OMethodCall.java Version 4.3 */
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=true,NODE_PREFIX=O,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
package com.orientechnologies.orient.core.sql.parser;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class OMethodCall extends SimpleNode {
  protected OIdentifier       methodName;
  protected List<OExpression> params = new ArrayList<OExpression>();

  public OMethodCall(int id) {
    super(id);
  }

  public OMethodCall(OrientSql p, int id) {
    super(p, id);
  }

  /** Accept the visitor. **/
  public Object jjtAccept(OrientSqlVisitor visitor, Object data) {
    return visitor.visit(this, data);
  }

  @Override
  public String toString() {
    StringBuilder result = new StringBuilder();
    result.append(".");
    result.append(methodName.toString());
    result.append("(");
    boolean first = true;
    for (OExpression param : params) {
      if (!first) {
        result.append(", ");
      }
      result.append(param.toString());
      first = false;
    }
    result.append(")");
    return result.toString();
  }

  public void replaceParameters(Map<Object, Object> iParams) {
    if(this.params!=null){
      for(OExpression exp:this.params){
        exp.replaceParameters(iParams);
      }
    }
  }
}
/* JavaCC - OriginalChecksum=da95662da21ceb8dee3ad88c0d980413 (do not edit this line) */
