Class: Keisan::AST::UnaryIdentity
- Inherits:
-
UnaryOperator
- Object
- Node
- Parent
- Operator
- UnaryOperator
- Keisan::AST::UnaryIdentity
- Defined in:
- lib/keisan/ast/unary_identity.rb
Direct Known Subclasses
Constant Summary
Constants inherited from Operator
Operator::ARITIES, Operator::ARITY_PRIORITY_ASSOCIATIVITY, Operator::ASSOCIATIVITIES, Operator::ASSOCIATIVITY_OF_PRIORITY, Operator::PRIORITIES
Instance Attribute Summary
Attributes inherited from Parent
Class Method Summary collapse
Instance Method Summary collapse
- #differentiate(variable, context = nil) ⇒ Object
- #evaluate(context = nil) ⇒ Object
- #simplify(context = nil) ⇒ Object
- #value(context = nil) ⇒ Object
Methods inherited from UnaryOperator
arity, associativity, #child, #initialize, priority, #to_s
Methods inherited from Operator
#arity, arity, #associativity, associativity, associativity_of_priority, #blank_value, #evaluate_assignments, #initialize, priority, #priority, #symbol, #to_s
Methods inherited from Parent
#==, #deep_dup, #freeze, #initialize, #replace, #traverse, #unbound_functions, #unbound_variables
Methods inherited from Node
#!, #%, #&, #*, #**, #+, #+@, #-, #-@, #/, #<, #<<, #<=, #>, #>=, #>>, #^, #and, #coerce, #contains_a?, #deep_dup, #differentiated, #equal, #evaluate_assignments, #evaluated, #false?, #not_equal, #or, #replace, #replaced, #simplified, #to_cell, #to_node, #traverse, #true?, #unbound_functions, #unbound_variables, #well_defined?, #|, #~
Constructor Details
This class inherits a constructor from Keisan::AST::UnaryOperator
Class Method Details
.symbol ⇒ Object
12 13 14 |
# File 'lib/keisan/ast/unary_identity.rb', line 12 def self.symbol nil end |
Instance Method Details
#differentiate(variable, context = nil) ⇒ Object
20 21 22 23 |
# File 'lib/keisan/ast/unary_identity.rb', line 20 def differentiate(variable, context = nil) context ||= Context.new child.differentiate(variable, context).simplify(context) end |
#evaluate(context = nil) ⇒ Object
8 9 10 |
# File 'lib/keisan/ast/unary_identity.rb', line 8 def evaluate(context = nil) child.evaluate(context) end |
#simplify(context = nil) ⇒ Object
16 17 18 |
# File 'lib/keisan/ast/unary_identity.rb', line 16 def simplify(context = nil) child.simplify(context) end |
#value(context = nil) ⇒ Object
4 5 6 |
# File 'lib/keisan/ast/unary_identity.rb', line 4 def value(context = nil) child.value(context) end |