1 # $Id: source.rb,v 1.4 2011/12/08 11:33:17 machan Exp $
2
3 require 'tmdoc/constant'
4 require 'tmdoc/model/object'
5 require 'tmdoc/model/document/abstraction'
6 require 'tmdoc/model/document/node'
7 require 'tmdoc/model/document/link'
8
9
10 module TmDoc
11
12 module Model::Document
13
14 module Source
15
16 class Source < Abstraction::Document
17 attr_reader :name,
18 :a_module_structure,
19 :a_class_hierarchy,
20 :map_of_line_num_to_links
21
22
23 def initialize(
24 name,
25 a_module_structure, a_class_hierarchy,
26 map_of_line_num_to_links
27 )
28 ASSERT.kind_of name, String
29 ASSERT.opt_kind_of a_module_structure, MDN::ModuleStructure
30 ASSERT.opt_kind_of a_class_hierarchy, MDN::ClassHierarchy
31 ASSERT.kind_of(
32 map_of_line_num_to_links, MDL::MapOfLineNumToLinks
33 )
34
35 @name = name
36 @a_module_structure = a_module_structure
37 @a_class_hierarchy = a_class_hierarchy
38 @map_of_line_num_to_links = map_of_line_num_to_links
39 end
40
41
42 def to_s
43 ASSERT.kind_of self.name, String
44 end
45
46
47 def print
48 LOG::Debug.log(
49 "\t---- %s: %s ----",
50 self.class.to_s, self.name
51 )
52
53 ms = self.map_of_line_num_to_links
54 unless ms.empty?
55 LOG::Debug.log "\tmap_of_line_num_to_links:"
56 for num in ms.domains.sort
57 LOG::Debug.log "\t\tline_num: %d", num
58 LOG::Debug.log "\t\tlinks:"
59 for lk in ms.at num
60 LOG::Debug.log "\t\t\t%s", lk.to_s
61 end
62 end
63 end
64
65 nil
66 end
67 end
68
69
70
71 class SeqOfSource < Abstraction::SeqOfDocument
72 LSM_ELEMENT_CLASS = Source
73 end
74
75 end # TmDoc::Model::Document::Source
76
77 end # TmDoc::Model::Document
78
79 end # TmDoc