rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
}
public void setDragMode(int mode) { if ((mode != LIVE_DRAG_MODE) && (mode != OUTLINE_DRAG_MODE)) throw new IllegalArgumentException("Drag mode not valid."); // FIXME: Unsupported mode. if (mode == OUTLINE_DRAG_MODE) { // throw new IllegalArgumentException("Outline drag modes are unsupported."); mode = LIVE_DRAG_MODE; } dragMode = mode; }
array = Array.newInstance(klass, INITIAL_SIZE);
GrowableArrayContext(String id, Class newClass) { setId(id); klass = newClass; }
if (!klass.isInstance(o)) throw new AssemblyException( new IllegalArgumentException( "Cannot add object " + o + " to array where the elements are of class " + klass));
if (length == Array.getLength(array)) { Object tmp = Array.newInstance(klass, length * 2); System.arraycopy(array, 0, tmp, 0, length); array = tmp; }
public void addParameterObject(Object o) throws AssemblyException { if (!klass.isInstance(o)) throw new AssemblyException( new IllegalArgumentException( "Cannot add object " + o + " to array where the elements are of class " + klass)); list.add(o); }
list.add(o);
try { Array.set(array, length++, o); } catch(IllegalArgumentException iae) { throw new AssemblyException(iae); }
public void addParameterObject(Object o) throws AssemblyException { if (!klass.isInstance(o)) throw new AssemblyException( new IllegalArgumentException( "Cannot add object " + o + " to array where the elements are of class " + klass)); list.add(o); }
if (array == null)
if (length != Array.getLength(array))
public Object endContext(Context outerContext) throws AssemblyException { if (array == null) { array = Array.newInstance(klass, list.size()); for (int i = 0; i < list.size(); i++) Array.set(array, i, list.get(i)); } return array; }
array = Array.newInstance(klass, list.size()); for (int i = 0; i < list.size(); i++) Array.set(array, i, list.get(i));
Object tmp = Array.newInstance(klass, length); System.arraycopy(array, 0, tmp, 0, length); array = tmp;
public Object endContext(Context outerContext) throws AssemblyException { if (array == null) { array = Array.newInstance(klass, list.size()); for (int i = 0; i < list.size(); i++) Array.set(array, i, list.get(i)); } return array; }
if (array == null) return list.get(index); else
public Object get(int index) throws AssemblyException { if (array == null) return list.get(index); else return Array.get(array, index); }
if (array == null) { if (klass.isInstance(o)) list.add(index, o); else throw new AssemblyException( new IllegalArgumentException("Argument is not compatible to array component type.")); } else
try {
public void set(int index, Object o) throws AssemblyException { if (array == null) { if (klass.isInstance(o)) list.add(index, o); else throw new AssemblyException( new IllegalArgumentException("Argument is not compatible to array component type.")); } else Array.set(array, index, o); }
} catch(IllegalArgumentException iae) { throw new AssemblyException(iae); }
public void set(int index, Object o) throws AssemblyException { if (array == null) { if (klass.isInstance(o)) list.add(index, o); else throw new AssemblyException( new IllegalArgumentException("Argument is not compatible to array component type.")); } else Array.set(array, index, o); }
super(SwingUtilities.getOwnerFrame());
super(SwingUtilities.getOwnerFrame(null));
public JWindow() { super(SwingUtilities.getOwnerFrame()); windowInit(); }
return parent.getGraphics().create(location.x, location.y, size.width, size.height);
final int x = jComponent.getX(); final int y = jComponent.getY(); final int width = jComponent.getWidth(); final int height = jComponent.getHeight(); return parent.getGraphics().create(x, y, width, height);
public Graphics getGraphics() { log.debug("getGraphics"); final Component parent = component.getParent(); if (parent != null) { //System.out.println("creating graphics"); return parent.getGraphics().create(location.x, location.y, size.width, size.height); } else { throw new Error(); } }
public void hide() {
public final void hide() {
public void hide() { setVisible(false); }
public Dimension minimumSize() {
public final Dimension minimumSize() {
public Dimension minimumSize() { return jComponent.getMinimumSize(); }
public Dimension preferredSize() {
public final Dimension preferredSize() {
public Dimension preferredSize() { return jComponent.getPreferredSize(); }
public void print(Graphics g) {
public final void print(Graphics g) {
public void print(Graphics g) { jComponent.print(g); }
public void repaint(long tm, int x, int y, int width, int height) {
public final void repaint(long tm, int x, int y, int width, int height) {
public void repaint(long tm, int x, int y, int width, int height) { jComponent.repaint(tm, x, y, width, height); paintAWTComponent(); }
public void requestFocus() {
public final void requestFocus() {
public void requestFocus() { jComponent.requestFocus(); }
public void reshape(int x, int y, int width, int height) {
public final void reshape(int x, int y, int width, int height) {
public void reshape(int x, int y, int width, int height) { setBounds(x, y, width, height); }
public void setBackground(Color c) {
public final void setBackground(Color c) {
public void setBackground(Color c) { jComponent.setBackground(c); paintAWTComponent(); }
public void setBounds(int x, int y, int width, int height) { Rectangle b = jComponent.getBounds();
public final void setBounds(int x, int y, int width, int height) { final int oldWidth = jComponent.getWidth(); final int oldHeight = jComponent.getHeight();
public void setBounds(int x, int y, int width, int height) { Rectangle b = jComponent.getBounds(); jComponent.setBounds(x, y, width, height); if (b.width != width || b.height != height) { sendComponentEvent(ComponentEvent.COMPONENT_RESIZED); } else { sendComponentEvent(ComponentEvent.COMPONENT_MOVED); } }
if (b.width != width || b.height != height) {
if ((oldWidth != width) || (oldHeight != height)) {
public void setBounds(int x, int y, int width, int height) { Rectangle b = jComponent.getBounds(); jComponent.setBounds(x, y, width, height); if (b.width != width || b.height != height) { sendComponentEvent(ComponentEvent.COMPONENT_RESIZED); } else { sendComponentEvent(ComponentEvent.COMPONENT_MOVED); } }
public void setCursor(Cursor cursor) {
public final void setCursor(Cursor cursor) {
public void setCursor(Cursor cursor) { jComponent.setCursor(cursor); }
public void setEnabled(boolean b) {
public final void setEnabled(boolean b) {
public void setEnabled(boolean b) { jComponent.setEnabled(b); }
public void setEventMask(long mask) {
public final void setEventMask(long mask) {
public void setEventMask(long mask) { // TODO Auto-generated method stub }
public void setFont(Font f) {
public final void setFont(Font f) {
public void setFont(Font f) { jComponent.setFont(f); paintAWTComponent(); }
public void setVisible(boolean b) {
public final void setVisible(boolean b) {
public void setVisible(boolean b) { jComponent.setVisible(b); paintAWTComponent(); }
public void show() {
public final void show() {
public void show() { setVisible(true); }
public static Component[] getVisibleChildren(Container c)
public static List getVisibleChildren(Container c)
public static Component[] getVisibleChildren(Container c) { Component[] children = c.getComponents(); Vector visible = new Vector(); for (int i = 0; i < children.length; i++) if (children[i].isVisible()) visible.add(children[i]); return (Component[]) visible.toArray(new Container[visible.size()]); }
Vector visible = new Vector(); for (int i = 0; i < children.length; i++) if (children[i].isVisible()) visible.add(children[i]); return (Component[]) visible.toArray(new Container[visible.size()]);
Object o = visibleChildrenCache.get(children); VisibleComponentList visibleChildren = null; if (o == null) { visibleChildren = new VisibleComponentList(children); visibleChildrenCache.put(children, visibleChildren); } else visibleChildren = (VisibleComponentList) o; return visibleChildren;
public static Component[] getVisibleChildren(Container c) { Component[] children = c.getComponents(); Vector visible = new Vector(); for (int i = 0; i < children.length; i++) if (children[i].isVisible()) visible.add(children[i]); return (Component[]) visible.toArray(new Container[visible.size()]); }
public Checkbox() {
Checkbox() {
public Checkbox() { this("", false, null); }
public void addNotify() {
addNotify() {
public void addNotify() { if (peer == null) peer = getToolkit().createCheckbox(this); super.addNotify(); }
public CheckboxGroup getCheckboxGroup() { return (group); }
getCheckboxGroup() { return(group); }
public CheckboxGroup getCheckboxGroup() { return (group); }
public Object[] getSelectedObjects() {
getSelectedObjects() {
public Object[] getSelectedObjects() { if (state == false) return (null); Object[] objs = new Object[1]; objs[0] = label; return (objs); }
protected String paramString() { return ("label=" + label + ",state=" + state + ",group=" + group + "," + super.paramString()); }
paramString() { return ("label=" + label + ",state=" + state + ",group=" + group + "," + super.paramString()); }
protected String paramString() { return ("label=" + label + ",state=" + state + ",group=" + group + "," + super.paramString()); }
public synchronized void setCheckboxGroup(CheckboxGroup group) {
setCheckboxGroup(CheckboxGroup group) {
public synchronized void setCheckboxGroup(CheckboxGroup group) { this.group = group; if (peer != null) { CheckboxPeer cp = (CheckboxPeer) peer; cp.setCheckboxGroup(group); } }
cp.setCheckboxGroup(group); }
cp.setCheckboxGroup (group);
public synchronized void setCheckboxGroup(CheckboxGroup group) { this.group = group; if (peer != null) { CheckboxPeer cp = (CheckboxPeer) peer; cp.setCheckboxGroup(group); } }
}
public synchronized void setCheckboxGroup(CheckboxGroup group) { this.group = group; if (peer != null) { CheckboxPeer cp = (CheckboxPeer) peer; cp.setCheckboxGroup(group); } }
public synchronized void setLabel(String label) {
setLabel(String label) {
public synchronized void setLabel(String label) { this.label = label; if (peer != null) { CheckboxPeer cp = (CheckboxPeer) peer; cp.setLabel(label); } }
public synchronized void setState(boolean state) {
setState(boolean state) {
public synchronized void setState(boolean state) { this.state = state; if (peer != null) { CheckboxPeer cp = (CheckboxPeer) peer; cp.setState(state); } }
cp.setState(state); }
cp.setState (state);
public synchronized void setState(boolean state) { this.state = state; if (peer != null) { CheckboxPeer cp = (CheckboxPeer) peer; cp.setState(state); } }
}
public synchronized void setState(boolean state) { this.state = state; if (peer != null) { CheckboxPeer cp = (CheckboxPeer) peer; cp.setState(state); } }
setDropTarget(new DropTarget());
public JComponent() { super(); super.setLayout(new FlowLayout()); defaultLocale = Locale.getDefault(); debugGraphicsOptions = DebugGraphics.NONE_OPTION; }
public Object getClientProperty(Object key)
public final Object getClientProperty(Object key)
public Object getClientProperty(Object key) { return getClientProperties().get(key); }
return "JComponent";
StringBuffer sb = new StringBuffer(); sb.append(super.paramString()); sb.append(",alignmentX=").append(getAlignmentX()); sb.append(",alignmentY=").append(getAlignmentY()); sb.append(",border="); if (getBorder() != null) sb.append(getBorder()); sb.append(",maximumSize="); if (getMaximumSize() != null) sb.append(getMaximumSize()); sb.append(",minimumSize="); if (getMinimumSize() != null) sb.append(getMinimumSize()); sb.append(",preferredSize="); if (getPreferredSize() != null) sb.append(getPreferredSize()); return sb.toString();
protected String paramString() { return "JComponent"; }
public void putClientProperty(Object key, Object value)
public final void putClientProperty(Object key, Object value)
public void putClientProperty(Object key, Object value) { getClientProperties().put(key, value); }
counter++;
public DebugGraphics() { // TODO }
if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Clearing rect: " + new Rectangle(x, y, width, height)); }
public void clearRect(int x, int y, int width, int height) { graphics.clearRect(x, y, width, height); }
if ((debugOptions & LOG_OPTION) != 0) logStream().println(" Netting clipRect: " + graphics.getClipBounds());
public void clipRect(int x, int y, int width, int height) { graphics.clipRect(x, y, width, height); }
if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Copying area from: " + new Rectangle(x, y, width, height) + " to: " + new Point(destx, desty)); }
public void copyArea(int x, int y, int width, int height, int destx, int desty) { graphics.copyArea(x, y, width, height, destx, desty); }
return new DebugGraphics(graphics.create());
DebugGraphics copy = new DebugGraphics(graphics.create()); copy.debugOptions = debugOptions; return copy;
public Graphics create() { return new DebugGraphics(graphics.create()); }
if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Drawing 3D rect: " + new Rectangle(x, y, width, height) + "Raised bezel: " + raised); }
public void draw3DRect(int x, int y, int width, int height, boolean raised) { graphics.draw3DRect(x, y, width, height, raised); }
if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Drawing arc: " + new Rectangle(x, y, width, height) + " startAngle: " + startAngle + " arcAngle: " + arcAngle); }
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) { graphics.drawArc(x, y, width, height, startAngle, arcAngle); }
if ((debugOptions & LOG_OPTION) != 0) logStream().println(prefix() + " Drawing bytes at: " + new Point(x, y));
public void drawBytes(byte[] data, int offset, int length, int x, int y) { graphics.drawBytes(data, offset, length, x, y); }
graphics.setColor(color);
public void drawChars(char[] data, int offset, int length, int x, int y) { for (int index = 0; index < (debugFlashCount - 1); ++index) { graphics.setColor(color); graphics.drawChars(data, offset, length, x, y); sleep(debugFlashTime); graphics.setColor(debugFlashColor); graphics.drawChars(data, offset, length, x, y); sleep(debugFlashTime); } graphics.setColor(color); graphics.drawChars(data, offset, length, x, y); }
if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Drawing image: " + image + " at: " + new Point(x, y)); }
public boolean drawImage(Image image, int x, int y, ImageObserver observer) { return graphics.drawImage(image, x, y, observer); }
if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Drawing line: from (" + x1 + ", " + y1 + ") to (" + x2 + ", " + y2 + ")"); }
public void drawLine(int x1, int y1, int x2, int y2) { graphics.drawLine(x1, y1, x2, y2); }
if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Drawing oval: " + new Rectangle(x, y, width, height)); }
public void drawOval(int x, int y, int width, int height) { graphics.drawOval(x, y, width, height); }
if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Drawing polygon: nPoints: " + npoints + " X's: " + xpoints + " Y's: " + ypoints); }
public void drawPolygon(int[] xpoints, int[] ypoints, int npoints) { graphics.drawPolygon(xpoints, ypoints, npoints); }
if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Drawing polyline: nPoints: " + npoints + " X's: " + xpoints + " Y's: " + ypoints); }
public void drawPolyline(int[] xpoints, int[] ypoints, int npoints) { graphics.drawPolyline(xpoints, ypoints, npoints); }
graphics.setColor(color);
public void drawRect(int x, int y, int width, int height) { for (int index = 0; index < (debugFlashCount - 1); ++index) { graphics.setColor(color); graphics.drawRect(x, y, width, height); sleep(debugFlashTime); graphics.setColor(debugFlashColor); graphics.drawRect(x, y, width, height); sleep(debugFlashTime); } graphics.setColor(color); graphics.drawRect(x, y, width, height); }
if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Drawing round rect: " + new Rectangle(x, y, width, height) + " arcWidth: " + arcWidth + " arcHeight: " + arcHeight); }
public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) { graphics.drawRoundRect(x, y, width, height, arcWidth, arcHeight); }
if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Drawing string: \"" + string + "\" at: " + new Point(x, y)); }
public void drawString(String string, int x, int y) { graphics.drawString(string, x, y); }
if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Filling 3D rect: " + new Rectangle(x, y, width, height) + "Raised bezel: " + raised); }
public void fill3DRect(int x, int y, int width, int height, boolean raised) { graphics.fill3DRect(x, y, width, height, raised); }
if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Filling arc: " + new Rectangle(x, y, width, height) + " startAngle: " + startAngle + " arcAngle: " + arcAngle); }
public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle) { graphics.fillArc(x, y, width, height, startAngle, arcAngle); }
if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Filling oval: " + new Rectangle(x, y, width, height)); }
public void fillOval(int x, int y, int width, int height) { graphics.fillOval(x, y, width, height); }
if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Drawing polygon: nPoints: " + npoints + " X's: " + xpoints + " Y's: " + ypoints); }
public void fillPolygon(int[] xpoints, int[] ypoints, int npoints) { graphics.fillPolygon(xpoints, ypoints, npoints); }
graphics.setColor(color);
public void fillRect(int x, int y, int width, int height) { for (int index = 0; index < (debugFlashCount - 1); ++index) { graphics.setColor(color); graphics.fillRect(x, y, width, height); sleep(debugFlashTime); graphics.setColor(debugFlashColor); graphics.fillRect(x, y, width, height); sleep(debugFlashTime); } graphics.setColor(color); graphics.fillRect(x, y, width, height); }
if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Filling round rect: " + new Rectangle(x, y, width, height) + " arcWidth: " + arcWidth + " arcHeight: " + arcHeight); }
public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) { graphics.fillRoundRect(x, y, width, height, arcWidth, arcHeight); }
return color;
return graphics.getColor();
public Color getColor() { return color; }
if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Setting new clipRect: " + new Rectangle(x, y, width, height)); }
public void setClip(int x, int y, int width, int height) { graphics.setClip(x, y, width, height); }
this.color = color;
if ((debugOptions & LOG_OPTION) != 0) logStream().println(prefix() + " Setting color: " + color); graphics.setColor(color);
public void setColor(Color color) { this.color = color; }
if ((debugOptions & LOG_OPTION) != 0) if (options == NONE_OPTION) logStream().println(prefix() + "Disabling debug"); else logStream().println(prefix() + "Enabling debug");
public void setDebugOptions(int options) { debugOptions = options; }
if ((debugOptions & LOG_OPTION) != 0) logStream().println(prefix() + " Setting font: " + font);
public void setFont(Font font) { graphics.setFont(font); }
if ((debugOptions & LOG_OPTION) != 0) logStream().println(prefix() + " Setting paint mode");
public void setPaintMode() { graphics.setPaintMode(); }
if ((debugOptions & LOG_OPTION) != 0) logStream().println(prefix() + " Setting XOR mode: " + color);
public void setXORMode(Color color) { graphics.setXORMode(color); }
if ((debugOptions & LOG_OPTION) != 0) logStream().println(prefix() + " Translating by: " + new Point(x, y));
public void translate(int x, int y) { graphics.translate(x, y); }
sem.send();
if (sem.send()) {
private void sendIt (Frame parent, SendEMail sem) { if (parent == null) parent = new JFrame(); try { sem.send(); JOptionPane.showMessageDialog(parent, LangTool.getString("em.confirmationMessage") + " " + (String)toAddress.getSelectedItem(), LangTool.getString("em.titleConfirmation"), JOptionPane.INFORMATION_MESSAGE); if (session != null) { config.setProperty("emailTo", getToTokens(config.getStringProperty("emailTo"), toAddress)); config.saveSessionProps(); setToCombo(config.getStringProperty("emailTo"),toAddress); } } catch (IOException ioe) { System.out.println(ioe.getMessage()); } catch (SendFailedException sfe) { showFailedException(parent, sfe); } catch (Exception ex) { System.out.println(ex.getMessage()); } }
if (session != null) { config.setProperty("emailTo", getToTokens(config.getStringProperty("emailTo"), toAddress)); config.saveSessionProps(); setToCombo(config.getStringProperty("emailTo"),toAddress);
if (session != null) { config.setProperty("emailTo", getToTokens(config.getStringProperty("emailTo"), toAddress)); config.saveSessionProps(); setToCombo(config.getStringProperty("emailTo"),toAddress); }
private void sendIt (Frame parent, SendEMail sem) { if (parent == null) parent = new JFrame(); try { sem.send(); JOptionPane.showMessageDialog(parent, LangTool.getString("em.confirmationMessage") + " " + (String)toAddress.getSelectedItem(), LangTool.getString("em.titleConfirmation"), JOptionPane.INFORMATION_MESSAGE); if (session != null) { config.setProperty("emailTo", getToTokens(config.getStringProperty("emailTo"), toAddress)); config.saveSessionProps(); setToCombo(config.getStringProperty("emailTo"),toAddress); } } catch (IOException ioe) { System.out.println(ioe.getMessage()); } catch (SendFailedException sfe) { showFailedException(parent, sfe); } catch (Exception ex) { System.out.println(ex.getMessage()); } }
catch (SendFailedException sfe) { showFailedException(parent, sfe); }
private void sendIt (Frame parent, SendEMail sem) { if (parent == null) parent = new JFrame(); try { sem.send(); JOptionPane.showMessageDialog(parent, LangTool.getString("em.confirmationMessage") + " " + (String)toAddress.getSelectedItem(), LangTool.getString("em.titleConfirmation"), JOptionPane.INFORMATION_MESSAGE); if (session != null) { config.setProperty("emailTo", getToTokens(config.getStringProperty("emailTo"), toAddress)); config.saveSessionProps(); setToCombo(config.getStringProperty("emailTo"),toAddress); } } catch (IOException ioe) { System.out.println(ioe.getMessage()); } catch (SendFailedException sfe) { showFailedException(parent, sfe); } catch (Exception ex) { System.out.println(ex.getMessage()); } }
vstack.push(createConst(type, fpv1 + fpv2));
vstack.push(createConst(ifac, type, fpv1 + fpv2));
final static void add(AbstractX86Stream os, EmitterContext ec, VirtualStack vstack, int type) { final Item v2 = vstack.pop(type); final Item v1 = vstack.pop(type); if (v1.isConstant() && v2.isConstant()) { final double fpv1 = getFPValue(v1); final double fpv2 = getFPValue(v2); vstack.push(createConst(type, fpv1 + fpv2)); } else { // Prepare stack final FPUStack fpuStack = vstack.fpuStack; final Register reg; reg = prepareForOperation(os, ec, vstack, fpuStack, v2, v1, true); final Item result = fpuStack.getItem(reg); fpuStack.pop(); // Calculate os.writeFADDP(reg); // Push result vstack.push(result); } }
final IntItem res = IntItem.createReg(resr);
final ItemFactory ifac = ec.getItemFactory(); final IntItem res = (IntItem)ifac.createReg(JvmType.INT, resr);
final static void compare(AbstractX86Stream os, EmitterContext ec, VirtualStack vstack, boolean gt, int type, Label curInstrLabel) { final Item v2 = vstack.pop(type); final Item v1 = vstack.pop(type); // Prepare operands final FPUStack fpuStack = vstack.fpuStack; final Register reg; reg = prepareForOperation(os, ec, vstack, fpuStack, v2, v1, false); // We need reg to be ST1. fxchST1(os, fpuStack, reg); final X86RegisterPool pool = ec.getPool(); pool.request(EAX); final Register resr = pool.request(JvmType.INT); if (!gt) { // Reverse order fxch(os, fpuStack, Register.ST1); } os.writeFUCOMPP(); // Compare, Pop twice os.writeFNSTSW_AX(); // Store fp status word in AX os.writeSAHF(); // Store AH to Flags // Pop fpu stack twice (FUCOMPP) fpuStack.pop(); fpuStack.pop(); final Label eqLabel = new Label(curInstrLabel + "eq"); final Label ltLabel = new Label(curInstrLabel + "lt"); final Label endLabel = new Label(curInstrLabel + "end"); os.writeJCC(eqLabel, X86Constants.JE); os.writeJCC(ltLabel, X86Constants.JB); // Greater if (gt) { os.writeMOV_Const(resr, -1); } else { os.writeMOV_Const(resr, 1); } os.writeJMP(endLabel); // Equal os.setObjectRef(eqLabel); os.writeXOR(resr, resr); os.writeJMP(endLabel); // Less os.setObjectRef(ltLabel); if (gt) { os.writeMOV_Const(resr, 1); } else { os.writeMOV_Const(resr, -1); } // End os.setObjectRef(endLabel); // Push result final IntItem res = IntItem.createReg(resr); pool.transferOwnerTo(resr, res); vstack.push(res); // Release pool.release(EAX); }
vstack.push(createConst(toType, getFPValue(v)));
vstack.push(createConst(ifac, toType, getFPValue(v)));
final static void convert(EmitterContext ec, VirtualStack vstack, int fromType, int toType) { final Item v = vstack.pop(fromType); if (v.isConstant()) { vstack.push(createConst(toType, getFPValue(v))); } else { v.pushToFPU(ec); vstack.fpuStack.pop(v); final Item result = createFPUStack(toType); vstack.push(result); vstack.fpuStack.push(result); } }
final Item result = createFPUStack(toType);
final Item result = ifac.createFPUStack(toType);
final static void convert(EmitterContext ec, VirtualStack vstack, int fromType, int toType) { final Item v = vstack.pop(fromType); if (v.isConstant()) { vstack.push(createConst(toType, getFPValue(v))); } else { v.pushToFPU(ec); vstack.fpuStack.pop(v); final Item result = createFPUStack(toType); vstack.push(result); vstack.fpuStack.push(result); } }
private final static Item createConst(int type, double value) {
private final static Item createConst(ItemFactory ifac, int type, double value) {
private final static Item createConst(int type, double value) { switch (type) { case JvmType.DOUBLE: return DoubleItem.createConst(value); case JvmType.FLOAT: return FloatItem.createConst((float) value); case JvmType.INT: return IntItem.createConst((int) value); case JvmType.LONG: return LongItem.createConst((long) value); default: throw new IllegalArgumentException("Invalid type " + type); } }
return DoubleItem.createConst(value);
return ifac.createDConst(value);
private final static Item createConst(int type, double value) { switch (type) { case JvmType.DOUBLE: return DoubleItem.createConst(value); case JvmType.FLOAT: return FloatItem.createConst((float) value); case JvmType.INT: return IntItem.createConst((int) value); case JvmType.LONG: return LongItem.createConst((long) value); default: throw new IllegalArgumentException("Invalid type " + type); } }
return FloatItem.createConst((float) value);
return ifac.createFConst((float) value);
private final static Item createConst(int type, double value) { switch (type) { case JvmType.DOUBLE: return DoubleItem.createConst(value); case JvmType.FLOAT: return FloatItem.createConst((float) value); case JvmType.INT: return IntItem.createConst((int) value); case JvmType.LONG: return LongItem.createConst((long) value); default: throw new IllegalArgumentException("Invalid type " + type); } }
return IntItem.createConst((int) value);
return ifac.createIConst((int) value);
private final static Item createConst(int type, double value) { switch (type) { case JvmType.DOUBLE: return DoubleItem.createConst(value); case JvmType.FLOAT: return FloatItem.createConst((float) value); case JvmType.INT: return IntItem.createConst((int) value); case JvmType.LONG: return LongItem.createConst((long) value); default: throw new IllegalArgumentException("Invalid type " + type); } }
return LongItem.createConst((long) value);
return ifac.createLConst((long) value);
private final static Item createConst(int type, double value) { switch (type) { case JvmType.DOUBLE: return DoubleItem.createConst(value); case JvmType.FLOAT: return FloatItem.createConst((float) value); case JvmType.INT: return IntItem.createConst((int) value); case JvmType.LONG: return LongItem.createConst((long) value); default: throw new IllegalArgumentException("Invalid type " + type); } }
vstack.push(createConst(type, fpv1 / fpv2));
vstack.push(createConst(ifac, type, fpv1 / fpv2));
final static void div(AbstractX86Stream os, EmitterContext ec, VirtualStack vstack, int type) { final Item v2 = vstack.pop(type); final Item v1 = vstack.pop(type); if (v1.isConstant() && v2.isConstant()) { final double fpv1 = getFPValue(v1); final double fpv2 = getFPValue(v2); vstack.push(createConst(type, fpv1 / fpv2)); } else { // Prepare stack final FPUStack fpuStack = vstack.fpuStack; final Register reg; reg = prepareForOperation(os, ec, vstack, fpuStack, v2, v1, false); final Item result = fpuStack.getItem(reg); fpuStack.pop(); // Calculate os.writeFDIVP(reg); // Push result vstack.push(result); } }
vstack.push(createConst(type, fpv1 * fpv2));
vstack.push(createConst(ifac, type, fpv1 * fpv2));
final static void mul(AbstractX86Stream os, EmitterContext ec, VirtualStack vstack, int type) { final Item v2 = vstack.pop(type); final Item v1 = vstack.pop(type); if (v1.isConstant() && v2.isConstant()) { final double fpv1 = getFPValue(v1); final double fpv2 = getFPValue(v2); vstack.push(createConst(type, fpv1 * fpv2)); } else { // Prepare stack final FPUStack fpuStack = vstack.fpuStack; final Register reg; reg = prepareForOperation(os, ec, vstack, fpuStack, v2, v1, true); final Item result = fpuStack.getItem(reg); fpuStack.pop(); // Calculate os.writeFMULP(reg); // Push result vstack.push(result); } }
vstack.push(createConst(type, -fpv));
vstack.push(createConst(ifac, type, -fpv));
final static void neg(AbstractX86Stream os, EmitterContext ec, VirtualStack vstack, int type) { final Item v = vstack.pop(type); if (v.isConstant()) { final double fpv = getFPValue(v); vstack.push(createConst(type, -fpv)); } else { // Prepare final FPUStack fpuStack = vstack.fpuStack; prepareForOperation(os, ec, vstack, fpuStack, v); // Calculate os.writeFCHS(); // Push result vstack.push(v); } }
vstack.push(createConst(type, fpv1 % fpv2));
vstack.push(createConst(ifac, type, fpv1 % fpv2));
final static void rem(AbstractX86Stream os, EmitterContext ec, VirtualStack vstack, int type) { final Item v2 = vstack.pop(type); final Item v1 = vstack.pop(type); if (v1.isConstant() && v2.isConstant()) { final double fpv1 = getFPValue(v1); final double fpv2 = getFPValue(v2); vstack.push(createConst(type, fpv1 % fpv2)); } else { // Prepare stack final FPUStack fpuStack = vstack.fpuStack; final Register reg; reg = prepareForOperation(os, ec, vstack, fpuStack, v2, v1, false); // We need reg to be ST1, if not swap fxchST1(os, fpuStack, reg); // Pop the fpuStack.tos fpuStack.pop(); // Calculate os.writeFXCH(Register.ST1); os.writeFPREM(); os.writeFSTP(Register.ST1); // Push result vstack.push(fpuStack.tos()); } }
vstack.push(createConst(type, fpv1 - fpv2));
vstack.push(createConst(ifac, type, fpv1 - fpv2));
final static void sub(AbstractX86Stream os, EmitterContext ec, VirtualStack vstack, int type) { final Item v2 = vstack.pop(type); final Item v1 = vstack.pop(type); if (v1.isConstant() && v2.isConstant()) { final double fpv1 = getFPValue(v1); final double fpv2 = getFPValue(v2); vstack.push(createConst(type, fpv1 - fpv2)); } else { // Prepare stack final FPUStack fpuStack = vstack.fpuStack; final Register reg; reg = prepareForOperation(os, ec, vstack, fpuStack, v2, v1, false); final Item result = fpuStack.getItem(reg); fpuStack.pop(); // Calculate os.writeFSUBP(reg); // Push result vstack.push(result); } }
REMatch newMatch = null; REMatch last = null;
REMatch.REMatchList newMatch = new REMatch.REMatchList();
private boolean matchP(CharIndexed input, REMatch mymatch) { REMatch newMatch = null; REMatch last = null; REToken tk; for (int i=0; i < options.size(); i++) { // In ordaer that the backtracking can work, // each option must be chained to the next token. // But the chain method has some side effect, so // we use clones. tk = (REToken)((REToken) options.elementAt(i)).clone(); tk.chain(this.next); tk.setUncle(this.uncle); tk.subIndex = this.subIndex; REMatch tryMatch = (REMatch) mymatch.clone(); if (tk.match(input, tryMatch)) { // match was successful if (last == null) { newMatch = tryMatch; last = tryMatch; } else { last.next = tryMatch; last = tryMatch; } } // is a match } // try next option if (newMatch != null) { // set contents of mymatch equal to newMatch // try each one that matched mymatch.assignFrom(newMatch); return true; } else { return false; } }
if (last == null) { newMatch = tryMatch; last = tryMatch; } else { last.next = tryMatch; last = tryMatch; }
newMatch.addTail(tryMatch);
private boolean matchP(CharIndexed input, REMatch mymatch) { REMatch newMatch = null; REMatch last = null; REToken tk; for (int i=0; i < options.size(); i++) { // In ordaer that the backtracking can work, // each option must be chained to the next token. // But the chain method has some side effect, so // we use clones. tk = (REToken)((REToken) options.elementAt(i)).clone(); tk.chain(this.next); tk.setUncle(this.uncle); tk.subIndex = this.subIndex; REMatch tryMatch = (REMatch) mymatch.clone(); if (tk.match(input, tryMatch)) { // match was successful if (last == null) { newMatch = tryMatch; last = tryMatch; } else { last.next = tryMatch; last = tryMatch; } } // is a match } // try next option if (newMatch != null) { // set contents of mymatch equal to newMatch // try each one that matched mymatch.assignFrom(newMatch); return true; } else { return false; } }
if (newMatch != null) {
if (newMatch.head != null) {
private boolean matchP(CharIndexed input, REMatch mymatch) { REMatch newMatch = null; REMatch last = null; REToken tk; for (int i=0; i < options.size(); i++) { // In ordaer that the backtracking can work, // each option must be chained to the next token. // But the chain method has some side effect, so // we use clones. tk = (REToken)((REToken) options.elementAt(i)).clone(); tk.chain(this.next); tk.setUncle(this.uncle); tk.subIndex = this.subIndex; REMatch tryMatch = (REMatch) mymatch.clone(); if (tk.match(input, tryMatch)) { // match was successful if (last == null) { newMatch = tryMatch; last = tryMatch; } else { last.next = tryMatch; last = tryMatch; } } // is a match } // try next option if (newMatch != null) { // set contents of mymatch equal to newMatch // try each one that matched mymatch.assignFrom(newMatch); return true; } else { return false; } }
mymatch.assignFrom(newMatch);
mymatch.assignFrom(newMatch.head);
private boolean matchP(CharIndexed input, REMatch mymatch) { REMatch newMatch = null; REMatch last = null; REToken tk; for (int i=0; i < options.size(); i++) { // In ordaer that the backtracking can work, // each option must be chained to the next token. // But the chain method has some side effect, so // we use clones. tk = (REToken)((REToken) options.elementAt(i)).clone(); tk.chain(this.next); tk.setUncle(this.uncle); tk.subIndex = this.subIndex; REMatch tryMatch = (REMatch) mymatch.clone(); if (tk.match(input, tryMatch)) { // match was successful if (last == null) { newMatch = tryMatch; last = tryMatch; } else { last.next = tryMatch; last = tryMatch; } } // is a match } // try next option if (newMatch != null) { // set contents of mymatch equal to newMatch // try each one that matched mymatch.assignFrom(newMatch); return true; } else { return false; } }
methods.remove(new Long (hash));
methods.remove(new Long(hash)); }
private void buildMethodHash(Class cls, boolean build) { Method[] meths = cls.getMethods(); for (int i = 0; i < meths.length; i++) { /* Don't need to include any java.xxx related stuff */ if (meths[i].getDeclaringClass().getName().startsWith("java.")) { continue; } long hash = RMIHashes.getMethodHash(meths[i]); if(build) methods.put(new Long (hash), meths[i]); else methods.remove(new Long (hash));//System.out.println("meth = " + meths[i] + ", hash = " + hash); }}
}
private void buildMethodHash(Class cls, boolean build) { Method[] meths = cls.getMethods(); for (int i = 0; i < meths.length; i++) { /* Don't need to include any java.xxx related stuff */ if (meths[i].getDeclaringClass().getName().startsWith("java.")) { continue; } long hash = RMIHashes.getMethodHash(meths[i]); if(build) methods.put(new Long (hash), meths[i]); else methods.remove(new Long (hash));//System.out.println("meth = " + meths[i] + ", hash = " + hash); }}
public RemoteStub exportObject(Remote obj) throws RemoteException { if (myself == null) {
public Remote exportObject(Remote obj) throws RemoteException { if (myself == null) {
public RemoteStub exportObject(Remote obj) throws RemoteException { if (myself == null) { myself = obj; // Save it to server manager, to let client calls in the same VM to issue // local call manager.serverobj = obj; // Find and install the stub Class cls = obj.getClass(); Class expCls; try { // where ist the _Stub? (check superclasses also) expCls = findStubSkelClass(cls); } catch (Exception ex) { throw new RemoteException("can not find stubs for class: " + cls, ex); } stub = (RemoteStub)getHelperClass(expCls, "_Stub"); if (stub == null) { throw new RemoteException("failed to export: " + cls); } // Find and install the skeleton (if there is one) skel = (Skeleton)getHelperClass(expCls, "_Skel"); // Build hash of methods which may be called. buildMethodHash(obj.getClass(), true); // Export it. UnicastServer.exportObject(this); } return (stub);}