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

package ilog.language.design.base;

/**
 * @version     Last modified on Tue Feb 19 10:38:51 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.ObjectMap;
import ilog.language.design.backend.Indexable;

public class FillMapFromIntArray extends Instruction implements PushValue, PushObject
{
  public FillMapFromIntArray ()
    {
      setName("FILL_MAP_IA");
    }

  public final void execute (Runtime r)
    {
      Indexable indexable = (Indexable)r.popObject();
      Object[] array = new Object[indexable.size()];
      int[] seed = (int[])(array[0] = r.popObject());
      for (int i=1; i<array.length; i++)
        array[i] = r.copy(seed);
      r.pushObject(new ObjectMap(array,indexable));
      r.incIP();
    }
}
