This commit is contained in:
2025-12-10 00:14:53 +01:00
parent df9520821a
commit 41df0a89b9
31 changed files with 579 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
import java.util.Iterator;
import java.util.NoSuchElementException;
/**
MonBrinIterator
gère la navigation dans un Brin d'ADN
*/
public class MonBrinIterator implements Iterator<Base> {
// maillon courant de la navigation
private MonMaillon courant;
public MonBrinIterator(MonMaillon m){
this.courant = m;
}
@Override
public boolean hasNext(){
return this.courant != null;
}
@Override
public Base next() {
if (this.courant == null) {
throw new NoSuchElementException("Plus de base dans ce brin");
}
Base valeur = this.courant.getBase();
this.courant = this.courant.getSuiteMaillon();
return valeur;
}
}