/**
  * Calculates the Jacard Similarity between the comparators' scalar attributes
  * @param  Comparator $a
  * @param  Comparator $b
  * @return float        Jaccard Similarity
  */
 public function analyse(Comparator $a, Comparator $b)
 {
     $aa = $a->getScalarAttributes();
     $ba = $b->getScalarAttributes();
     if (count($aa) != count($ba)) {
         throw new \LogicException("Cannot compute similary: attributes arrays are unequal");
     }
     if (count($aa) == 0 && count($ba) == 0) {
         return 1;
     }
     //follows the convention that two empty objects are equal
     $this->similarity = count(array_intersect_assoc($aa, $ba)) / count($aa);
     return $this->similarity;
 }