/// Evolver Copyright 2000, Morgan McGuire
/// matrix@alum.mit.edu   http://graphics3d.com/matrix
import java.util.*;

/**
 * A local environment for looking up parameter values.  This is used
 * when creating "meta-filters".  See Trails.java for an example.
 */
public class ParameterList 
{
    private Hashtable table;

    public ParameterList()
    {
	table = new Hashtable();
    }

    /**
     * Creates a parameter list from a set of parameter, value pairs.
     * @param pairs An object array with alternating parameter names (String)
     * and values (ELMatrix).  Don't mutate matrices that have been inserted
     * into a parameter list.
     */
    public ParameterList(Object pairs[]) 
    {
	table = new Hashtable();
	for(int i = 0; i < pairs.length; i++) {
	    String parameter = (String)pairs[i];
	    i++;
	    ELMatrix value = (ELMatrix)pairs[i];
	    table.put(parameter, value);
	}
    }

    /**
     * Returns the value of a parameter given its name.
     */
    public void get(String parameter, ELMatrix out) 
    {
	out.set((ELMatrix)table.get(parameter));
    }
}
