Class: Antlr4::Runtime::Triple
- Inherits:
-
Object
- Object
- Antlr4::Runtime::Triple
- Defined in:
- lib/antlr4/runtime/triple.rb
Instance Attribute Summary collapse
-
#a ⇒ Object
Returns the value of attribute a.
-
#b ⇒ Object
Returns the value of attribute b.
-
#c ⇒ Object
Returns the value of attribute c.
Instance Method Summary collapse
- #eql?(obj) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(a, b, c) ⇒ Triple
constructor
A new instance of Triple.
- #to_s ⇒ Object
Constructor Details
#initialize(a, b, c) ⇒ Triple
Returns a new instance of Triple.
7 8 9 10 11 |
# File 'lib/antlr4/runtime/triple.rb', line 7 def initialize(a, b, c) @a = a @b = b @c = c end |
Instance Attribute Details
#a ⇒ Object
Returns the value of attribute a.
3 4 5 |
# File 'lib/antlr4/runtime/triple.rb', line 3 def a @a end |
#b ⇒ Object
Returns the value of attribute b.
4 5 6 |
# File 'lib/antlr4/runtime/triple.rb', line 4 def b @b end |
#c ⇒ Object
Returns the value of attribute c.
5 6 7 |
# File 'lib/antlr4/runtime/triple.rb', line 5 def c @c end |
Instance Method Details
#eql?(obj) ⇒ Boolean
13 14 15 16 17 18 19 20 21 |
# File 'lib/antlr4/runtime/triple.rb', line 13 def eql?(obj) if obj == self return true else return false unless obj.is_a? Triple end ObjectEqualityComparator.instance.compare(a, obj.a).zero? && ObjectEqualityComparator.instance.compare(b, obj.b).zero? && ObjectEqualityComparator.instance.compare(c, obj.c).zero? end |
#hash ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/antlr4/runtime/triple.rb', line 23 def hash hash_code = RumourHash.hash([@a, @b, @c]) unless @_hash.nil? if hash_code == @_hash puts 'Same hash_code for Triple' else puts 'Different hash_code for Triple' end end @_hash = hash_code end |
#to_s ⇒ Object
36 37 38 |
# File 'lib/antlr4/runtime/triple.rb', line 36 def to_s '(' << @a.to_s << ',' << @b.to_s << ', ' << @c.to_s << ')' end |