Ejemplo n.º 1
0
 /** @brief Checks whether provided facet is similar to current instance.
  *
  * Two instances are considered similar when following values are equals:
  * - facet identifier,
  * - facet type (or one is of unknown type),
  * - facet layout (or one is of unknown layout).
  * Other facet parameters are not taken into account.
  *
  * @param $other [in] instance to compare with.
  * @return @c True when both instances are similar, @c false otherwise.
  */
 public function is_similar_to(AfsFacet $other)
 {
     if ($this->id == $other->get_id() && ($this->type == $other->get_type() || $this->type == AfsFacetType::UNKNOWN_TYPE || $other->get_type() == AfsFacetType::UNKNOWN_TYPE) && ($this->layout == $other->get_layout() || $this->type == AfsFacetLayout::UNKNOWN || $other->get_layout() == AfsFacetLayout::UNKNOWN)) {
         return true;
     } else {
         return false;
     }
 }
Ejemplo n.º 2
0
 public function testFacetOfDifferentLayout()
 {
     $facet = new AfsFacet('foo', AfsFacetType::BOOL_TYPE);
     $other = new AfsFacet('foo', AfsFacetType::BOOL_TYPE, AfsFacetLayout::INTERVAL);
     $this->assertFalse($facet->is_similar_to($other));
 }
Ejemplo n.º 3
0
 /** @brief Checks whether provided facet is sticky or not.
  *
  * If facet mode is undefined, rely on default facet mode to determine
  * whether the facet is sticky or not.
  *
  * @param $facet [in] Facet for which mode should be determined.
  *
  * @return @c true when the facet is considered as sticky, @c false
  *         otherwise.
  */
 public function is_sticky(AfsFacet $facet)
 {
     $mode = $facet->get_mode();
     if (AfsFacetMode::UNSPECIFIED_MODE == $mode) {
         $mode = $this->facet_mode;
     }
     return $this->is_mode_sticky($mode);
 }