Skip to content
Snippets Groups Projects
Commit 5dfb7bfa authored by hiba1907's avatar hiba1907
Browse files

Realisation de la classe CoordinateIterator avec le teste effectuée sans...

Realisation de la classe CoordinateIterator avec le teste effectuée sans probleme pour les méthodes codées
parent c17e781e
No related branches found
No related tags found
No related merge requests found
Pipeline #38323 failed
File deleted
No preview for this file type
...@@ -15,8 +15,15 @@ class CoordinateIterator implements Iterator<Coordinate> { ...@@ -15,8 +15,15 @@ class CoordinateIterator implements Iterator<Coordinate> {
* @param width The width of the coordinate range. * @param width The width of the coordinate range.
* @param height The height of the coordinate range. * @param height The height of the coordinate range.
*/ */
private int width ;
private int height;
private int x;
private int y;
public CoordinateIterator(int width, int height) { public CoordinateIterator(int width, int height) {
// TODO: à compléter this.width=width;
this.height=height;
this.x=x;
this.y=y;
} }
/** /**
...@@ -26,8 +33,7 @@ class CoordinateIterator implements Iterator<Coordinate> { ...@@ -26,8 +33,7 @@ class CoordinateIterator implements Iterator<Coordinate> {
*/ */
@Override @Override
public boolean hasNext() { public boolean hasNext() {
// TODO: à compléter return x<width && y<height ;
return false;
} }
/** /**
...@@ -38,7 +44,14 @@ class CoordinateIterator implements Iterator<Coordinate> { ...@@ -38,7 +44,14 @@ class CoordinateIterator implements Iterator<Coordinate> {
*/ */
@Override @Override
public Coordinate next() { public Coordinate next() {
// TODO: à compléter if (!hasNext()) throw new NoSuchElementException();
return null;
Coordinate Actual = new Coordinate(this.x, this.y);
x++;
if (x>=width){
x=0;
y++;
}
return Actual;
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment