Example #1
0
  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);
    }
  }
Example #2
0
 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);
   }
 }
Example #3
0
 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--;
       }
     }
   }
 }
Example #4
0
 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;
 }
Example #5
0
 void addNode(UNode node, int index) {
   HeaderTableItem item = findHeaderTableItemById(node.getId());
   item.addNodeItem(node, index);
 }