Class: Plexus::Arc
Class Method Summary collapse
-
.[](p_source, p_target, p_label = nil) ⇒ Object
Shortcut constructor.
Instance Method Summary collapse
-
#<=>(rhs) ⇒ Object
Sort support.
-
#eql?(other) ⇒ Boolean
(also: #==)
Ignore labels for equality.
-
#hash ⇒ Object
Hash is defined in such a way that label is not part of the hash value FIXME: I had to get rid of that in order to make to_dot_graph work, but I can’t figure it out (doesn’t show up in the stack!).
-
#initialize(p_source, p_target, p_label = nil) ⇒ Arc
constructor
A new instance of Arc.
- #inspect ⇒ Object
-
#reverse ⇒ Object
Returns (v,u) if self == (u,v).
- #to_s ⇒ Object
Constructor Details
#initialize(p_source, p_target, p_label = nil) ⇒ Arc
Returns a new instance of Arc.
10 11 12 |
# File 'lib/plexus/arc.rb', line 10 def initialize(p_source, p_target, p_label = nil) super(p_source, p_target, p_label) end |
Class Method Details
Instance Method Details
#<=>(rhs) ⇒ Object
Sort support.
27 28 29 |
# File 'lib/plexus/arc.rb', line 27 def <=>(rhs) [source, target] <=> [rhs.source, rhs.target] end |
#eql?(other) ⇒ Boolean Also known as: ==
Ignore labels for equality.
15 16 17 18 |
# File 'lib/plexus/arc.rb', line 15 def eql?(other) same_class = self.class.ancestors.include?(other.class) || other.class.ancestors.include?(self.class) same_class && target == other.target && source == other.source end |
#hash ⇒ Object
Hash is defined in such a way that label is not part of the hash value FIXME: I had to get rid of that in order to make to_dot_graph work, but I can’t figure it out (doesn’t show up in the stack!)
42 43 44 |
# File 'lib/plexus/arc.rb', line 42 def hash source.hash ^ (target.hash + 1) end |
#inspect ⇒ Object
53 54 55 |
# File 'lib/plexus/arc.rb', line 53 def inspect "#{self.class.to_s}[#{source.inspect},#{target.inspect},#{label.inspect}]" end |
#reverse ⇒ Object
Returns (v,u) if self == (u,v).
22 23 24 |
# File 'lib/plexus/arc.rb', line 22 def reverse() self.class.new(target, source, label) end |