Improves handling of non-fiction classification data.
[quanlib.git] / classify / bookclass.rb
1 # Classification information for a single book
2
3 class BookClass
4   def initialize(grouping, title)
5     @author = nil
6     @ddc = nil
7     @grouping = grouping
8     @fast = []
9     @filename = []
10     @lcc = nil
11     @title = title
12   end
13
14   def author 
15     @author 
16   end
17   def author=(value) 
18     @author = value 
19   end
20   def ddc 
21     @ddc 
22   end
23   def ddc=(value) 
24     @ddc = value 
25   end
26   def fast 
27     @fast 
28   end
29   def filename
30     @filename
31   end
32   def filename=(value)
33     @filename = value
34   end
35   def grouping
36     @grouping
37   end
38   def lcc 
39     @lcc 
40   end
41   def lcc=(value) 
42     @lcc = value 
43   end
44   def title 
45     @title 
46   end
47
48   def add_fast(id)
49     @fast.push(id)
50   end
51
52   def inspect 
53     data = []
54
55     if nil != @author_name 
56       data.push('author_name="' + @author_name + '"') 
57     end
58     if nil != @ddc
59       data.push('ddc="' + @ddc + '"') 
60     end
61     if nil != @grouping 
62       data.push('grouping="' + @grouping + '"') 
63     end
64     if nil != @fast 
65       data.push('fast=' + @fast.inspect) 
66     end
67     if nil != @filename
68       data.push('filename=' + @filename.to_s + '"')
69     end
70     if nil != @lcc 
71       data.push('lcc="' + @lcc + '"') 
72     end
73     if nil != @title 
74       data.push('title="' + @title + '"') 
75     end
76
77     return '(BookClass:' + data.join(',') + ')'
78   end
79 end
80