package lrs.lazyLRSEvaluators;

import lrs.*;

/**
 * Given an element e and a number n, creates a list of length n,
 * containing elements of e.
 */
public class LazyNCopiesEval extends ALazyEval {
    public LazyNCopiesEval(Object e, int n) {
      _e = e;
      _n = n;
    }
    
    // FOR STUDENT TO COMPLETE: add fields and methods here
    protected Object _e;
    protected int _n;
    
    public LRStruct nextLRS() {
        return makeLRS();
    }
    
    /**
     * If _n is >0, decrements _n and returns a lazy list with _e as first.
     * @return a list with _e as first if _n>0, empty otherwise.
     */
    public LRStruct makeLRS() {    
      if (_n-->0)
        return makeLazyLRS(_e);
      else
        return new LRStruct();
    }
}

