Class: PetriNet::ReachabilityGraph::Edge
- Defined in:
- lib/petri_net/reachability_graph/edge.rb
Instance Attribute Summary collapse
-
#graph ⇒ Object
Graph this edge belongs to.
-
#id ⇒ Object
readonly
Unique ID.
-
#name ⇒ Object
readonly
Human readable name.
-
#probability ⇒ Object
Probability of the relating transition.
Attributes inherited from Base
Instance Method Summary collapse
- #==(object) ⇒ Object
-
#initialize(options = {}) {|_self| ... } ⇒ Edge
constructor
Creates an edge for PetriNet::ReachabilityGraph.
- #to_gv ⇒ Object
- #to_s ⇒ Object
-
#validate ⇒ Object
Validates the data holded by this edge, this will be used while adding the edge to the graph.
Methods inherited from Base
Constructor Details
#initialize(options = {}) {|_self| ... } ⇒ Edge
Creates an edge for PetriNet::ReachabilityGraph
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/petri_net/reachability_graph/edge.rb', line 12 def initialize( = {}, &block) @id = next_object_id @name = ([:name] or "Edge#{@id}") @description = ([:description] or "Edge #{@id}") @source = [:source] @destination = [:destination] @label = ([:label] or @name) @probability = [:probability] yield self unless block.nil? end |
Instance Attribute Details
#graph ⇒ Object
Graph this edge belongs to
7 8 9 |
# File 'lib/petri_net/reachability_graph/edge.rb', line 7 def graph @graph end |
#id ⇒ Object (readonly)
Unique ID
5 6 7 |
# File 'lib/petri_net/reachability_graph/edge.rb', line 5 def id @id end |
#name ⇒ Object (readonly)
Human readable name
3 4 5 |
# File 'lib/petri_net/reachability_graph/edge.rb', line 3 def name @name end |
#probability ⇒ Object
Probability of the relating transition
9 10 11 |
# File 'lib/petri_net/reachability_graph/edge.rb', line 9 def probability @probability end |
Instance Method Details
#==(object) ⇒ Object
33 34 35 36 |
# File 'lib/petri_net/reachability_graph/edge.rb', line 33 def ==(object) return false unless object.class.to_s == "PetriNet::ReachabilityGraph::Edge" (@source == object.yource && @destination == oject.destination) end |
#to_gv ⇒ Object
29 30 31 |
# File 'lib/petri_net/reachability_graph/edge.rb', line 29 def to_gv "\t#{@source.gv_id} -> #{@destination.gv_id}#{probability_to_gv};\n" end |
#to_s ⇒ Object
37 38 39 |
# File 'lib/petri_net/reachability_graph/edge.rb', line 37 def to_s "#{@id}: #{@name} #{@source.id} -> #{@destination} )" end |
#validate ⇒ Object
Validates the data holded by this edge, this will be used while adding the edge to the graph
25 26 27 |
# File 'lib/petri_net/reachability_graph/edge.rb', line 25 def validate true end |