Class: Ibex::Impact::Edge
- Inherits:
-
Object
- Object
- Ibex::Impact::Edge
- Defined in:
- lib/ibex/impact/graph.rb
Overview
A grammar dependency edge with enough origin information for a witness.
Instance Attribute Summary collapse
-
#kind ⇒ Object
readonly
: Symbol.
-
#position ⇒ Object
readonly
: Integer?.
-
#production ⇒ Object
readonly
: Integer?.
-
#source ⇒ Object
readonly
: Integer.
-
#target ⇒ Object
readonly
: Integer.
Instance Method Summary collapse
-
#initialize(source:, target:, kind:, production: nil, position: nil) ⇒ Edge
constructor
A new instance of Edge.
- #sort_key ⇒ Object
Constructor Details
#initialize(source:, target:, kind:, production: nil, position: nil) ⇒ Edge
Returns a new instance of Edge.
17 18 19 20 21 22 23 24 |
# File 'lib/ibex/impact/graph.rb', line 17 def initialize(source:, target:, kind:, production: nil, position: nil) @source = source @target = target @kind = kind.to_sym @production = production @position = position freeze end |
Instance Attribute Details
#kind ⇒ Object (readonly)
: Symbol
12 13 14 |
# File 'lib/ibex/impact/graph.rb', line 12 def kind @kind end |
#position ⇒ Object (readonly)
: Integer?
14 15 16 |
# File 'lib/ibex/impact/graph.rb', line 14 def position @position end |
#production ⇒ Object (readonly)
: Integer?
13 14 15 |
# File 'lib/ibex/impact/graph.rb', line 13 def production @production end |
#source ⇒ Object (readonly)
: Integer
10 11 12 |
# File 'lib/ibex/impact/graph.rb', line 10 def source @source end |
#target ⇒ Object (readonly)
: Integer
11 12 13 |
# File 'lib/ibex/impact/graph.rb', line 11 def target @target end |
Instance Method Details
#sort_key ⇒ Object
27 28 29 |
# File 'lib/ibex/impact/graph.rb', line 27 def sort_key [@source, @target, @production || -1, @position || -1, @kind] end |