equal
deleted
inserted
replaced
55 Graph<N,E> *G; //operator*() miatt kell!!! |
55 Graph<N,E> *G; //operator*() miatt kell!!! |
56 int n; //nem kellene, ha itt mutato lenne!! |
56 int n; //nem kellene, ha itt mutato lenne!! |
57 public: |
57 public: |
58 |
58 |
59 NodeIterator() {;} |
59 NodeIterator() {;} |
|
60 NodeIterator(Graph<N,E> &Gr)//'const Graph<N,E> &G' would be wrong. |
|
61 {G=&Gr;n=Gr.OldGraph<N,E>::FirstNode();} |
60 NodeIterator(const NodeIterator &i) {G=i.G;n=i.n;} |
62 NodeIterator(const NodeIterator &i) {G=i.G;n=i.n;} |
61 |
63 |
62 NodeIterator &GoNext() { n=G->NextNode(n); return *this;} |
64 NodeIterator &GoNext() { n=G->NextNode(n); return *this;} |
63 NodeIterator Next() const { return NodeIterator(*this).GoNext();} |
65 NodeIterator Next() const { return NodeIterator(*this).GoNext();} |
64 NodeIterator &operator++() { return GoNext();} |
66 NodeIterator &operator++() { return GoNext();} |
146 |
148 |
147 class InEdgeIterator : public EdgeIterator |
149 class InEdgeIterator : public EdgeIterator |
148 //Ne a BiEdgeIterator-bol szarmazzon? |
150 //Ne a BiEdgeIterator-bol szarmazzon? |
149 { |
151 { |
150 public: |
152 public: |
|
153 InEdgeIterator() {} |
|
154 InEdgeIterator(const Graph<N,E> &Gr,const NodeIterator &n) |
|
155 { G=&Gr; e=Gr.OldGraph<N,E>::FirstIn(n.n);} |
|
156 |
151 InEdgeIterator &GoNext() { e=e->NextIn(); return *this;} |
157 InEdgeIterator &GoNext() { e=e->NextIn(); return *this;} |
152 InEdgeIterator Next() const {return InEdgeIterator(*this).GoNext();} |
158 InEdgeIterator Next() const {return InEdgeIterator(*this).GoNext();} |
153 InEdgeIterator &operator++() { return GoNext();} |
159 InEdgeIterator &operator++() { return GoNext();} |
154 InEdgeIterator operator++(int) |
160 InEdgeIterator operator++(int) |
155 {InEdgeIterator tmp(*this); GoNext(); return tmp;} |
161 {InEdgeIterator tmp(*this); GoNext(); return tmp;} |
167 }; |
173 }; |
168 |
174 |
169 class OutEdgeIterator : public EdgeIterator |
175 class OutEdgeIterator : public EdgeIterator |
170 { |
176 { |
171 public: |
177 public: |
|
178 OutEdgeIterator() {} |
|
179 OutEdgeIterator(Graph<N,E> &Gr,const NodeIterator &n) |
|
180 { G=&Gr; e=Gr.OldGraph<N,E>::FirstOut(n.n);} |
|
181 |
172 OutEdgeIterator &GoNext() { e=e->NextOut(); return *this;} |
182 OutEdgeIterator &GoNext() { e=e->NextOut(); return *this;} |
173 OutEdgeIterator Next() const {return OutEdgeIterator(*this).GoNext();} |
183 OutEdgeIterator Next() const {return OutEdgeIterator(*this).GoNext();} |
174 OutEdgeIterator &operator++() { return GoNext();} |
184 OutEdgeIterator &operator++() { return GoNext();} |
175 OutEdgeIterator operator++(int) |
185 OutEdgeIterator operator++(int) |
176 {OutEdgeIterator tmp(*this); GoNext(); return tmp;} |
186 {OutEdgeIterator tmp(*this); GoNext(); return tmp;} |
190 class SymEdgeIterator : public EdgeIterator |
200 class SymEdgeIterator : public EdgeIterator |
191 { |
201 { |
192 NodeIterator n; // Itt ketszer van a G |
202 NodeIterator n; // Itt ketszer van a G |
193 |
203 |
194 public: |
204 public: |
|
205 SymEdgeIterator() {} |
|
206 SymEdgeIterator(const Graph<N,E> &Gr,const NodeIterator &nn) |
|
207 { G=&Gr; n=nn; e=Gr.FirstSym(nn.n); } |
|
208 |
195 SymEdgeIterator &GoNext() { e=e->NextEdge(n.n); return *this;} |
209 SymEdgeIterator &GoNext() { e=e->NextEdge(n.n); return *this;} |
196 SymEdgeIterator Next() const {return SymEdgeIterator(*this).GoNext();} |
210 SymEdgeIterator Next() const {return SymEdgeIterator(*this).GoNext();} |
197 SymEdgeIterator &operator++() { return GoNext();} |
211 SymEdgeIterator &operator++() { return GoNext();} |
198 SymEdgeIterator operator++(int) |
212 SymEdgeIterator operator++(int) |
199 {SymEdgeIterator tmp(*this); GoNext(); return tmp;} |
213 {SymEdgeIterator tmp(*this); GoNext(); return tmp;} |
214 class AllEdgeIterator : public EdgeIterator |
228 class AllEdgeIterator : public EdgeIterator |
215 { |
229 { |
216 NodeIterator n; // Itt ketszer van a G |
230 NodeIterator n; // Itt ketszer van a G |
217 |
231 |
218 public: |
232 public: |
|
233 AllEdgeIterator() {} |
|
234 AllEdgeIterator(Graph<N,E> &Gr) : n(Gr) |
|
235 { |
|
236 e=n.isValid()?Gr.OldGraph<N,E>::FirstOut(n.n):NULL; |
|
237 } |
|
238 |
219 AllEdgeIterator &GoNext() |
239 AllEdgeIterator &GoNext() |
220 { |
240 { |
221 e=e->NextOut(); |
241 e=e->NextOut(); |
222 if(!e && (++n).isValid()) e=G->OldGraph<N,E>::FirstOut(n.n); |
242 if(!e && (++n).isValid()) e=G->OldGraph<N,E>::FirstOut(n.n); |
223 return *this; |
243 return *this; |
246 typedef BiEdgeIterator DeletingBiEdgeIterator; |
266 typedef BiEdgeIterator DeletingBiEdgeIterator; |
247 typedef OutEdgeIterator DeletingOutEdgeIterator; |
267 typedef OutEdgeIterator DeletingOutEdgeIterator; |
248 typedef InEdgeIterator DeletingInEdgeIterator; |
268 typedef InEdgeIterator DeletingInEdgeIterator; |
249 typedef SymEdgeIterator DeletingSymEdgeIterator; |
269 typedef SymEdgeIterator DeletingSymEdgeIterator; |
250 |
270 |
251 const NodeIterator &FirstNode() |
271 const NodeIterator FirstNode() |
252 { |
272 { |
253 NodeIterator i; |
273 NodeIterator i; |
254 i.G=this;i.n=OldGraph<N,E>::FirstNode(); |
274 i.G=this;i.n=OldGraph<N,E>::FirstNode(); |
255 return i; |
275 return i; |
256 } |
276 } |
282 } |
302 } |
283 |
303 |
284 |
304 |
285 |
305 |
286 //Vagy beginnode()? |
306 //Vagy beginnode()? |
287 const DeletingEdgeIterator &FirstOut(const NodeIterator &n) |
307 const DeletingEdgeIterator FirstOut(const NodeIterator &n) |
288 { |
308 { |
289 EdgeIterator i; |
309 EdgeIterator i; |
290 i.G=n.G;i.edge=n.G->OldGraph<N,E>::FirstOut(n.n); |
310 i.G=n.G;i.edge=n.G->OldGraph<N,E>::FirstOut(n.n); |
291 return i; |
311 return i; |
292 } |
312 } |
293 const DeletingEdgeIterator &FirstIn(const NodeIterator &n) |
313 const DeletingEdgeIterator FirstIn(const NodeIterator &n) |
294 { |
314 { |
295 EdgeIterator i; |
315 EdgeIterator i; |
296 i.G=n.G;i.edge=n.G->OldGraph<N,E>::FirstIn(n.n); |
316 i.G=n.G;i.edge=n.G->OldGraph<N,E>::FirstIn(n.n); |
297 return i; |
317 return i; |
298 } |
318 } |
299 const DeletingSymEdgeIterator &FirstSym(const NodeIterator &n) |
319 const DeletingSymEdgeIterator FirstSym(const NodeIterator &n) |
300 { |
320 { |
301 EdgeIterator i; |
321 EdgeIterator i; |
302 i.G=n.G;i.n=n.n; |
322 i.G=n.G;i.n=n.n; |
303 i.edge=n.G->OldGraph<N,E>::FirstEdge(n.n); |
323 i.edge=n.G->OldGraph<N,E>::FirstEdge(n.n); |
304 return i; |
324 return i; |
366 |
386 |
367 void Delete(DeletingNodeIterator n) {n.G->OldGraph<N,E>::Delete(n.n);} |
387 void Delete(DeletingNodeIterator n) {n.G->OldGraph<N,E>::Delete(n.n);} |
368 void Delete(DeletingEdgeIterator e) {e.G->OldGraph<N,E>::Delete(e.e);} |
388 void Delete(DeletingEdgeIterator e) {e.G->OldGraph<N,E>::Delete(e.e);} |
369 |
389 |
370 int NodeNum() { OldGraph<N,E>::NodeNum(); } |
390 int NodeNum() { OldGraph<N,E>::NodeNum(); } |
371 int Clean() { OldGraph<N,E>::Clean(); } |
391 void Clean() { OldGraph<N,E>::Clean(); } |
372 |
392 |
373 Graph() : _FST(this) {} |
393 Graph() : _FST(this) {} |
374 }; |
394 }; |
375 |
395 |
376 /* Ez itt a fiam kommentje: |
396 /* Ez itt a fiam kommentje: |