@Test public void testAddLabel() { String label = "R3"; LabelContainer instance = new LabelContainer(); instance.addLabel(label); Assert.assertEquals(3, instance.getSize()); Integer expectedValue = 2; Assert.assertEquals(expectedValue, instance.getLabelID("R3")); }
synchronized public void addLabel(String label) { if (!labelMap.contains(label)) { labelMap.add(labelCounter++, label); } }
LabelContainer { synchronized public void addLabel(String label) { if (!labelMap.contains(label)) { labelMap.add(labelCounter++, label); } } }
LabelContainer { synchronized public void addLabel(String label) { if (!labelMap.contains(label)) { labelMap.add(labelCounter++, label); } } protected  LabelContainer(); }
LabelContainer { synchronized public void addLabel(String label) { if (!labelMap.contains(label)) { labelMap.add(labelCounter++, label); } } protected  LabelContainer(); synchronized static LabelContainer getInstance(); synchronized void addLabel(String label); synchronized Integer getLabelID(String label); synchronized String getLabel(Integer labelID); synchronized int getSize(); }
LabelContainer { synchronized public void addLabel(String label) { if (!labelMap.contains(label)) { labelMap.add(labelCounter++, label); } } protected  LabelContainer(); synchronized static LabelContainer getInstance(); synchronized void addLabel(String label); synchronized Integer getLabelID(String label); synchronized String getLabel(Integer labelID); synchronized int getSize();  }