]> git.mxchange.org Git - jcore.git/commitdiff
DatabaseResult is now "basicly finished".
authorRoland Haeder <roland@mxchange.org>
Wed, 12 Aug 2015 13:00:55 +0000 (15:00 +0200)
committerRoland Haeder <roland@mxchange.org>
Wed, 12 Aug 2015 13:00:55 +0000 (15:00 +0200)
Signed-off-by:Roland Häder <roland@mxchange.org>

src/org/mxchange/jcore/database/result/DatabaseResult.java

index df8386d91e7d7bf181bd8f1a0b31a18730e46ec0..abddc78ff7e672d32e30008ead62475c97df6cea 100644 (file)
@@ -17,6 +17,8 @@
 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;
 
@@ -25,10 +27,17 @@ 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<>();
        }
 
        /**
@@ -38,26 +47,31 @@ public class DatabaseResult extends BaseFrameworkSystem implements Result<Storea
         */
        @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();
        }
 }