id
stringlengths
36
36
text
stringlengths
1
1.25M
51f47f38-5f34-4df9-ae95-b60bc2025d3c
public void testPartialExpiry() throws Exception { //Add an apple, it will expire at 2000 cache.put(1, "apple"); Clock.setTime(1500); //Add an orange, it will expire at 2500 cache.put(2, "orange"); assertEquals("apple", cache.get(1)); assertEquals("orange", cache.get(2)); assertEquals(2, cache.size()); //Set time to 2300 and check that only the apple has disappeared Clock.setTime(2300); assertNull(cache.get(1)); assertEquals("orange", cache.get(2)); assertEquals(1, cache.size()); }
f537ff3a-38ed-4220-8783-e10040af1a32
public void testPutReturnValue() { cache.put(1, "apple"); assertNotNull(cache.put(1, "banana")); Clock.setTime(3000); assertNull(cache.put(1, "mango")); }
49a6c06a-3135-4294-a592-d45042a3ff7b
public void testRemove() throws Exception { assertNull(cache.remove(1)); cache.put(1, "apple"); assertEquals("apple", cache.remove(1)); assertNull(cache.get(1)); assertEquals(0, cache.size()); }
4adbdd51-8022-4aed-896d-4deb2cbe8387
public void testContainsKeyAndContainsValue() { assertFalse(cache.containsKey(1)); assertFalse(cache.containsValue("apple")); assertFalse(cache.containsKey(2)); assertFalse(cache.containsValue("orange")); cache.put(1, "apple"); assertTrue(cache.containsKey(1)); assertTrue(cache.containsValue("apple")); assertFalse(cache.containsKey(2)); assertFalse(cache.containsValue("orange")); Clock.setTime(3000); assertFalse(cache.containsKey(1)); assertFalse(cache.containsValue("apple")); assertFalse(cache.containsKey(2)); assertFalse(cache.containsValue("orange")); }
ec4e9cd1-1b2a-4c26-a79a-e079e828e0c1
public static long getTime() { if (time == null) { return System.currentTimeMillis(); } else { return time; } }
a1fd1820-3600-4a27-9024-4cfd1c5c3d04
public static void setTime(long time) { Clock.time = time; }
3b6ebe5c-9d25-4e7b-afde-a69acf8b970d
public static void clearTime() { Clock.time = null; }
edb5fde4-3ce7-4b5d-b6e4-d9256f7b52b9
public Person(String name, String phoneNumber) { this.name = name; }
c57ceff2-cd88-4a82-baff-c538200688b7
public String getName() { return name; }
337e5f1d-c2ae-4073-b771-af5ddd8679ca
public void setName(String name) { name = name; }
311d4df1-c08c-453b-8d29-c7139c127486
public String getPhoneNumber() { return phoneNumber; }
159e02f4-5241-42a7-b911-6d08cac74817
public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; }
f41efda4-e71c-4384-a4fa-e7c13d369103
public boolean hasMobile(String name) { final Person person = addressDb.findPerson(name); return person != null && hasSwissMobileNumber(person); }
0780f6d4-abca-4c54-a81a-a69f877a810c
public int getSize() { return addressDb.getAll().size(); }
29324baa-3f2b-44b4-9206-2a39e6b3da4d
public String getMobile(String name) { Person person = addressDb.findPerson(name); return hasMobile(name) ? person.getPhoneNumber() : null; }
443a4ba6-d6a0-41b9-a0df-8c6c97344e7d
public List getNames(int maxLength) { List<String> names = new LinkedList<>(); for (Person person : addressDb.getAll()) { String name = person.getName(); if (name.length() > maxLength) { names.add(name.substring(0, maxLength)); } } return names; }
38c29f4e-89a0-4fcc-a9b6-4e563cc58b03
public List getList() { List<Person> listOfPersonWithMobilePhones = new LinkedList<>(); for (Person person : addressDb.getAll()) { if (hasMobile(person.getName())) { listOfPersonWithMobilePhones.add(person); } } return listOfPersonWithMobilePhones; }
fb10bf4a-fb2c-4c9a-a128-d771af6c861d
private boolean hasSwissMobileNumber(Person person) { return person.getPhoneNumber().startsWith(SWISS_CODE); }
46f79841-7343-402d-b98a-3efe529acc3b
public static AddressDb getInstance() { if (instance == null) { synchronized (AddressDb.class) { if (instance == null) { instance = new AddressDb(); } } } return instance; }
8610a30b-9930-401b-a371-04188ec65fc0
private AddressDb() { try { Class.forName(JDBC_DRIVER); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } }
00a7616b-6dd6-40d3-86bf-a46d4c855e8b
public void addPerson(Person person) { if (person == null) return; try ( Connection connection = getDBConnection(); PreparedStatement statement = connection.prepareStatement(ADD_PERSON_QUERY) ) { statement.setLong(1, System.currentTimeMillis()); statement.setString(2, person.getName()); statement.setString(3, person.getPhoneNumber()); statement.executeUpdate(); } catch (SQLException e) { throw new RuntimeException(e); } }
5641d058-b327-47b4-b6c1-14f1bf8a891f
public Person findPerson(String name) { if (name == null) return null; try ( Connection connection = getDBConnection(); PreparedStatement statement = connection.prepareStatement(FIND_PERSON_QUERY) ) { ResultSet personResultSet = statement.executeQuery(); return personResultSet.next() ? getPersonFromResultSet(personResultSet) : null; } catch (SQLException e) { throw new RuntimeException(e); } }
b56463ba-153f-43ee-9006-950cf5a7ea8e
public List<Person> getAll() { try ( Connection connection = getDBConnection(); PreparedStatement statement = connection.prepareStatement(GET_ALL_PEOPLE_QUERY) ) { List<Person> entries = new LinkedList<>(); ResultSet personResultSet = statement.executeQuery(); while (personResultSet.next()) { entries.add(getPersonFromResultSet(personResultSet)); } return entries; } catch (SQLException e) { throw new RuntimeException(e); } }
05ff2e78-b38d-496f-b539-4ef1beb936a1
private Connection getDBConnection() throws SQLException { return DriverManager.getConnection(DB_CONNECTION_URI, DB_CONNECTION_USERNAME, DB_CONNECTION_PASSWORD); }
57cf6524-f0b0-4089-86bd-3ce4ebb8e6f0
private Person getPersonFromResultSet(ResultSet personResultSet) throws SQLException { String name = personResultSet.getString(NAME_COLUMN); String phoneNumber = personResultSet.getString(PHONE_NUMBER_COLUMN); return new Person(name, phoneNumber); }
054c26c1-2e54-4e7e-96f2-500046f7c917
private Rating(int ratingVal) { this.ratingVal = ratingVal; }
7836177c-a430-4d7b-ae65-2cd5ee46172a
public int getRatingVal() { return ratingVal; }
8e8211cc-b3ca-4a47-90ba-dbfbeebc3ec8
@Override public String toString() { return metricValue + " " + metric + " " + label; }
3b1a2a41-8ce3-4d7c-bd92-0f55fbdb2df7
private Metric(String name) { this.name = name; }
9410f307-a988-4e1c-b4ad-b66d3e12c8a2
public String getName() { return name; }
38b1837e-7397-4236-acd4-cac65341913c
public T getById(int id);
9f42df02-4403-409c-9e2d-bc1850f3f474
public List<T> getAll();
e99090e2-6fd3-46e7-bed6-9db727bdd607
public void store(T t);
5805f9d2-a988-4b92-b3b3-781db759b247
public void update(T t);
b7eaf5d9-e4f8-4a6d-87dd-55cceed05d2d
public void delete(T t);
f22f7d30-2dfb-40f1-b71e-295b0ccf76e3
public void deleteByID(int id);
16462f3c-df9f-447c-aec7-7e42d8c029f2
public Recipe getById(int recipeId) { return entityManager.find(Recipe.class, recipeId); }
64465214-dca1-477d-af09-0a306280a611
public List<Recipe> getWithIngredients(Ingredient[] ingredients) { Query withIngredientsQuery = entityManager .createNamedQuery("Recipe.withIngredients"); for (Ingredient ingredient : ingredients) { withIngredientsQuery.setParameter("ingreds", ingredient.getLabel()); } List<Recipe> recipes = withIngredientsQuery.getResultList(); log.debug("{} recipes with the ingredients ({}) found.", recipes.size(), ingredients); return null; }
c56d97dd-7265-40c4-a98a-b993dc730689
public void store(Recipe recipe) { entityManager.persist(recipe); entityManager.flush(); }
3b819e21-c82b-4e9b-9674-24c9a499fc99
public void update(Recipe recipe) { entityManager.merge(recipe); }
63866b4d-43f9-4b22-a71e-1686cc9ad8f9
public void delete(Recipe recipe) { Recipe recipeToRemove = recipe; if (!entityManager.contains(recipe)) { recipeToRemove = entityManager.merge(recipe); } entityManager.remove(recipeToRemove); }
f3f859a0-282f-414a-9058-5bbd44ee8588
public void deleteByID(int recipeId) { delete(getById(recipeId)); }
c021a3e9-9c84-4a16-9090-6961707ac09f
public List<Recipe> getAll() { return entityManager.createQuery("SELECT r FROM Recipe r").getResultList(); }
6c419832-3a52-433f-b07c-3301fac19cbb
@PostConstruct public void init() { String id = FacesContext.getCurrentInstance().getExternalContext() .getRequestParameterMap().get("id"); recipe = recipeDataService.getById(Integer.valueOf(id)); }
eff143e2-ae3c-49f5-af2c-977b11671e4c
public static void main(String args[]){ Player player = new Player(); int player_health = player.getHealth(); Monster monster = new Monster(); int monster_health = monster.getMonsterHealth(); Attack attack = new Attack(); int special_attack = attack.getSepcialAttack(); //Game loop boolean running = true; //User Options String user_option = ""; String attack_option = ""; String potion_option = ""; String restart_option = ""; //Potions Potions potions = new Potions(); int weak_potion = potions.getWeakPotion(); int weak_count = 5; int strong_potion = potions.getStrongPotion(); int strong_count = 3; int super_potion = potions.getSuperPotion(); int super_count = 1; while(running){ System.out.println("1 --> Attack Monster!\n" + "2 --> Run Away like a chicken!\n" + "3 --> QUIT THE DAMN GAME!!!"); user_option = input.nextLine(); if (user_option.equals("1")){ while(player_health > 0 || monster_health > 0){ System.out.println("1 --> Attack\n" + "2 --> Special Attack\n" + "3 --> Drink Health Potion"); attack_option = input.nextLine(); if (attack_option.equals("1")){ //Attack player_health = attack.monsterDamage(player_health); monster_health = attack.playerDamage(monster_health); System.out.printf("Player Health: %d\n" + "Monster Health: %d\n", attack.monsterDamage(player_health), attack.playerDamage(monster_health)); } else if (attack_option.equals("2")){ //Special Attack if (special_attack > 0){ special_attack -= 25; player_health = attack.monsterDamage(player_health); monster_health = attack.playerSpecialDamage(monster_health); System.out.printf("Player Health: %d\n" + "Monster Health: %d\n", player_health, monster_health); } else { System.out.println("Let your special attack recharge!"); } } //Potion Option else if (attack_option.equals("3")){ System.out.println("1 --> Weak Health Potion (Restore 10 health)\n" + "2 --> Strong Health Potion (Restore 20 health)\n" + "3 --> Super Health Potion (Restore 50 health)\n" + "4 --> Quit"); potion_option = input.nextLine(); while (!potion_option.equals("4")){ if (potion_option.equals("1")){ //Weak Health Potion if (weak_count > 0){ weak_count -= 1; player_health += weak_potion; System.out.println(player_health); break; } else { System.out.println("You have run out of Weak Health Potion"); break; } } else if (potion_option.equals("2")){ //Strong Health Potion if (strong_count > 0){ strong_count -= 1; player_health += strong_potion; System.out.println(player_health); break; } else { System.out.println("You have run out of Strong Health Potion."); break; } } else if (potion_option.equals("3")){ //Super Health Potion if (super_count > 0){ super_count -= 1; player_health += super_potion; System.out.println(player_health); break; } else { System.out.println("You have run out of Super Health Potion."); break; } } else if (potion_option.equals("4")){ break; } else { System.out.println("1 --> Weak Health Potion (10)\n" + "2 --> Strong Health Potion (20)\n" + "3 --> Super Health Potion (50)\n" + "4 --> Quit"); potion_option = input.nextLine(); } } if (monster_health < 0 || player_health < 0){ break; } } // End of User Option 3 //Restart the game if (monster_health < 0){ System.out.println("You Won! Would you like to restart?\n" + "1 --> Yes\t2 --> No"); restart_option = input.nextLine(); if (restart_option.equals("1")){ //Yes player_health = 100; player.setHealth(player_health); monster_health = 100; monster.setMonsterHealth(monster_health); weak_count = 5; strong_count = 3; super_count = 1; attack.setSepcialAttack(50); } else if (restart_option.equals("2")){ //No System.out.println("Thank you for playing an awesome game!"); running = false; break; } else { //If user does not enter valid text System.out.println("You Won! Would you like to restart?\n" + "1 --> Yes\t2 --> No"); restart_option = input.nextLine(); } } else if (player_health < 0){ System.out.println("You Lost! Would you like to restart?\n" + "1 --> Yes\t2 --> No"); restart_option = input.nextLine(); if (restart_option.equals("1")){ //Yes player_health = 100; player.setHealth(player_health); monster_health = 100; monster.setMonsterHealth(monster_health); weak_count = 5; strong_count = 3; super_count = 1; attack.setSepcialAttack(50); } else if(restart_option.equals("2")){ System.out.println("Thank you for playing an awesome game!"); running = false; break; } } } // End of Combat Loop } else if (user_option.equals("2")){ //Run away like a chicken System.out.println("You run away like a chiekn!"); running = false; } else if (user_option.equals("3")){ System.out.println("You successfully closed the game!"); running = false; } else { System.out.println("1 --> Attack Monster!\n" + "2 --> Run Away like a chicken!\n" + "3 --> QUIT THE DAMN GAME!!!"); user_option = input.nextLine(); } } }
b2aff49a-7b1a-4839-b884-e131fb98b98c
public Player(String name, int health, int special){ this.name = name; this.health = health; this.special = special; }
67031c7b-2418-45d2-b8cb-f65a8dec9df2
public Player(String name){ this(name, 100, 50); }
741230b4-a8a9-4423-b561-15f2bc2f53b4
public Player(){ this("No Name", 100, 50); }
5103eb3d-8a2d-486d-9ddc-b9323870929d
public void setName(String name){ this.name = name; }
c9e60ea0-1fe7-4996-af43-5802e3f0d08e
public String getName(){ return name; }
5d61dd77-ea90-4c35-ad57-f8280d944ea6
public void setHealth(int health){ this.health = health; }
d3f7b5e8-d9f3-4cff-b921-550dbebaa774
public int getHealth(){ return health; }
83607ff9-d369-49f5-9d78-c05b497c95dd
public void setSpecial(int special){ this.special = special; }
e7307442-e536-47ea-9970-6f1aa4814d09
public int getSpecial(){ return special; }
248a6b6f-9e40-4f2b-a39e-6ab5bc143ffa
public int playerDamage(int monster_health){ int player_dmg = rand.nextInt(PLAYERATTACK); monster_health -= player_dmg; return monster_health; }
a75dede2-8db3-4143-b80a-c7ba4b510131
public int playerSpecialDamage(int monster_health){ int player_dmg = rand.nextInt(PLAYERATTACK) + 15; monster_health -= player_dmg; return monster_health; }
8acaf821-c352-4eb6-b64e-6df32f6910de
public int monsterDamage(int player_health){ int monster_dmg = rand.nextInt(MONSTERATTACK); player_health -= monster_dmg; return player_health; }
cff30621-c5ee-493e-bad0-38feb982f2d9
public void setSepcialAttack(int special_attack){ this.special_attack = special_attack; }
48afb6e3-d777-49c3-a46f-325fa8b72157
public int getSepcialAttack(){ return special_attack; }
d1c43f5b-66db-4f93-aea9-7e0659823e43
public void setWeakPotion(int weak_potion){ this.weak_potion = weak_potion; }
4418a1b0-baa3-4835-ad0c-9cd9d52956c8
public void setStrongPotion(int strong_potion){ this.strong_potion = strong_potion; }
9adbfbb1-2e17-4d35-a9da-9f42db6f63d7
public void setSuperPotion(int super_potion){ this.super_potion = super_potion; }
374617e3-be8d-4053-a170-fd236dad3c60
public int getWeakPotion(){ return weak_potion; }
0d2b6bcb-06b5-4b74-a706-8156de718a7f
public int getStrongPotion(){ return strong_potion; }
6cb308be-b087-47e7-ba44-62c6030e1494
public int getSuperPotion(){ return super_potion; }
f354cb9c-ccf7-4d8c-84c7-32aed1d97758
public Monster(){ this(getMonsterName(), 100, level); }
2c80930c-109b-4c88-abd3-59eca0a57616
public Monster(String name, int health, int level) { this.name = name; this.health = health; this.level = level; }
de8b4658-d69b-4ac8-8b66-db04bc58919a
public static String getMonsterName(){ Vector<String> monsterlist = new Vector<String>(); Random rand = new Random(); int select = rand.nextInt(3); monsterlist.add("Skeleton"); monsterlist.add("Spider"); monsterlist.add("Snake"); return monsterlist.get(select); }
90c955ac-901d-4536-9118-bf1fcb88e1e8
public void setMonsterName(String name){ this.name = name; }
49b360fe-fcc0-4b4f-bdab-499820538a25
public void setMonsterHealth(int health){ this.health = health; }
456a4842-d7b2-46e1-88e0-99de0d7718ec
public int getMonsterHealth(){ return health; }
29cca83c-f49b-44f2-a4a0-c51632340b8b
public void setMonsterLevel(int level){ this.level = level; }
5cf5aad1-ec3b-4a9b-ae8d-b1d665c62986
public int getMonsterLevel(){ return level; }
895b6b21-b282-4cfb-90e5-b175964207dc
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); }
e6dd8fd8-5a4a-4ea3-a3a1-50c4f644e452
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; }
f5c5a673-31de-4b53-ba26-01145eb81be0
public void addGraph(final Graph graph) { if (graph == null) { throw new IllegalArgumentException("Graph cannot be null"); } graphs.add(graph); }
416dee57-7462-4cc2-91cf-246a2437c548
public void addCustomData(final Plotter plotter) { if (plotter == null) { throw new IllegalArgumentException("Plotter cannot be null"); } defaultGraph.addPlotter(plotter); graphs.add(defaultGraph); }
df903aa1-42c1-4a6b-b0bf-68d5749072e9
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; } }
e63e2ccb-2b2d-4d40-86ec-c864abd9eac0
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()); } } }
2f136ff8-098e-42fe-a74a-3016c23db944
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); } }
831d10ea-bb76-4a07-b9da-bf174b11cf4d
public void enable() throws IOException { synchronized (optOutLock) { if (isOptOut()) { configuration.set("opt-out", false); configuration.save(configurationFile); } if (task == null) { start(); } } }
3f7ba4ae-8628-473c-a332-783c83d8e89d
public void disable() throws IOException { synchronized (optOutLock) { if (!isOptOut()) { configuration.set("opt-out", true); configuration.save(configurationFile); } if (task != null) { task.cancel(); task = null; } } }
e5a01cfe-751a-4b6c-b6bd-6a99020cb77b
public File getConfigFile() { File pluginsFolder = plugin.getDataFolder().getParentFile(); return new File(new File(pluginsFolder, "PluginMetrics"), "config.yml"); }
7f4ba4a3-458d-450e-9967-2e10073efd0d
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(); } } } } } }
58f360c8-2717-4626-9bca-4b919cd51ad2
private boolean isMineshafterPresent() { try { Class.forName("mineshafter.MineServer"); return true; } catch (Exception e) { return false; } }
baef3c87-90b3-492b-91fd-b8e057f3f31f
private static void encodeDataPair(final StringBuilder buffer, final String key, final String value) throws UnsupportedEncodingException { buffer.append('&').append(encode(key)).append('=').append(encode(value)); }
c4ef34dc-18d2-4b3f-8468-ad52cc962448
private static String encode(final String text) throws UnsupportedEncodingException { return URLEncoder.encode(text, "UTF-8"); }
a4a600c2-78bc-4bfd-b3dc-2533337de17e
private Graph(final String name) { this.name = name; }
a367a4d0-1882-4eab-9a68-dd14293133a4
public String getName() { return name; }
f5923178-7fa3-4fc2-bd46-e7b9cd730f09
public void addPlotter(final Plotter plotter) { plotters.add(plotter); }
1c1824fc-d9b9-4ef4-b828-581a475aad8f
public void removePlotter(final Plotter plotter) { plotters.remove(plotter); }
5dda02a9-004d-486c-8dee-9731b3a45c93
public Set<Plotter> getPlotters() { return Collections.unmodifiableSet(plotters); }
0378aaad-2dcf-4b4f-a3ab-c99a04a11668
@Override public int hashCode() { return name.hashCode(); }
1d9816a8-ddab-499c-992c-771705766890
@Override public boolean equals(final Object object) { if (!(object instanceof Graph)) { return false; } final Graph graph = (Graph) object; return graph.name.equals(name); }
356a5622-0d54-4505-a939-2d666a5d0d74
protected void onOptOut() { }
2a83c278-d299-49ce-947f-88aa74d2ae94
public Plotter() { this("Default"); }
09365888-103c-41ca-924f-e65c39a1c8a5
public Plotter(final String name) { this.name = name; }
87168e9f-f01c-4a58-ad50-d30ce45bf531
public abstract int getValue();
809da670-993a-4141-af22-1d855512776e
public String getColumnName() { return name; }
fac02cc8-2c39-45e9-8b1f-5374b41cdf12
public void reset() { }