001    package org.hackystat.telemetry.analyzer.language.ast;
002    
003    /**
004     * Telemetry expression representing a reducer call. A reducer is responsible for processing
005     * low level software metrics. Reducer call always evaluates to an instance of 
006     * <code>TelemetryStreamCollection</code> which contains at least one telemetry stream.
007     * 
008     * @author (Cedric) Qin ZHANG
009     * @version $Id$
010     */
011    public class ReducerCall implements Expression {
012    
013      /** The name of the reducer. */
014      private String reducerName;
015      
016      /** The parameters. */
017      private Expression[] parameters;
018      
019      /**
020       * Constructs this instance.
021       * 
022       * @param reducerName The name of the reducer.
023       * @param parameters The reducer parameters. Null is valid if the reducer does not
024       *        require any parameter.
025       */
026      public ReducerCall(String reducerName, Expression[] parameters) {
027        this.reducerName = reducerName;
028        this.parameters = parameters == null ? new Expression[]{} : parameters;
029      }
030    
031      /**
032       * Gets the name of the reducer to be invoked.
033       * 
034       * @return The reducer name.
035       */
036      public String getReducerName() {
037        return this.reducerName;
038      }
039     
040      /**
041       * Gets reducer parameters.
042       * 
043       * @return The reducer 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    }