knowrob  2.1.0
A Knowledge Base System for Cognition-enabled Robots
knowrob::AnswerComparator Struct Reference

#include <Answer.h>

Public Member Functions

bool operator() (const AnswerPtr &v0, const AnswerPtr &v1) const
 
bool operator() (const AnswerPtr &v0, const AnswerPtr &v1) const
 

Detailed Description

Used to compare answers.

Definition at line 143 of file Answer.h.

Member Function Documentation

◆ operator()() [1/2]

bool knowrob::AnswerComparator::operator() ( const AnswerPtr v0,
const AnswerPtr v1 
) const

Definition at line 143 of file Answer.cpp.

143  {
144  if (!v0) {
145  if (!v1) return false;
146  else return true;
147  } else if (!v1 || v0 == v1) {
148  return false;
149  } else if (v0->isCertain() != v1->isCertain()) {
150  return v0->isCertain() < v1->isCertain();
151  } else if (v0->isPositive() != v1->isPositive()) {
152  return v0->isPositive() < v1->isPositive();
153  } else if (v0->isNegative() != v1->isNegative()) {
154  return v0->isNegative() > v1->isNegative();
155  } else {
156  return v0->hashOfAnswer() < v1->hashOfAnswer();
157  }
158  }

◆ operator()() [2/2]

bool knowrob::AnswerComparator::operator() ( const AnswerPtr v0,
const AnswerPtr v1 
) const

The documentation for this struct was generated from the following files: