ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/reports/DBReporter/NodePage.java
Revision: 1.1
Committed: Thu Jan 11 19:03:39 2001 UTC (24 years, 11 months ago) by pjm2
Branch: MAIN
Error occurred while calculating annotation data.
Log Message:
USed at the moment to generator (or at least find) which 4th level index
pages we are going to make.

File Contents

# Content
1 //---PACKAGE DECLARATION---
2
3
4
5 //---IMPORTS---
6
7
8
9 import java.io.*;
10
11 import java.util.*;
12
13
14
15 /**
16
17 * Produces non-root index pages for reports.
18 * (levels 2, 3 and 4)
19
20 *
21
22 * @author $Author: $
23
24 * @version $Id: $
25
26 */
27
28 public class NodePage {
29
30
31
32 //---FINAL ATTRIBUTES---
33
34
35
36 /**
37
38 * The current CVS revision of this class
39
40 */
41
42 public final String REVISION = "$Revision: $";
43
44
45
46 //---STATIC METHODS---
47
48
49
50 //---CONSTRUCTORS---
51
52
53
54 public NodePage(String reportDirectory, LinkedList pages){
55
56 _reportDirectory = reportDirectory;
57 _pages = pages;
58
59 }
60
61
62
63 //---PUBLIC METHODS---
64
65
66
67
68 public void generateAllLevels() {
69 this.generateLevel(4, 0, 1, 2);
70 this.generateLevel(4, 0, 2, 1);
71 this.generateLevel(4, 1, 0, 2);
72 this.generateLevel(4, 1, 2, 0);
73 this.generateLevel(4, 2, 0, 1);
74 this.generateLevel(4, 2, 1, 0);
75 }
76
77 private LinkedList generateLevel(int level, int indexA, int indexB, int indexC) {
78 LinkedList pagesMade = new LinkedList();
79 switch (level) {
80 case 4:
81
82 // Select unique pairs of elements
83 HashSet set = new HashSet();
84
85 // Populate the HashSets.
86 Iterator it = _pages.iterator();
87 while (it.hasNext()) {
88 String[] pair = new String[2];
89 pair[0] = ((String[])it.next())[indexA];
90 pair[1] = ((String[])it.next())[indexB];
91 set.add(pair);
92 }
93
94 Iterator setit = set.iterator();
95 while (setit.hasNext()){
96 String[] pair = (String[])setit.next();
97 it = _pages.iterator();
98 while (it.hasNext()){
99 String[] entry = (String[])it.next();
100 if (pair[indexA] == entry[indexA] && pair[indexB] == entry[indexB]) {
101 pagesMade.add(entry);
102 }
103 }
104 }
105
106 String[] descriptions = new String[3];
107 descriptions[0] = "machine name";
108 descriptions[1] = "time period";
109 descriptions[2] = "report type";
110 it = pagesMade.iterator();
111 while (it.hasNext()){
112 String[] entry = (String[])it.next();
113 System.out.println("4th level index: "+descriptions[indexC]+"s available for "+descriptions[indexA]+entry[indexA]+" and "+descriptions[indexB]+entry[indexB]);
114 }
115
116 break;
117 case 3:
118 // bla
119 break;
120 case 2:
121 //bla
122 break;
123 }
124 return pagesMade;
125 }
126
127
128 /**
129
130 * Overrides the {@link java.lang.Object#toString() Object.toString()}
131
132 * method to provide clean logging (every class should have this).
133
134 *
135
136 * @return the name of this class and its CVS revision
137
138 */
139
140 public String toString() {
141
142 return this.getClass().getName() + "(" + REVISION.substring(11, REVISION.length() - 2) + ")";
143
144 }
145
146
147
148 //---PRIVATE METHODS---
149
150
151
152 //---ACCESSOR/MUTATOR METHODS---
153
154
155
156 //---ATTRIBUTES---
157
158
159 String _reportDirectory;
160 LinkedList _pages;
161
162
163 //---STATIC ATTRIBUTES---
164
165
166
167 }
168