Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/make/src/classes/build/tools/jdwpgen/ConstantSetNode.java
32287 views
/*1* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package build.tools.jdwpgen;2627import java.util.*;28import java.io.*;2930class ConstantSetNode extends AbstractNamedNode {3132/**33* The mapping between a constant and its value.34*/35protected static final Map<String, String> constantMap = new HashMap<>();3637void prune() {38List<Node> addons = new ArrayList<>();3940if (!addons.isEmpty()) {41components.addAll(addons);42}43super.prune();44}4546void constrainComponent(Context ctx, Node node) {47if (node instanceof ConstantNode) {48node.constrain(ctx);49constantMap.put(name + "_" + ((ConstantNode) node).getName(), node.comment());50} else {51error("Expected 'Constant', got: " + node);52}53}5455void document(PrintWriter writer) {56writer.println("<h4><a name=\"" + context.whereC + "\">" + name +57" Constants</a></h4>");58writer.println(comment());59writer.println("<dd><table border=1 cellpadding=3 cellspacing=0 width=\"90%\" summary=\"\"><tr>");60writer.println("<th width=\"20%\"><th width=\"5%\"><th width=\"65%\">");61ConstantNode n;62for (Node node : components) {63n = (ConstantNode)node;64writer.println("<a NAME=\"" + name + "_" + n.name + "\"></a>");65n.document(writer);66}67writer.println("</table>");68}6970void documentIndex(PrintWriter writer) {71writer.print("<li><a href=\"#" + context.whereC + "\">");72writer.println(name() + "</a> Constants");73// writer.println("<ul>");74// for (Iterator it = components.iterator(); it.hasNext();) {75// ((Node)it.next()).documentIndex(writer);76// }77// writer.println("</ul>");78}7980void genJavaClassSpecifics(PrintWriter writer, int depth) {81}8283void genJava(PrintWriter writer, int depth) {84genJavaClass(writer, depth);85}8687public static String getConstant(String key){88String com = constantMap.get(key);89if(com == null){90return "";91} else {92return com;93}94}9596}979899