gitweb on Svarog

projekti pod git sistemom za održavanje verzija -- projects under the git version control system
Hash, primeri se sada sami pokrecu.
[spa2-materijali.git] / Hash / Gadjanje.java
index 27684ec..b70b6d0 100644 (file)
@@ -9,22 +9,6 @@ public class Gadjanje extends InfoTip {
        private int[] rezultati;
        private static int MAX_DUZ = 20;
 
-       public Gadjanje(String linija) {
-               String[] delovi = linija.replaceAll("  ", " ").split(" ");
-               if (delovi.length > 0) {
-                       try {
-                               int br = Integer.parseInt(delovi[0]);
-                               rezultati = new int[br];
-                               for (int i = 0; i < br; i++) {
-                                       rezultati[i] = Integer.parseInt(delovi[i + 1]);
-                               }
-                       } catch (Exception ex) {
-                               throw new RuntimeException(ex);
-                       }
-               } else
-                       throw new RuntimeException("Pogresan broj argumenata u redu");
-       }
-
        public Gadjanje() {
                // prazan konstruktor potreban za test program
        }
@@ -93,4 +77,26 @@ public class Gadjanje extends InfoTip {
                return str;
        }
 
+       // pomocni metod za lakse testiranje
+       public static void main(String[] args) {
+               new TestHash(new Gadjanje(), "mete").run();
+       }
+       
+       // ovaj konstruktor nije neophodan, ostavljen je kao primer
+       public Gadjanje(String linija) {
+               String[] delovi = linija.replaceAll("  ", " ").split(" ");
+               if (delovi.length > 0) {
+                       try {
+                               int br = Integer.parseInt(delovi[0]);
+                               rezultati = new int[br];
+                               for (int i = 0; i < br; i++) {
+                                       rezultati[i] = Integer.parseInt(delovi[i + 1]);
+                               }
+                       } catch (Exception ex) {
+                               throw new RuntimeException(ex);
+                       }
+               } else
+                       throw new RuntimeException("Pogresan broj argumenata u redu");
+       }
+
 }
Svarog.pmf.uns.ac.rs/gitweb maintanance Doni Pracner