//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
// PLEASE DO NOT EDIT WITHOUT THE EXPLICIT CONSENT OF THE AUTHOR! \\
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\

package ilog.language.design.base;

/**
 * @version     Last modified on Sun Nov 03 18:18:01 2002 by hak
 * @author      <a href="mailto:hak@ilog.fr">Hassan A&iuml;t-Kaci</a>
 * @copyright   &copy; 2000-2002 <a href="http://www.ilog.fr/">ILOG, S.A.</a>
 */

import ilog.language.design.backend.Runtime;
import ilog.language.design.backend.Closure;
import ilog.language.design.backend.NullValueException;

/**
 * A refinement of <a href="Apply.html"><tt>Apply</tt></tt> that carries its own closure
 * as opposed of taking it from the stack.
 */
public class ApplyClosure extends Apply
{
  private Closure _closure;

  public ApplyClosure (Closure closure)
    {
      setName("APPLY_CLOSURE");
      _closure = closure;
      _intArity = closure.intArity();
      _realArity = closure.realArity();
      _objectArity = closure.objectArity();
    }

  public void execute (Runtime r) throws NullValueException
    {
      if (_closure == null)
        throw new NullValueException("can't apply a null function");
      _execute(_closure,r);
    }
}
