id
stringlengths
36
36
text
stringlengths
1
1.25M
2953a33b-c9cd-4016-9de5-3845430521c2
@Override public int hashCode() { return getColumnName().hashCode(); }
18b759d2-cb22-4ad1-834b-0c033beee92c
@Override public boolean equals(final Object object) { if (!(object instanceof Plotter)) { return false; } final Plotter plotter = (Plotter) object; return plotter.name.equals(name) && plotter.getValue() == getValue(); }
b9cab2b7-7458-46c5-921f-28c91f72fbcc
public Listeners(Censornizer main) { this.main = main; }
1a38e5fe-5d52-4e15-8861-f7552ae8bd7e
@EventHandler public void onPlayerCommand(PlayerCommandPreprocessEvent event) { if (main.getConfig().getBoolean("Config.CheckCommands", true)) { Player p = event.getPlayer(); String space = null; if (!p.hasPermission("censornizer.bypass")) { String msg = event.getMessage().toLowerCase(); if (main.getConfig().getBoolean("Config.checkWithoutSpaces", true)) { space = msg.replaceAll(" ", ""); } else { space = msg; } if (main.getConfig().getBoolean("Config.UseBanlist", true)) { for (int i = 0; i < main.bancommands.size(); i++) { if (space.contains(main.bancommands.get(i))) { p.kickPlayer(main.getConfig().getString("Messages.banmsg").replaceAll("&((?i)[0-9a-fk-or])", "§$1")); p.setBanned(true); return; } } } for (int i = 0; i < main.white.size(); i++) { if (space.contains(main.white.get(i))) { return; } } for (int i = 0; i < main.blacklist.size(); i++) { if (main.getConfig().getString("Config.Punishment").equalsIgnoreCase("replace")) { String replace = main.getConfig().getString("Config.replace.word"); if (space.contains(main.blacklist.get(i))) { msg = msg.replace(main.blacklist.get(i), replace); event.setMessage(msg); } } if (main.getConfig().getString("Config.Punishment").equalsIgnoreCase("kick")) { if (space.contains(main.blacklist.get(i))) { event.setCancelled(true); p.kickPlayer(main.getConfig().getString("Messages.kickmsg").replaceAll("&((?i)[0-9a-fk-or])", "§$1")); } } if (main.getConfig().getString("Config.Punishment").equalsIgnoreCase("mute")) { if (space.contains(main.blacklist.get(i))) { if (!main.map.containsKey(p.getName())) { main.map.put(p.getName(), System.currentTimeMillis()); } } } } } } }
c3baf369-d359-4f08-a782-09bf343ec36f
@EventHandler(priority = EventPriority.HIGHEST) public void onPlayerChat(AsyncPlayerChatEvent event) { Player p = event.getPlayer(); if (!p.hasPermission("censornizer.bypass")) { String msg = event.getMessage().toLowerCase(); if (main.getConfig().getBoolean("Config.checkWithoutSpaces", true)) { msg = msg.replaceAll(" ", ""); } if (main.getConfig().getBoolean("Config.UseBanlist", true)) { for (int i = 0; i < main.bancommands.size(); i++) { if (msg.contains(main.bancommands.get(i))) { p.kickPlayer(main.getConfig().getString("Messages.banmsg").replaceAll("&((?i)[0-9a-fk-or])", "§$1")); p.setBanned(true); return; } } } for (int i = 0; i < main.white.size(); i++) { if (msg.contains(main.white.get(i))) { return; } } for (int i = 0; i < main.blacklist.size(); i++) { if (main.getConfig().getString("Config.Punishment").equalsIgnoreCase("replace")) { String replace = main.getConfig().getString("Config.replace.word"); msg = msg.replace(main.blacklist.get(i), replace); event.setMessage(msg); } else if (main.getConfig().getString("Config.Punishment").equalsIgnoreCase("kick")) { if (msg.contains(main.blacklist.get(i))) { p.kickPlayer(main.getConfig().getString("Messages.kickmsg").replaceAll("&((?i)[0-9a-fk-or])", "§$1")); event.setCancelled(true); } } else if (main.getConfig().getString("Config.Punishment").equalsIgnoreCase("mute")) { if (msg.contains(main.blacklist.get(i))) { if (!main.map.containsKey(p.getName())) { main.map.put(p.getName(), System.currentTimeMillis()); } } } else { return; } } Player player = event.getPlayer(); if (main.map.containsKey(player.getName())) { long diff = (System.currentTimeMillis() - main.map.get(p.getName())) / 1000; if (diff < main.mutetime) { String mutemsg = main.getConfig().getString("Messages.mutemsg"); p.sendMessage(main.format(mutemsg).replaceAll("%duration%", String.valueOf(main.mutetime))); event.setCancelled(true); } else { main.map.remove(player.getName()); } } if (main.getConfig().getBoolean("Config.BlockIPs", true)) { String[] domains = getDomains(); for (int i = 0; i < domains.length; i++) { String domain = domains[i]; if (event.getMessage().contains(domain)) { player.sendMessage(main.getConfig().getString("Messages.IPfound").replaceAll("&((?i)[0-9a-fk-or])", "§$1")); event.setCancelled(true); } } String[] message = event.getMessage().split("\\."); if (message.length >= 3) { player.sendMessage(main.getConfig().getString("Messages.IPfound").replaceAll("&((?i)[0-9a-fk-or])", "§$1")); event.setCancelled(true); } } } }
bda34aa6-73b0-4e2c-9c95-e0fe8c89fb21
public String[] getDomains() { String values = ".ac .au .biz .ci .com .cz .de .fr .ge .info .io .mobi .net .org .to .uk .us .eu"; return values.split(" "); }
d7f0f30e-ff2e-4e18-88d8-0df2a4522811
public TestCapsProtection(Censornizer main) { this.main = main; }
14349f6f-34c5-492d-b870-e3836879dac7
@EventHandler(priority = EventPriority.HIGHEST) public void onPlayerChat(AsyncPlayerChatEvent event) { if (main.getConfig().getBoolean("Config.BlockCaps", true)) { event.setMessage(event.getMessage().toLowerCase()); } }
e8fe19b6-3d55-4f60-a311-bed23c735dcf
public Updatechecker(Censornizer main) { this.main = main; }
882270f2-fa76-4bbc-9202-53d52c1476a6
private int updateCheck(int currentVersion) throws Exception { String pluginUrlString = "http://dev.bukkit.org/server-mods/CensorNizer/files.rss"; try { URL url = new URL(pluginUrlString); Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(url.openConnection().getInputStream()); doc.getDocumentElement().normalize(); NodeList nodes = doc.getElementsByTagName("item"); Node firstNode = nodes.item(0); if (firstNode.getNodeType() == 1) { Element firstElement = (Element) firstNode; NodeList firstElementTagName = firstElement.getElementsByTagName("title"); Element firstNameElement = (Element) firstElementTagName.item(0); NodeList firstNodes = firstNameElement.getChildNodes(); this.newerversion = firstNodes.item(0).getNodeValue().replace("CensorNizer ", ""); return Integer.valueOf(firstNodes.item(0).getNodeValue().replace("CensorNizer ", "").replaceAll("\\.", "")); } } catch (UnknownHostException e) { System.out.println("[CensorNizer] Could not check for updates! Maybe you have an internet protection?"); } catch (Exception e) { System.out.println("[CensorNizer] Error on UpdateCheck \n" + e.getMessage() + "\n"); System.out.println(e); } return currentVersion; }
5400983f-6e95-4001-99ba-5ee16b89caea
public void checkUpdate() { if (main.getConfig().getBoolean("Config.CheckForUpdates", true)) { currentversion = Integer.valueOf(main.getDescription().getVersion().replaceAll("\\.", "")); updateChecker = main.getServer().getScheduler().runTaskTimerAsynchronously(main, new Runnable() { @Override public void run() { try { newversion = updateCheck(currentversion); if (newversion > currentversion) { System.out.println("[CensorNizer] version " + newerversion + " has been released! You can download it at http://dev.bukkit.org/server-mods/CensorNizer/"); } else if (currentversion > newversion) { System.out.println("[CensorNizer] your version (" + main.getDescription().getVersion() + ") is higher than the newest version on bukkitDev (" + newerversion + "), do you use a development build?"); } } catch (FileNotFoundException e) { System.err.println("[CensorNizer] Could not check for updates! Maybe you have an internet protection?"); } catch (UnknownHostException e) { System.err.println("[CensorNizer] Could not check for updates! Maybe you have an internet protection?"); } catch (Exception e) { System.out.println("[CensorNizer] Error on UpdateCheck \n" + e.getMessage() + "\n"); System.out.println(e); } } }, 0, 36000); } }
28accd5c-3df5-46c5-872d-db184a9c283e
@Override public void run() { try { newversion = updateCheck(currentversion); if (newversion > currentversion) { System.out.println("[CensorNizer] version " + newerversion + " has been released! You can download it at http://dev.bukkit.org/server-mods/CensorNizer/"); } else if (currentversion > newversion) { System.out.println("[CensorNizer] your version (" + main.getDescription().getVersion() + ") is higher than the newest version on bukkitDev (" + newerversion + "), do you use a development build?"); } } catch (FileNotFoundException e) { System.err.println("[CensorNizer] Could not check for updates! Maybe you have an internet protection?"); } catch (UnknownHostException e) { System.err.println("[CensorNizer] Could not check for updates! Maybe you have an internet protection?"); } catch (Exception e) { System.out.println("[CensorNizer] Error on UpdateCheck \n" + e.getMessage() + "\n"); System.out.println(e); } }
023e2908-5e87-474d-88d3-23c416a033b1
public Files(Censornizer main) { this.main = main; }
3d104456-126c-4c1f-8213-2ba895e66673
public void loadFiles() { if (new File("plugins/CensorNizer/config.yml").exists()) { main.config = main.getConfig(); main.config.options().copyDefaults(true); } else { main.saveDefaultConfig(); main.config = main.getConfig(); main.config.options().copyDefaults(true); } if (!list.exists()) { try { list.createNewFile(); } catch (IOException ex) { Logger.getLogger(Censornizer.class.getName()).log(Level.SEVERE, null, ex); } } if (!banlist.exists()) { try { banlist.createNewFile(); } catch (IOException ex) { Logger.getLogger(Censornizer.class.getName()).log(Level.SEVERE, null, ex); } } if (!whitelist.exists()) { try { whitelist.createNewFile(); } catch (IOException ex) { Logger.getLogger(Censornizer.class.getName()).log(Level.SEVERE, null, ex); } } try { Scanner s = new Scanner(list); while (s.hasNextLine()) { main.blacklist.add(s.nextLine()); } s.close(); } catch (Exception ex) { System.err.println("[CensorNizer] " + ex + ex.getMessage()); System.out.println(""); ex.printStackTrace(); } finally { System.out.println("[" + main.getDescription().getName() + " by JeterLP" + " Version: " + main.getDescription().getVersion() + "] loaded " + main.blacklist.size() + " words to be censored!"); } try { Scanner s = new Scanner(whitelist); while (s.hasNextLine()) { main.white.add(s.nextLine()); } s.close(); } catch (Exception ex) { System.err.println("[CensorNizer] " + ex + ex.getMessage()); System.out.println(""); ex.printStackTrace(); } finally { System.out.println("[" + main.getDescription().getName() + " by JeterLP" + " Version: " + main.getDescription().getVersion() + "] loaded " + main.white.size() + " words to be not censored!"); } if (main.getConfig().getBoolean("Config.UseBanlist", true)) { try { Scanner s = new Scanner(banlist); while (s.hasNextLine()) { main.bancommands.add(s.nextLine()); } s.close(); } catch (Exception ex) { System.err.println("[CensorNizer] " + ex + ex.getMessage()); System.out.println(""); ex.printStackTrace(); } finally { System.out.println("[" + main.getDescription().getName() + " by JeterLP" + " Version: " + main.getDescription().getVersion() + "] loaded " + main.bancommands.size() + " words to ban players!"); } } else { System.out.println("[" + main.getDescription().getName() + " by JeterLP" + " Version: " + main.getDescription().getVersion() + "] banlist is disabled!"); } }
2308275f-1489-4852-b867-c99cba59b9d9
public void reload() throws FileNotFoundException { main.reloadConfig(); main.bancommands.clear(); main.blacklist.clear(); main.white.clear(); if (main.getConfig().getBoolean("Config.UseBanlist", true)) { Scanner s = new Scanner(banlist); while (s.hasNextLine()) { main.bancommands.add(s.nextLine()); } s.close(); } Scanner s = new Scanner(list); Scanner s2 = new Scanner(whitelist); while (s.hasNextLine()) { main.blacklist.add(s.nextLine()); } while (s2.hasNextLine()) { main.white.add(s2.nextLine()); } s.close(); s2.close(); }
befa8402-c139-4145-9e4e-98966f3890b1
public Metricschecker(Censornizer main) { this.main = main; }
eb002a09-227d-4fdf-98fd-3a4160bf161f
public void checkMetrics() { try { Metrics metrics = new Metrics(main); metrics.start(); } catch (Exception e) { System.out.println("CensorNizer: Could not send information to: http://mcstats.org!"); } }
6364afb3-a3d4-41e5-8469-64720d12abdc
public CensorNizer(Censornizer t) { this.main = t; }
4bb1b0b3-a1b0-4959-9668-db80c43dfa29
@Override public boolean onCommand(CommandSender sender, Command cmd, String commandlabel, String[] args) { if (cmd.getName().equalsIgnoreCase("censornizer")) { if (args.length >= 2) { sender.sendMessage("§cUsage: §a/censornizer <unmute Player|reload>"); return true; } if (args[0].equalsIgnoreCase("unmute")) { Player target = main.getServer().getPlayer(args[1]); try { if (sender.hasPermission("censornizer.unmute")) { if (!main.map.containsKey(target.getName())) { sender.sendMessage("§4The Player " + ChatColor.GREEN + target.getDisplayName() + ChatColor.DARK_RED + " is not muted!"); return true; } else { sender.sendMessage("§aThe Player " + ChatColor.GOLD + target.getDisplayName() + ChatColor.GREEN + " is now unmuted!"); main.map.remove(target.getName()); return true; } } else { sender.sendMessage("§4You dont have permission!"); return true; } } catch (NullPointerException e) { sender.sendMessage("§4The Player " + args[0] + "is not online!"); return true; } } else if (args[0].equalsIgnoreCase("reload")) { if (sender.hasPermission("censornizer.reload")) { try { main.files.reload(); sender.sendMessage("§aSuccessfully reloaded!"); return true; } catch (FileNotFoundException ex) { sender.sendMessage("§cError on reload."); ex.printStackTrace(); return true; } } else { sender.sendMessage("§4You dont have permission!"); return true; } } else { sender.sendMessage("§cUsage: §a/censornizer <unmute player|reload>"); return true; } } return false; }
cfe8ae52-5548-4026-9ff6-6fb2629fd9fb
public Metrics(final Plugin plugin) throws IOException { if (plugin == null) { throw new IllegalArgumentException("Plugin cannot be null"); } this.plugin = plugin; configurationFile = getConfigFile(); configuration = YamlConfiguration.loadConfiguration(configurationFile); configuration.addDefault("opt-out", false); configuration.addDefault("guid", UUID.randomUUID().toString()); configuration.addDefault("debug", false); if (configuration.get("guid", null) == null) { configuration.options().header("http://mcstats.org").copyDefaults(true); configuration.save(configurationFile); } guid = configuration.getString("guid"); debug = configuration.getBoolean("debug", false); }
c1bd7faf-e09e-48a0-be32-ca68429c46ce
public Graph createGraph(final String name) { if (name == null) { throw new IllegalArgumentException("Graph name cannot be null"); } final Graph graph = new Graph(name); graphs.add(graph); return graph; }
7a335bbe-4c84-4ec1-80e1-561f7d241a3b
public void addGraph(final Graph graph) { if (graph == null) { throw new IllegalArgumentException("Graph cannot be null"); } graphs.add(graph); }
3d998236-5356-4832-8a69-55ab2958134a
public void addCustomData(final Plotter plotter) { if (plotter == null) { throw new IllegalArgumentException("Plotter cannot be null"); } defaultGraph.addPlotter(plotter); graphs.add(defaultGraph); }
e95117fa-97fc-421d-901a-9f585479e874
public boolean start() { synchronized (optOutLock) { if (isOptOut()) { return false; } if (task != null) { return true; } task = plugin.getServer().getScheduler().runTaskTimerAsynchronously(plugin, new Runnable() { private boolean firstPost = true; public void run() { try { synchronized (optOutLock) { if (isOptOut() && task != null) { task.cancel(); task = null; for (Graph graph : graphs) { graph.onOptOut(); } } } postPlugin(!firstPost); firstPost = false; } catch (IOException e) { if (debug) { Bukkit.getLogger().log(Level.INFO, "[Metrics] " + e.getMessage()); } } } }, 0, PING_INTERVAL * 1200); return true; } }
75ee0494-9894-40f1-a2ab-5e3d0160a4c3
public void run() { try { synchronized (optOutLock) { if (isOptOut() && task != null) { task.cancel(); task = null; for (Graph graph : graphs) { graph.onOptOut(); } } } postPlugin(!firstPost); firstPost = false; } catch (IOException e) { if (debug) { Bukkit.getLogger().log(Level.INFO, "[Metrics] " + e.getMessage()); } } }
3fce1b83-f6cb-44ec-860d-f9438ad696de
public boolean isOptOut() { synchronized (optOutLock) { try { configuration.load(getConfigFile()); } catch (IOException ex) { if (debug) { Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage()); } return true; } catch (InvalidConfigurationException ex) { if (debug) { Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage()); } return true; } return configuration.getBoolean("opt-out", false); } }
c0dc9688-f41a-42c7-b4ba-5750163af66f
public void enable() throws IOException { synchronized (optOutLock) { if (isOptOut()) { configuration.set("opt-out", false); configuration.save(configurationFile); } if (task == null) { start(); } } }
bbfe1601-9a5d-487c-ba8d-aa3f7209f210
public void disable() throws IOException { synchronized (optOutLock) { if (!isOptOut()) { configuration.set("opt-out", true); configuration.save(configurationFile); } if (task != null) { task.cancel(); task = null; } } }
472d9009-2760-4015-beb6-9de7bd67398e
public File getConfigFile() { File pluginsFolder = plugin.getDataFolder().getParentFile(); return new File(new File(pluginsFolder, "PluginMetrics"), "config.yml"); }
9643fe66-be58-42ce-a51e-c9af1e2195e4
private void postPlugin(final boolean isPing) throws IOException { PluginDescriptionFile description = plugin.getDescription(); String pluginName = description.getName(); boolean onlineMode = Bukkit.getServer().getOnlineMode(); String pluginVersion = description.getVersion(); String serverVersion = Bukkit.getVersion(); int playersOnline = Bukkit.getServer().getOnlinePlayers().length; final StringBuilder data = new StringBuilder(); data.append(encode("guid")).append('=').append(encode(guid)); encodeDataPair(data, "version", pluginVersion); encodeDataPair(data, "server", serverVersion); encodeDataPair(data, "players", Integer.toString(playersOnline)); encodeDataPair(data, "revision", String.valueOf(REVISION)); String osname = System.getProperty("os.name"); String osarch = System.getProperty("os.arch"); String osversion = System.getProperty("os.version"); String java_version = System.getProperty("java.version"); int coreCount = Runtime.getRuntime().availableProcessors(); if (osarch.equals("amd64")) { osarch = "x86_64"; } encodeDataPair(data, "osname", osname); encodeDataPair(data, "osarch", osarch); encodeDataPair(data, "osversion", osversion); encodeDataPair(data, "cores", Integer.toString(coreCount)); encodeDataPair(data, "online-mode", Boolean.toString(onlineMode)); encodeDataPair(data, "java_version", java_version); if (isPing) { encodeDataPair(data, "ping", "true"); } synchronized (graphs) { final Iterator<Graph> iter = graphs.iterator(); while (iter.hasNext()) { final Graph graph = iter.next(); for (Plotter plotter : graph.getPlotters()) { final String key = String.format("C%s%s%s%s", CUSTOM_DATA_SEPARATOR, graph.getName(), CUSTOM_DATA_SEPARATOR, plotter.getColumnName()); final String value = Integer.toString(plotter.getValue()); encodeDataPair(data, key, value); } } } URL url = new URL(BASE_URL + String.format(REPORT_URL, encode(pluginName))); URLConnection connection; if (isMineshafterPresent()) { connection = url.openConnection(Proxy.NO_PROXY); } else { connection = url.openConnection(); } connection.setDoOutput(true); final OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream()); writer.write(data.toString()); writer.flush(); final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); final String response = reader.readLine(); writer.close(); reader.close(); if (response == null || response.startsWith("ERR")) { throw new IOException(response); } else { if (response.contains("OK This is your first update this hour")) { synchronized (graphs) { final Iterator<Graph> iter = graphs.iterator(); while (iter.hasNext()) { final Graph graph = iter.next(); for (Plotter plotter : graph.getPlotters()) { plotter.reset(); } } } } } }
d05e8afe-8018-4158-87c3-c6b697ab8e35
private boolean isMineshafterPresent() { try { Class.forName("mineshafter.MineServer"); return true; } catch (Exception e) { return false; } }
e2b3a7e6-3c55-4729-a268-1013ae1d6c51
private static void encodeDataPair(final StringBuilder buffer, final String key, final String value) throws UnsupportedEncodingException { buffer.append('&').append(encode(key)).append('=').append(encode(value)); }
4fc66719-224f-4894-b7f5-e1fcb5a335cb
private static String encode(final String text) throws UnsupportedEncodingException { return URLEncoder.encode(text, "UTF-8"); }
04710f82-2870-4ec1-989e-e9bacd97e0ec
private Graph(final String name) { this.name = name; }
af6cf076-e9de-434b-898a-039df1ddeb3f
public String getName() { return name; }
84fbf45a-9847-42cf-9c8b-5488f1fdb23a
public void addPlotter(final Plotter plotter) { plotters.add(plotter); }
7ca141f4-4836-4970-90d2-ae253f3eb3fa
public void removePlotter(final Plotter plotter) { plotters.remove(plotter); }
ca098979-7070-4f84-9cdb-84dead1a2e1b
public Set<Plotter> getPlotters() { return Collections.unmodifiableSet(plotters); }
d3742689-46af-4791-9076-6b625ce9fa65
@Override public int hashCode() { return name.hashCode(); }
2b482b47-61d8-49b7-baaa-b40cd193730b
@Override public boolean equals(final Object object) { if (!(object instanceof Graph)) { return false; } final Graph graph = (Graph) object; return graph.name.equals(name); }
6f91377c-79b9-47e7-a283-07ae8a5fdff8
protected void onOptOut() { }
148bc04b-abbe-4b7b-8c5c-bc4979cfdec5
public Plotter() { this("Default"); }
baed928b-b673-4f34-8d15-f6f0af0c3062
public Plotter(final String name) { this.name = name; }
33eeab65-ebae-46e7-b4bc-5e531ba65f1c
public abstract int getValue();
fbd514f0-b3a9-4279-b50e-512e5745ebe4
public String getColumnName() { return name; }
14bc4f24-35d1-4bf7-98a0-34c071e3346b
public void reset() { }
c19bb778-4e88-4466-be44-3676e5c3162f
@Override public int hashCode() { return getColumnName().hashCode(); }
525c68e4-0591-475c-958f-9968871eb14a
@Override public boolean equals(final Object object) { if (!(object instanceof Plotter)) { return false; } final Plotter plotter = (Plotter) object; return plotter.name.equals(name) && plotter.getValue() == getValue(); }
26be9731-448c-4245-b1ab-95df7ab96aa5
public void execute();
afcdb166-9af7-401e-b61c-f9d117a38083
public void parse(Element xml);
18fffc7b-7115-484f-86ec-77b5353e2ce7
public ActivePhenomena(String instanceId) { super(instanceId); }
a75caa98-2cb3-46ca-8df5-4252943f1c10
private PhenomenaUpdater(String id) { super(id); }
a966354b-c79f-4404-bbfa-eb293bb3362a
public void run() { while(running) { // Updates the phenomena try { updatePhenomena(); } catch (InterruptedException e) { break; } // Notifies the observers (if any) ActivePhenomena.this.setChanged(); ActivePhenomena.this.notifyObservers(); // Sleeps for a while try { sleep(sleepTime*1000); } catch (InterruptedException e) { break; } } }
30ed7cbd-b290-49e8-aeff-eda19288b90f
public synchronized void start() { if (updater == null || !updater.isAlive()) { this.updater = new PhenomenaUpdater(instanceName); running = true; updater.start(); } }
e4dfb4a3-87b4-47bc-8e5d-41bfda5d2cb7
public synchronized void stop() { if (updater!=null && updater.isAlive()) { running = false; updater.interrupt(); updater = null; } }
516ab1f9-a174-4df8-aa5d-5b991fa71e8b
public synchronized int getSleepTime() { return sleepTime; }
fcda263e-e224-4d35-9320-e50a267b2077
public synchronized void setSleepTime(int sleepTime) { this.sleepTime = sleepTime; }
3d835161-81c7-4284-99fc-47cd6336c82a
@Override abstract public void configure(String configXML);
300443b4-bd5e-4820-9368-f9b0fc865bad
@Override abstract public void restore();
d0834d87-89ad-4e84-af68-e2e61678c3a3
abstract protected void updatePhenomena() throws InterruptedException;
de64345c-4fd2-4b7a-bafd-89c9a902ca68
public PhenomenaCommand(Phenomena target, PhenomenaWindow origin) { this.target = target; this.origin = origin; }
3ea77558-8fd5-4061-a75f-9054c70c3099
public PassivePhenomena(String instanceId) { super(instanceId); }
0898b0c6-d0f9-4b2d-b5b4-fec1c46fb614
public synchronized void start() { running = true; }
ff14d17e-ff19-4702-888d-dbe7ed6a50d6
public synchronized void stop() { running = false; }
b78b9276-46ca-4f32-94c2-f0b48ededfea
@Override abstract public void configure(String configXML);
a0f573df-f58f-41df-8edf-4f20efb86123
@Override abstract public void restore();
91a8a427-de9b-4fd0-ad41-1dccca0fb437
private Phenomena() { }
0910a448-a0ee-431f-8dd9-6fb1d2704a1d
public Phenomena(String instanceId) { this(); this.instanceName = instanceId; this.phenWindows = new ArrayList<PhenomenaWindow>(); }
3652a921-197e-43b3-9bb6-c668d64d323b
public String getInstanceName() { return instanceName; }
800d6e40-0dfa-415f-9db6-4f61a9a00b24
public List<PhenomenaWindow> getWindows() { return phenWindows; }
abaf6aa4-efd4-413f-8d66-f89f8767917e
public synchronized boolean isRunning() { return running; }
b1bfe98b-4f89-4b94-b607-0c6a1124ecd7
@Override public void notifyObservers() { this.setChanged(); super.notifyObservers(); }
3194d5f3-c72a-4191-a655-6fb5fb334a45
public abstract void start();
d5a973ae-bc8f-459b-bcc1-bb52420f1936
public abstract void stop();
80107aef-3f0e-4a3e-ab84-b0616aee86b3
abstract public void configureWindows(String configXML);
011ca8ba-b139-463d-83db-ffff23cde858
abstract public void configure(String configXML);
28591fb2-2a4d-4734-afef-128385b779d5
abstract public void restore();
e45ea6f2-e216-4853-81a6-7e9c80700c52
abstract public void cleanup();
2d9ecef0-9861-48bd-9e3a-39cb73227eda
public PhenomenaWindow(String windowName) { // TODO before this check this is unique!!! this.windowId = windowName; }
5ea5a20d-a498-49dd-b9f7-c2287ce1d4d1
@Override public void update(Observable o, Object arg){ update((Phenomena)o); }
52901531-f43f-4028-8d0f-8c11b600b3c5
abstract public void update(Phenomena p);
13621f64-db10-4a35-b0d6-9082e31e14b3
abstract public String toXML();
b6347aa0-92a5-4f7c-abd4-abd626814b7e
public String getWindowId() { return windowId; }
bac238ed-a85e-43cb-82f1-0f5074851695
public String getAddress() { return address; }
c193578f-83ec-4cfd-b5bc-0412d9574e5e
public Person(String name){ super(name); }
01111678-73c7-4cca-ad23-89d8adfd162e
public void setAddress(String address) { this.address = address; }
b7903cd5-40d6-40e6-be1b-b464c9651f86
public String getPhone() { return phone; }
008c5582-6e83-44e9-a0e3-f4b2b80538e8
public void setPhone(String phone) { this.phone = phone; }
9935b06f-4375-4bc9-aa8a-3c7fbdeeb9f3
public String getMail() { return mail; }
d42ab93e-67d3-4a98-8176-76313352ebd5
public void setMail(String mail) { this.mail = mail; }
ee4f4d07-3ac0-4eaf-8002-7eb94028a24d
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Node node = (Node) o; if (!children.equals(node.children)) return false; if (!name.equals(node.name)) return false; if (!weight.equals(node.weight)) return false; return true; }
3fd3a536-7099-49de-9f10-836e294587e1
@Override public int hashCode() { int result = name.hashCode(); result = 31 * result + children.hashCode(); result = 31 * result + weight.hashCode(); return result; }
ccb8658c-a7b9-42aa-a9e4-5d45996d03da
public Node(String name){ this.weight = 100; this.name = name; children = new ArrayList<Node>(); }
688864f6-5d31-4cf2-855a-328e1172e78f
public String getName() { return name; }
6f0d2f7f-50eb-41ae-b3bc-1bd1e3a64229
@Override public String toString() { return "Node{" + "name='" + name + '\'' + ", children=" + children + ", weight=" + weight + '}'; }
755ca42e-7cc3-433a-9ad0-a4fd70e9f30d
public String toJson() { List<String> json = Lists.newArrayList(); for (Node node : children) { json.add(String.format("{\"name\":\"%s\"}", node.getName())); } return "[" + Joiner.on(",").join(json) + "]"; }
4fa7296d-057b-4c77-b1e3-acb08e266980
public void setName(String name) { this.name = name; }
47da3535-0ab0-4c0e-81d0-44bf316ea87c
public Node getChild(int index) { return children.get(index); }
f42eec00-925f-412b-854c-5ad494ec358c
public void addChild(Node project) { this.children.add(project); }
e1aca4b0-4da0-43f6-bdde-6c751a6bb299
public Integer getWeight() { return weight; }