Commit 212d9118 authored by Maxime Goret's avatar Maxime Goret
Browse files

Voisinage version 2

parent a39f15f8
......@@ -22,6 +22,7 @@ private :
friend class RegleVoisinage;
friend class RegleVoisinageMoore;
friend class RegleVoisinageNeumann;
friend class VoisinageIterator;
public:
Voisinage();
......@@ -29,6 +30,9 @@ public:
Cellule* getCelluleCentre()const {return celluleCentre;}
void setr(unsigned int rayon);
unsigned int getr() const {return r;}
VoisinageIterator *creerIterator()const{
return new VoisinageIterator(this);
}
};
......@@ -62,4 +66,32 @@ public:
void calculVoisinage(Voisinage& v);
};
class VoisinageIterator {
const Voisinage *vsn;
int i;
public :
VoisinageIterator(const Voisinage *v){
vsn = v;
}
void first(){
i=0;
}
void next(){
i++;
}
// bool isDone(){
// return i == vsn->voisinage
// }
int currentItem(){
return vsn->voisinage[i];
}
}
#endif /* voisinnage_hpp */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment