/// Evolver Copyright 2000, Morgan McGuire
/// matrix@alum.mit.edu   http://graphics3d.com/matrix
/**
 * Parameters are special expressions that are not used as part of
 * Evolver's normal grammar.  Parameters are used only inside of
 * meta-filters; that is, filters that are defined in terms of other
 * filters.  Parameters allow abstraction in EL.
 *
 * See Trail for an example of parameters in action.
 */
public class ELParameter extends AbstractELExpression implements ELExpression
{
    String name;

    public ELParameter(String name)
    {
	this.name = name;
    }

    public ELExpression geneticClone(ELCall parent, GeneticParameters gp) 
    {
	throw new Error("Can't evolve expressions containing parameters.");
    }

    public Object clone()
    {
	return new ELParameter(name);
    }

    public String unparse()
    {
	return "[" + name + "]";
    }

    public String toString()
    {
	return "Parameter[\"" + name + "\"]";
    }

    public void evaluate(ELMatrix out, ELEnvironment environment, ParameterList pl)
    {
	pl.get(name, out);
    }    
}
