Class: Ibex::Impact::Edge
- Inherits:
-
Object
- Object
- Ibex::Impact::Edge
- Defined in:
- lib/ibex/impact/graph.rb,
sig/ibex/impact/graph.rbs
Overview
A grammar dependency edge with enough origin information for a witness.
Instance Attribute Summary collapse
- #kind ⇒ Symbol readonly
- #position ⇒ Integer? readonly
- #production ⇒ Integer? readonly
- #source ⇒ Integer readonly
- #target ⇒ Integer readonly
Instance Method Summary collapse
-
#initialize(source:, target:, kind:, production: nil, position: nil) ⇒ Edge
constructor
A new instance of Edge.
- #sort_key ⇒ Array[Integer | Symbol | nil]
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 ⇒ Symbol (readonly)
12 13 14 |
# File 'lib/ibex/impact/graph.rb', line 12 def kind @kind end |
#position ⇒ Integer? (readonly)
14 15 16 |
# File 'lib/ibex/impact/graph.rb', line 14 def position @position end |
#production ⇒ Integer? (readonly)
13 14 15 |
# File 'lib/ibex/impact/graph.rb', line 13 def production @production end |
#source ⇒ Integer (readonly)
10 11 12 |
# File 'lib/ibex/impact/graph.rb', line 10 def source @source end |
#target ⇒ Integer (readonly)
11 12 13 |
# File 'lib/ibex/impact/graph.rb', line 11 def target @target end |
Instance Method Details
#sort_key ⇒ Array[Integer | Symbol | nil]
27 28 29 |
# File 'lib/ibex/impact/graph.rb', line 27 def sort_key [@source, @target, @production || -1, @position || -1, @kind] end |