@Override public boolean remove(Object o) { boolean result = false; if (o instanceof MappingNode) { result = nodes.remove(o); String list = ((MappingNode)o).getList(); lists.remove(list); nodesByList.remove(list); } // if linear node return result; }// remove
@Override public MappingNode remove(int index) { MappingNode result = null; result = nodes.remove(index); if (null!=result) { String list = result.getList(); lists.remove(list); nodesByList.remove(list); } return result; }
/** * adds a new node at the specified position, only if its list is new and uniquely mapped to this node. * @param o a node * @param index position in the list */ @Override public void add(int index, MappingNode o) { String list = o.getList(); if(!nodesByList.containsKey(list)) { nodes.add(index, o); nodesByList.put(list, o); lists.add(list); } // if unique } // add()
/** * adds a new node, only if its list is new and uniquely mapped to this node. * @param o a node * @return true if the list of node is not already mapped with another node. */ @Override public boolean add(MappingNode o) { boolean result = false; String list = o.getList(); if(!nodesByList.containsKey(list)) { result = nodes.add(o); nodesByList.put(list, o); lists.add(list); } // if unique return result; } // add()