Class: Port
- Inherits:
-
Object
- Object
- Port
- Defined in:
- lib/Port.rb
Overview
This class defines the Port object. Ports are instantiated each time an Inst object is created and they correspond to the conecptual “ports” found on each Inst. They are connected to other ports via a connection list, these connections are built by the Parser component and in sum form the data structure which models the digital circuit described by the input EDF file.
Instance Attribute Summary collapse
-
#connections ⇒ Object
Returns the value of attribute connections.
-
#inst ⇒ Object
Returns the value of attribute inst.
-
#name ⇒ Object
Returns the value of attribute name.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#add_connection(port) ⇒ Object
This method takes the name of another port as a string (port) and appends it to an array which holds the connection list attribute (connections) for the given port.
-
#initialize(inst, type, name) ⇒ Port
constructor
This method is called each time a new Port object is instantiated.
Constructor Details
#initialize(inst, type, name) ⇒ Port
This method is called each time a new Port object is instantiated. It takes a string argument for the Inst it belongs to (inst); the type of port it is, either input or output, (type); and its name (name), a concatenation of the name of the Inst to which it belongs and the port which it is representing.
12 13 14 15 16 17 |
# File 'lib/Port.rb', line 12 def initialize(inst, type, name) self.inst = inst self.connections = [] self.type = type self.name = name end |
Instance Attribute Details
#connections ⇒ Object
Returns the value of attribute connections.
7 8 9 |
# File 'lib/Port.rb', line 7 def connections @connections end |
#inst ⇒ Object
Returns the value of attribute inst.
7 8 9 |
# File 'lib/Port.rb', line 7 def inst @inst end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/Port.rb', line 7 def name @name end |
#type ⇒ Object
Returns the value of attribute type.
7 8 9 |
# File 'lib/Port.rb', line 7 def type @type end |
Instance Method Details
#add_connection(port) ⇒ Object
This method takes the name of another port as a string (port) and appends it to an array which holds the connection list attribute (connections) for the given port.
21 22 23 |
# File 'lib/Port.rb', line 21 def add_connection(port) self.connections << port end |