package org.mxchange.jcore.database.result;
import java.util.Iterator;
+import java.util.SortedSet;
+import java.util.TreeSet;
import org.mxchange.jcore.BaseFrameworkSystem;
import org.mxchange.jcore.database.storage.Storeable;
* @author Roland Haeder
*/
public class DatabaseResult extends BaseFrameworkSystem implements Result<Storeable> {
+ /**
+ * Set of all found Storeable instances
+ */
+ private final SortedSet<Storeable> result;
+
/**
* Default constructor
*/
public DatabaseResult () {
+ // Init set here
+ this.result = new TreeSet<>();
}
/**
*/
@Override
public void add (final Storeable storeable) {
- throw new UnsupportedOperationException("Not supported yet: storeable=" + storeable); //To change body of generated methods, choose Tools | Templates.
+ // Add to result
+ this.result.add(storeable);
}
@Override
public boolean hasNext () {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ // Call iterator's method
+ return this.iterator().hasNext();
}
@Override
public Iterator<Storeable> iterator () {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ // Return iterator from result set
+ return this.result.iterator();
}
@Override
public Storeable next () {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ // Call iterator's method
+ return this.iterator().next();
}
@Override
public void remove () {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ // Call iterator's method
+ this.iterator().remove();
}
}