Example #1
0
 public function distance(Node $node)
 {
     #fwrite(STDOUT, __FUNCTION__.''."\n");
     $rv = array_fill(0, static::ID_LEN_BYTE, 0);
     #ve($rv);
     if ($node && $this !== $node) {
         $thisId = $this->getId();
         $nodeId = $node->getId();
         #ve($thisId);
         #ve($nodeId);
         for ($idPos = 0; $idPos < static::ID_LEN_BYTE; $idPos++) {
             $rv[$idPos] = $thisId[$idPos] ^ $nodeId[$idPos];
             #fwrite(STDOUT, __FUNCTION__.'     pos: '.$idPos.' -> '.$rv[$idPos]."\n");
         }
     }
     return $rv;
 }