コード例 #1
0
 @Override
 public KademliaOverlayID getOverlayID(SkyNetID skyNetID) {
   BigDecimal dec = skyNetID.getID().multiply(upperBound);
   BigInteger kademliaOverlayID = null;
   try {
     kademliaOverlayID = dec.toBigIntegerExact();
   } catch (Exception e) {
     log.fatal("Unable to create exact integer out of " + dec.toPlainString());
   }
   return new KademliaOverlayID(kademliaOverlayID.subtract(BigInteger.ONE), config);
 }
コード例 #2
0
 @Override
 public KademliaOverlayKey getOverlayKey(SkyNetID skyNetKey) {
   BigInteger kademliaOverlayKey = skyNetKey.getID().multiply(upperBound).toBigIntegerExact();
   return new KademliaOverlayKey(kademliaOverlayKey.subtract(BigInteger.ONE), config);
 }