@Test public void testAdd() { ModuleDeps deps = new ModuleDeps(); Assert.assertTrue(deps.add("module1", new ModuleDepInfo("has", new BooleanTerm("A"), null))); Assert.assertTrue(deps.add("module2", new ModuleDepInfo("has", new BooleanTerm("B"), null))); Assert.assertTrue(deps.add("module2", new ModuleDepInfo("has", new BooleanTerm("C"), null))); Assert.assertEquals(2, deps.size()); Assert.assertEquals( new HashSet<String>(Arrays.asList(new String[]{"has!A?"})), deps.get("module1").getHasPluginPrefixes() ); Assert.assertEquals( new HashSet<String>(Arrays.asList(new String[]{"has!B?", "has!C?"})), deps.get("module2").getHasPluginPrefixes() ); Assert.assertFalse(deps.add("module1", deps.get("module1"))); }
public boolean add(String key, ModuleDepInfo info) { if (info == null) { throw new NullPointerException(); } boolean modified = false; ModuleDepInfo existing = get(key); if (!containsKey(key) || existing != info) { if (existing != null) { modified = existing.add(info); } else { super.put(key, info); modified = true; } } return modified; }
ModuleDeps extends LinkedHashMap<String, ModuleDepInfo> implements Serializable { public boolean add(String key, ModuleDepInfo info) { if (info == null) { throw new NullPointerException(); } boolean modified = false; ModuleDepInfo existing = get(key); if (!containsKey(key) || existing != info) { if (existing != null) { modified = existing.add(info); } else { super.put(key, info); modified = true; } } return modified; } }
ModuleDeps extends LinkedHashMap<String, ModuleDepInfo> implements Serializable { public boolean add(String key, ModuleDepInfo info) { if (info == null) { throw new NullPointerException(); } boolean modified = false; ModuleDepInfo existing = get(key); if (!containsKey(key) || existing != info) { if (existing != null) { modified = existing.add(info); } else { super.put(key, info); modified = true; } } return modified; } ModuleDeps();  ModuleDeps(ModuleDeps other); }
ModuleDeps extends LinkedHashMap<String, ModuleDepInfo> implements Serializable { public boolean add(String key, ModuleDepInfo info) { if (info == null) { throw new NullPointerException(); } boolean modified = false; ModuleDepInfo existing = get(key); if (!containsKey(key) || existing != info) { if (existing != null) { modified = existing.add(info); } else { super.put(key, info); modified = true; } } return modified; } ModuleDeps();  ModuleDeps(ModuleDeps other); boolean add(String key, ModuleDepInfo info); boolean addAll(ModuleDeps other); boolean containsDep(String moduleName, BooleanTerm term); ModuleDeps andWith(ModuleDepInfo info); boolean subtract(String key, ModuleDepInfo subInfo); boolean subtractAll(ModuleDeps toSub); Set<String> getModuleIds(); Set<String> getModuleIds(Map<?, ?> formulaCache); Map<String, String> getModuleIdsWithComments(); ModuleDeps resolveWith(Features features); ModuleDeps resolveWith(Features features, boolean coerceUndefinedToFalse); ModuleDeps simplify(Map<?, ?> formulaCache); @Override ModuleDepInfo put(String key, ModuleDepInfo value); @Override void putAll(Map<? extends String, ? extends ModuleDepInfo> map); }
ModuleDeps extends LinkedHashMap<String, ModuleDepInfo> implements Serializable { public boolean add(String key, ModuleDepInfo info) { if (info == null) { throw new NullPointerException(); } boolean modified = false; ModuleDepInfo existing = get(key); if (!containsKey(key) || existing != info) { if (existing != null) { modified = existing.add(info); } else { super.put(key, info); modified = true; } } return modified; } ModuleDeps();  ModuleDeps(ModuleDeps other); boolean add(String key, ModuleDepInfo info); boolean addAll(ModuleDeps other); boolean containsDep(String moduleName, BooleanTerm term); ModuleDeps andWith(ModuleDepInfo info); boolean subtract(String key, ModuleDepInfo subInfo); boolean subtractAll(ModuleDeps toSub); Set<String> getModuleIds(); Set<String> getModuleIds(Map<?, ?> formulaCache); Map<String, String> getModuleIdsWithComments(); ModuleDeps resolveWith(Features features); ModuleDeps resolveWith(Features features, boolean coerceUndefinedToFalse); ModuleDeps simplify(Map<?, ?> formulaCache); @Override ModuleDepInfo put(String key, ModuleDepInfo value); @Override void putAll(Map<? extends String, ? extends ModuleDepInfo> map);  }