Class: ActiveFacts::CQL::Compiler::Reciprocal
- Defined in:
- lib/activefacts/cql/compiler/expression.rb
Instance Attribute Summary collapse
-
#divisor ⇒ Object
Returns the value of attribute divisor.
Attributes inherited from Operation
#binding, #certainty, #clause, #fact_type, #player, #role, #role_ref
Instance Method Summary collapse
- #identify_player(context) ⇒ Object
-
#initialize(divisor) ⇒ Reciprocal
constructor
A new instance of Reciprocal.
-
#inspect ⇒ Object
def result_type_name(context) raise hell end.
- #operator ⇒ Object
- #refs ⇒ Object
- #to_s ⇒ Object
Methods inherited from Operation
#bind, #conjunction, #identify_other_players, #identify_players_with_role_name, #is_equality_comparison, #is_existential_type, #is_naked_object_type, #leading_adjective, #literal, #match_existing_fact_type, #nested_clauses, #objectification_of, #objectified_as, #operands, #result_type_name, #result_value_type, #role_name, #side_effects, #trailing_adjective, #value_constraint
Constructor Details
#initialize(divisor) ⇒ Reciprocal
Returns a new instance of Reciprocal.
322 323 324 |
# File 'lib/activefacts/cql/compiler/expression.rb', line 322 def initialize divisor @divisor = divisor end |
Instance Attribute Details
#divisor ⇒ Object
Returns the value of attribute divisor.
321 322 323 |
# File 'lib/activefacts/cql/compiler/expression.rb', line 321 def divisor @divisor end |
Instance Method Details
#identify_player(context) ⇒ Object
334 335 336 337 338 339 340 341 342 |
# File 'lib/activefacts/cql/compiler/expression.rb', line 334 def identify_player context @player || begin # The player in @divisor has already been identified # REVISIT: Calculate the units of the result from the units in @divisor # REVISIT: Do we want integer division? v = context.vocabulary @player = v.constellation.ValueType(v, 'Real', :concept => :new) end end |
#inspect ⇒ Object
def result_type_name(context)
raise hell
end
350 |
# File 'lib/activefacts/cql/compiler/expression.rb', line 350 def inspect; to_s; end |
#operator ⇒ Object
326 327 328 |
# File 'lib/activefacts/cql/compiler/expression.rb', line 326 def operator '1/' end |
#refs ⇒ Object
330 331 332 |
# File 'lib/activefacts/cql/compiler/expression.rb', line 330 def refs [@divisor] end |
#to_s ⇒ Object
352 353 354 |
# File 'lib/activefacts/cql/compiler/expression.rb', line 352 def to_s "reciprocal(#{factor.to_s})" end |