1 package org.apache.ojb.odmg.collections; 2 3 17 18 import java.util.Iterator ; 19 20 import org.apache.ojb.odmg.TransactionImpl; 21 22 27 class DSetIterator implements Iterator 28 { 29 private Iterator iter; 30 private DSetImpl dSet; 31 private DSetEntry currentEntry = null; 32 33 36 public DSetIterator(DSetImpl set) 37 { 38 this.dSet = set; 39 this.iter = set.getElements().iterator(); 40 } 41 42 45 public boolean hasNext() 46 { 47 return iter.hasNext(); 48 } 49 50 53 public Object next() 54 { 55 currentEntry = ((DSetEntry) iter.next()); 56 return currentEntry.getRealSubject(); 57 } 58 59 62 public void remove() 63 { 64 iter.remove(); 65 TransactionImpl tx = dSet.getTransaction(); 66 if (tx != null) 67 { 68 tx.markDelete(currentEntry); 69 } 70 currentEntry = null; 71 } 72 } 73 | Popular Tags |