author | ctornqvi |
Fri, 19 Aug 2016 18:20:22 +0200 | |
changeset 40632 | 8cf7f396360e |
parent 23010 | 6dadb192ad81 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
23010
6dadb192ad81
8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents:
21805
diff
changeset
|
2 |
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
package build.tools.jdwpgen; |
|
27 |
||
28 |
import java.util.*; |
|
29 |
import java.io.*; |
|
30 |
||
31 |
class ConstantSetNode extends AbstractNamedNode { |
|
32 |
||
33 |
/** |
|
34 |
* The mapping between a constant and its value. |
|
35 |
*/ |
|
10110 | 36 |
protected static final Map<String, String> constantMap = new HashMap<>(); |
2 | 37 |
|
38 |
void prune() { |
|
10110 | 39 |
List<Node> addons = new ArrayList<>(); |
2 | 40 |
|
41 |
if (!addons.isEmpty()) { |
|
42 |
components.addAll(addons); |
|
43 |
} |
|
44 |
super.prune(); |
|
45 |
} |
|
46 |
||
47 |
void constrainComponent(Context ctx, Node node) { |
|
48 |
if (node instanceof ConstantNode) { |
|
49 |
node.constrain(ctx); |
|
50 |
constantMap.put(name + "_" + ((ConstantNode) node).getName(), node.comment()); |
|
51 |
} else { |
|
52 |
error("Expected 'Constant', got: " + node); |
|
53 |
} |
|
54 |
} |
|
55 |
||
56 |
void document(PrintWriter writer) { |
|
57 |
writer.println("<h4><a name=\"" + context.whereC + "\">" + name + |
|
58 |
" Constants</a></h4>"); |
|
59 |
writer.println(comment()); |
|
60 |
writer.println("<dd><table border=1 cellpadding=3 cellspacing=0 width=\"90%\" summary=\"\"><tr>"); |
|
61 |
writer.println("<th width=\"20%\"><th width=\"5%\"><th width=\"65%\">"); |
|
62 |
ConstantNode n; |
|
10110 | 63 |
for (Node node : components) { |
64 |
n = (ConstantNode)node; |
|
2 | 65 |
writer.println("<a NAME=\"" + name + "_" + n.name + "\"></a>"); |
66 |
n.document(writer); |
|
67 |
} |
|
68 |
writer.println("</table>"); |
|
69 |
} |
|
70 |
||
71 |
void documentIndex(PrintWriter writer) { |
|
72 |
writer.print("<li><a href=\"#" + context.whereC + "\">"); |
|
73 |
writer.println(name() + "</a> Constants"); |
|
74 |
// writer.println("<ul>"); |
|
75 |
// for (Iterator it = components.iterator(); it.hasNext();) { |
|
76 |
// ((Node)it.next()).documentIndex(writer); |
|
77 |
// } |
|
78 |
// writer.println("</ul>"); |
|
79 |
} |
|
80 |
||
81 |
void genJavaClassSpecifics(PrintWriter writer, int depth) { |
|
82 |
} |
|
83 |
||
84 |
void genJava(PrintWriter writer, int depth) { |
|
85 |
genJavaClass(writer, depth); |
|
86 |
} |
|
87 |
||
88 |
public static String getConstant(String key){ |
|
51 | 89 |
String com = constantMap.get(key); |
2 | 90 |
if(com == null){ |
91 |
return ""; |
|
92 |
} else { |
|
93 |
return com; |
|
94 |
} |
|
95 |
} |
|
96 |
||
97 |
} |