Class: TECSCDE::TECSModel::TmCPortArray

Inherits:
TmPortArray show all
Defined in:
lib/tecscde/tecs_model/tm_c_port_array.rb

Instance Attribute Summary

Attributes inherited from TmPortArray

#actual_size, #ports

Attributes inherited from TECSCDE::TmObject

#owner

Instance Method Summary collapse

Methods inherited from TmPortArray

#array?, #clone_for_undo, #delete, #delete_highlighted, #editable?, #get_member, #get_near_port, #get_port_for_new_join, #insert, #moved, #moved_edge, #setup_clone, #unsubscripted_array?

Methods inherited from TECSCDE::TmObject

#copy_from, #model, #modified

Constructor Details

#initialize(cell, port_def) ⇒ TmCPortArray

Returns a new instance of TmCPortArray.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/tecscde/tecs_model/tm_c_port_array.rb', line 56

def initialize(cell, port_def)
  # p "TmCPortArray port_def:#{port_def}"
  @port_def = port_def
  @owner = cell
  if port_def.get_array_size == "[]"
    @actual_size = 1
  else
    @actual_size = port_def.get_array_size
  end

  @ports = []
  (0..(@actual_size - 1)).each do |subscript|
    # p "TmCPortArray: length=#{@ports.length}  subscript=#{subscript}"
    @ports << TmCPort.new(self, port_def, subscript)
  end
  modified {}
end

Instance Method Details

#complete?Boolean

TmCPortArray#complete?

Returns:

  • (Boolean)


83
84
85
# File 'lib/tecscde/tecs_model/tm_c_port_array.rb', line 83

def complete?
  @ports.all?(&:complete?)
end

#get_join(subscript) ⇒ Object



74
75
76
77
78
79
80
# File 'lib/tecscde/tecs_model/tm_c_port_array.rb', line 74

def get_join(subscript)
  return nil if subscript.nil?
  if 0 <= subscript && subscript < @actual_size
    @ports[subscript]
  end
  nil
end

#new_port(subscript) ⇒ Object

TmCPortArray#new_port



93
94
95
# File 'lib/tecscde/tecs_model/tm_c_port_array.rb', line 93

def new_port(subscript)
  TECSCDE::TECSModel::TmCPort.new(self, @port_def, subscript)
end

#optional?Boolean

TmCPortArray#optional?

Returns:

  • (Boolean)


88
89
90
# File 'lib/tecscde/tecs_model/tm_c_port_array.rb', line 88

def optional?
  @port_def.is_optional?
end