gitweb on Svarog

projekti pod git sistemom za održavanje verzija -- projects under the git version control system
TestHash, poruke na srpskom, eksplicitno prijavljivanje problema sa fajlom
authorDoni Pracner <quinnuendo@gmail.com>
Tue, 17 Nov 2015 17:09:15 +0000 (18:09 +0100)
committerDoni Pracner <quinnuendo@gmail.com>
Tue, 17 Nov 2015 17:09:15 +0000 (18:09 +0100)
Hash/TestHash.java

index 565614b81066a83302cf5267e26730d8aa691046..e1906f7ec54b7897fc4d40367e964463017034c3 100644 (file)
@@ -56,11 +56,15 @@ public class TestHash {
                OHashSet<InfoTip> hash = new OHashSet<>(size);
                if (Svetovid.testIn(fajl)) {
                        while (Svetovid.in(fajl).hasMore()) {
-                               hash.add(i.ucitaj(Svetovid.in(fajl)));
+                               InfoTip sledeci = i.ucitaj(Svetovid.in(fajl));
+                               hash.add(sledeci);
                        }
                        Svetovid.closeIn(fajl);
+
+                       hash.printStats();
+               } else {
+                       System.err.println("ne moze se otvoriti fajl!");
                }
-               hash.printStats();
        }
 
        /*
@@ -74,24 +78,28 @@ public class TestHash {
                                hash.add(i.ucitaj(Svetovid.in(fajl)));
                        }
                        Svetovid.closeIn(fajl);
-               }
-               System.out.println("-- dodatni testovi ubacivanja i izbacivanja --");
-               // hash.printStats();
-               InfoTip it = hash.someElement();
-               if (!hash.add(it)) {
-                       System.out.println("success: not added again");
-               } else {
-                       System.out.println("fail: added again!");
-               }
-               if (hash.remove(it)) {
-                       System.out.println("success: removed");
-               } else {
-                       System.out.println("fail: not removed!");
-               }
-               if (hash.add(it)) {
-                       System.out.println("success: added back in");
+
+                       System.out
+                                       .println("-- dodatni testovi ubacivanja i izbacivanja --");
+                       // hash.printStats();
+                       InfoTip it = hash.someElement();
+                       if (!hash.add(it)) {
+                               System.out.println("uspeh: nije ponovo dodat");
+                       } else {
+                               System.out.println("neuspeh: ponovo dodat!");
+                       }
+                       if (hash.remove(it)) {
+                               System.out.println("uspeh: uklonjen");
+                               if (hash.add(it)) {
+                                       System.out.println("uspeh: vracen");
+                               } else {
+                                       System.out.println("neuspeh: nije vracen");
+                               }
+                       } else {
+                               System.out.println("neuspeh: nije uklonjen!");
+                       }
                } else {
-                       System.out.println("fail: not added back in");
+                       System.err.println("ne moze se otvoriti fajl!");
                }
        }
 
Svarog.pmf.uns.ac.rs/gitweb maintanance Doni Pracner