File: model/document/module-infobox.rb

Overview
Module Structure
Class Hierarchy
Code

Overview

Module Structure

  module: <Toplevel Module>
  module: TmDoc#9
  module: Model
  module: Document#11
  module: Module
  module: InfoBox#13
  class: InfoBox#15
inherits from
  Abstract ( TmDoc::Model::Document::Abstraction::InfoBox )
has properties
method: print #16
  module: EntryRow#31
  class: SeqOfEntryRow#33
  class: Module#37
inherits from
  NamedEntryRow ( TmDoc::Model::Document::Abstraction::InfoBox::EntryRow )
has properties
attribute: a_link_to_module [R] #38
method: initialize / 2 #41
method: to_s #51
  class: Class#60
  class: Constant#64
inherits from
  Property ( TmDoc::Model::Document::Abstraction::InfoBox::EntryRow )
has properties
method: initialize / 3 #65
  class: Alias#76
inherits from
  Property ( TmDoc::Model::Document::Abstraction::InfoBox::EntryRow )
has properties
attribute: orig_name [R] #77
method: initialize / 6 #80
  class: Attribute#98
inherits from
  Property ( TmDoc::Model::Document::Abstraction::InfoBox::EntryRow )
has properties
attribute: accessor [R] #99
method: initialize / 6 #102
  class: Method#120
inherits from
  Property ( TmDoc::Model::Document::Abstraction::InfoBox::EntryRow )
has properties
attribute: num_of_args [R] #121
method: initialize / 6 #124
method: to_s #140
  class: Location#155
inherits from
  Abstract ( TmDoc::Model::Document::Abstraction::InfoBox::EntryRow )
has properties
attribute: links_to_line [R] #156
attribute: a_link_to_file [R] #156
method: initialize / 2 #159
method: to_s #170
  module: Row#185

Class Hierarchy

Object ( Builtin-Module )
Abstract ( TmStd::Lsm )
Abstract ( TmStd::Lsm::Product )
GenericDocument ( TmDoc::Model::Abstraction )
Document ( TmDoc::Model::Document::Abstraction )
Abstract ( TmDoc::Model::Document::Abstraction::InfoBox::EntryRow )
Row ( TmDoc::Model::Document::Abstraction::InfoBox )
Abstract ( TmDoc::Model::Document::Abstraction::InfoBox )
Abstract ( TmStd::Lsm::Collection )

Code

   1  # $Id: module-infobox.rb,v 1.12 2012/01/23 11:14:44 machan Exp $
   2 
   3  require 'tmdoc/constant'
   4  require 'tmdoc/model/object'
   5  require 'tmdoc/model/document/abstraction'
   6  require 'tmdoc/model/document/link'
   7 
   8 
   9  module TmDoc
  10 
  11  module Model::Document
  12 
  13  module Module::InfoBox
  14 
  15  class InfoBox < Abstraction::InfoBox::Abstract
  16      def print
  17          self.rows.each_with_index do |row, row_index|
  18              LOG::Debug.log "\t\t[%d] %s", row_index, row.class.to_s
  19              row.entry_rows.each_with_index do |ent_row, ent_row_index|
  20                  LOG::Debug.log(
  21                      "\t\t\t[%d] %s", ent_row_index, ent_row.class.to_s
  22                  )
  23                  LOG::Debug.log "\t\t\t\t%s", ent_row.to_s
  24              end
  25          end
  26      end
  27  end
  28 
  29 
  30 
  31  module EntryRow
  32 
  33  class SeqOfEntryRow < Abstraction::InfoBox::EntryRow::SeqOfEntryRow; end
  34 
  35 
  36 
  37  class Module < Abstraction::InfoBox::EntryRow::NamedEntryRow
  38      attr_reader :a_link_to_module
  39 
  40 
  41      def initialize(name, a_link_to_module)
  42          ASSERT.kind_of name,                String
  43          ASSERT.kind_of a_link_to_module,    Link::Module
  44 
  45          super(name)
  46 
  47          @a_link_to_module = a_link_to_module
  48      end
  49 
  50 
  51      def to_s
  52          str = super(self.a_link_to_module.to_s)
  53 
  54          ASSERT.kind_of str, String
  55      end
  56  end
  57 
  58 
  59 
  60  class Class < Module; end
  61 
  62 
  63 
  64  class Constant < Abstraction::InfoBox::EntryRow::Property
  65      def initialize(name, tag, a_link_to_line)
  66          ASSERT.kind_of  name,           String
  67          ASSERT.kind_of  tag,            Symbol
  68          ASSERT.kind_of  a_link_to_line, MDL::Line
  69 
  70          super(name, tag, a_link_to_line, 0, 0)
  71      end
  72  end
  73 
  74 
  75 
  76  class Alias < Abstraction::InfoBox::EntryRow::Property
  77      attr_reader :orig_name
  78 
  79 
  80      def initialize(
  81          name, tag, a_link_to_line, uniq_num, max_uniq_num, orig_name
  82      )
  83          ASSERT.kind_of  name,           String
  84          ASSERT.kind_of  tag,            Symbol
  85          ASSERT.kind_of  a_link_to_line, MDL::Line
  86          ASSERT.kind_of  uniq_num,       Integer
  87          ASSERT.kind_of  max_uniq_num,   Integer
  88          ASSERT.kind_of  orig_name,      String
  89 
  90          super(name, tag, a_link_to_line, uniq_num, max_uniq_num)
  91 
  92          @orig_name = orig_name
  93      end
  94  end
  95 
  96 
  97 
  98  class Attribute < Abstraction::InfoBox::EntryRow::Property
  99      attr_reader :accessor
 100 
 101 
 102      def initialize(
 103          name, tag, a_link_to_line, uniq_num, max_uniq_num, accessor
 104      )
 105          ASSERT.kind_of  name,           String
 106          ASSERT.kind_of  tag,            Symbol
 107          ASSERT.kind_of  a_link_to_line, MDL::Line
 108          ASSERT.kind_of  uniq_num,       Integer
 109          ASSERT.kind_of  max_uniq_num,   Integer
 110          ASSERT.kind_of  accessor,       String
 111 
 112          super(name, tag, a_link_to_line, uniq_num, max_uniq_num)
 113 
 114          @accessor = accessor
 115      end
 116  end
 117 
 118 
 119 
 120  class Method < Abstraction::InfoBox::EntryRow::Property
 121      attr_reader :num_of_args
 122 
 123 
 124      def initialize(
 125          name, tag, a_link_to_line, uniq_num, max_uniq_num, num_of_args
 126      )
 127          ASSERT.kind_of  name,           String
 128          ASSERT.kind_of  tag,            Symbol
 129          ASSERT.kind_of  a_link_to_line, MDL::Line
 130          ASSERT.kind_of  uniq_num,       Integer
 131          ASSERT.kind_of  max_uniq_num,   Integer
 132          ASSERT.kind_of  num_of_args,    Integer
 133 
 134          super(name, tag, a_link_to_line, uniq_num, max_uniq_num)
 135 
 136          @num_of_args = num_of_args
 137      end
 138 
 139 
 140      def to_s
 141          str = super(
 142              if self.num_of_args > 0
 143                  format " / %d", self.num_of_args
 144              else
 145                  nil
 146              end
 147          )
 148 
 149          ASSERT.kind_of str, String
 150      end
 151  end
 152 
 153 
 154 
 155  class Location < Abstraction::InfoBox::EntryRow::Abstract
 156      attr_reader :links_to_line, :a_link_to_file
 157 
 158 
 159      def initialize(links_to_line, a_link_to_file)
 160          ASSERT.kind_of links_to_line,       Link::SeqOfLine
 161          ASSERT.kind_of a_link_to_file,      Link::File
 162 
 163          ASSERT.assert links_to_line.length >= 1
 164 
 165          @links_to_line  = links_to_line
 166          @a_link_to_file = a_link_to_file
 167      end
 168 
 169 
 170      def to_s
 171          str = format(
 172              "%s (%s)",
 173              self.links_to_line.map { |link| link.to_s }.join(', '),
 174              self.a_link_to_file.to_s
 175          )
 176 
 177          ASSERT.kind_of str, String
 178      end
 179  end
 180 
 181  end
 182 
 183 
 184 
 185  module Row
 186 
 187  class AboveModule       < Abstraction::InfoBox::Row; end
 188  class BelowModules      < Abstraction::InfoBox::Row; end
 189  class SiblingModules    < Abstraction::InfoBox::Row; end
 190  class ExtendeeModules   < Abstraction::InfoBox::Row; end
 191  class ExtenderModules   < Abstraction::InfoBox::Row; end
 192  class IncludeeModules   < Abstraction::InfoBox::Row; end
 193  class IncluderModules   < Abstraction::InfoBox::Row; end
 194  class Superclass        < Abstraction::InfoBox::Row; end
 195  class Subclasses        < Abstraction::InfoBox::Row; end
 196  class SiblingClasses    < Abstraction::InfoBox::Row; end
 197  class Properties        < Abstraction::InfoBox::Row; end
 198  class Locations         < Abstraction::InfoBox::Row; end
 199 
 200 
 201 
 202  class SeqOfRow < Abstraction::InfoBox::SeqOfRow; end
 203 
 204  end
 205 
 206  end # TmDoc::Model::Document::Module::InfoBox
 207 
 208  end # TmDoc::Model::Document
 209 
 210  end # TmDoc