Package com.bpodgursky.set_query_lib.node

Source Code of com.bpodgursky.set_query_lib.node.DataNode

package com.bpodgursky.set_query_lib.node;

import com.bpodgursky.set_query_lib.IntBitSet;

public class DataNode extends TrieNode<DataNode> {

  private IntBitSet allBelow;
  private long cumulativeBelow;

  public DataNode(int[] id, DataNode[] children, long size) {
    super(id, children);

    this.cumulativeBelow = size;
    this.allBelow = new IntBitSet(id);
  }

  public IntBitSet getAllBelow() {
    return allBelow;
  }

  public long getCumulativeBelow(){
    return cumulativeBelow;
  }

  public void incrementCumulativeBelow(){
    cumulativeBelow++;
  }

  @Override
  public boolean isReal() {
    long val = this.cumulativeBelow;
    for(DataNode sn: this.getChildren()) val-=sn.cumulativeBelow;
    return val != 0;
  }

  @Override
  public String toString() {
    return "DataNode{" +
        "allBelow=" + allBelow +
        ", cumulativeBelow=" + cumulativeBelow +
        '}';
  }

  //  package

  protected void setAllBelow(IntBitSet value){
    this.allBelow = value;
  }

}
TOP

Related Classes of com.bpodgursky.set_query_lib.node.DataNode

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.