Class: Plexus::Arc
Class Method Summary (collapse)
-
+ (Object) [](p_source, p_target, p_label = nil)
Shortcut constructor.
Instance Method Summary (collapse)
-
- (Object) <=>(rhs)
Sort support.
-
- (Boolean) eql?(other)
(also: #==)
Ignore labels for equality.
-
- (Object) hash
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!).
-
- (Arc) initialize(p_source, p_target, p_label = nil)
constructor
A new instance of Arc.
- - (Object) inspect
-
- (Object) reverse
Returns (v,u) if self == (u,v).
- - (Object) to_s
Constructor Details
- (Arc) initialize(p_source, p_target, p_label = nil)
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
- (Object) <=>(rhs)
Sort support.
27 28 29 |
# File 'lib/plexus/arc.rb', line 27 def <=>(rhs) [source, target] <=> [rhs.source, rhs.target] end |
- (Boolean) eql?(other) 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 |
- (Object) hash
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 |
- (Object) inspect
53 54 55 |
# File 'lib/plexus/arc.rb', line 53 def inspect "#{self.class.to_s}[#{source.inspect},#{target.inspect},#{label.inspect}]" end |
- (Object) reverse
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 |