org.hackystat.telemetry.analyzer.function
Class TelemetryFunctionManager

java.lang.Object
  extended by org.hackystat.telemetry.analyzer.function.TelemetryFunctionManager

public class TelemetryFunctionManager
extends java.lang.Object

Implements a global singleton for managing telemetry function instances. It serves two purposes:

All function names are case-insensitive.

Author:
(Cedric) Qin ZHANG

Method Summary
 java.lang.Object compute(java.lang.String functionName, java.lang.Object[] parameters)
          Invokes telemetry function to perform computation.
 TelemetryFunctionInfo getFunctionInfo(java.lang.String functionName)
          Gets telemetry function information by name.
static TelemetryFunctionManager getInstance()
          Gets the global instance.
 boolean isFunction(java.lang.String functionName)
          Determines whether a particular telemetry function is available.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static TelemetryFunctionManager getInstance()
Gets the global instance.

Returns:
The global instance.

isFunction

public boolean isFunction(java.lang.String functionName)
Determines whether a particular telemetry function is available.

Parameters:
functionName - Telemetry function name.
Returns:
True if the specified telemetry function is available.

getFunctionInfo

public TelemetryFunctionInfo getFunctionInfo(java.lang.String functionName)
Gets telemetry function information by name.

Parameters:
functionName - The name of the function.
Returns:
The telemetry function information, or null if the function is not defined.

compute

public java.lang.Object compute(java.lang.String functionName,
                                java.lang.Object[] parameters)
                         throws TelemetryFunctionException
Invokes telemetry function to perform computation.

Parameters:
functionName - The name of the telemetry function.
parameters - An array of objects of type either String, Number, and/or TelemetryStreamCollection.
Returns:
Either an instance of Number or TelemetryStreamCollection.
Throws:
TelemetryFunctionException - If anything is wrong.