/* * Decompiled with CFR 0.152. */ package com.tridium.fox.sys; import com.tridium.fox.message.FoxMessage; import com.tridium.fox.session.MulticastServer; import com.tridium.fox.sys.BLearnStation; import java.util.HashMap; public class Learn { /* * WARNING - Removed try catching itself - possible behaviour change. */ public static BLearnStation[] learn(long l, MulticastServer.RollcallCallback rollcallCallback) throws Exception { MulticastServer multicastServer = null; try { multicastServer = new MulticastServer(null); multicastServer.start(); } catch (Exception exception) { System.err.println("ERROR: Could not create Fox MulticastServer: " + exception); throw exception; } try { BLearnStation[] bLearnStationArray = Learn.learn(multicastServer, l, rollcallCallback); Object var5_6 = null; multicastServer.kill(); return bLearnStationArray; } catch (Throwable throwable) { Object var5_7 = null; multicastServer.kill(); throw throwable; } } public static BLearnStation[] learn(MulticastServer multicastServer, long l, MulticastServer.RollcallCallback rollcallCallback) throws Exception { if (multicastServer == null) { return Learn.learn(l, rollcallCallback); } FoxMessage[] foxMessageArray = multicastServer.rollcall(new FoxMessage(), l, rollcallCallback); HashMap hashMap = new HashMap(); int n = 0; while (n < foxMessageArray.length) { try { BLearnStation[] bLearnStationArray = BLearnStation.make(foxMessageArray[n]); int n2 = 0; while (n2 < bLearnStationArray.length) { if (hashMap.get(bLearnStationArray[n2].getKey()) == null) { hashMap.put(bLearnStationArray[n2].getKey(), bLearnStationArray[n2]); } ++n2; } } catch (Exception exception) { exception.printStackTrace(); try { foxMessageArray[n].dump(); } catch (Exception exception2) {} } ++n; } return hashMap.values().toArray(new BLearnStation[hashMap.values().size()]); } public static void main(String[] stringArray) throws Exception { long l = 5000L; System.out.println("Searching (" + l + "ms)..."); BLearnStation[] bLearnStationArray = Learn.learn(l, null); System.out.println("Found " + bLearnStationArray.length + " Stations"); int n = 0; while (n < bLearnStationArray.length) { System.out.println((Object)bLearnStationArray[n]); ++n; } System.exit(0); } }