Tabnine Logo
KBucketSet.getRange
Code IndexAdd Tabnine to your IDE (free)

How to use
getRange
method
in
net.i2p.kademlia.KBucketSet

Best Java code snippets using net.i2p.kademlia.KBucketSet.getRange (Showing top 4 results out of 315)

origin: i2p/i2p.i2p

/**
 *  The bucket number (NOT the range number) that the xor of the key goes in
 *  Caller must hold read lock
 *  @return 0 to max-1 or -1 for us
 */
private int pickBucket(T key) {
  int range = getRange(key);
  if (range < 0)
    return -1;
  int rv = pickBucket(range);
  if (rv >= 0) {
     return rv;
  }
  _log.error("Key does not fit in any bucket?!\nKey  : [" 
        + DataHelper.toHexString(key.getData()) + "]" 
        + "\nUs   : " + _us
        + "\nDelta: ["
        + DataHelper.toHexString(DataHelper.xor(_us.getData(), key.getData()))
        + "]", new Exception("???"));
  _log.error(toString());
  throw new IllegalStateException("pickBucket returned " + rv);
  //return -1;
}

origin: i2p/i2p.i2p

KBucket<T> b2 = createBucket(s2, e2);
for (T key : b0.getEntries()) {
  if (getRange(key) < s2)
    b1.add(key);
  else
origin: i2p/i2p.i2p

/** @since 0.9.10 */
public void testAudit() {
  int errors = 0;
  for (KBucket<Hash> b : set.getBuckets()) {
    for (Hash sds : b.getEntries()) {
      int range = set.getRange(sds);
      if (range < b.getRangeBegin() || range > b.getRangeEnd()) {
        log.error("Hash " + sds + " with range " + range +
             " does not belong in " + b);
        errors++;
      }
    }
  }
  assertTrue(errors == 0);
}
origin: i2p/i2p.i2p

/** @since 0.9.10 */
public void testGenRandom() {
  int errors = 0;
  for (KBucket<Hash> b : set.getBuckets()) {
    for (int j = 0; j < 4000; j++) {
      Hash rand = set.generateRandomKey(b);
      int range = set.getRange(rand);
      if (range < b.getRangeBegin() || range > b.getRangeEnd()) {
        log.error("Generate random key failed range=" + range + " for " + rand + " meant for bucket " + b);
        errors++;
      }
    }
  }
  assertTrue(errors == 0);
}
net.i2p.kademliaKBucketSetgetRange

Javadoc

The number of bits minus 1 (range number) for the xor of the key. Package private for testing only. Others shouldn't need this.

Popular methods of KBucketSet

  • <init>
    Use the supplied trim strategy.
  • add
  • getClosest
    The keys closest to the key. Returned list will never contain us.
  • getExploreKeys
    For every bucket that hasn't been updated in this long, or isn't close to full, generate a random ke
  • toString
  • clear
  • generateRandomKey
    Generate a random key to go within this bucket Package private for testing only. Others shouldn't ne
  • getAll
  • remove
  • size
    The current number of entries.
  • createBucket
  • createBuckets
  • createBucket,
  • createBuckets,
  • getBucket,
  • getBuckets,
  • getReadLock,
  • getWriteLock,
  • locked_split,
  • makeKey,
  • pickBucket

Popular in Java

  • Creating JSON documents from java classes using gson
  • onRequestPermissionsResult (Fragment)
  • putExtra (Intent)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • BoxLayout (javax.swing)
  • JFrame (javax.swing)
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • 14 Best Plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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