Class: JavaClass::Dependencies::Edge
- Defined in:
- lib/javaclass/dependencies/edge.rb
Overview
An edge in the Graph of dependencies. An edge knows it’s source and destination details.
- Author
-
Peter Kofler
Instance Attribute Summary collapse
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(source, target) ⇒ Edge
constructor
A new instance of Edge.
- #to_s ⇒ Object
Constructor Details
#initialize(source, target) ⇒ Edge
Returns a new instance of Edge.
11 12 13 14 |
# File 'lib/javaclass/dependencies/edge.rb', line 11 def initialize(source, target) @source = source @target = target end |
Instance Attribute Details
#source ⇒ Object (readonly)
Returns the value of attribute source.
8 9 10 |
# File 'lib/javaclass/dependencies/edge.rb', line 8 def source @source end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
9 10 11 |
# File 'lib/javaclass/dependencies/edge.rb', line 9 def target @target end |
Instance Method Details
#<=>(other) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/javaclass/dependencies/edge.rb', line 30 def <=>(other) res = @target <=> other.target if res == 0 res = @source <=> other.source end res end |
#==(other) ⇒ Object Also known as: eql?
20 21 22 |
# File 'lib/javaclass/dependencies/edge.rb', line 20 def ==(other) @source == other.source && @target == other.target end |
#hash ⇒ Object
26 27 28 |
# File 'lib/javaclass/dependencies/edge.rb', line 26 def hash [@source, @target].hash end |
#to_s ⇒ Object
16 17 18 |
# File 'lib/javaclass/dependencies/edge.rb', line 16 def to_s "#{@target} (#{@source})" end |