congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
TreeDecoder.buildTree
Code IndexAdd Tabnine to your IDE (free)

How to use
buildTree
method
in
it.unimi.dsi.compression.TreeDecoder

Best Java code snippets using it.unimi.dsi.compression.TreeDecoder.buildTree (Showing top 6 results out of 315)

origin: blazegraph/database

/** Creates a new codeword-based decoder starting from a set
 * of complete, lexicographically ordered codewords. It
 * is responsability of the caller that the tree is well-formed,
 * that is, that the provided codewords are exactly the root-to-leaf
 * paths of such a tree.
 * 
 * @param lexSortedCodeWord a vector of lexically sorted codeWords.
 * @param symbol a mapping from codewords to symbols.
 */
public TreeDecoder( BitVector[] lexSortedCodeWord, int[] symbol ) {
  this( buildTree( lexSortedCodeWord, symbol, 0, 0, lexSortedCodeWord.length ), lexSortedCodeWord.length );
}

origin: it.unimi.dsi/dsiutils

/** Creates a new codeword-based decoder starting from a set
 * of complete, lexicographically ordered codewords. It
 * is responsibility of the caller that the tree is well-formed,
 * that is, that the provided codewords are exactly the root-to-leaf
 * paths of such a tree.
 *
 * @param lexSortedCodeWord a vector of lexically sorted codeWords.
 * @param symbol a mapping from codewords to symbols.
 */
public TreeDecoder(BitVector[] lexSortedCodeWord, int[] symbol) {
  this(buildTree(lexSortedCodeWord, symbol, 0, 0, lexSortedCodeWord.length), lexSortedCodeWord.length);
}
origin: com.blazegraph/dsi-utils

/** Creates a new codeword-based decoder starting from a set
 * of complete, lexicographically ordered codewords. It
 * is responsability of the caller that the tree is well-formed,
 * that is, that the provided codewords are exactly the root-to-leaf
 * paths of such a tree.
 * 
 * @param lexSortedCodeWord a vector of lexically sorted codeWords.
 * @param symbol a mapping from codewords to symbols.
 */
public TreeDecoder( BitVector[] lexSortedCodeWord, int[] symbol ) {
  this( buildTree( lexSortedCodeWord, symbol, 0, 0, lexSortedCodeWord.length ), lexSortedCodeWord.length );
}

origin: it.unimi.dsi/dsiutils

private static Node buildTree(BitVector lexSortedCodeWords[], final int[] symbol, int prefix, int offset, int length) {
  if (DEBUG) {
    System.err.println("****** " + offset + " " + length);
    System.err.println(Arrays.toString(lexSortedCodeWords));
    for(int i = 0; i < length; i++) {
      System.err.print(lexSortedCodeWords[offset + i].length() + "\t");
      for(int j = 0; j < lexSortedCodeWords[offset + i].length(); j++) System.err.print(lexSortedCodeWords[offset + i].getBoolean(j) ? 1 : 0);
      System.err.println();
    }
  }
  if (length == 1) return new LeafNode(symbol[offset]);
  for(int i = length - 1; i-- != 0;)
    if (lexSortedCodeWords[offset + i].getBoolean(prefix) != lexSortedCodeWords[offset + i + 1].getBoolean(prefix)) {
      final Node node = new Node();
      node.left = buildTree(lexSortedCodeWords, symbol, prefix + 1, offset, i + 1);
      node.right = buildTree(lexSortedCodeWords, symbol, prefix + 1, offset + i + 1, length - i - 1);
      return node;
    }
  throw new IllegalStateException();
}
origin: blazegraph/database

private static Node buildTree( BitVector lexSortedCodeWords[], final int[] symbol, int prefix, int offset, int length ) {
  if ( DEBUG ) {
    System.err.println( "****** " + offset + " " + length ); 
    System.err.println( Arrays.toString( lexSortedCodeWords ) );
    for( int i = 0; i < length; i++ ) {
      System.err.print( lexSortedCodeWords[ offset + i ].size() + "\t" );
      for( int j = 0; j < lexSortedCodeWords[ offset + i ].size(); j++ ) System.err.print( lexSortedCodeWords[ offset + i ].getBoolean( j ) ? 1 : 0 );
      System.err.println();
    }
  }
  
  if ( length == 1 ) return new LeafNode( symbol[ offset ] );
  for( int i = length - 1; i-- != 0; ) 
    if ( lexSortedCodeWords[ offset + i ].get( prefix ) != lexSortedCodeWords[ offset + i + 1 ].get( prefix ) ) {
      final Node node = new Node();
      node.left = buildTree( lexSortedCodeWords, symbol, prefix + 1, offset, i + 1 );
      node.right = buildTree( lexSortedCodeWords, symbol, prefix + 1, offset + i + 1, length - i - 1 );
      return node;
    }
  
  throw new IllegalStateException();
}

origin: com.blazegraph/dsi-utils

private static Node buildTree( BitVector lexSortedCodeWords[], final int[] symbol, int prefix, int offset, int length ) {
  if ( DEBUG ) {
    System.err.println( "****** " + offset + " " + length ); 
    System.err.println( Arrays.toString( lexSortedCodeWords ) );
    for( int i = 0; i < length; i++ ) {
      System.err.print( lexSortedCodeWords[ offset + i ].size() + "\t" );
      for( int j = 0; j < lexSortedCodeWords[ offset + i ].size(); j++ ) System.err.print( lexSortedCodeWords[ offset + i ].getBoolean( j ) ? 1 : 0 );
      System.err.println();
    }
  }
  
  if ( length == 1 ) return new LeafNode( symbol[ offset ] );
  for( int i = length - 1; i-- != 0; ) 
    if ( lexSortedCodeWords[ offset + i ].get( prefix ) != lexSortedCodeWords[ offset + i + 1 ].get( prefix ) ) {
      final Node node = new Node();
      node.left = buildTree( lexSortedCodeWords, symbol, prefix + 1, offset, i + 1 );
      node.right = buildTree( lexSortedCodeWords, symbol, prefix + 1, offset + i + 1, length - i - 1 );
      return node;
    }
  
  throw new IllegalStateException();
}

it.unimi.dsi.compressionTreeDecoderbuildTree

Popular methods of TreeDecoder

  • <init>
    Creates a new codeword-based decoder starting from a set of complete, lexicographically ordered code
  • buildCodes
    Populates the codeword vector by scanning recursively the decoding tree.
  • visit

Popular in Java

  • Running tasks concurrently on multiple threads
  • getContentResolver (Context)
  • setScale (BigDecimal)
  • requestLocationUpdates (LocationManager)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • JLabel (javax.swing)
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now