public void updateHeaderTable(UNode uNode, double probability, double prefixValue) { HeaderTableItem item = null; if ((item = findHeaderTableItemById(uNode.getId())) == null) { HeaderTableItem headerTableItem = addNewTableItem(uNode.getId()); headerTableItem.updateHeaderData(uNode, probability, prefixValue); } else { item.updateHeaderData(uNode, probability, prefixValue); } }
public void removeAllNodes(String id) { HeaderTableItem headerTableItem = getHeaderTableItem(id); List<UNode> nodeList = headerTableItem.getNodeList(); headerTableItems.remove(headerTableItem); int count = nodeList.size(); for (int i = 0; i < count; i++) { UNode childNode = nodeList.get(i); UNode parentNode = childNode.getParentNode(); parentNode.getChildNodeList().remove(childNode); } }
public void slideHeaderTable() { for (HeaderTableItem item : headerTableItems) { List<UNode> nodes = item.getNodeList(); int counter = nodes.size(); for (int i = 0; i < counter; i++) { UNode node = nodes.get(i); boolean isEmpty = true; for (UData data : node.getUncertainDataList()) { if (data.getItemProbability() > 0) { isEmpty = false; break; } } if (isEmpty) { nodes.remove(node); counter = counter - 1; i--; } } } }
public HeaderTable copy(UNode uNode) { HeaderTable newTable = new HeaderTable(windowSize); List<UNode> distinctNodes = uNode.getDistinctNodes(); for (HeaderTableItem item : this.headerTableItems) { HeaderTableItem newTableItem = newTable.addNewTableItem(item.getItemId()); newTableItem.addProbabilityAndPrefixValue( item.getTotalProbability(), item.getTotalPrefixValue()); } for (UNode node : distinctNodes) { newTable.updateHeaderTable(node, 0, 0); } return newTable; }
void addNode(UNode node, int index) { HeaderTableItem item = findHeaderTableItemById(node.getId()); item.addNodeItem(node, index); }