Class: YPetri::Simulation::NodeRepresentation

Inherits:
Object
  • Object
show all
Defined in:
lib/y_petri/simulation/node_representation.rb

Overview

Representation of a YPetri node inside a YPetri::Simulation instance. An instance of YPetri::Simulation does is constructed based on an instance of YPetri::Net, but not directly work with Petri net nodes (that is, it does not work with instances of YPetri::Place or YPetri::Transition). Instead, it creates its own internal representations of the nodes of the Petri net it is constructed from – instances of NodeRepresentation.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(net_node_id) ⇒ NodeRepresentation

Expect a single YPetri node (place or transition) as an argument.


20
21
22
# File 'lib/y_petri/simulation/node_representation.rb', line 20

def initialize net_node_id
  @source = net.node( net_node_id )
end

Instance Attribute Details

#sourceObject (readonly)

source place


14
15
16
# File 'lib/y_petri/simulation/node_representation.rb', line 14

def source
  @source
end

Instance Method Details

#to_sObject

Tweak the #to_s method to give the node representations the inspect string of type #<Name>.


27
28
29
# File 'lib/y_petri/simulation/node_representation.rb', line 27

def to_s
  "#<#{super}>"
end