public static void main(String[] args) { strings = new String[N]; for (int i = 0; i < N; i++) { strings[i] = rndString(); } System.out.printf("begin\n"); boolean mine = true; if (mine) { long time4 = System.currentTimeMillis(); HashTable ht = new HashTable(); for (int i = 0; i < N; i++) { ht.insert(strings[i]); } System.out.printf("time: %d\n", System.currentTimeMillis() - time4); System.out.printf("col: %d\n", ht.colProbe); long time1 = System.currentTimeMillis(); for (int j = 0; j < 10; j++) { for (int i = 0; i < N; i++) { int idx = ht.search(strings[i]); if (idx == -1) { System.out.printf("%s: %d %d %s\n", strings[i], i, idx, idx != -1 ? "true" : "false"); } } } System.out.printf("time: %d\n", System.currentTimeMillis() - time1); System.out.printf("hops: %d %d %f\n", ht.nhops, ht.nsearch, (float) ht.nhops / ht.nsearch); } if (!mine) { long time3 = System.currentTimeMillis(); HashSet<String> hs = new HashSet<String>(); for (int i = 0; i < N; i++) { hs.add(strings[i]); } System.out.printf("time: %d\n", System.currentTimeMillis() - time3); long time2 = System.currentTimeMillis(); for (int j = 0; j < 10; j++) { for (int i = 0; i < N; i++) { if (!hs.contains(strings[i])) { System.out.printf("%s: %d\n", strings[i], i); } } } System.out.printf("time: %d\n", System.currentTimeMillis() - time2); } }
final Object method583(long key, int i) { try { int i_6_ = -59 % ((i - 2) / 47); anInt1085++; Class348_Sub42_Sub8 class348_sub42_sub8 = (Class348_Sub42_Sub8) hashTable.get(key); if (class348_sub42_sub8 == null) return null; Object object = class348_sub42_sub8.method3193(86); if (object == null) { class348_sub42_sub8.removeNode(); class348_sub42_sub8.removeSubnode(); anInt1086 += ((Class348_Sub42_Sub8) class348_sub42_sub8).anInt9545; return null; } if (class348_sub42_sub8.method3195(-4)) { Class348_Sub42_Sub8_Sub2 class348_sub42_sub8_sub2 = new Class348_Sub42_Sub8_Sub2( object, (((Class348_Sub42_Sub8) class348_sub42_sub8).anInt9545)); hashTable.putNode((((Node) class348_sub42_sub8).nodeKey), class348_sub42_sub8_sub2); queue.add(class348_sub42_sub8_sub2); ((SubNode) class348_sub42_sub8_sub2).subnodeKey = 0L; class348_sub42_sub8.removeNode(); class348_sub42_sub8.removeSubnode(); } else { queue.add(class348_sub42_sub8); ((SubNode) class348_sub42_sub8).subnodeKey = 0L; } return object; } catch (RuntimeException runtimeexception) { throw Class348_Sub17.method2929(runtimeexception, "jr.K(" + key + ',' + i + ')'); } }
public static void main(String args[]) { HashTable ht = new HashTable(30); String[] arrayWithData = {"1", "5", "9", "11", "25"}; ht.hashFunction1(arrayWithData, ht.theArray); ht.displayTheStack(); System.out.println("\n \n"); HashTable ht2 = new HashTable(30); String[] arrayWithData1 = { "1", "5", "9", "11", "25", "64", "78", "112", "164", "235", "456", "420", "535", "355", "888", "999", "666", "555", "333", "222", "753", "357", "159", "951", "459", "956", "235", "876", "451", "237" }; ht2.hashFunction2(arrayWithData1, ht2.theArray); ht2.displayTheStack(); System.out.println("\n \n"); HashTable ht3 = new HashTable(250); String[] arrayWithData2 = {"ku", "pq", "gh", "xy", "hj", "yu"}; ht3.hashFunction3(arrayWithData2, ht3.theArray); ht3.displayTheStack(); }
@Override public HashTable clone() { try { HashTable result = (HashTable) super.clone(); result.buckets = new Entry[buckets.length]; for (int i = 0; i < buckets.length; i++) { if (buckets[i] != null) result.buckets[i] = buckets[i].deepCopy2(); } return result; } catch (CloneNotSupportedException e) { throw new AssertionError(); } }
final Object method579(int i) { anInt1094++; Class348_Sub42_Sub8 class348_sub42_sub8 = (Class348_Sub42_Sub8) hashTable.method3482(0); while (class348_sub42_sub8 != null) { Object object = class348_sub42_sub8.method3193(114); if (object != null) return object; Class348_Sub42_Sub8 class348_sub42_sub8_4_ = class348_sub42_sub8; class348_sub42_sub8 = (Class348_Sub42_Sub8) hashTable.method3482(0); class348_sub42_sub8_4_.removeNode(); class348_sub42_sub8_4_.removeSubnode(); anInt1086 += ((Class348_Sub42_Sub8) class348_sub42_sub8_4_).anInt9545; } if (i > -67) aHa1098 = null; return null; }
final Object method588() { anInt1087++; Class348_Sub42_Sub8 class348_sub42_sub8 = (Class348_Sub42_Sub8) hashTable.method3484(0); while (class348_sub42_sub8 != null) { Object object = class348_sub42_sub8.method3193(119); if (object == null) { Class348_Sub42_Sub8 class348_sub42_sub8_9_ = class348_sub42_sub8; class348_sub42_sub8 = (Class348_Sub42_Sub8) hashTable.method3482(0); class348_sub42_sub8_9_.removeNode(); class348_sub42_sub8_9_.removeSubnode(); anInt1086 += (((Class348_Sub42_Sub8) class348_sub42_sub8_9_).anInt9545); } else return object; } return null; }
final void method578(int i, int i_2_) { if (i == 2) { anInt1093++; if (Class101_Sub1.aClass246_5675 != null) { for (Class348_Sub42_Sub8 class348_sub42_sub8 = ((Class348_Sub42_Sub8) queue.getFirst()); class348_sub42_sub8 != null; class348_sub42_sub8 = ((Class348_Sub42_Sub8) queue.next())) { if (!class348_sub42_sub8.method3195(-4)) { if ((++((SubNode) class348_sub42_sub8).subnodeKey ^ 0xffffffffffffffffL) < ((long) i_2_ ^ 0xffffffffffffffffL)) { Class348_Sub42_Sub8 class348_sub42_sub8_3_ = Class101_Sub1.aClass246_5675.method1888(3, class348_sub42_sub8); hashTable.putNode((((Node) class348_sub42_sub8).nodeKey), class348_sub42_sub8_3_); Class59_Sub2_Sub2.method573(class348_sub42_sub8_3_, class348_sub42_sub8, (byte) 63); class348_sub42_sub8.removeNode(); class348_sub42_sub8.removeSubnode(); } } else if (class348_sub42_sub8.method3193(100) == null) { class348_sub42_sub8.removeNode(); class348_sub42_sub8.removeSubnode(); anInt1086 += (((Class348_Sub42_Sub8) class348_sub42_sub8).anInt9545); } } } } }
public static void main(String[] args) { loop: while (true) { System.out.println("\nphonebook - input your command (h for help)"); String s = JOptionPane.showInputDialog("เลือก"); switch (s) { case "h": System.out.println(" i - insert a phone number "); System.out.println(" d - delete a phone number"); System.out.println(" m - modify a phone number"); System.out.println(" s - search"); System.out.println(" x - exit program"); break; } String k = JOptionPane.showInputDialog("เลือก"); switch (k) { case "i": telaphon xt = new telaphon(); xt.add(); xt.show(); break; case "d": System.out.println(" delete a phone number "); telaphon de = new telaphon(); de.delete(); break; case "m": System.out.println(" modify a phone number "); break; case "s": System.out.println(" search "); for (int i = 0; i < 0; i++) { String St = JOptionPane.showInputDialog("ค้นหา"); HashTable ht = new HashTable(i); System.out.println(ht.toString()); } break; case "x": System.out.println("exit program"); break loop; } } }
private final void method586(long key) { try { anInt1090++; Class348_Sub42_Sub8 class348_sub42_sub8 = (Class348_Sub42_Sub8) hashTable.get(key); method585(class348_sub42_sub8, -57); } catch (RuntimeException runtimeexception) { throw Class348_Sub17.method2929(runtimeexception, "jr.J(" + key + ')'); } }
private static void finishPacket( HashTable ht, Packet packet, BufferedWriter output, BufferedWriter failOutput) throws IOException { if (packet.isIgnore()) { failOutput.write(packet.toString()); } else { String detectedApp = ht.getApp(packet); // if (!detectedApp.startsWith("network.warden") && !detectedApp.equals("unknown")) // { if (detectedApp.startsWith("android.youtube")) { packet.setApp(detectedApp); output.write(packet.toString()); } } }
public static void main(String[] args) { Link element; int size, nrEl; Scanner sc = new Scanner(System.in); System.out.print("Introduceti dimensiunea tabelei: "); size = sc.nextInt(); System.out.print("Introduceti numarul de elemente: "); nrEl = sc.nextInt(); HashTable htb = new HashTable(size); // inserare for (int i = 0; i < nrEl; i++) { // generare random elemente intre 1 si 100 Random rand = new Random(); int key = rand.nextInt((100 - 1) + 1) + 1; element = new Link(key); htb.insert(element); } htb.displayTable(); // inserare element System.out.print("Insereaza un element: "); int elIns = sc.nextInt(); element = new Link(elIns); htb.insert(element); htb.displayTable(); // stergere element System.out.print("Sterge un element: "); int elDeSters = sc.nextInt(); htb.delete(elDeSters); htb.displayTable(); System.out.print("Cauta un element: "); int elCautat = sc.nextInt(); element = htb.find(elCautat); if (element != null) System.out.println("A fost gasit " + elCautat); else System.out.println("Nu a fost gasit " + elCautat); sc.close(); }
final void put(int i, Object object, long key, int i_5_) { try { anInt1092++; if (i_5_ > anInt1084) throw new IllegalStateException("s>cs"); method586(key); anInt1086 -= i_5_; while ((anInt1086 ^ 0xffffffff) > -1) { Class348_Sub42_Sub8 class348_sub42_sub8 = ((Class348_Sub42_Sub8) queue.removeFirst()); method585(class348_sub42_sub8, i ^ ~0x7cfa); } Class348_Sub42_Sub8_Sub2 class348_sub42_sub8_sub2 = new Class348_Sub42_Sub8_Sub2(object, i_5_); hashTable.putNode(key, class348_sub42_sub8_sub2); if (i != 31902) anInt1086 = -106; queue.add(class348_sub42_sub8_sub2); ((SubNode) class348_sub42_sub8_sub2).subnodeKey = 0L; } catch (RuntimeException runtimeexception) { throw Class348_Sub17.method2929( runtimeexception, ("jr.E(" + i + ',' + (object != null ? "{...}" : "null") + ',' + key + ',' + i_5_ + ')')); } }
final void removeAll(int i) { anInt1091++; queue.removeAll(); hashTable.removeAll(i); anInt1086 = anInt1084; }
@Override /** * (non-Javadoc) * * @see commande.Commande#execute(java.lang.String[], boolean) */ public void execute(String[] parametres, boolean addToHistory) { // TODO Auto-generated method stub /* * @param option * Cree les differents choix possible de l'utilisateur : * Oui, Non, Annuler */ int option = JOptionPane.showConfirmDialog( null, "Voulez vous enregistrer votre dessin", "Tortue", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); /* * Verifie qu'elle choix a ete fait */ if (option == JOptionPane.YES_OPTION) { /* * le resultat affecte a oui est 1 */ i = 1; /* * Si le choix est oui, il fait appel a save puis a clear et met * un fond de couleur blanc */ try { HashTable.hgj("SAVE", false); Fenetre.jPanelDessin.setBackground(Color.white); HashTable.hgj("CLEAR", false); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } if (option == JOptionPane.NO_OPTION) { /* * Si non, 0 est affecte au resultat seul la commande clear est * appelee avec en plus un fond blanc remis */ i = 0; try { HashTable.hgj("CLEAR", false); Fenetre.jPanelDessin.setBackground(Color.white); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } if (option == JOptionPane.CANCEL_OPTION) { /* * Si le choix est annule le resultat est -1 * et rien ne se passe */ i = -1; } }
public void search(int xt) { HashTable ht = new HashTable(xt); System.out.println(ht.toString()); }