JaffarPlus
High-performance best-first search optimizer for tool-assisted speedruns
Loading...
Searching...
No Matches
jaffarPlus::Condition Class Referenceabstract

Abstract base for a single boolean comparison. More...

#include <condition.hpp>

Inheritance diagram for jaffarPlus::Condition:
[legend]

Public Types

enum  operator_t {
  op_equal , op_not_equal , op_greater , op_greater_or_equal ,
  op_less , op_less_or_equal , op_bit_true , op_bit_false ,
  op_modulo_zero , op_modulo_non_zero
}
 The comparison operator applied between the condition's two operands. More...
 

Public Member Functions

 Condition (const operator_t opType)
 Constructs a condition with the given operator.
 
virtual bool evaluate () const =0
 Evaluates the condition against the current values of its operands.
 

Static Public Member Functions

static operator_t getOperatorType (const std::string &operation)
 Maps a configuration operator string to its operator_t value.
 

Protected Attributes

const operator_t _opType
 The comparison operator selected for this condition.
 

Detailed Description

Abstract base for a single boolean comparison.

A condition compares two operands (each either a game Property or an immediate value) with a relational/bitwise/modulo operator. Rules and input sets hold lists of conditions that must all evaluate to true (logical AND). The concrete, type-specialized implementation is _vCondition.

Definition at line 22 of file condition.hpp.

Member Enumeration Documentation

◆ operator_t

The comparison operator applied between the condition's two operands.

Enumerator
op_equal 

operand1 == operand2 (config operator "==")

op_not_equal 

operand1 != operand2 (config operator "!=")

op_greater 

operand1 > operand2 (config operator ">")

op_greater_or_equal 

operand1 >= operand2 (config operator ">=")

op_less 

operand1 < operand2 (config operator "<")

op_less_or_equal 

operand1 <= operand2 (config operator "<=")

op_bit_true 

the bit of operand1 at index operand2 is set (config operator "BitTrue")

op_bit_false 

the bit of operand1 at index operand2 is clear (config operator "BitFalse")

op_modulo_zero 

operand1 % operand2 == 0 (config operator "%0")

op_modulo_non_zero 

operand1 % operand2 != 0 (config operator "%N")

Definition at line 26 of file condition.hpp.

Constructor & Destructor Documentation

◆ Condition()

jaffarPlus::Condition::Condition ( const operator_t  opType)
inline

Constructs a condition with the given operator.

Parameters
opTypeThe comparison operator to apply when the condition is evaluated.

Definition at line 44 of file condition.hpp.

Member Function Documentation

◆ evaluate()

virtual bool jaffarPlus::Condition::evaluate ( ) const
pure virtual

Evaluates the condition against the current values of its operands.

Returns
true if the comparison holds, false otherwise.

Implemented in jaffarPlus::_vCondition< T >.

◆ getOperatorType()

static operator_t jaffarPlus::Condition::getOperatorType ( const std::string &  operation)
inlinestatic

Maps a configuration operator string to its operator_t value.

Parameters
operationThe operator token from the config (e.g. "==", ">=", "BitTrue", "%0").
Returns
The matching operator enum value.
Exceptions
Alogic error if the token is not a recognized operator.

Definition at line 59 of file condition.hpp.

Member Data Documentation

◆ _opType

const operator_t jaffarPlus::Condition::_opType
protected

The comparison operator selected for this condition.

Definition at line 79 of file condition.hpp.


The documentation for this class was generated from the following file: