/// <summary>
 /// Creates a graph input handler for a given function
 /// </summary>
 public static IGraphInputHandler CreateHandlerForFunction( IFunction1d function )
 {
     if ( function is PiecewiseLinearFunction1d )
     {
         return new PiecewiseGraphInputHandler( ( PiecewiseLinearFunction1d )function );
     }
     return new GraphInputHandler( function );
 }
 /// <summary>
 /// Sets the function to use as a graph source
 /// </summary>
 /// <param name="function">Graph data source</param>
 public GraphX2dSourceFunction1dAdapter( IFunction1d function )
 {
     if ( function == null )
     {
         throw new ArgumentNullException( "function" );
     }
     m_Function = function;
 }
 /// <summary>
 /// Sets the function to be controller by this handler
 /// </summary>
 public GraphInputHandler( IFunction1d function )
 {
     if ( function == null )
     {
         throw new ArgumentNullException( "function" );
     }
     m_Function = function;
 }
 /// <summary>
 /// Removes a function from the control (must be wrapped in a <see cref="GraphInputHandler"/>)
 /// </summary>
 public void RemoveFunction( IFunction1d function )
 {
     for ( int handlerIndex = 0; handlerIndex < m_Handlers.Count; )
     {
         GraphInputHandler gHandler = m_Handlers[ handlerIndex ] as GraphInputHandler;
         if ( ( gHandler != null ) && ( gHandler.Function == function ) )
         {
             gHandler.Detach( this );
             m_Handlers.RemoveAt( handlerIndex );
         }
         else
         {
             ++handlerIndex;
         }
     }
     Invalidate( );
 }
 /// <summary>
 /// Returns true if the specified function is supported
 /// </summary>
 public abstract bool SupportsFunction( IFunction1d function );
 /// <summary>
 /// Sets up the descriptor
 /// </summary>
 /// <param name="name">Name of the function</param>
 /// <param name="defaultFunction">The default function used by the descriptor</param>
 public FunctionDescriptor( string name, IFunction1d defaultFunction )
 {
     m_Name = name;
     m_Function = defaultFunction;
 }
 /// <summary>
 /// Returns true if the specified function is supported
 /// </summary>
 public override bool SupportsFunction( IFunction1d function )
 {
     return ( function is PiecewiseLinearFunction1d );
 }