/* */ private final void buildIDIndex(DOM document) /* */ { /* 322 */ setRootForKeys(document.getDocument()); /* */ /* 324 */ if ((document instanceof DOMEnhancedForDTM)) { /* 325 */ DOMEnhancedForDTM enhancedDOM = (DOMEnhancedForDTM) document; /* */ /* 330 */ if (enhancedDOM.hasDOMSource()) { /* 331 */ buildKeyIndex("##id", document); /* 332 */ return; /* */ } /* */ /* 335 */ Hashtable elementsByID = enhancedDOM.getElementsWithIDs(); /* */ /* 337 */ if (elementsByID == null) { /* 338 */ return; /* */ } /* */ /* 344 */ Enumeration idValues = elementsByID.keys(); /* 345 */ boolean hasIDValues = false; /* */ /* 347 */ while (idValues.hasMoreElements()) { /* 348 */ Object idValue = idValues.nextElement(); /* 349 */ int element = document.getNodeHandle(((Integer) elementsByID.get(idValue)).intValue()); /* */ /* 354 */ buildKeyIndex("##id", element, idValue); /* 355 */ hasIDValues = true; /* */ } /* */ /* 358 */ if (hasIDValues) /* 359 */ setKeyIndexDom("##id", document); /* */ } /* */ }
private Vector addAnchorString(Vector list, String field, double diff) { Vector topIndex = new Vector(); Hashtable topIndexParms, currEntry; double lastValue, currValue; if (list.size() == 0) return null; currEntry = (Hashtable) list.get(0); lastValue = Common.parseDouble((String) currEntry.get(field)) + diff; for (int i = 1; i < list.size(); i++) { currEntry = (Hashtable) list.get(i); currValue = Common.parseDouble((String) currEntry.get(field)); if (currValue >= lastValue) { // Values for navigation line topIndexParms = new Hashtable(); topIndexParms.put("HREF", Convert.toString(i)); topIndexParms.put("TEXT", Convert.toString(lastValue)); topIndex.add(topIndexParms); // add anchor entry to list currEntry.put("ANCHORNAME", Convert.toString(i)); currEntry.put("ANCHORTEXT", Convert.toString(lastValue)); lastValue = currValue + diff; } else { // clear value from previous run currEntry.put("ANCHORNAME", ""); currEntry.put("ANCHORTEXT", ""); } list.set(i, currEntry); } return topIndex; }
@Override public Hashtable Serialize() { Hashtable hash = super.Serialize(); hash.put("_equipType", _equipType.CastToInt()); hash.put("_price", _price); hash.put("_minTech", _minTech.CastToInt()); hash.put("_chance", _chance); return hash; }
/** Print the HTML tag. */ public static void printTag(PrintStream out, Hashtable atts) { out.print("<applet"); String v = (String) atts.get("codebase"); if (v != null) { out.print(" codebase=\"" + v + "\""); } v = (String) atts.get("code"); if (v == null) { v = "applet.class"; } out.print(" code=\"" + v + "\""); v = (String) atts.get("width"); if (v == null) { v = "150"; } out.print(" width=" + v); v = (String) atts.get("height"); if (v == null) { v = "100"; } out.print(" height=" + v); v = (String) atts.get("name"); if (v != null) { out.print(" name=\"" + v + "\""); } out.println(">"); // A very slow sorting algorithm int len = atts.size(); String params[] = new String[len]; len = 0; for (Enumeration e = atts.keys(); e.hasMoreElements(); ) { String param = (String) e.nextElement(); int i = 0; for (; i < len; i++) { if (params[i].compareTo(param) >= 0) { break; } } System.arraycopy(params, i, params, i + 1, len - i); params[i] = param; len++; } for (int i = 0; i < len; i++) { String param = params[i]; if (systemParam.get(param) == null) { out.println("<param name=" + param + " value=\"" + atts.get(param) + "\">"); } } out.println("</applet>"); }
/** * Add edges to the graph. Edges are added to/from every node in the graph and a distance is * computed for each of them. * * @param numvert the number of nodes in the graph */ private void addEdges(int numvert) { int count1 = 0; for (Vertex tmp = nodes[0]; tmp != null; tmp = tmp.next()) { Hashtable hash = tmp.neighbors(); for (int i = 0; i < numvert; i++) { if (i != count1) { int dist = computeDist(i, count1, numvert); hash.put(nodes[i], new Integer(dist)); } } count1++; } }
/** Scan tag */ public static Hashtable scanTag(Reader in) throws IOException { Hashtable atts = new Hashtable(); skipSpace(in); while (c >= 0 && c != '>') { String att = scanIdentifier(in); String val = ""; skipSpace(in); if (c == '=') { int quote = -1; c = in.read(); skipSpace(in); if ((c == '\'') || (c == '\"')) { quote = c; c = in.read(); } StringBuffer buf = new StringBuffer(); while ((c > 0) && (((quote < 0) && (c != ' ') && (c != '\t') && (c != '\n') && (c != '\r') && (c != '>')) || ((quote >= 0) && (c != quote)))) { buf.append((char) c); c = in.read(); } if (c == quote) { c = in.read(); } skipSpace(in); val = buf.toString(); } // statusMsgStream.println("PUT " + att + " = '" + val + "'"); if (!val.equals("")) { atts.put(att.toLowerCase(j86.java.util.Locale.ENGLISH), val); } while (true) { if ((c == '>') || (c < 0) || ((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')) || ((c >= '0') && (c <= '9')) || (c == '_')) break; c = in.read(); } // skipSpace(in); } return atts; }
public static void main(String[] args) { Hashtable<String> hashtable = new HashtableOpenAddressLinearProbingImpl<String>(10); hashtable.insert("A"); hashtable.insert("a"); hashtable.insert("B"); hashtable.insert("C"); hashtable.insert("D"); hashtable.insert("E"); hashtable.insert("F"); hashtable.insert("G"); hashtable.insert("H"); hashtable.insert("I"); System.out.println(hashtable); hashtable.remove("F"); System.out.println(hashtable); String a = hashtable.search("A"); String x = hashtable.search("X"); print("Should be found a : " + a); print("Should be found null !" + x); }
protected static String char2simpleChar(char c) { if (c < 127) { // leave alone as equivalent string. return null; } else { String s = (String) iso2simpleMappings.get(new Integer(c)); if (s == null) // not in table, replace with empty string just to be sure return ""; else return s; } } // end charToEntity
static { systemParam.put("codebase", "codebase"); systemParam.put("code", "code"); systemParam.put("alt", "alt"); systemParam.put("width", "width"); systemParam.put("height", "height"); systemParam.put("align", "align"); systemParam.put("vspace", "vspace"); systemParam.put("hspace", "hspace"); }
public int compare(Object o1, Object o2) { Hashtable hash1 = (Hashtable) o1; Hashtable hash2 = (Hashtable) o2; String str1, str2; double dbl1, dbl2; str1 = hash1.get(compareWhat).toString().toLowerCase(); str2 = hash2.get(compareWhat).toString().toLowerCase(); if (this.compareWhat.equals("WAYPOINT")) { str1 = hash1.get(compareWhat).toString().substring(2).toLowerCase(); str2 = hash2.get(compareWhat).toString().substring(2).toLowerCase(); } if (this.compareWhat.equals("DISTANCE")) { dbl1 = Common.parseDouble(str1.substring(0, str1.length() - 3)); dbl2 = Common.parseDouble(str2.substring(0, str2.length() - 3)); if (dbl1 > dbl2) return 1; if (dbl1 < dbl2) return -1; else return 0; } else { return str1.compareTo(str2); } }
public void reserve(Word w) { words.put(w.lexeme, w); }
public void doIt() { CacheHolderDetail det; CacheHolder ch; ProgressBarForm pbf = new ProgressBarForm(); Handle h = new Handle(); int exportErrors = 0; new String(); FileChooser fc = new FileChooser(FileChooserBase.DIRECTORY_SELECT, pref.getExportPath(expName)); fc.setTitle("Select target directory:"); String targetDir; if (fc.execute() != FormBase.IDCANCEL) { targetDir = fc.getChosen() + "/"; pref.setExportPath(expName, targetDir); Vector cache_index = new Vector(); Vector cacheImg = new Vector(); Vector logImg = new Vector(); Vector mapImg = new Vector(); Vector usrImg = new Vector(); Vector logIcons = new Vector(15); String icon; Hashtable varParams; Hashtable imgParams; Hashtable logImgParams; Hashtable usrImgParams; Hashtable mapImgParams; // Generate index page int counter = cacheDB.countVisible(); pbf.showMainTask = false; pbf.setTask(h, "Exporting ..."); pbf.exec(); for (int i = 0; i < counter; i++) { h.progress = (float) (i + 1) / (float) counter; h.changed(); ch = cacheDB.get(i); if (ch.isVisible()) { if (ch.is_incomplete()) { exportErrors++; Global.getPref() .log("HTMLExport: skipping export of incomplete waypoint " + ch.getWayPoint()); continue; } det = ch.getCacheDetails(false, false); varParams = new Hashtable(); varParams.put("TYPE", CacheType.cw2ExportString(ch.getType())); varParams.put("WAYPOINT", ch.getWayPoint()); varParams.put("NAME", ch.getCacheName()); varParams.put("OWNER", ch.getCacheOwner()); if (ch.isAddiWpt() || CacheType.CW_TYPE_CUSTOM == ch.getType()) { varParams.put("SIZE", ""); varParams.put("DIFFICULTY", ""); varParams.put("TERRAIN", ""); } else { varParams.put( "SIZE", CacheSize.isValidSize(ch.getCacheSize()) ? CacheSize.cw2ExportString(ch.getCacheSize()) : ""); varParams.put( "DIFFICULTY", CacheTerrDiff.isValidTD(ch.getHard()) ? CacheTerrDiff.longDT(ch.getHard()) : ""); varParams.put( "TERRAIN", CacheTerrDiff.isValidTD(ch.getTerrain()) ? CacheTerrDiff.longDT(ch.getTerrain()) : ""); } varParams.put("DISTANCE", ch.getDistance()); varParams.put("BEARING", ch.bearing); varParams.put("LATLON", ch.LatLon); varParams.put("STATUS", ch.getCacheStatus()); varParams.put("DATE", ch.getDateHidden()); cache_index.add(varParams); // We can generate the individual page here! try { Template page_tpl = new Template(template_init_page); page_tpl.setParam("TYPE", varParams.get("TYPE").toString()); page_tpl.setParam("SIZE", varParams.get("SIZE").toString()); page_tpl.setParam("WAYPOINT", ch.getWayPoint()); page_tpl.setParam("NAME", ch.getCacheName()); page_tpl.setParam("OWNER", ch.getCacheOwner()); page_tpl.setParam("DIFFICULTY", varParams.get("DIFFICULTY").toString()); page_tpl.setParam("TERRAIN", varParams.get("TERRAIN").toString()); page_tpl.setParam("DISTANCE", ch.getDistance()); page_tpl.setParam("BEARING", ch.bearing); page_tpl.setParam("LATLON", ch.LatLon); page_tpl.setParam("STATUS", ch.getCacheStatus()); page_tpl.setParam("DATE", ch.getDateHidden()); if (det != null) { if (ch.is_HTML()) { page_tpl.setParam("DESCRIPTION", modifyLongDesc(det, targetDir)); } else { page_tpl.setParam( "DESCRIPTION", STRreplace.replace(det.LongDescription, "\n", "<br>")); } page_tpl.setParam("HINTS", det.Hints); page_tpl.setParam("DECRYPTEDHINTS", Common.rot13(det.Hints)); StringBuffer sb = new StringBuffer(2000); for (int j = 0; j < det.CacheLogs.size(); j++) { sb.append( STRreplace.replace( det.CacheLogs.getLog(j).toHtml(), "http://www.geocaching.com/images/icons/", null)); sb.append("<br>"); icon = det.CacheLogs.getLog(j).getIcon(); if (logIcons.find(icon) < 0) logIcons.add(icon); // Add the icon to list of icons to copy to dest directory } page_tpl.setParam("LOGS", sb.toString()); page_tpl.setParam("NOTES", STRreplace.replace(det.getCacheNotes(), "\n", "<br>")); cacheImg.clear(); for (int j = 0; j < det.images.size(); j++) { imgParams = new Hashtable(); String imgFile = new String(det.images.get(j).getFilename()); imgParams.put("FILE", imgFile); imgParams.put("TEXT", det.images.get(j).getTitle()); if (DataMover.copy(profile.dataDir + imgFile, targetDir + imgFile)) cacheImg.add(imgParams); else exportErrors++; } page_tpl.setParam("cacheImg", cacheImg); // Log images logImg.clear(); for (int j = 0; j < det.logImages.size(); j++) { logImgParams = new Hashtable(); String logImgFile = det.logImages.get(j).getFilename(); logImgParams.put("FILE", logImgFile); logImgParams.put("TEXT", det.logImages.get(j).getTitle()); if (DataMover.copy(profile.dataDir + logImgFile, targetDir + logImgFile)) logImg.add(logImgParams); else exportErrors++; } page_tpl.setParam("logImg", logImg); // User images usrImg.clear(); for (int j = 0; j < det.userImages.size(); j++) { usrImgParams = new Hashtable(); String usrImgFile = new String(det.userImages.get(j).getFilename()); usrImgParams.put("FILE", usrImgFile); usrImgParams.put("TEXT", det.userImages.get(j).getTitle()); if (DataMover.copy(profile.dataDir + usrImgFile, targetDir + usrImgFile)) usrImg.add(usrImgParams); else exportErrors++; } page_tpl.setParam("userImg", usrImg); // Map images mapImg.clear(); mapImgParams = new Hashtable(); String mapImgFile = new String(ch.getWayPoint() + "_map.gif"); // check if map file exists File test = new File(profile.dataDir + mapImgFile); if (test.exists()) { mapImgParams.put("FILE", mapImgFile); mapImgParams.put("TEXT", mapImgFile); if (DataMover.copy(profile.dataDir + mapImgFile, targetDir + mapImgFile)) mapImg.add(mapImgParams); else exportErrors++; mapImgParams = new Hashtable(); mapImgFile = ch.getWayPoint() + "_map_2.gif"; mapImgParams.put("FILE", mapImgFile); mapImgParams.put("TEXT", mapImgFile); if (DataMover.copy(profile.dataDir + mapImgFile, targetDir + mapImgFile)) mapImg.add(mapImgParams); else exportErrors++; page_tpl.setParam("mapImg", mapImg); } } else { page_tpl.setParam("DESCRIPTION", ""); page_tpl.setParam("HINTS", ""); page_tpl.setParam("DECRYPTEDHINTS", ""); page_tpl.setParam("LOGS", ""); page_tpl.setParam("NOTES", ""); page_tpl.setParam("cacheImg", cacheImg); page_tpl.setParam("logImg", ""); // ??? page_tpl.setParam("userImg", ""); // ??? page_tpl.setParam("mapImg", ""); // ??? exportErrors++; } PrintWriter pagefile = new PrintWriter( new BufferedWriter(new FileWriter(targetDir + ch.getWayPoint() + ".html"))); pagefile.print(page_tpl.output()); pagefile.close(); } catch (IllegalArgumentException e) { exportErrors++; ch.setIncomplete(true); Global.getPref() .log( "HTMLExport: " + ch.getWayPoint() + " is incomplete reason: ", e, Global.getPref().debug); } catch (Exception e) { exportErrors++; Global.getPref() .log( "HTMLExport: error wehen exporting " + ch.getWayPoint() + " reason: ", e, Global.getPref().debug); } } // if is black, filtered } // Copy the log-icons to the destination directory for (int j = 0; j < logIcons.size(); j++) { icon = (String) logIcons.elementAt(j); if (!DataMover.copy(FileBase.getProgramDirectory() + "/" + icon, targetDir + icon)) exportErrors++; } if (!DataMover.copy( FileBase.getProgramDirectory() + "/recommendedlog.gif", targetDir + "recommendedlog.gif")) exportErrors++; try { Template tpl = new Template(template_init_index); tpl.setParam("cache_index", cache_index); PrintWriter detfile; detfile = new PrintWriter(new BufferedWriter(new FileWriter(targetDir + "/index.html"))); detfile.print(tpl.output()); detfile.close(); // sort by waypoint sortAndPrintIndex(tpl, cache_index, targetDir + "/index_wp.html", "WAYPOINT"); // sort by name sortAndPrintIndex(tpl, cache_index, targetDir + "/index_alpha.html", "NAME", false); // sort by type sortAndPrintIndex(tpl, cache_index, targetDir + "/index_type.html", "TYPE", true); // sort by size sortAndPrintIndex(tpl, cache_index, targetDir + "/index_size.html", "SIZE", true); // sort by distance sortAndPrintIndex(tpl, cache_index, targetDir + "/index_dist.html", "DISTANCE", 10.0); } catch (Exception e) { Vm.debug("Problem writing HTML files\n"); e.printStackTrace(); } // try } // if pbf.exit(0); if (exportErrors > 0) { new MessageBox( "Export Error", exportErrors + " errors during export. See log for details.", FormBase.OKB) .execute(); } }
static { String[] mappingArray = new String[] { "34", "'", "160", " ", "161", "i", "162", "c", "163", "$", "164", "o", "165", "$", "166", "!", "167", "$", "168", " ", "169", " ", "170", " ", "171", "<", "172", " ", "173", "-", "174", " ", "175", "-", "176", " ", "177", "+/-", "178", "2", "179", "3", "180", "'", "181", " ", "182", " ", "183", " ", "184", ",", "185", "1", "186", " ", "187", ">", "188", "1/4", "189", "1/2", "190", "3/4", "191", "?", "192", "A", "193", "A", "194", "A", "195", "A", "196", "Ae", "197", "A", "198", "AE", "199", "C", "200", "E", "201", "E", "202", "E", "203", "E", "204", "I", "205", "I", "206", "I", "207", "I", "208", "D", "209", "N", "210", "O", "211", "O", "212", "O", "213", "O", "214", "Oe", "215", "x", "216", "O", "217", "U", "218", "U", "219", "U", "220", "Ue", "221", "Y", "222", " ", "223", "ss", "224", "a", "225", "a", "226", "a", "227", "a", "228", "ae", "229", "a", "230", "ae", "231", "c", "232", "e", "233", "e", "234", "e", "235", "e", "236", "i", "237", "i", "238", "i", "239", "i", "240", "o", "241", "n", "242", "o", "243", "o", "244", "o", "245", "o", "246", "oe", "247", "/", "248", "o", "249", "u", "250", "u", "251", "u", "252", "ue", "253", "y", "254", "p", "255", "y" }; for (int i = 0; i < mappingArray.length; i = i + 2) { iso2simpleMappings.put(Integer.valueOf(mappingArray[i]), mappingArray[i + 1]); } }
public static void parse(URL url, PrintStream statusMsgStream, AppletViewerFactory factory) throws IOException { // <OBJECT> <EMBED> tag flags boolean isAppletTag = false; boolean isObjectTag = false; boolean isEmbedTag = false; // warning messages String requiresNameWarning = amh.getMessage("parse.warning.requiresname"); String paramOutsideWarning = amh.getMessage("parse.warning.paramoutside"); String appletRequiresCodeWarning = amh.getMessage("parse.warning.applet.requirescode"); String appletRequiresHeightWarning = amh.getMessage("parse.warning.applet.requiresheight"); String appletRequiresWidthWarning = amh.getMessage("parse.warning.applet.requireswidth"); String objectRequiresCodeWarning = amh.getMessage("parse.warning.object.requirescode"); String objectRequiresHeightWarning = amh.getMessage("parse.warning.object.requiresheight"); String objectRequiresWidthWarning = amh.getMessage("parse.warning.object.requireswidth"); String embedRequiresCodeWarning = amh.getMessage("parse.warning.embed.requirescode"); String embedRequiresHeightWarning = amh.getMessage("parse.warning.embed.requiresheight"); String embedRequiresWidthWarning = amh.getMessage("parse.warning.embed.requireswidth"); String appNotLongerSupportedWarning = amh.getMessage("parse.warning.appnotLongersupported"); j86.java.net.URLConnection conn = url.openConnection(); Reader in = makeReader(conn.getInputStream()); /* The original URL may have been redirected - this * sets it to whatever URL/codebase we ended up getting */ url = conn.getURL(); int ydisp = 1; Hashtable atts = null; while (true) { c = in.read(); if (c == -1) break; if (c == '<') { c = in.read(); if (c == '/') { c = in.read(); String nm = scanIdentifier(in); if (nm.equalsIgnoreCase("applet") || nm.equalsIgnoreCase("object") || nm.equalsIgnoreCase("embed")) { // We can't test for a code tag until </OBJECT> // because it is a parameter, not an attribute. if (isObjectTag) { if (atts.get("code") == null && atts.get("object") == null) { statusMsgStream.println(objectRequiresCodeWarning); atts = null; } } if (atts != null) { // XXX 5/18 In general this code just simply // shouldn't be part of parsing. It's presence // causes things to be a little too much of a // hack. factory.createAppletViewer(x, y, url, atts); x += XDELTA; y += YDELTA; // make sure we don't go too far! Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); if ((x > d.width - 300) || (y > d.height - 300)) { x = 0; y = 2 * ydisp * YDELTA; ydisp++; } } atts = null; isAppletTag = false; isObjectTag = false; isEmbedTag = false; } } else { String nm = scanIdentifier(in); if (nm.equalsIgnoreCase("param")) { Hashtable t = scanTag(in); String att = (String) t.get("name"); if (att == null) { statusMsgStream.println(requiresNameWarning); } else { String val = (String) t.get("value"); if (val == null) { statusMsgStream.println(requiresNameWarning); } else if (atts != null) { atts.put(att.toLowerCase(), val); } else { statusMsgStream.println(paramOutsideWarning); } } } else if (nm.equalsIgnoreCase("applet")) { isAppletTag = true; atts = scanTag(in); if (atts.get("code") == null && atts.get("object") == null) { statusMsgStream.println(appletRequiresCodeWarning); atts = null; } else if (atts.get("width") == null) { statusMsgStream.println(appletRequiresWidthWarning); atts = null; } else if (atts.get("height") == null) { statusMsgStream.println(appletRequiresHeightWarning); atts = null; } } else if (nm.equalsIgnoreCase("object")) { isObjectTag = true; atts = scanTag(in); // The <OBJECT> attribute codebase isn't what // we want. If its defined, remove it. if (atts.get("codebase") != null) { atts.remove("codebase"); } if (atts.get("width") == null) { statusMsgStream.println(objectRequiresWidthWarning); atts = null; } else if (atts.get("height") == null) { statusMsgStream.println(objectRequiresHeightWarning); atts = null; } } else if (nm.equalsIgnoreCase("embed")) { isEmbedTag = true; atts = scanTag(in); if (atts.get("code") == null && atts.get("object") == null) { statusMsgStream.println(embedRequiresCodeWarning); atts = null; } else if (atts.get("width") == null) { statusMsgStream.println(embedRequiresWidthWarning); atts = null; } else if (atts.get("height") == null) { statusMsgStream.println(embedRequiresHeightWarning); atts = null; } } else if (nm.equalsIgnoreCase("app")) { statusMsgStream.println(appNotLongerSupportedWarning); Hashtable atts2 = scanTag(in); nm = (String) atts2.get("class"); if (nm != null) { atts2.remove("class"); atts2.put("code", nm + ".class"); } nm = (String) atts2.get("src"); if (nm != null) { atts2.remove("src"); atts2.put("codebase", nm); } if (atts2.get("width") == null) { atts2.put("width", "100"); } if (atts2.get("height") == null) { atts2.put("height", "100"); } printTag(statusMsgStream, atts2); statusMsgStream.println(); } } } } in.close(); }
private Vector addAnchorString(Vector list, String field, boolean fullCompare) { Vector topIndex = new Vector(); Hashtable topIndexParms, currEntry; String lastValue, currValue; if (list.size() == 0) return null; currEntry = (Hashtable) list.get(0); lastValue = (String) currEntry.get(field); if (lastValue == null || lastValue.length() == 0) lastValue = " "; lastValue = lastValue.toUpperCase(); for (int i = 1; i < list.size(); i++) { currEntry = (Hashtable) list.get(i); currValue = (String) currEntry.get(field); currValue = currValue.toUpperCase(); if (currValue == null || currValue == "") continue; try { if (fullCompare) { if (lastValue.compareTo(currValue) != 0) { // Values for navigation line topIndexParms = new Hashtable(); topIndexParms.put("HREF", Convert.toString(i)); topIndexParms.put("TEXT", currValue); topIndex.add(topIndexParms); // add anchor entry to list currEntry.put("ANCHORNAME", Convert.toString(i)); currEntry.put("ANCHORTEXT", currValue); } else { // clear value from previous run currEntry.put("ANCHORNAME", ""); currEntry.put("ANCHORTEXT", ""); } } else { if (lastValue.charAt(0) != currValue.charAt(0)) { // Values for navigation line topIndexParms = new Hashtable(); topIndexParms.put("HREF", Convert.toString(i)); topIndexParms.put("TEXT", currValue.charAt(0) + " "); topIndex.add(topIndexParms); // add anchor entry to list currEntry.put("ANCHORNAME", Convert.toString(i)); currEntry.put("ANCHORTEXT", currValue.charAt(0) + " "); } else { // clear value from previous run currEntry.put("ANCHORNAME", ""); currEntry.put("ANCHORTEXT", ""); } } list.set(i, currEntry); lastValue = currValue; } catch (Exception e) { continue; } } return topIndex; }
/** Create the applet viewer */ public AppletViewer( int x, int y, URL doc, Hashtable atts, PrintStream statusMsgStream, AppletViewerFactory factory) { this.factory = factory; this.statusMsgStream = statusMsgStream; setTitle(amh.getMessage("tool.title", atts.get("code"))); MenuBar mb = factory.getBaseMenuBar(); Menu m = new Menu(amh.getMessage("menu.applet")); addMenuItem(m, "menuitem.restart"); addMenuItem(m, "menuitem.reload"); addMenuItem(m, "menuitem.stop"); addMenuItem(m, "menuitem.save"); addMenuItem(m, "menuitem.start"); addMenuItem(m, "menuitem.clone"); m.add(new MenuItem("-")); addMenuItem(m, "menuitem.tag"); addMenuItem(m, "menuitem.info"); addMenuItem(m, "menuitem.edit").disable(); addMenuItem(m, "menuitem.encoding"); m.add(new MenuItem("-")); addMenuItem(m, "menuitem.print"); m.add(new MenuItem("-")); addMenuItem(m, "menuitem.props"); m.add(new MenuItem("-")); addMenuItem(m, "menuitem.close"); if (factory.isStandalone()) { addMenuItem(m, "menuitem.quit"); } mb.add(m); setMenuBar(mb); add("Center", panel = new AppletViewerPanel(doc, atts)); add("South", label = new Label(amh.getMessage("label.hello"))); panel.init(); appletPanels.addElement(panel); pack(); move(x, y); setVisible(true); WindowListener windowEventListener = new WindowAdapter() { public void windowClosing(WindowEvent evt) { appletClose(); } public void windowIconified(WindowEvent evt) { appletStop(); } public void windowDeiconified(WindowEvent evt) { appletStart(); } }; class AppletEventListener implements AppletListener { final Frame frame; public AppletEventListener(Frame frame) { this.frame = frame; } public void appletStateChanged(AppletEvent evt) { AppletPanel src = (AppletPanel) evt.getSource(); switch (evt.getID()) { case AppletPanel.APPLET_RESIZE: { if (src != null) { resize(preferredSize()); validate(); } break; } case AppletPanel.APPLET_LOADING_COMPLETED: { Applet a = src.getApplet(); // j86.sun.applet.AppletPanel // Fixed #4754451: Applet can have methods running on main // thread event queue. // // The cause of this bug is that the frame of the applet // is created in main thread group. Thus, when certain // AWT/Swing events are generated, the events will be // dispatched through the wrong event dispatch thread. // // To fix this, we rearrange the AppContext with the frame, // so the proper event queue will be looked up. // // Swing also maintains a Frame list for the AppContext, // so we will have to rearrange it as well. // if (a != null) AppletPanel.changeFrameAppContext(frame, SunToolkit.targetToAppContext(a)); else AppletPanel.changeFrameAppContext(frame, AppContext.getAppContext()); break; } } } }; addWindowListener(windowEventListener); panel.addAppletListener(new AppletEventListener(this)); // Start the applet showStatus(amh.getMessage("status.start")); initEventQueue(); }
/** Constructor; enters all predefined identifiers and operators into symbol table. */ private Symtab(Context context) throws CompletionFailure { super(); context.put(symtabKey, this); names = Name.Table.instance(context); byteType = new Type(TypeTags.BYTE, null); charType = new Type(TypeTags.CHAR, null); shortType = new Type(TypeTags.SHORT, null); intType = new Type(TypeTags.INT, null); longType = new Type(TypeTags.LONG, null); floatType = new Type(TypeTags.FLOAT, null); doubleType = new Type(TypeTags.DOUBLE, null); booleanType = new Type(TypeTags.BOOLEAN, null); voidType = new Type(TypeTags.VOID, null); botType = new Type(TypeTags.BOT, null); unknownType = new Type(TypeTags.UNKNOWN, null) { public boolean isSameType(Type that) { return true; } public boolean isSubType(Type that) { return false; } public boolean isSuperType(Type that) { return true; } }; rootPackage = new PackageSymbol(names.empty, null); emptyPackage = new PackageSymbol(names.emptyPackage, rootPackage); noSymbol = new TypeSymbol(0, names.empty, Type.noType, rootPackage); noSymbol.kind = Kinds.NIL; errSymbol = new ClassSymbol(PUBLIC | STATIC, names.any, null, rootPackage); errType = new ErrorType(errSymbol); initType(byteType, "byte", "Byte"); initType(shortType, "short", "Short"); initType(charType, "char", "Character"); initType(intType, "int", "Integer"); initType(longType, "long", "Long"); initType(floatType, "float", "Float"); initType(doubleType, "double", "Double"); initType(booleanType, "boolean", "Boolean"); initType(voidType, "void", "Void"); initType(botType, "<nulltype>"); initType(errType, errSymbol); initType(unknownType, "<any?>"); arrayClass = new ClassSymbol(PUBLIC, names.Array, noSymbol); methodClass = new ClassSymbol(PUBLIC, names.Method, noSymbol); predefClass = new ClassSymbol(PUBLIC, names.empty, rootPackage); Scope scope = new Scope(predefClass); predefClass.members_field = scope; scope.enter(byteType.tsym); scope.enter(shortType.tsym); scope.enter(charType.tsym); scope.enter(intType.tsym); scope.enter(longType.tsym); scope.enter(floatType.tsym); scope.enter(doubleType.tsym); scope.enter(booleanType.tsym); scope.enter(errType.tsym); classes.put(predefClass.fullname, predefClass); reader = ClassReader.instance(context); reader.init(this); objectType = enterClass("java.lang.Object"); classType = enterClass("java.lang.Class"); stringType = enterClass("java.lang.String"); stringBufferType = enterClass("java.lang.StringBuffer"); cloneableType = enterClass("java.lang.Cloneable"); throwableType = enterClass("java.lang.Throwable"); serializableType = enterClass("java.io.Serializable"); errorType = enterClass("java.lang.Error"); exceptionType = enterClass("java.lang.Exception"); runtimeExceptionType = enterClass("java.lang.RuntimeException"); classNotFoundExceptionType = enterClass("java.lang.ClassNotFoundException"); noClassDefFoundErrorType = enterClass("java.lang.NoClassDefFoundError"); assertionErrorType = enterClass("java.lang.AssertionError"); classLoaderType = enterClass("java.lang.ClassLoader"); ClassType arrayClassType = (ClassType) arrayClass.type; arrayClassType.supertype_field = objectType; arrayClassType.interfaces_field = List.make(cloneableType, serializableType); arrayClass.members_field = new Scope(arrayClass); lengthVar = new VarSymbol(PUBLIC | FINAL, names.length, intType, arrayClass); arrayClass.members().enter(lengthVar); Symbol cloneMethod = new MethodSymbol( PUBLIC, names.clone, new MethodType(Type.emptyList, objectType, Type.emptyList, methodClass), arrayClass); arrayClass.members().enter(cloneMethod); nullConst = enterConstant("null", botType); trueConst = enterConstant("true", booleanType.constType(new Integer(1))); falseConst = enterConstant("false", booleanType.constType(new Integer(0))); enterUnop("+", intType, intType, nop); enterUnop("+", longType, longType, nop); enterUnop("+", floatType, floatType, nop); enterUnop("+", doubleType, doubleType, nop); enterUnop("-", intType, intType, ineg); enterUnop("-", longType, longType, lneg); enterUnop("-", floatType, floatType, fneg); enterUnop("-", doubleType, doubleType, dneg); enterUnop("~", intType, intType, ixor); enterUnop("~", longType, longType, lxor); enterUnop("++", byteType, byteType, iadd); enterUnop("++", shortType, shortType, iadd); enterUnop("++", charType, charType, iadd); enterUnop("++", intType, intType, iadd); enterUnop("++", longType, longType, ladd); enterUnop("++", floatType, floatType, fadd); enterUnop("++", doubleType, doubleType, dadd); enterUnop("--", byteType, byteType, isub); enterUnop("--", shortType, shortType, isub); enterUnop("--", charType, charType, isub); enterUnop("--", intType, intType, isub); enterUnop("--", longType, longType, lsub); enterUnop("--", floatType, floatType, fsub); enterUnop("--", doubleType, doubleType, dsub); enterUnop("!", booleanType, booleanType, bool_not); nullcheck = enterUnop("<*nullchk*>", objectType, objectType, nullchk); enterBinop("+", stringType, stringType, stringType, string_add); enterBinop("+", stringType, intType, stringType, string_add); enterBinop("+", stringType, longType, stringType, string_add); enterBinop("+", stringType, floatType, stringType, string_add); enterBinop("+", stringType, doubleType, stringType, string_add); enterBinop("+", stringType, booleanType, stringType, string_add); enterBinop("+", stringType, objectType, stringType, string_add); enterBinop("+", stringType, botType, stringType, string_add); enterBinop("+", intType, stringType, stringType, string_add); enterBinop("+", longType, stringType, stringType, string_add); enterBinop("+", floatType, stringType, stringType, string_add); enterBinop("+", doubleType, stringType, stringType, string_add); enterBinop("+", booleanType, stringType, stringType, string_add); enterBinop("+", objectType, stringType, stringType, string_add); enterBinop("+", botType, stringType, stringType, string_add); enterBinop("+", intType, intType, intType, iadd); enterBinop("+", longType, longType, longType, ladd); enterBinop("+", floatType, floatType, floatType, fadd); enterBinop("+", doubleType, doubleType, doubleType, dadd); enterBinop("+", botType, botType, botType, error); enterBinop("+", botType, intType, botType, error); enterBinop("+", botType, longType, botType, error); enterBinop("+", botType, floatType, botType, error); enterBinop("+", botType, doubleType, botType, error); enterBinop("+", botType, booleanType, botType, error); enterBinop("+", botType, objectType, botType, error); enterBinop("+", intType, botType, botType, error); enterBinop("+", longType, botType, botType, error); enterBinop("+", floatType, botType, botType, error); enterBinop("+", doubleType, botType, botType, error); enterBinop("+", booleanType, botType, botType, error); enterBinop("+", objectType, botType, botType, error); enterBinop("-", intType, intType, intType, isub); enterBinop("-", longType, longType, longType, lsub); enterBinop("-", floatType, floatType, floatType, fsub); enterBinop("-", doubleType, doubleType, doubleType, dsub); enterBinop("*", intType, intType, intType, imul); enterBinop("*", longType, longType, longType, lmul); enterBinop("*", floatType, floatType, floatType, fmul); enterBinop("*", doubleType, doubleType, doubleType, dmul); enterBinop("/", intType, intType, intType, idiv); enterBinop("/", longType, longType, longType, ldiv); enterBinop("/", floatType, floatType, floatType, fdiv); enterBinop("/", doubleType, doubleType, doubleType, ddiv); enterBinop("%", intType, intType, intType, imod); enterBinop("%", longType, longType, longType, lmod); enterBinop("%", floatType, floatType, floatType, fmod); enterBinop("%", doubleType, doubleType, doubleType, dmod); enterBinop("&", booleanType, booleanType, booleanType, iand); enterBinop("&", intType, intType, intType, iand); enterBinop("&", longType, longType, longType, land); enterBinop("|", booleanType, booleanType, booleanType, ior); enterBinop("|", intType, intType, intType, ior); enterBinop("|", longType, longType, longType, lor); enterBinop("^", booleanType, booleanType, booleanType, ixor); enterBinop("^", intType, intType, intType, ixor); enterBinop("^", longType, longType, longType, lxor); enterBinop("<<", intType, intType, intType, ishl); enterBinop("<<", longType, intType, longType, lshl); enterBinop("<<", intType, longType, intType, ishll); enterBinop("<<", longType, longType, longType, lshll); enterBinop(">>", intType, intType, intType, ishr); enterBinop(">>", longType, intType, longType, lshr); enterBinop(">>", intType, longType, intType, ishrl); enterBinop(">>", longType, longType, longType, lshrl); enterBinop(">>>", intType, intType, intType, iushr); enterBinop(">>>", longType, intType, longType, lushr); enterBinop(">>>", intType, longType, intType, iushrl); enterBinop(">>>", longType, longType, longType, lushrl); enterBinop("<", intType, intType, booleanType, if_icmplt); enterBinop("<", longType, longType, booleanType, lcmp, iflt); enterBinop("<", floatType, floatType, booleanType, fcmpg, iflt); enterBinop("<", doubleType, doubleType, booleanType, dcmpg, iflt); enterBinop(">", intType, intType, booleanType, if_icmpgt); enterBinop(">", longType, longType, booleanType, lcmp, ifgt); enterBinop(">", floatType, floatType, booleanType, fcmpl, ifgt); enterBinop(">", doubleType, doubleType, booleanType, dcmpl, ifgt); enterBinop("<=", intType, intType, booleanType, if_icmple); enterBinop("<=", longType, longType, booleanType, lcmp, ifle); enterBinop("<=", floatType, floatType, booleanType, fcmpg, ifle); enterBinop("<=", doubleType, doubleType, booleanType, dcmpg, ifle); enterBinop(">=", intType, intType, booleanType, if_icmpge); enterBinop(">=", longType, longType, booleanType, lcmp, ifge); enterBinop(">=", floatType, floatType, booleanType, fcmpl, ifge); enterBinop(">=", doubleType, doubleType, booleanType, dcmpl, ifge); enterBinop("==", intType, intType, booleanType, if_icmpeq); enterBinop("==", longType, longType, booleanType, lcmp, ifeq); enterBinop("==", floatType, floatType, booleanType, fcmpl, ifeq); enterBinop("==", doubleType, doubleType, booleanType, dcmpl, ifeq); enterBinop("==", booleanType, booleanType, booleanType, if_icmpeq); enterBinop("==", objectType, objectType, booleanType, if_acmpeq); enterBinop("!=", intType, intType, booleanType, if_icmpne); enterBinop("!=", longType, longType, booleanType, lcmp, ifne); enterBinop("!=", floatType, floatType, booleanType, fcmpl, ifne); enterBinop("!=", doubleType, doubleType, booleanType, dcmpl, ifne); enterBinop("!=", booleanType, booleanType, booleanType, if_icmpne); enterBinop("!=", objectType, objectType, booleanType, if_acmpne); enterBinop("&&", booleanType, booleanType, booleanType, bool_and); enterBinop("||", booleanType, booleanType, booleanType, bool_or); }
/** * A class that defines all predefined constants and operators as well as special classes such as * java.lang.Object, which need to be known to the compiler. All symbols are held in instance * fields. This makes it possible to work in multiple concurrent projects, which might use different * class files for library classes. */ public class Symtab implements Flags, ByteCodes { /** The context key for the symbol table. */ private static final Context.Key symtabKey = new Context.Key(); /** Get the symbol table instance. */ public static Symtab instance(Context context) { Symtab instance = (Symtab) context.get(symtabKey); if (instance == null) instance = new Symtab(context); return instance; } private final Name.Table names; private final ClassReader reader; /** A symbol for the root package. */ public final PackageSymbol rootPackage; /** A symbol for the empty package. */ public final PackageSymbol emptyPackage; /** A symbol that stands for a missing symbol. */ public final TypeSymbol noSymbol; /** The error symbol. */ public final ClassSymbol errSymbol; /** Builtin types. */ public final Type byteType; public final Type charType; public final Type shortType; public final Type intType; public final Type longType; public final Type floatType; public final Type doubleType; public final Type booleanType; public final Type voidType; public final Type botType; public final Type errType; /** A value for the unknown type. */ public final Type unknownType; /** The builtin type of all arrays. */ public final ClassSymbol arrayClass; /** The builtin type of all methods. */ public final ClassSymbol methodClass; /** Predefined types. */ public final Type objectType; public final Type classType; public final Type classLoaderType; public final Type stringType; public final Type stringBufferType; public final Type cloneableType; public final Type serializableType; public final Type throwableType; public final Type errorType; public final Type exceptionType; public final Type runtimeExceptionType; public final Type classNotFoundExceptionType; public final Type noClassDefFoundErrorType; public final Type assertionErrorType; /** The symbol representing the length field of an array. */ public final VarSymbol lengthVar; /** Predefined constants. */ public final VarSymbol nullConst; public final VarSymbol trueConst; public final VarSymbol falseConst; /** The null check operator. */ public final OperatorSymbol nullcheck; /** The predefined type that belongs to a tag. */ public final Type[] typeOfTag = new Type[TypeTags.TypeTagCount]; /** The name of the class that belongs to a basix type tag. */ public final Name[] boxedName = new Name[TypeTags.TypeTagCount]; /** * A hashtable containing the encountered top-level and member classes, indexed by flat names. The * table does not contain local classes. It should be updated from the outside to reflect classes * defined by compiled source files. */ public final Hashtable classes = Hashtable.make(); /** * A hashtable containing the encountered packages. the table should be updated from outside to * reflect packages defined by compiled source files. */ public final Hashtable packages = Hashtable.make(); public void initType(Type type, ClassSymbol c) { type.tsym = c; typeOfTag[type.tag] = type; } public void initType(Type type, String name) { initType(type, new ClassSymbol(PUBLIC, names.fromString(name), type, rootPackage)); } public void initType(Type type, String name, String bname) { initType(type, name); boxedName[type.tag] = names.fromString("java.lang." + bname); } /** The class symbol that owns all predefined symbols. */ public final ClassSymbol predefClass; /** * Enter a constant into symbol table. * * @param name The constant's name. * @param type The constant's type. */ private VarSymbol enterConstant(String name, Type type) { VarSymbol c = new VarSymbol(PUBLIC | STATIC | FINAL, names.fromString(name), type, predefClass); c.constValue = type.constValue; predefClass.members().enter(c); return c; } /** * Enter a binary operation into symbol table. * * @param name The name of the operator. * @param left The type of the left operand. * @param right The type of the left operand. * @param res The operation's result type. * @param opcode The operation's bytecode instruction. */ private void enterBinop(String name, Type left, Type right, Type res, int opcode) { predefClass .members() .enter( new OperatorSymbol( names.fromString(name), new MethodType(List.make(left, right), res, Type.emptyList, methodClass), opcode, predefClass)); } /** * Enter a binary operation, as above but with two opcodes, which get encoded as (opcode1 << * ByteCodeTags.preShift) + opcode2. * * @param opcode1 First opcode. * @param opcode2 Second opcode. */ private void enterBinop(String name, Type left, Type right, Type res, int opcode1, int opcode2) { enterBinop(name, left, right, res, (opcode1 << ByteCodes.preShift) | opcode2); } /** * Enter a unary operation into symbol table. * * @param name The name of the operator. * @param arg The type of the operand. * @param res The operation's result type. * @param opcode The operation's bytecode instruction. */ private OperatorSymbol enterUnop(String name, Type arg, Type res, int opcode) { OperatorSymbol sym = new OperatorSymbol( names.fromString(name), new MethodType(List.make(arg), res, Type.emptyList, methodClass), opcode, predefClass); predefClass.members().enter(sym); return sym; } /** * Enter a class into symbol table. * * @param The name of the class. */ private Type enterClass(String s) { return reader.enterClass(names.fromString(s)).type; } /** Constructor; enters all predefined identifiers and operators into symbol table. */ private Symtab(Context context) throws CompletionFailure { super(); context.put(symtabKey, this); names = Name.Table.instance(context); byteType = new Type(TypeTags.BYTE, null); charType = new Type(TypeTags.CHAR, null); shortType = new Type(TypeTags.SHORT, null); intType = new Type(TypeTags.INT, null); longType = new Type(TypeTags.LONG, null); floatType = new Type(TypeTags.FLOAT, null); doubleType = new Type(TypeTags.DOUBLE, null); booleanType = new Type(TypeTags.BOOLEAN, null); voidType = new Type(TypeTags.VOID, null); botType = new Type(TypeTags.BOT, null); unknownType = new Type(TypeTags.UNKNOWN, null) { public boolean isSameType(Type that) { return true; } public boolean isSubType(Type that) { return false; } public boolean isSuperType(Type that) { return true; } }; rootPackage = new PackageSymbol(names.empty, null); emptyPackage = new PackageSymbol(names.emptyPackage, rootPackage); noSymbol = new TypeSymbol(0, names.empty, Type.noType, rootPackage); noSymbol.kind = Kinds.NIL; errSymbol = new ClassSymbol(PUBLIC | STATIC, names.any, null, rootPackage); errType = new ErrorType(errSymbol); initType(byteType, "byte", "Byte"); initType(shortType, "short", "Short"); initType(charType, "char", "Character"); initType(intType, "int", "Integer"); initType(longType, "long", "Long"); initType(floatType, "float", "Float"); initType(doubleType, "double", "Double"); initType(booleanType, "boolean", "Boolean"); initType(voidType, "void", "Void"); initType(botType, "<nulltype>"); initType(errType, errSymbol); initType(unknownType, "<any?>"); arrayClass = new ClassSymbol(PUBLIC, names.Array, noSymbol); methodClass = new ClassSymbol(PUBLIC, names.Method, noSymbol); predefClass = new ClassSymbol(PUBLIC, names.empty, rootPackage); Scope scope = new Scope(predefClass); predefClass.members_field = scope; scope.enter(byteType.tsym); scope.enter(shortType.tsym); scope.enter(charType.tsym); scope.enter(intType.tsym); scope.enter(longType.tsym); scope.enter(floatType.tsym); scope.enter(doubleType.tsym); scope.enter(booleanType.tsym); scope.enter(errType.tsym); classes.put(predefClass.fullname, predefClass); reader = ClassReader.instance(context); reader.init(this); objectType = enterClass("java.lang.Object"); classType = enterClass("java.lang.Class"); stringType = enterClass("java.lang.String"); stringBufferType = enterClass("java.lang.StringBuffer"); cloneableType = enterClass("java.lang.Cloneable"); throwableType = enterClass("java.lang.Throwable"); serializableType = enterClass("java.io.Serializable"); errorType = enterClass("java.lang.Error"); exceptionType = enterClass("java.lang.Exception"); runtimeExceptionType = enterClass("java.lang.RuntimeException"); classNotFoundExceptionType = enterClass("java.lang.ClassNotFoundException"); noClassDefFoundErrorType = enterClass("java.lang.NoClassDefFoundError"); assertionErrorType = enterClass("java.lang.AssertionError"); classLoaderType = enterClass("java.lang.ClassLoader"); ClassType arrayClassType = (ClassType) arrayClass.type; arrayClassType.supertype_field = objectType; arrayClassType.interfaces_field = List.make(cloneableType, serializableType); arrayClass.members_field = new Scope(arrayClass); lengthVar = new VarSymbol(PUBLIC | FINAL, names.length, intType, arrayClass); arrayClass.members().enter(lengthVar); Symbol cloneMethod = new MethodSymbol( PUBLIC, names.clone, new MethodType(Type.emptyList, objectType, Type.emptyList, methodClass), arrayClass); arrayClass.members().enter(cloneMethod); nullConst = enterConstant("null", botType); trueConst = enterConstant("true", booleanType.constType(new Integer(1))); falseConst = enterConstant("false", booleanType.constType(new Integer(0))); enterUnop("+", intType, intType, nop); enterUnop("+", longType, longType, nop); enterUnop("+", floatType, floatType, nop); enterUnop("+", doubleType, doubleType, nop); enterUnop("-", intType, intType, ineg); enterUnop("-", longType, longType, lneg); enterUnop("-", floatType, floatType, fneg); enterUnop("-", doubleType, doubleType, dneg); enterUnop("~", intType, intType, ixor); enterUnop("~", longType, longType, lxor); enterUnop("++", byteType, byteType, iadd); enterUnop("++", shortType, shortType, iadd); enterUnop("++", charType, charType, iadd); enterUnop("++", intType, intType, iadd); enterUnop("++", longType, longType, ladd); enterUnop("++", floatType, floatType, fadd); enterUnop("++", doubleType, doubleType, dadd); enterUnop("--", byteType, byteType, isub); enterUnop("--", shortType, shortType, isub); enterUnop("--", charType, charType, isub); enterUnop("--", intType, intType, isub); enterUnop("--", longType, longType, lsub); enterUnop("--", floatType, floatType, fsub); enterUnop("--", doubleType, doubleType, dsub); enterUnop("!", booleanType, booleanType, bool_not); nullcheck = enterUnop("<*nullchk*>", objectType, objectType, nullchk); enterBinop("+", stringType, stringType, stringType, string_add); enterBinop("+", stringType, intType, stringType, string_add); enterBinop("+", stringType, longType, stringType, string_add); enterBinop("+", stringType, floatType, stringType, string_add); enterBinop("+", stringType, doubleType, stringType, string_add); enterBinop("+", stringType, booleanType, stringType, string_add); enterBinop("+", stringType, objectType, stringType, string_add); enterBinop("+", stringType, botType, stringType, string_add); enterBinop("+", intType, stringType, stringType, string_add); enterBinop("+", longType, stringType, stringType, string_add); enterBinop("+", floatType, stringType, stringType, string_add); enterBinop("+", doubleType, stringType, stringType, string_add); enterBinop("+", booleanType, stringType, stringType, string_add); enterBinop("+", objectType, stringType, stringType, string_add); enterBinop("+", botType, stringType, stringType, string_add); enterBinop("+", intType, intType, intType, iadd); enterBinop("+", longType, longType, longType, ladd); enterBinop("+", floatType, floatType, floatType, fadd); enterBinop("+", doubleType, doubleType, doubleType, dadd); enterBinop("+", botType, botType, botType, error); enterBinop("+", botType, intType, botType, error); enterBinop("+", botType, longType, botType, error); enterBinop("+", botType, floatType, botType, error); enterBinop("+", botType, doubleType, botType, error); enterBinop("+", botType, booleanType, botType, error); enterBinop("+", botType, objectType, botType, error); enterBinop("+", intType, botType, botType, error); enterBinop("+", longType, botType, botType, error); enterBinop("+", floatType, botType, botType, error); enterBinop("+", doubleType, botType, botType, error); enterBinop("+", booleanType, botType, botType, error); enterBinop("+", objectType, botType, botType, error); enterBinop("-", intType, intType, intType, isub); enterBinop("-", longType, longType, longType, lsub); enterBinop("-", floatType, floatType, floatType, fsub); enterBinop("-", doubleType, doubleType, doubleType, dsub); enterBinop("*", intType, intType, intType, imul); enterBinop("*", longType, longType, longType, lmul); enterBinop("*", floatType, floatType, floatType, fmul); enterBinop("*", doubleType, doubleType, doubleType, dmul); enterBinop("/", intType, intType, intType, idiv); enterBinop("/", longType, longType, longType, ldiv); enterBinop("/", floatType, floatType, floatType, fdiv); enterBinop("/", doubleType, doubleType, doubleType, ddiv); enterBinop("%", intType, intType, intType, imod); enterBinop("%", longType, longType, longType, lmod); enterBinop("%", floatType, floatType, floatType, fmod); enterBinop("%", doubleType, doubleType, doubleType, dmod); enterBinop("&", booleanType, booleanType, booleanType, iand); enterBinop("&", intType, intType, intType, iand); enterBinop("&", longType, longType, longType, land); enterBinop("|", booleanType, booleanType, booleanType, ior); enterBinop("|", intType, intType, intType, ior); enterBinop("|", longType, longType, longType, lor); enterBinop("^", booleanType, booleanType, booleanType, ixor); enterBinop("^", intType, intType, intType, ixor); enterBinop("^", longType, longType, longType, lxor); enterBinop("<<", intType, intType, intType, ishl); enterBinop("<<", longType, intType, longType, lshl); enterBinop("<<", intType, longType, intType, ishll); enterBinop("<<", longType, longType, longType, lshll); enterBinop(">>", intType, intType, intType, ishr); enterBinop(">>", longType, intType, longType, lshr); enterBinop(">>", intType, longType, intType, ishrl); enterBinop(">>", longType, longType, longType, lshrl); enterBinop(">>>", intType, intType, intType, iushr); enterBinop(">>>", longType, intType, longType, lushr); enterBinop(">>>", intType, longType, intType, iushrl); enterBinop(">>>", longType, longType, longType, lushrl); enterBinop("<", intType, intType, booleanType, if_icmplt); enterBinop("<", longType, longType, booleanType, lcmp, iflt); enterBinop("<", floatType, floatType, booleanType, fcmpg, iflt); enterBinop("<", doubleType, doubleType, booleanType, dcmpg, iflt); enterBinop(">", intType, intType, booleanType, if_icmpgt); enterBinop(">", longType, longType, booleanType, lcmp, ifgt); enterBinop(">", floatType, floatType, booleanType, fcmpl, ifgt); enterBinop(">", doubleType, doubleType, booleanType, dcmpl, ifgt); enterBinop("<=", intType, intType, booleanType, if_icmple); enterBinop("<=", longType, longType, booleanType, lcmp, ifle); enterBinop("<=", floatType, floatType, booleanType, fcmpg, ifle); enterBinop("<=", doubleType, doubleType, booleanType, dcmpg, ifle); enterBinop(">=", intType, intType, booleanType, if_icmpge); enterBinop(">=", longType, longType, booleanType, lcmp, ifge); enterBinop(">=", floatType, floatType, booleanType, fcmpl, ifge); enterBinop(">=", doubleType, doubleType, booleanType, dcmpl, ifge); enterBinop("==", intType, intType, booleanType, if_icmpeq); enterBinop("==", longType, longType, booleanType, lcmp, ifeq); enterBinop("==", floatType, floatType, booleanType, fcmpl, ifeq); enterBinop("==", doubleType, doubleType, booleanType, dcmpl, ifeq); enterBinop("==", booleanType, booleanType, booleanType, if_icmpeq); enterBinop("==", objectType, objectType, booleanType, if_acmpeq); enterBinop("!=", intType, intType, booleanType, if_icmpne); enterBinop("!=", longType, longType, booleanType, lcmp, ifne); enterBinop("!=", floatType, floatType, booleanType, fcmpl, ifne); enterBinop("!=", doubleType, doubleType, booleanType, dcmpl, ifne); enterBinop("!=", booleanType, booleanType, booleanType, if_icmpne); enterBinop("!=", objectType, objectType, booleanType, if_acmpne); enterBinop("&&", booleanType, booleanType, booleanType, bool_and); enterBinop("||", booleanType, booleanType, booleanType, bool_or); } }