001    package org.hackystat.telemetry.analyzer.language.ast;
002    
003    /**
004     * Telemetry expression representing a function call. A function can be as simple as "Add"
005     * or "Subtract" funciton built into telemetry language, or it can be a custom supplied function
006     * doing anything imaginable.
007     * 
008     * @author (Cedric) Qin ZHANG
009     * @version $Id$
010     */
011    public class FunctionCall implements Expression {
012    
013      /** The name of the function. */
014      private String functionName;
015      
016      /** The function parameters. */
017      private Expression[] parameters;
018      
019      /**
020       * Constructs this instance.
021       * 
022       * @param functionName The name of the function.
023       * @param parameters The function parameters. Null is valid if the function does not
024       *        require any parameter.
025       */
026      public FunctionCall(String functionName, Expression[] parameters) {
027        this.functionName = functionName;
028        this.parameters = parameters == null ? new Expression[]{} : parameters;
029      }
030      
031      /**
032       * Gets the name of the function to be invoked.
033       * 
034       * @return The function name.
035       */
036      public String getFunctionName() {
037        return this.functionName;
038      }
039      
040      /**
041       * Gets function parameters.
042       * 
043       * @return The function parameters. It will never return null. If there is no parameter,
044       *         an empty array will be returned.
045       */
046      public Expression[] getParameters() {
047        return this.parameters;
048      }
049    }