Class: NetworkElement

Inherits:
Object
  • Object
show all
Includes:
SerializeBehavior
Defined in:
lib/network_entities/abstracts/network_element.rb

Direct Known Subclasses

Host, Link, Router

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SerializeBehavior

#transform_to_output_representation, #validate_concrete_builder

Constructor Details

#initialize(id) ⇒ NetworkElement



8
9
10
11
12
13
# File 'lib/network_entities/abstracts/network_element.rb', line 8

def initialize(id)
   @my_number = self.increase_quantity_in_one 
  @id = id
   @out_elements = [] 
   @in_elements = []
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/network_entities/abstracts/network_element.rb', line 6

def id
  @id
end

#in_elementsObject (readonly)

Returns the value of attribute in_elements.



6
7
8
# File 'lib/network_entities/abstracts/network_element.rb', line 6

def in_elements
  @in_elements
end

#my_numberObject (readonly)

Returns the value of attribute my_number.



6
7
8
# File 'lib/network_entities/abstracts/network_element.rb', line 6

def my_number
  @my_number
end

#out_elementsObject (readonly)

Returns the value of attribute out_elements.



6
7
8
# File 'lib/network_entities/abstracts/network_element.rb', line 6

def out_elements
  @out_elements
end

Instance Method Details

#increase_quantity_in_oneObject



15
16
17
18
# File 'lib/network_entities/abstracts/network_element.rb', line 15

def increase_quantity_in_one
    @@quantity ||= 0
    @@quantity += 1
end