Class: CAS::Equal
- Defined in:
- lib/functions/fnc-conditions.rb
Overview
This class is a Condition for two equal function
Instance Attribute Summary
Attributes inherited from Condition
Instance Method Summary collapse
-
#==(op) ⇒ Object
Return true if two functions are equal, false if different.
-
#call(fd) ⇒ Object
Function call will evaluate left and right functions to solve the relation.
-
#representative ⇒ Object
Saves some required elements.
Methods inherited from Condition
#args, #depend?, #diff, #dot_graph, #initialize, #inspect, #simplify, #subs, #to_code, #to_s
Constructor Details
This class inherits a constructor from CAS::Condition
Instance Method Details
#==(op) ⇒ Object
Return true if two functions are equal, false if different
* **argument**: `CAS::Op` operator to check against for equality
* **returns**: `TrueClass` or `FalseClass`
184 185 186 187 188 |
# File 'lib/functions/fnc-conditions.rb', line 184 def ==(op) CAS::Help.assert(op, CAS::Op) cond_f = ((@x == op.x) and (@y == op.y)) or ((@x == op.y) and (@y == op.x)) return (cond_f and (self.class == op.class)) end |
#call(fd) ⇒ Object
Function call will evaluate left and right functions to solve the relation
* **argument**: `Hash` with feed dictionary
* **returns**: `Trueclass` or `Falseclass`
174 175 176 177 178 |
# File 'lib/functions/fnc-conditions.rb', line 174 def call(fd) CAS::Help.assert fd, Hash return (@x.call(fd) == @y.call(fd)) end |
#representative ⇒ Object
Saves some required elements
164 165 166 167 |
# File 'lib/functions/fnc-conditions.rb', line 164 def representative @cond_type, @cond_repr = "==", "≡" self end |