@Test(expected=IllegalArgumentException.class) public void testAddRootNode_WhichAlreadyExists(){ metaData.addRootNode(new LabelNodeImpl(HIERARCHY_ROOT_NODE_NAME)); }
public void addRootNode(LabelNode rootNode) { if (rootNode == null) { throw new ArgumentNullException("rootNode"); } if (rootLabelNodes.contains(rootNode)) { throw new IllegalArgumentException( String.format("The root label node '%s' is already added.", rootNode.getName())); } rootLabelNodes.add(rootNode); processNodeIndex(rootNode, IndexingAction.Add); }
LabelsMetaDataImpl implements LabelsMetaData, Serializable, Externalizable { public void addRootNode(LabelNode rootNode) { if (rootNode == null) { throw new ArgumentNullException("rootNode"); } if (rootLabelNodes.contains(rootNode)) { throw new IllegalArgumentException( String.format("The root label node '%s' is already added.", rootNode.getName())); } rootLabelNodes.add(rootNode); processNodeIndex(rootNode, IndexingAction.Add); } }
LabelsMetaDataImpl implements LabelsMetaData, Serializable, Externalizable { public void addRootNode(LabelNode rootNode) { if (rootNode == null) { throw new ArgumentNullException("rootNode"); } if (rootLabelNodes.contains(rootNode)) { throw new IllegalArgumentException( String.format("The root label node '%s' is already added.", rootNode.getName())); } rootLabelNodes.add(rootNode); processNodeIndex(rootNode, IndexingAction.Add); } LabelsMetaDataImpl(); }
LabelsMetaDataImpl implements LabelsMetaData, Serializable, Externalizable { public void addRootNode(LabelNode rootNode) { if (rootNode == null) { throw new ArgumentNullException("rootNode"); } if (rootLabelNodes.contains(rootNode)) { throw new IllegalArgumentException( String.format("The root label node '%s' is already added.", rootNode.getName())); } rootLabelNodes.add(rootNode); processNodeIndex(rootNode, IndexingAction.Add); } LabelsMetaDataImpl(); void addRootNode(LabelNode rootNode); LabelNode getLabelNode(String labelName); Set<String> getLabelNames(); boolean containsLabel(String labelName); boolean isHierarchy(); int getNumLabels(); Set<LabelNode> getRootLabels(); @SuppressWarnings("unchecked") @Override LabelsMetaData clone(); int removeLabelNode(String labelName); @SuppressWarnings("unchecked") @Override void readExternal(ObjectInput in); @Override void writeExternal(ObjectOutput out); }
LabelsMetaDataImpl implements LabelsMetaData, Serializable, Externalizable { public void addRootNode(LabelNode rootNode) { if (rootNode == null) { throw new ArgumentNullException("rootNode"); } if (rootLabelNodes.contains(rootNode)) { throw new IllegalArgumentException( String.format("The root label node '%s' is already added.", rootNode.getName())); } rootLabelNodes.add(rootNode); processNodeIndex(rootNode, IndexingAction.Add); } LabelsMetaDataImpl(); void addRootNode(LabelNode rootNode); LabelNode getLabelNode(String labelName); Set<String> getLabelNames(); boolean containsLabel(String labelName); boolean isHierarchy(); int getNumLabels(); Set<LabelNode> getRootLabels(); @SuppressWarnings("unchecked") @Override LabelsMetaData clone(); int removeLabelNode(String labelName); @SuppressWarnings("unchecked") @Override void readExternal(ObjectInput in); @Override void writeExternal(ObjectOutput out);  }