// anche l'iteratore deve stare nel package

package linguaggio;

// serve l'interfaccia Iterator che andiamo ad estendere

import java.util.*;

// la classe e' ristretta in accesso a livello di package
// estendiamo precisamente Iterator<Istruzione>

class IteratorSequenza implements Iterator<Istruzione> {
  Iterator<Istruzione> it;

// costruttore (ristretto al package)

  IteratorSequenza(IstruzioneSequenza s) {
    it=s.sequenza.iterator();
  }

// metodi hasNext e next pubblici

  public boolean hasNext() {
    return it.hasNext();
  }

  public Istruzione next() {
    return it.next();
  }

// metodo remove: opzionale

  public void remove() {
    throw new UnsupportedOperationException();
  }
}
