Class: MiniKraken::Rela::BinaryRelation
- Inherits:
-
Core::Relation
- Object
- Core::Specification
- Core::Relation
- MiniKraken::Rela::BinaryRelation
- Defined in:
- lib/mini_kraken/rela/binary_relation.rb
Overview
A binary relation between sets X and Y is a subset of the Cartesian product X × Y; that is, it is a set of ordered pairs (x, y) consisting of elements x in X and y in Y.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Core::Specification
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(aName) ⇒ BinaryRelation
constructor
A new instance of BinaryRelation.
Methods inherited from Core::Relation
Methods inherited from Core::Specification
#check_arity, #inspect, #variadic?
Constructor Details
#initialize(aName) ⇒ BinaryRelation
Returns a new instance of BinaryRelation.
12 13 14 15 |
# File 'lib/mini_kraken/rela/binary_relation.rb', line 12 def initialize(aName) super(aName, 2) freeze end |
Class Method Details
.symmetric ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/mini_kraken/rela/binary_relation.rb', line 17 def self.symmetric define_method :commute_cond do |arg1, arg2, ctx| w1 = weight_arg(arg1, ctx) w2 = weight_arg(arg2, ctx) if w2 > w1 [arg2, arg1] else [arg1, arg2] end end end |