bugged
stringlengths
6
599k
fixed
stringlengths
10
599k
__index_level_0__
int64
0
1.13M
public abstract boolean checkPermission(Principal user, Permission perm);
boolean checkPermission(Principal user, Permission perm);
13,397
public abstract Enumeration entries();
Enumeration entries();
13,398
public abstract String getName();
String getName();
13,399
public abstract Enumeration getPermissions(Principal user);
Enumeration getPermissions(Principal user);
13,400
public abstract boolean removeEntry(Principal caller, AclEntry entry) throws NotOwnerException;
boolean removeEntry(Principal caller, AclEntry entry) throws NotOwnerException;
13,401
public abstract void setName(Principal caller, String name) throws NotOwnerException;
void setName(Principal caller, String name) throws NotOwnerException;
13,402
public abstract String toString();
String toString();
13,403
public void waitForIdle () { if (EventQueue.isDispatchThread ()) throw new IllegalThreadStateException ("Robot: waitForIdle called from " + "the event dispatch thread"); EventQueue q = Toolkit.getDefaultToolkit ().getSystemEventQueue (); try { q.invokeAndWait (new Runnable () { public void run () { } }); } catch (InterruptedException e) { System.err.println ("Robot: waitForIdle interrupted"); } catch (InvocationTargetException e) { System.err.println ("Robot: waitForIdle cannot invoke target"); } }
public void waitForIdle () { if (EventQueue.isDispatchThread ()) throw new IllegalThreadStateException ("Robot: waitForIdle called from " + "the event dispatch thread"); try { q.invokeAndWait (new Runnable () { public void run () { } }); } catch (InterruptedException e) { System.err.println ("Robot: waitForIdle interrupted"); } catch (InvocationTargetException e) { System.err.println ("Robot: waitForIdle cannot invoke target"); } }
13,404
public void waitForIdle () { if (EventQueue.isDispatchThread ()) throw new IllegalThreadStateException ("Robot: waitForIdle called from " + "the event dispatch thread"); EventQueue q = Toolkit.getDefaultToolkit ().getSystemEventQueue (); try { q.invokeAndWait (new Runnable () { public void run () { } }); } catch (InterruptedException e) { System.err.println ("Robot: waitForIdle interrupted"); } catch (InvocationTargetException e) { System.err.println ("Robot: waitForIdle cannot invoke target"); } }
public void waitForIdle () { if (EventQueue.isDispatchThread ()) throw new IllegalThreadStateException ("Robot: waitForIdle called from " + "the event dispatch thread"); EventQueue q = Toolkit.getDefaultToolkit ().getSystemEventQueue (); try { EventQueue.invokeAndWait (new Runnable () { public void run () { } }); } catch (InterruptedException e) { System.err.println ("Robot: waitForIdle interrupted"); } catch (InvocationTargetException e) { System.err.println ("Robot: waitForIdle cannot invoke target"); } }
13,405
q.invokeAndWait (new Runnable () { public void run () { } });
EventQueue.invokeAndWait (new Runnable () { public void run () { } });
13,406
int[] getRGBPixels (Rectangle r);
int[] getRGBPixels (Rectangle screen);
13,407
void keyPress (int x);
void keyPress (int keycode);
13,408
void keyRelease (int x);
void keyRelease (int keycode);
13,409
void mousePress (int x);
void mousePress (int buttons);
13,410
void mouseRelease (int x);
void mouseRelease (int buttons);
13,411
void mouseWheel (int x);
void mouseWheel (int wheelAmt);
13,412
public InetAddress[] getHostByName(String hostname) throws UnknownHostException;
public byte[][] getHostByName(String hostname) throws UnknownHostException;
13,413
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { if (c instanceof JMenu) { JMenu menu = (JMenu) c; if (menu.isSelected()) { g.setColor(borderColorDark); g.drawLine(x, y, x, y + h); g.drawLine(x, y, x + w, y); g.drawLine(x + w - 2, y + 1, x + w - 2, y + h); g.setColor(borderColorLight); g.drawLine(x + w - 1, y + 1, x + w - 1, y + h); } } else if (c instanceof JMenuItem) { JMenuItem item = (JMenuItem) c; if (item.isArmed()) { g.setColor(borderColorDark); g.drawLine(x, y, x + w, y); g.setColor(borderColorLight); g.drawLine(x, y + h - 1, x + w, y + h - 1); } } }
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { if (c instanceof JMenu) { JMenu menu = (JMenu) c; if (menu.isSelected()) { g.setColor(dark); g.drawLine(x, y, x, y + h); g.drawLine(x, y, x + w, y); g.drawLine(x + w - 2, y + 1, x + w - 2, y + h); g.setColor(borderColorLight); g.drawLine(x + w - 1, y + 1, x + w - 1, y + h); } } else if (c instanceof JMenuItem) { JMenuItem item = (JMenuItem) c; if (item.isArmed()) { g.setColor(dark); g.drawLine(x, y, x + w, y); g.setColor(borderColorLight); g.drawLine(x, y + h - 1, x + w, y + h - 1); } } }
13,414
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { if (c instanceof JMenu) { JMenu menu = (JMenu) c; if (menu.isSelected()) { g.setColor(borderColorDark); g.drawLine(x, y, x, y + h); g.drawLine(x, y, x + w, y); g.drawLine(x + w - 2, y + 1, x + w - 2, y + h); g.setColor(borderColorLight); g.drawLine(x + w - 1, y + 1, x + w - 1, y + h); } } else if (c instanceof JMenuItem) { JMenuItem item = (JMenuItem) c; if (item.isArmed()) { g.setColor(borderColorDark); g.drawLine(x, y, x + w, y); g.setColor(borderColorLight); g.drawLine(x, y + h - 1, x + w, y + h - 1); } } }
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { if (c instanceof JMenu) { JMenu menu = (JMenu) c; if (menu.isSelected()) { g.setColor(borderColorDark); g.drawLine(x, y, x, y + h); g.drawLine(x, y, x + w, y); g.drawLine(x + w - 2, y + 1, x + w - 2, y + h); g.setColor(light); g.drawLine(x + w - 1, y + 1, x + w - 1, y + h); } } else if (c instanceof JMenuItem) { JMenuItem item = (JMenuItem) c; if (item.isArmed()) { g.setColor(borderColorDark); g.drawLine(x, y, x + w, y); g.setColor(light); g.drawLine(x, y + h - 1, x + w, y + h - 1); } } }
13,415
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { if (c instanceof JMenu) { JMenu menu = (JMenu) c; if (menu.isSelected()) { g.setColor(borderColorDark); g.drawLine(x, y, x, y + h); g.drawLine(x, y, x + w, y); g.drawLine(x + w - 2, y + 1, x + w - 2, y + h); g.setColor(borderColorLight); g.drawLine(x + w - 1, y + 1, x + w - 1, y + h); } } else if (c instanceof JMenuItem) { JMenuItem item = (JMenuItem) c; if (item.isArmed()) { g.setColor(borderColorDark); g.drawLine(x, y, x + w, y); g.setColor(borderColorLight); g.drawLine(x, y + h - 1, x + w, y + h - 1); } } }
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { if (c instanceof JMenu) { JMenu menu = (JMenu) c; if (menu.isSelected()) { g.setColor(borderColorDark); g.drawLine(x, y, x, y + h); g.drawLine(x, y, x + w, y); g.drawLine(x + w - 2, y + 1, x + w - 2, y + h); g.setColor(borderColorLight); g.drawLine(x + w - 1, y + 1, x + w - 1, y + h); } } else if (c instanceof JMenuItem) { JMenuItem item = (JMenuItem) c; if (item.isArmed()) { g.setColor(borderColorDark); g.drawLine(x, y, x + w, y); g.setColor(borderColorLight); g.drawLine(x, y + h - 1, x + w, y + h - 1); } } }
13,416
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { Color darkShadow = MetalLookAndFeel.getPrimaryControlDarkShadow(); Color light = MetalLookAndFeel.getPrimaryControlHighlight(); // draw dark outer border g.setColor(darkShadow); g.drawRect(x, y, w - 1, h - 1); // draw highlighted inner border (only top and left) g.setColor(light); g.drawLine(x + 1, y + 1, x + 1, y + h - 2); g.drawLine(x + 1, y + 1, x + w - 2, y + 1); }
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { Color darkShadow = MetalLookAndFeel.getPrimaryControlDarkShadow(); Color light = MetalLookAndFeel.getPrimaryControlHighlight(); // draw dark outer border g.setColor(darkShadow); g.drawRect(x, y, w - 1, h - 1); // draw highlighted inner border (only top and left) g.setColor(light); g.drawLine(x + 1, y + 1, x + w - 2, y + 1); }
13,417
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { JToolBar tb = (JToolBar) c; if (tb.getOrientation() == JToolBar.HORIZONTAL) { MetalUtils.fillMetalPattern(g, x + 2, y + 2, x + 11, y + h - 5, MetalLookAndFeel.getControlHighlight(), MetalLookAndFeel.getControlDarkShadow()); } else { MetalUtils.fillMetalPattern(g, x + 2, y + 2, x + w - 5, y + 11, MetalLookAndFeel.getControlHighlight(), MetalLookAndFeel.getControlDarkShadow()); } }
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { JToolBar tb = (JToolBar) c; if (tb.getOrientation() == JToolBar.HORIZONTAL) { MetalUtils.fillMetalPattern(tb, g, x + 2, y + 2, x + 11, y + h - 5, MetalLookAndFeel.getControlHighlight(), MetalLookAndFeel.getControlDarkShadow()); } else { MetalUtils.fillMetalPattern(g, x + 2, y + 2, x + w - 5, y + 11, MetalLookAndFeel.getControlHighlight(), MetalLookAndFeel.getControlDarkShadow()); } }
13,418
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { JToolBar tb = (JToolBar) c; if (tb.getOrientation() == JToolBar.HORIZONTAL) { MetalUtils.fillMetalPattern(g, x + 2, y + 2, x + 11, y + h - 5, MetalLookAndFeel.getControlHighlight(), MetalLookAndFeel.getControlDarkShadow()); } else { MetalUtils.fillMetalPattern(g, x + 2, y + 2, x + w - 5, y + 11, MetalLookAndFeel.getControlHighlight(), MetalLookAndFeel.getControlDarkShadow()); } }
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { JToolBar tb = (JToolBar) c; if (tb.getOrientation() == JToolBar.HORIZONTAL) { MetalUtils.fillMetalPattern(g, x + 2, y + 2, x + 11, y + h - 5, MetalLookAndFeel.getControlHighlight(), MetalLookAndFeel.getControlDarkShadow()); } else { MetalUtils.fillMetalPattern(tb, g, x + 2, y + 2, x + w - 5, y + 11, MetalLookAndFeel.getControlHighlight(), MetalLookAndFeel.getControlDarkShadow()); } }
13,419
public StreamResult(OutputStream stream) { this.outputStream = stream; }
public StreamResult(OutputStream stream) { this.outputStream = stream; }
13,420
public void propertyChange(PropertyChangeEvent e) { String propName = e.getPropertyName(); if (propName.equals("JInternalFrame.isPalette")) { if (e.getNewValue().equals(Boolean.TRUE)) setPalette(true); else setPalette(false); } else super.propertyChange(e); }
public void propertyChange(PropertyChangeEvent e) { String propName = e.getPropertyName(); if (e.getPropertyName().equals(JInternalFrame.FRAME_ICON_PROPERTY)) { title.setIcon(frame.getFrameIcon()); } else if (propName.equals("JInternalFrame.isPalette")) { if (e.getNewValue().equals(Boolean.TRUE)) setPalette(true); else setPalette(false); } else super.propertyChange(e); }
13,421
AttributedString(AttributedCharacterIterator aci){ this(aci, aci.getBeginIndex(), aci.getEndIndex(), null);}
AttributedString(String str){ this(aci, aci.getBeginIndex(), aci.getEndIndex(), null);}
13,422
AttributedString(AttributedCharacterIterator aci){ this(aci, aci.getBeginIndex(), aci.getEndIndex(), null);}
AttributedString(AttributedCharacterIterator aci){ sci = new StringCharacterIterator(str); attribs = new AttributeRange[0];}
13,423
addAttribute(AttributedCharacterIterator.Attribute attrib, Object value){ addAttribute(attrib, value, 0, sci.getEndIndex() - 1);}
addAttribute(AttributedCharacterIterator.Attribute attrib, Object value){ addAttribute(attrib, value, 0, sci.getEndIndex());}
13,424
getIterator(){ return(new AttributedStringIterator(sci, attribs, 0, sci.getEndIndex() - 1, null));}
getIterator(){ return(new AttributedStringIterator(sci, attribs, 0, sci.getEndIndex() - 1, null));}
13,425
public final void visit_dup2_x2() { // Push all on the stack, since this opcode is just too complicated vstack.push(eContext); System.out.println("NEW dup2_x2"); final Item v1 = vstack.pop1(); final Item v2 = vstack.pop1(); final int c1 = v1.getCategory(); final int c2 = v2.getCategory(); // Perform a stack swap independent of the actual form os.writePOP(helper.AAX); // Value1 os.writePOP(helper.ABX); // Value2 os.writePOP(helper.ACX); // Value3 os.writePOP(helper.ADX); // Value4 os.writePUSH(helper.ABX); // Value2 os.writePUSH(helper.AAX); // Value1 os.writePUSH(helper.ADX); // Value4 os.writePUSH(helper.ACX); // Value3 os.writePUSH(helper.ABX); // Value2 os.writePUSH(helper.AAX); // Value1 // Now update the operandstack // cope with brain-dead definition from Sun (look-like somebody there // was to eager to optimize this and it landed in the compiler... if (c1 == 2) { if (c2 == 2) { // form 4 vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v2); vstack.push1(v1); } else { // form 2 final Item v3 = vstack.pop1(); int c3 = v3.getCategory(); assertCondition(c3 == 1, "category mismatch"); vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v3); vstack.push1(v2); vstack.push1(v1); } } else { assertCondition(c2 == 1, "category mismatch"); final Item v3 = vstack.pop1(); int c3 = v3.getCategory(); if (c3 == 2) { // form 3 vstack.push1(ifac.createStack(v2.getType())); vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v3); vstack.push1(v2); vstack.push1(v1); } else { // form 1 final Item v4 = vstack.pop1(); vstack.push1(ifac.createStack(v2.getType())); vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v4); vstack.push1(v3); vstack.push1(v2); vstack.push1(v1); } } }
public final void visit_dup2_x2() { // Push all on the stack, since this opcode is just too complicated vstack.push(eContext); System.out.println("NEW dup2_x2"); final Item v1 = vstack.pop1(); final Item v2 = vstack.pop1(); final int c1 = v1.getCategory(); final int c2 = v2.getCategory(); // Perform a stack swap independent of the actual form os.writePOP(helper.AAX); // Value1 os.writePOP(helper.ABX); // Value2 os.writePOP(helper.ACX); // Value3 os.writePOP(helper.ADX); // Value4 os.writePUSH(helper.ABX); // Value2 os.writePUSH(helper.AAX); // Value1 os.writePUSH(helper.ADX); // Value4 os.writePUSH(helper.ACX); // Value3 os.writePUSH(helper.ABX); // Value2 os.writePUSH(helper.AAX); // Value1 // Now update the operandstack // cope with brain-dead definition from Sun (look-like somebody there // was to eager to optimize this and it landed in the compiler... if (c1 == 2) { if (c2 == 2) { // form 4 vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v2); vstack.push1(v1); } else { // form 2 final Item v3 = vstack.pop1(); int c3 = v3.getCategory(); assertCondition(c3 == 1, "category mismatch"); vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v3); vstack.push1(v2); vstack.push1(v1); } } else { assertCondition(c2 == 1, "category mismatch"); final Item v3 = vstack.pop1(); int c3 = v3.getCategory(); if (c3 == 2) { // form 3 vstack.push1(ifac.createStack(v2.getType())); vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v3); vstack.push1(v2); vstack.push1(v1); } else { // form 1 final Item v4 = vstack.pop1(); vstack.push1(ifac.createStack(v2.getType())); vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v4); vstack.push1(v3); vstack.push1(v2); vstack.push1(v1); } } }
13,426
public final void visit_dup2_x2() { // Push all on the stack, since this opcode is just too complicated vstack.push(eContext); System.out.println("NEW dup2_x2"); final Item v1 = vstack.pop1(); final Item v2 = vstack.pop1(); final int c1 = v1.getCategory(); final int c2 = v2.getCategory(); // Perform a stack swap independent of the actual form os.writePOP(helper.AAX); // Value1 os.writePOP(helper.ABX); // Value2 os.writePOP(helper.ACX); // Value3 os.writePOP(helper.ADX); // Value4 os.writePUSH(helper.ABX); // Value2 os.writePUSH(helper.AAX); // Value1 os.writePUSH(helper.ADX); // Value4 os.writePUSH(helper.ACX); // Value3 os.writePUSH(helper.ABX); // Value2 os.writePUSH(helper.AAX); // Value1 // Now update the operandstack // cope with brain-dead definition from Sun (look-like somebody there // was to eager to optimize this and it landed in the compiler... if (c1 == 2) { if (c2 == 2) { // form 4 vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v2); vstack.push1(v1); } else { // form 2 final Item v3 = vstack.pop1(); int c3 = v3.getCategory(); assertCondition(c3 == 1, "category mismatch"); vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v3); vstack.push1(v2); vstack.push1(v1); } } else { assertCondition(c2 == 1, "category mismatch"); final Item v3 = vstack.pop1(); int c3 = v3.getCategory(); if (c3 == 2) { // form 3 vstack.push1(ifac.createStack(v2.getType())); vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v3); vstack.push1(v2); vstack.push1(v1); } else { // form 1 final Item v4 = vstack.pop1(); vstack.push1(ifac.createStack(v2.getType())); vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v4); vstack.push1(v3); vstack.push1(v2); vstack.push1(v1); } } }
public final void visit_dup2_x2() { // Push all on the stack, since this opcode is just too complicated vstack.push(eContext); System.out.println("NEW dup2_x2"); final Item v1 = vstack.pop1(); final Item v2 = vstack.pop1(); final int c1 = v1.getCategory(); final int c2 = v2.getCategory(); // Perform a stack swap independent of the actual form os.writePOP(helper.AAX); // Value1 os.writePOP(helper.ABX); // Value2 os.writePOP(helper.ACX); // Value3 os.writePOP(helper.ADX); // Value4 os.writePUSH(helper.ABX); // Value2 os.writePUSH(helper.AAX); // Value1 os.writePUSH(helper.ADX); // Value4 os.writePUSH(helper.ACX); // Value3 os.writePUSH(helper.ABX); // Value2 os.writePUSH(helper.AAX); // Value1 // Now update the operandstack // cope with brain-dead definition from Sun (look-like somebody there // was to eager to optimize this and it landed in the compiler... if (c1 == 2) { if (c2 == 2) { // form 4 vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v2); vstack.push1(v1); } else { // form 2 final Item v3 = vstack.pop1(); int c3 = v3.getCategory(); assertCondition(c3 == 1, "category mismatch"); vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v3); vstack.push1(v2); vstack.push1(v1); } } else { assertCondition(c2 == 1, "category mismatch"); final Item v3 = vstack.pop1(); int c3 = v3.getCategory(); if (c3 == 2) { // form 3 vstack.push1(ifac.createStack(v2.getType())); vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v3); vstack.push1(v2); vstack.push1(v1); } else { // form 1 final Item v4 = vstack.pop1(); vstack.push1(ifac.createStack(v2.getType())); vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v4); vstack.push1(v3); vstack.push1(v2); vstack.push1(v1); } } }
13,427
public final void visit_dup2_x2() { // Push all on the stack, since this opcode is just too complicated vstack.push(eContext); System.out.println("NEW dup2_x2"); final Item v1 = vstack.pop1(); final Item v2 = vstack.pop1(); final int c1 = v1.getCategory(); final int c2 = v2.getCategory(); // Perform a stack swap independent of the actual form os.writePOP(helper.AAX); // Value1 os.writePOP(helper.ABX); // Value2 os.writePOP(helper.ACX); // Value3 os.writePOP(helper.ADX); // Value4 os.writePUSH(helper.ABX); // Value2 os.writePUSH(helper.AAX); // Value1 os.writePUSH(helper.ADX); // Value4 os.writePUSH(helper.ACX); // Value3 os.writePUSH(helper.ABX); // Value2 os.writePUSH(helper.AAX); // Value1 // Now update the operandstack // cope with brain-dead definition from Sun (look-like somebody there // was to eager to optimize this and it landed in the compiler... if (c1 == 2) { if (c2 == 2) { // form 4 vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v2); vstack.push1(v1); } else { // form 2 final Item v3 = vstack.pop1(); int c3 = v3.getCategory(); assertCondition(c3 == 1, "category mismatch"); vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v3); vstack.push1(v2); vstack.push1(v1); } } else { assertCondition(c2 == 1, "category mismatch"); final Item v3 = vstack.pop1(); int c3 = v3.getCategory(); if (c3 == 2) { // form 3 vstack.push1(ifac.createStack(v2.getType())); vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v3); vstack.push1(v2); vstack.push1(v1); } else { // form 1 final Item v4 = vstack.pop1(); vstack.push1(ifac.createStack(v2.getType())); vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v4); vstack.push1(v3); vstack.push1(v2); vstack.push1(v1); } } }
public final void visit_dup2_x2() { // Push all on the stack, since this opcode is just too complicated vstack.push(eContext); System.out.println("NEW dup2_x2"); final Item v1 = vstack.pop1(); final Item v2 = vstack.pop1(); final int c1 = v1.getCategory(); final int c2 = v2.getCategory(); // Perform a stack swap independent of the actual form os.writePOP(helper.AAX); // Value1 os.writePOP(helper.ABX); // Value2 os.writePOP(helper.ACX); // Value3 os.writePOP(helper.ADX); // Value4 os.writePUSH(helper.ABX); // Value2 os.writePUSH(helper.AAX); // Value1 os.writePUSH(helper.ADX); // Value4 os.writePUSH(helper.ACX); // Value3 os.writePUSH(helper.ABX); // Value2 os.writePUSH(helper.AAX); // Value1 // Now update the operandstack // cope with brain-dead definition from Sun (look-like somebody there // was to eager to optimize this and it landed in the compiler... os.writePOP(helper.AAX); os.writePOP(helper.ABX); os.writePOP(helper.ACX); os.writePOP(helper.ADX); os.writePUSH(helper.ABX); os.writePUSH(helper.AAX); os.writePUSH(helper.ADX); os.writePUSH(helper.ACX); os.writePUSH(helper.ABX); os.writePUSH(helper.AAX); if (c2 == 2) { // form 4 vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v2); vstack.push1(v1); } else { // form 2 final Item v3 = vstack.pop1(); int c3 = v3.getCategory(); assertCondition(c3 == 1, "category mismatch"); vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v3); vstack.push1(v2); vstack.push1(v1); } } else { assertCondition(c2 == 1, "category mismatch"); final Item v3 = vstack.pop1(); int c3 = v3.getCategory(); if (c3 == 2) { // form 3 vstack.push1(ifac.createStack(v2.getType())); vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v3); vstack.push1(v2); vstack.push1(v1); } else { // form 1 final Item v4 = vstack.pop1(); vstack.push1(ifac.createStack(v2.getType())); vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v4); vstack.push1(v3); vstack.push1(v2); vstack.push1(v1); } } }
13,428
public final void visit_dup2_x2() { // Push all on the stack, since this opcode is just too complicated vstack.push(eContext); System.out.println("NEW dup2_x2"); final Item v1 = vstack.pop1(); final Item v2 = vstack.pop1(); final int c1 = v1.getCategory(); final int c2 = v2.getCategory(); // Perform a stack swap independent of the actual form os.writePOP(helper.AAX); // Value1 os.writePOP(helper.ABX); // Value2 os.writePOP(helper.ACX); // Value3 os.writePOP(helper.ADX); // Value4 os.writePUSH(helper.ABX); // Value2 os.writePUSH(helper.AAX); // Value1 os.writePUSH(helper.ADX); // Value4 os.writePUSH(helper.ACX); // Value3 os.writePUSH(helper.ABX); // Value2 os.writePUSH(helper.AAX); // Value1 // Now update the operandstack // cope with brain-dead definition from Sun (look-like somebody there // was to eager to optimize this and it landed in the compiler... if (c1 == 2) { if (c2 == 2) { // form 4 vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v2); vstack.push1(v1); } else { // form 2 final Item v3 = vstack.pop1(); int c3 = v3.getCategory(); assertCondition(c3 == 1, "category mismatch"); vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v3); vstack.push1(v2); vstack.push1(v1); } } else { assertCondition(c2 == 1, "category mismatch"); final Item v3 = vstack.pop1(); int c3 = v3.getCategory(); if (c3 == 2) { // form 3 vstack.push1(ifac.createStack(v2.getType())); vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v3); vstack.push1(v2); vstack.push1(v1); } else { // form 1 final Item v4 = vstack.pop1(); vstack.push1(ifac.createStack(v2.getType())); vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v4); vstack.push1(v3); vstack.push1(v2); vstack.push1(v1); } } }
public final void visit_dup2_x2() { // Push all on the stack, since this opcode is just too complicated vstack.push(eContext); System.out.println("NEW dup2_x2"); final Item v1 = vstack.pop1(); final Item v2 = vstack.pop1(); final int c1 = v1.getCategory(); final int c2 = v2.getCategory(); // Perform a stack swap independent of the actual form os.writePOP(helper.AAX); // Value1 os.writePOP(helper.ABX); // Value2 os.writePOP(helper.ACX); // Value3 os.writePOP(helper.ADX); // Value4 os.writePUSH(helper.ABX); // Value2 os.writePUSH(helper.AAX); // Value1 os.writePUSH(helper.ADX); // Value4 os.writePUSH(helper.ACX); // Value3 os.writePUSH(helper.ABX); // Value2 os.writePUSH(helper.AAX); // Value1 // Now update the operandstack // cope with brain-dead definition from Sun (look-like somebody there // was to eager to optimize this and it landed in the compiler... if (c1 == 2) { if (c2 == 2) { // form 4 vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v2); vstack.push1(v1); } else { // form 2 final Item v3 = vstack.pop1(); int c3 = v3.getCategory(); assertCondition(c3 == 1, "category mismatch"); vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v3); vstack.push1(v2); vstack.push1(v1); } } else { assertCondition(c2 == 1, "category mismatch"); final Item v3 = vstack.pop1(); int c3 = v3.getCategory(); if (c3 == 2) { // form 3 vstack.push1(ifac.createStack(v2.getType())); vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v3); vstack.push1(v2); vstack.push1(v1); } else { // form 1 final Item v4 = vstack.pop1(); vstack.push1(ifac.createStack(v2.getType())); vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v4); vstack.push1(v3); vstack.push1(v2); vstack.push1(v1); } } }
13,429
public final void visit_dup2_x2() { // Push all on the stack, since this opcode is just too complicated vstack.push(eContext); System.out.println("NEW dup2_x2"); final Item v1 = vstack.pop1(); final Item v2 = vstack.pop1(); final int c1 = v1.getCategory(); final int c2 = v2.getCategory(); // Perform a stack swap independent of the actual form os.writePOP(helper.AAX); // Value1 os.writePOP(helper.ABX); // Value2 os.writePOP(helper.ACX); // Value3 os.writePOP(helper.ADX); // Value4 os.writePUSH(helper.ABX); // Value2 os.writePUSH(helper.AAX); // Value1 os.writePUSH(helper.ADX); // Value4 os.writePUSH(helper.ACX); // Value3 os.writePUSH(helper.ABX); // Value2 os.writePUSH(helper.AAX); // Value1 // Now update the operandstack // cope with brain-dead definition from Sun (look-like somebody there // was to eager to optimize this and it landed in the compiler... if (c1 == 2) { if (c2 == 2) { // form 4 vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v2); vstack.push1(v1); } else { // form 2 final Item v3 = vstack.pop1(); int c3 = v3.getCategory(); assertCondition(c3 == 1, "category mismatch"); vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v3); vstack.push1(v2); vstack.push1(v1); } } else { assertCondition(c2 == 1, "category mismatch"); final Item v3 = vstack.pop1(); int c3 = v3.getCategory(); if (c3 == 2) { // form 3 vstack.push1(ifac.createStack(v2.getType())); vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v3); vstack.push1(v2); vstack.push1(v1); } else { // form 1 final Item v4 = vstack.pop1(); vstack.push1(ifac.createStack(v2.getType())); vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v4); vstack.push1(v3); vstack.push1(v2); vstack.push1(v1); } } }
public final void visit_dup2_x2() { // Push all on the stack, since this opcode is just too complicated vstack.push(eContext); System.out.println("NEW dup2_x2"); final Item v1 = vstack.pop1(); final Item v2 = vstack.pop1(); final int c1 = v1.getCategory(); final int c2 = v2.getCategory(); // Perform a stack swap independent of the actual form os.writePOP(helper.AAX); // Value1 os.writePOP(helper.ABX); // Value2 os.writePOP(helper.ACX); // Value3 os.writePOP(helper.ADX); // Value4 os.writePUSH(helper.ABX); // Value2 os.writePUSH(helper.AAX); // Value1 os.writePUSH(helper.ADX); // Value4 os.writePUSH(helper.ACX); // Value3 os.writePUSH(helper.ABX); // Value2 os.writePUSH(helper.AAX); // Value1 // Now update the operandstack // cope with brain-dead definition from Sun (look-like somebody there // was to eager to optimize this and it landed in the compiler... if (c1 == 2) { if (c2 == 2) { // form 4 vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v2); vstack.push1(v1); } else { // form 2 final Item v3 = vstack.pop1(); int c3 = v3.getCategory(); assertCondition(c3 == 1, "category mismatch"); vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v3); vstack.push1(v2); vstack.push1(v1); } } else { assertCondition(c2 == 1, "category mismatch"); final Item v3 = vstack.pop1(); int c3 = v3.getCategory(); if (c3 == 2) { // form 3 vstack.push1(ifac.createStack(v2.getType())); vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v3); vstack.push1(v2); vstack.push1(v1); } else { // form 1 final Item v4 = vstack.pop1(); vstack.push1(ifac.createStack(v2.getType())); vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v4); vstack.push1(v3); vstack.push1(v2); vstack.push1(v1); } } }
13,430
public final void visit_dup2_x2() { // Push all on the stack, since this opcode is just too complicated vstack.push(eContext); System.out.println("NEW dup2_x2"); final Item v1 = vstack.pop1(); final Item v2 = vstack.pop1(); final int c1 = v1.getCategory(); final int c2 = v2.getCategory(); // Perform a stack swap independent of the actual form os.writePOP(helper.AAX); // Value1 os.writePOP(helper.ABX); // Value2 os.writePOP(helper.ACX); // Value3 os.writePOP(helper.ADX); // Value4 os.writePUSH(helper.ABX); // Value2 os.writePUSH(helper.AAX); // Value1 os.writePUSH(helper.ADX); // Value4 os.writePUSH(helper.ACX); // Value3 os.writePUSH(helper.ABX); // Value2 os.writePUSH(helper.AAX); // Value1 // Now update the operandstack // cope with brain-dead definition from Sun (look-like somebody there // was to eager to optimize this and it landed in the compiler... if (c1 == 2) { if (c2 == 2) { // form 4 vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v2); vstack.push1(v1); } else { // form 2 final Item v3 = vstack.pop1(); int c3 = v3.getCategory(); assertCondition(c3 == 1, "category mismatch"); vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v3); vstack.push1(v2); vstack.push1(v1); } } else { assertCondition(c2 == 1, "category mismatch"); final Item v3 = vstack.pop1(); int c3 = v3.getCategory(); if (c3 == 2) { // form 3 vstack.push1(ifac.createStack(v2.getType())); vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v3); vstack.push1(v2); vstack.push1(v1); } else { // form 1 final Item v4 = vstack.pop1(); vstack.push1(ifac.createStack(v2.getType())); vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v4); vstack.push1(v3); vstack.push1(v2); vstack.push1(v1); } } }
public final void visit_dup2_x2() { // Push all on the stack, since this opcode is just too complicated vstack.push(eContext); System.out.println("NEW dup2_x2"); final Item v1 = vstack.pop1(); final Item v2 = vstack.pop1(); final int c1 = v1.getCategory(); final int c2 = v2.getCategory(); // Perform a stack swap independent of the actual form os.writePOP(helper.AAX); // Value1 os.writePOP(helper.ABX); // Value2 os.writePOP(helper.ACX); // Value3 os.writePOP(helper.ADX); // Value4 os.writePUSH(helper.ABX); // Value2 os.writePUSH(helper.AAX); // Value1 os.writePUSH(helper.ADX); // Value4 os.writePUSH(helper.ACX); // Value3 os.writePUSH(helper.ABX); // Value2 os.writePUSH(helper.AAX); // Value1 // Now update the operandstack // cope with brain-dead definition from Sun (look-like somebody there // was to eager to optimize this and it landed in the compiler... if (c1 == 2) { if (c2 == 2) { // form 4 vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v2); vstack.push1(v1); } else { // form 2 final Item v3 = vstack.pop1(); int c3 = v3.getCategory(); assertCondition(c3 == 1, "category mismatch"); vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v3); vstack.push1(v2); vstack.push1(v1); } } else { assertCondition(c2 == 1, "category mismatch"); final Item v3 = vstack.pop1(); int c3 = v3.getCategory(); if (c3 == 2) { // form 3 vstack.push1(ifac.createStack(v2.getType())); vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v3); vstack.push1(v2); vstack.push1(v1); } else { // form 1 final Item v4 = vstack.pop1(); vstack.push1(ifac.createStack(v2.getType())); vstack.push1(ifac.createStack(v1.getType())); vstack.push1(v4); vstack.push1(v3); vstack.push1(v2); vstack.push1(v1); } } }
13,431
public ImageGraphicAttribute (Image image, int alignment) { super (alignment); this.image = image; }
public ImageGraphicAttribute (Image image, int alignment) { super (alignment); this.image = image; }
13,432
public void draw (Graphics2D graphics, float x, float y) throws NotImplementedException { throw new Error ("not implemented"); }
public void draw (Graphics2D graphics, float x, float y) throws NotImplementedException { throw new Error ("not implemented"); }
13,433
public void draw (Graphics2D graphics, float x, float y) throws NotImplementedException { throw new Error ("not implemented"); }
public void draw (Graphics2D graphics, float x, float y) throws NotImplementedException { g.drawImage(image, (int) (x - originX), (int) (y - originY), null); }
13,434
public float getAdvance () throws NotImplementedException { throw new Error ("not implemented"); }
public float getAdvance () throws NotImplementedException { return Math.max(0, image.getWidth(null) - originX); }
13,435
public float getAscent () throws NotImplementedException { throw new Error ("not implemented"); }
public float getAscent () throws NotImplementedException { return Math.max(0, originY); }
13,436
public Rectangle2D getBounds () throws NotImplementedException { throw new Error ("not implemented"); }
public Rectangle2D getBounds () throws NotImplementedException { return new Rectangle2D.Float(- originX, - originY, image.getWidth(null), image.getHeight(null)); }
13,437
public float getDescent () throws NotImplementedException { throw new Error ("not implemented"); }
public float getDescent () throws NotImplementedException { return Math.max(0, image.getHeight(null) - originY); }
13,438
public int hashCode () throws NotImplementedException { throw new Error ("not implemented"); }
public int hashCode () throws NotImplementedException { throw new Error ("not implemented"); }
13,439
public int hashCode () throws NotImplementedException { throw new Error ("not implemented"); }
public int hashCode () throws NotImplementedException { return image.hashCode(); }
13,440
public Variable(int type, int index) { this(type, index, 1000*index); }
public Variable(int type, int index) { this(type, index, 1000*index); }
13,441
private SetOverrideType(int a_value) { _value = a_value; }
protected SetOverrideType(int a_value) { _value = a_value; }
13,442
public InetAddress[] getHostByName(String hostname) throws UnknownHostException { ArrayList list = null; for (Iterator i = nlm.getNetworkLayers().iterator(); i.hasNext(); ) { final NetworkLayer layer = (NetworkLayer)i.next(); final ProtocolAddress[] addrs = layer.getHostByName(hostname); if (addrs != null) { if (list != null) { list = new ArrayList(); } final int cnt = addrs.length; for (int j = 0; j < cnt; j++) { list.add(addrs[j].toInetAddress()); } } } if (list == null) { return null; } else { return (InetAddress[])list.toArray(new InetAddress[list.size()]); } }
public InetAddress[] getHostByName(String hostname) throws UnknownHostException { ArrayList list = null; for (Iterator i = nlm.getNetworkLayers().iterator(); i.hasNext(); ) { final NetworkLayer layer = (NetworkLayer)i.next(); final ProtocolAddress[] addrs = layer.getHostByName(hostname); if (addrs != null) { if (list == null) { list = new ArrayList(); } final int cnt = addrs.length; for (int j = 0; j < cnt; j++) { list.add(addrs[j].toInetAddress()); } } } if (list == null) { return null; } else { return (InetAddress[])list.toArray(new InetAddress[list.size()]); } }
13,444
public InetAddress[] getHostByName(String hostname) throws UnknownHostException { ArrayList list = null; for (Iterator i = nlm.getNetworkLayers().iterator(); i.hasNext(); ) { final NetworkLayer layer = (NetworkLayer)i.next(); final ProtocolAddress[] addrs = layer.getHostByName(hostname); if (addrs != null) { if (list != null) { list = new ArrayList(); } final int cnt = addrs.length; for (int j = 0; j < cnt; j++) { list.add(addrs[j].toInetAddress()); } } } if (list == null) { return null; } else { return (InetAddress[])list.toArray(new InetAddress[list.size()]); } }
public InetAddress[] getHostByName(String hostname) throws UnknownHostException { ArrayList list = null; for (Iterator i = nlm.getNetworkLayers().iterator(); i.hasNext(); ) { final NetworkLayer layer = (NetworkLayer)i.next(); final ProtocolAddress[] addrs = layer.getHostByName(hostname); if (addrs != null) { if (list != null) { list = new ArrayList(); } final int cnt = addrs.length; for (int j = 0; j < cnt; j++) { final ProtocolAddress pa = addrs[j]; if (pa != null) { list.add(pa.toInetAddress()); } } } } if (list == null) { return null; } else { return (InetAddress[])list.toArray(new InetAddress[list.size()]); } }
13,445
protected void installDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); Border border = defaults.getBorder("InternalFrame.border"); frame.setBorder(border); frame.setFrameIcon(defaults.getIcon("InternalFrame.icon")); // InternalFrames are invisible by default. frame.setVisible(false); }
protected void installDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); Border border = defaults.getBorder("InternalFrame.border"); frame.setBorder(border); frame.setFrameIcon(defaults.getIcon("InternalFrame.icon")); // InternalFrames are invisible by default. frame.setVisible(false); }
13,446
public DataBufferShort(int size, int numBanks) { super(TYPE_SHORT, size, numBanks); bankData = new short[numBanks][size]; data = bankData[0]; }
public DataBufferShort(int size) { super(TYPE_SHORT, size, numBanks); bankData = new short[numBanks][size]; data = bankData[0]; }
13,447
public DataBufferShort(int size, int numBanks) { super(TYPE_SHORT, size, numBanks); bankData = new short[numBanks][size]; data = bankData[0]; }
public DataBufferShort(int size, int numBanks) { super(TYPE_SHORT, size, numBanks); bankData = new short[numBanks][size]; data = bankData[0]; }
13,448
public DataBufferUShort(int size, int numBanks) { super(TYPE_USHORT, size, numBanks); bankData = new short[numBanks][size]; data = bankData[0]; }
public DataBufferUShort(int size) { super(TYPE_USHORT, size, numBanks); bankData = new short[numBanks][size]; data = bankData[0]; }
13,449
public DataBufferUShort(int size, int numBanks) { super(TYPE_USHORT, size, numBanks); bankData = new short[numBanks][size]; data = bankData[0]; }
public DataBufferUShort(int size, int numBanks) { super(TYPE_USHORT, size, numBanks); bankData = new short[numBanks][size]; data = bankData[0]; }
13,450
public DataBufferFloat(int size, int numBanks) { super(TYPE_FLOAT, size, numBanks); bankData = new float[numBanks][size]; data = bankData[0]; }
public DataBufferFloat(int size) { super(TYPE_FLOAT, size, numBanks); bankData = new float[numBanks][size]; data = bankData[0]; }
13,451
public DataBufferFloat(int size, int numBanks) { super(TYPE_FLOAT, size, numBanks); bankData = new float[numBanks][size]; data = bankData[0]; }
public DataBufferFloat(int size, int numBanks) { super(TYPE_FLOAT, size, numBanks); bankData = new float[numBanks][size]; data = bankData[0]; }
13,452
TemplateNode clone(Stylesheet stylesheet) { return new ChooseNode((children == null) ? null : children.clone(stylesheet), (next == null) ? null : next.clone(stylesheet)); }
TemplateNode clone(Stylesheet stylesheet) { return new ChooseNode((children == null) ? null : children.clone(stylesheet), (next == null) ? null : next.clone(stylesheet)); }
13,453
public static void main(String[] args) throws Exception { boolean xIncludeAware = false; if (args.length > 1 && "-x".equals(args[1])) xIncludeAware = true; XMLParser p = new XMLParser(new java.io.FileInputStream(args[0]), absolutize(null, args[0]), true, // validating true, // namespaceAware true, // coalescing, true, // replaceERefs true, // externalEntities true, // supportDTD true, // baseAware true, // stringInterning true, // extendedEventTypes null, null); XMLStreamReader reader = p; if (xIncludeAware) reader = new XIncludeFilter(p, args[0], true, true, true); try { int event; //do while (reader.hasNext()) { event = reader.next(); Location loc = reader.getLocation(); System.out.print(loc.getLineNumber()+":"+loc.getColumnNumber()+" "); switch (event) { case XMLStreamConstants.START_DOCUMENT: System.out.println("START_DOCUMENT version="+reader.getVersion()+ " encoding="+reader.getEncoding()); break; case XMLStreamConstants.END_DOCUMENT: System.out.println("END_DOCUMENT"); break; case XMLStreamConstants.START_ELEMENT: System.out.println("START_ELEMENT "+reader.getName()); int l = reader.getNamespaceCount(); for (int i = 0; i < l; i++) System.out.println("\tnamespace "+reader.getNamespacePrefix(i)+ "='"+reader.getNamespaceURI(i)+"'"); l = reader.getAttributeCount(); for (int i = 0; i < l; i++) System.out.println("\tattribute "+reader.getAttributeName(i)+ "='"+reader.getAttributeValue(i)+"'"); break; case XMLStreamConstants.END_ELEMENT: System.out.println("END_ELEMENT "+reader.getName()); break; case XMLStreamConstants.CHARACTERS: System.out.println("CHARACTERS '"+encodeText(reader.getText())+"'"); break; case XMLStreamConstants.CDATA: System.out.println("CDATA '"+encodeText(reader.getText())+"'"); break; case XMLStreamConstants.SPACE: System.out.println("SPACE '"+encodeText(reader.getText())+"'"); break; case XMLStreamConstants.DTD: System.out.println("DTD "+reader.getText()); break; case XMLStreamConstants.ENTITY_REFERENCE: System.out.println("ENTITY_REFERENCE "+reader.getText()); break; case XMLStreamConstants.COMMENT: System.out.println("COMMENT '"+encodeText(reader.getText())+"'"); break; case XMLStreamConstants.PROCESSING_INSTRUCTION: System.out.println("PROCESSING_INSTRUCTION "+reader.getPITarget()+ " "+reader.getPIData()); break; case START_ENTITY: System.out.println("START_ENTITY "+reader.getText()); break; case END_ENTITY: System.out.println("END_ENTITY "+reader.getText()); break; default: System.out.println("Unknown event: "+event); } } } catch (XMLStreamException e) { Location l = reader.getLocation(); System.out.println("At line "+l.getLineNumber()+ ", column "+l.getColumnNumber()+ " of "+l.getSystemId()); throw e; } }
public static void main(String[] args) throws Exception { boolean xIncludeAware = false; int pos = 0; while (pos < args.length && args[pos].startsWith("-")) { if ("-x".equals(args[pos])) xIncludeAware = true; XMLParser p = new XMLParser(new java.io.FileInputStream(args[0]), absolutize(null, args[0]), true, // validating true, // namespaceAware true, // coalescing, true, // replaceERefs true, // externalEntities true, // supportDTD true, // baseAware true, // stringInterning true, // extendedEventTypes null, null); XMLStreamReader reader = p; if (xIncludeAware) reader = new XIncludeFilter(p, args[0], true, true, true); try { int event; //do while (reader.hasNext()) { event = reader.next(); Location loc = reader.getLocation(); System.out.print(loc.getLineNumber()+":"+loc.getColumnNumber()+" "); switch (event) { case XMLStreamConstants.START_DOCUMENT: System.out.println("START_DOCUMENT version="+reader.getVersion()+ " encoding="+reader.getEncoding()); break; case XMLStreamConstants.END_DOCUMENT: System.out.println("END_DOCUMENT"); break; case XMLStreamConstants.START_ELEMENT: System.out.println("START_ELEMENT "+reader.getName()); int l = reader.getNamespaceCount(); for (int i = 0; i < l; i++) System.out.println("\tnamespace "+reader.getNamespacePrefix(i)+ "='"+reader.getNamespaceURI(i)+"'"); l = reader.getAttributeCount(); for (int i = 0; i < l; i++) System.out.println("\tattribute "+reader.getAttributeName(i)+ "='"+reader.getAttributeValue(i)+"'"); break; case XMLStreamConstants.END_ELEMENT: System.out.println("END_ELEMENT "+reader.getName()); break; case XMLStreamConstants.CHARACTERS: System.out.println("CHARACTERS '"+encodeText(reader.getText())+"'"); break; case XMLStreamConstants.CDATA: System.out.println("CDATA '"+encodeText(reader.getText())+"'"); break; case XMLStreamConstants.SPACE: System.out.println("SPACE '"+encodeText(reader.getText())+"'"); break; case XMLStreamConstants.DTD: System.out.println("DTD "+reader.getText()); break; case XMLStreamConstants.ENTITY_REFERENCE: System.out.println("ENTITY_REFERENCE "+reader.getText()); break; case XMLStreamConstants.COMMENT: System.out.println("COMMENT '"+encodeText(reader.getText())+"'"); break; case XMLStreamConstants.PROCESSING_INSTRUCTION: System.out.println("PROCESSING_INSTRUCTION "+reader.getPITarget()+ " "+reader.getPIData()); break; case START_ENTITY: System.out.println("START_ENTITY "+reader.getText()); break; case END_ENTITY: System.out.println("END_ENTITY "+reader.getText()); break; default: System.out.println("Unknown event: "+event); } } } catch (XMLStreamException e) { Location l = reader.getLocation(); System.out.println("At line "+l.getLineNumber()+ ", column "+l.getColumnNumber()+ " of "+l.getSystemId()); throw e; } }
13,456
public static void main(String[] args) throws Exception { boolean xIncludeAware = false; if (args.length > 1 && "-x".equals(args[1])) xIncludeAware = true; XMLParser p = new XMLParser(new java.io.FileInputStream(args[0]), absolutize(null, args[0]), true, // validating true, // namespaceAware true, // coalescing, true, // replaceERefs true, // externalEntities true, // supportDTD true, // baseAware true, // stringInterning true, // extendedEventTypes null, null); XMLStreamReader reader = p; if (xIncludeAware) reader = new XIncludeFilter(p, args[0], true, true, true); try { int event; //do while (reader.hasNext()) { event = reader.next(); Location loc = reader.getLocation(); System.out.print(loc.getLineNumber()+":"+loc.getColumnNumber()+" "); switch (event) { case XMLStreamConstants.START_DOCUMENT: System.out.println("START_DOCUMENT version="+reader.getVersion()+ " encoding="+reader.getEncoding()); break; case XMLStreamConstants.END_DOCUMENT: System.out.println("END_DOCUMENT"); break; case XMLStreamConstants.START_ELEMENT: System.out.println("START_ELEMENT "+reader.getName()); int l = reader.getNamespaceCount(); for (int i = 0; i < l; i++) System.out.println("\tnamespace "+reader.getNamespacePrefix(i)+ "='"+reader.getNamespaceURI(i)+"'"); l = reader.getAttributeCount(); for (int i = 0; i < l; i++) System.out.println("\tattribute "+reader.getAttributeName(i)+ "='"+reader.getAttributeValue(i)+"'"); break; case XMLStreamConstants.END_ELEMENT: System.out.println("END_ELEMENT "+reader.getName()); break; case XMLStreamConstants.CHARACTERS: System.out.println("CHARACTERS '"+encodeText(reader.getText())+"'"); break; case XMLStreamConstants.CDATA: System.out.println("CDATA '"+encodeText(reader.getText())+"'"); break; case XMLStreamConstants.SPACE: System.out.println("SPACE '"+encodeText(reader.getText())+"'"); break; case XMLStreamConstants.DTD: System.out.println("DTD "+reader.getText()); break; case XMLStreamConstants.ENTITY_REFERENCE: System.out.println("ENTITY_REFERENCE "+reader.getText()); break; case XMLStreamConstants.COMMENT: System.out.println("COMMENT '"+encodeText(reader.getText())+"'"); break; case XMLStreamConstants.PROCESSING_INSTRUCTION: System.out.println("PROCESSING_INSTRUCTION "+reader.getPITarget()+ " "+reader.getPIData()); break; case START_ENTITY: System.out.println("START_ENTITY "+reader.getText()); break; case END_ENTITY: System.out.println("END_ENTITY "+reader.getText()); break; default: System.out.println("Unknown event: "+event); } } } catch (XMLStreamException e) { Location l = reader.getLocation(); System.out.println("At line "+l.getLineNumber()+ ", column "+l.getColumnNumber()+ " of "+l.getSystemId()); throw e; } }
public static void main(String[] args) throws Exception { boolean xIncludeAware = false; if (args.length > 1 && "-x".equals(args[1])) xIncludeAware = true; XMLParser p = new XMLParser(new java.io.FileInputStream(args[0]), absolutize(null, args[0]), true, // validating true, // namespaceAware true, // coalescing, true, // replaceERefs true, // externalEntities true, // supportDTD true, // baseAware true, // stringInterning true, // extendedEventTypes null, null); XMLStreamReader reader = p; if (xIncludeAware) reader = new XIncludeFilter(p, args[0], true, true, true); try { int event; //do while (reader.hasNext()) { event = reader.next(); Location loc = reader.getLocation(); System.out.print(loc.getLineNumber()+":"+loc.getColumnNumber()+" "); switch (event) { case XMLStreamConstants.START_DOCUMENT: System.out.println("START_DOCUMENT version="+reader.getVersion()+ " encoding="+reader.getEncoding()); break; case XMLStreamConstants.END_DOCUMENT: System.out.println("END_DOCUMENT"); break; case XMLStreamConstants.START_ELEMENT: System.out.println("START_ELEMENT "+reader.getName()); int l = reader.getNamespaceCount(); for (int i = 0; i < l; i++) System.out.println("\tnamespace "+reader.getNamespacePrefix(i)+ "='"+reader.getNamespaceURI(i)+"'"); l = reader.getAttributeCount(); for (int i = 0; i < l; i++) System.out.println("\tattribute "+reader.getAttributeName(i)+ "='"+reader.getAttributeValue(i)+"'"); break; case XMLStreamConstants.END_ELEMENT: System.out.println("END_ELEMENT "+reader.getName()); break; case XMLStreamConstants.CHARACTERS: System.out.println("CHARACTERS '"+encodeText(reader.getText())+"'"); break; case XMLStreamConstants.CDATA: System.out.println("CDATA '"+encodeText(reader.getText())+"'"); break; case XMLStreamConstants.SPACE: System.out.println("SPACE '"+encodeText(reader.getText())+"'"); break; case XMLStreamConstants.DTD: System.out.println("DTD "+reader.getText()); break; case XMLStreamConstants.ENTITY_REFERENCE: System.out.println("ENTITY_REFERENCE "+reader.getText()); break; case XMLStreamConstants.COMMENT: System.out.println("COMMENT '"+encodeText(reader.getText())+"'"); break; case XMLStreamConstants.PROCESSING_INSTRUCTION: System.out.println("PROCESSING_INSTRUCTION "+reader.getPITarget()+ " "+reader.getPIData()); break; case START_ENTITY: System.out.println("START_ENTITY "+reader.getText()); break; case END_ENTITY: System.out.println("END_ENTITY "+reader.getText()); break; default: System.out.println("Unknown event: "+event); } } } catch (XMLStreamException e) { Location l = reader.getLocation(); System.out.println("At line "+l.getLineNumber()+ ", column "+l.getColumnNumber()+ " of "+l.getSystemId()); throw e; } }
13,457
public static void main(String[] args) throws Exception { boolean xIncludeAware = false; if (args.length > 1 && "-x".equals(args[1])) xIncludeAware = true; XMLParser p = new XMLParser(new java.io.FileInputStream(args[0]), absolutize(null, args[0]), true, // validating true, // namespaceAware true, // coalescing, true, // replaceERefs true, // externalEntities true, // supportDTD true, // baseAware true, // stringInterning true, // extendedEventTypes null, null); XMLStreamReader reader = p; if (xIncludeAware) reader = new XIncludeFilter(p, args[0], true, true, true); try { int event; //do while (reader.hasNext()) { event = reader.next(); Location loc = reader.getLocation(); System.out.print(loc.getLineNumber()+":"+loc.getColumnNumber()+" "); switch (event) { case XMLStreamConstants.START_DOCUMENT: System.out.println("START_DOCUMENT version="+reader.getVersion()+ " encoding="+reader.getEncoding()); break; case XMLStreamConstants.END_DOCUMENT: System.out.println("END_DOCUMENT"); break; case XMLStreamConstants.START_ELEMENT: System.out.println("START_ELEMENT "+reader.getName()); int l = reader.getNamespaceCount(); for (int i = 0; i < l; i++) System.out.println("\tnamespace "+reader.getNamespacePrefix(i)+ "='"+reader.getNamespaceURI(i)+"'"); l = reader.getAttributeCount(); for (int i = 0; i < l; i++) System.out.println("\tattribute "+reader.getAttributeName(i)+ "='"+reader.getAttributeValue(i)+"'"); break; case XMLStreamConstants.END_ELEMENT: System.out.println("END_ELEMENT "+reader.getName()); break; case XMLStreamConstants.CHARACTERS: System.out.println("CHARACTERS '"+encodeText(reader.getText())+"'"); break; case XMLStreamConstants.CDATA: System.out.println("CDATA '"+encodeText(reader.getText())+"'"); break; case XMLStreamConstants.SPACE: System.out.println("SPACE '"+encodeText(reader.getText())+"'"); break; case XMLStreamConstants.DTD: System.out.println("DTD "+reader.getText()); break; case XMLStreamConstants.ENTITY_REFERENCE: System.out.println("ENTITY_REFERENCE "+reader.getText()); break; case XMLStreamConstants.COMMENT: System.out.println("COMMENT '"+encodeText(reader.getText())+"'"); break; case XMLStreamConstants.PROCESSING_INSTRUCTION: System.out.println("PROCESSING_INSTRUCTION "+reader.getPITarget()+ " "+reader.getPIData()); break; case START_ENTITY: System.out.println("START_ENTITY "+reader.getText()); break; case END_ENTITY: System.out.println("END_ENTITY "+reader.getText()); break; default: System.out.println("Unknown event: "+event); } } } catch (XMLStreamException e) { Location l = reader.getLocation(); System.out.println("At line "+l.getLineNumber()+ ", column "+l.getColumnNumber()+ " of "+l.getSystemId()); throw e; } }
public static void main(String[] args) throws Exception { boolean xIncludeAware = false; if (args.length > 1 && "-x".equals(args[1])) xIncludeAware = true; XMLParser p = new XMLParser(new java.io.FileInputStream(args[0]), absolutize(null, args[0]), true, // validating true, // namespaceAware true, // coalescing, true, // replaceERefs true, // externalEntities true, // supportDTD true, // baseAware true, // stringInterning true, // extendedEventTypes null, null); XMLStreamReader reader = p; if (xIncludeAware) reader = new XIncludeFilter(p, args[pos], true, true, true); try { int event; //do while (reader.hasNext()) { event = reader.next(); Location loc = reader.getLocation(); System.out.print(loc.getLineNumber()+":"+loc.getColumnNumber()+" "); switch (event) { case XMLStreamConstants.START_DOCUMENT: System.out.println("START_DOCUMENT version="+reader.getVersion()+ " encoding="+reader.getEncoding()); break; case XMLStreamConstants.END_DOCUMENT: System.out.println("END_DOCUMENT"); break; case XMLStreamConstants.START_ELEMENT: System.out.println("START_ELEMENT "+reader.getName()); int l = reader.getNamespaceCount(); for (int i = 0; i < l; i++) System.out.println("\tnamespace "+reader.getNamespacePrefix(i)+ "='"+reader.getNamespaceURI(i)+"'"); l = reader.getAttributeCount(); for (int i = 0; i < l; i++) System.out.println("\tattribute "+reader.getAttributeName(i)+ "='"+reader.getAttributeValue(i)+"'"); break; case XMLStreamConstants.END_ELEMENT: System.out.println("END_ELEMENT "+reader.getName()); break; case XMLStreamConstants.CHARACTERS: System.out.println("CHARACTERS '"+encodeText(reader.getText())+"'"); break; case XMLStreamConstants.CDATA: System.out.println("CDATA '"+encodeText(reader.getText())+"'"); break; case XMLStreamConstants.SPACE: System.out.println("SPACE '"+encodeText(reader.getText())+"'"); break; case XMLStreamConstants.DTD: System.out.println("DTD "+reader.getText()); break; case XMLStreamConstants.ENTITY_REFERENCE: System.out.println("ENTITY_REFERENCE "+reader.getText()); break; case XMLStreamConstants.COMMENT: System.out.println("COMMENT '"+encodeText(reader.getText())+"'"); break; case XMLStreamConstants.PROCESSING_INSTRUCTION: System.out.println("PROCESSING_INSTRUCTION "+reader.getPITarget()+ " "+reader.getPIData()); break; case START_ENTITY: System.out.println("START_ENTITY "+reader.getText()); break; case END_ENTITY: System.out.println("END_ENTITY "+reader.getText()); break; default: System.out.println("Unknown event: "+event); } } } catch (XMLStreamException e) { Location l = reader.getLocation(); System.out.println("At line "+l.getLineNumber()+ ", column "+l.getColumnNumber()+ " of "+l.getSystemId()); throw e; } }
13,458
public int getIndex(String qName) { int len = reader.getAttributeCount(); for (int i = 0; i < len; i++) { QName q = reader.getAttributeQName(i); String localName = q.getLocalPart(); String prefix = q.getPrefix(); String qn = ("".equals(prefix)) ? localName : prefix + ":" + localName; if (qName.equals(qn)) return i; } return -1; }
public int getIndex(String qName) { int len = reader.getAttributeCount(); for (int i = 0; i < len; i++) { QName q = reader.getAttributeName(i); String localName = q.getLocalPart(); String prefix = q.getPrefix(); String qn = ("".equals(prefix)) ? localName : prefix + ":" + localName; if (qName.equals(qn)) return i; } return -1; }
13,460
public String getLocalName(int index) { return reader.getAttributeName(index); }
public String getLocalName(int index) { return reader.getAttributeLocalName(index); }
13,461
public String getPublicId() { return null; }
public String getPublicId() { Location l = reader.getLocation(); return l.getPublicId(); }
13,462
public String getQName(int index) { QName q = reader.getAttributeQName(index); String localName = q.getLocalPart(); String prefix = q.getPrefix(); return ("".equals(prefix)) ? localName : prefix + ":" + localName; }
public String getQName(int index) { QName q = reader.getAttributeName(index); String localName = q.getLocalPart(); String prefix = q.getPrefix(); return ("".equals(prefix)) ? localName : prefix + ":" + localName; }
13,463
public String getSystemId() { Location l = reader.getLocation(); return l.getLocationURI(); }
public String getSystemId() { Location l = reader.getLocation(); return l.getSystemId(); }
13,464
private boolean isIgnorableWhitespace(XMLParser reader, char[] b, boolean testCharacters) throws XMLStreamException { XMLParser.Doctype doctype = reader.doctype; if (doctype == null) return false; String currentElement = reader.getCurrentElement(); // check for xml:space int ac = reader.getAttributeCount(); for (int i = 0; i < ac; i++) { QName aname = reader.getAttributeQName(i); if ("space".equals(aname.getLocalPart()) && XMLConstants.XML_NS_URI.equals(aname.getNamespaceURI())) { if ("preserve".equals(reader.getAttributeValue(i))) return false; } } XMLParser.ContentModel model = doctype.getElementModel(currentElement); if (model == null || model.type != XMLParser.ContentModel.ELEMENT) return false; if (model.external && xmlStandalone) return false; boolean white = true; if (testCharacters) { for (int i = 0; i < b.length; i++) { if (b[i] != ' ' && b[i] != '\t' && b[i] != '\n' && b[i] != '\r') { white = false; break; } } } return white; }
private boolean isIgnorableWhitespace(XMLParser reader, char[] b, boolean testCharacters) throws XMLStreamException { XMLParser.Doctype doctype = reader.doctype; if (doctype == null) return false; String currentElement = reader.getCurrentElement(); // check for xml:space int ac = reader.getAttributeCount(); for (int i = 0; i < ac; i++) { QName aname = reader.getAttributeName(i); if ("space".equals(aname.getLocalPart()) && XMLConstants.XML_NS_URI.equals(aname.getNamespaceURI())) { if ("preserve".equals(reader.getAttributeValue(i))) return false; } } XMLParser.ContentModel model = doctype.getElementModel(currentElement); if (model == null || model.type != XMLParser.ContentModel.ELEMENT) return false; if (model.external && xmlStandalone) return false; boolean white = true; if (testCharacters) { for (int i = 0; i < b.length; i++) { if (b[i] != ' ' && b[i] != '\t' && b[i] != '\n' && b[i] != '\r') { white = false; break; } } } return white; }
13,465
public synchronized void parse(InputSource input) throws IOException, SAXException { reset(); String systemId = input.getSystemId(); InputStream in = input.getByteStream(); boolean opened = false; if (in != null) parser = new XMLParser(in, systemId, validating, namespaceAware, coalescing, replaceERefs, externalEntities, supportDTD, baseAware, stringInterning, this, this); else { Reader r = input.getCharacterStream(); if (r != null) parser = new XMLParser(r, systemId, validating, namespaceAware, coalescing, replaceERefs, externalEntities, supportDTD, baseAware, stringInterning, this, this); } if (parser == null) { if (systemId == null) throw new SAXException("No stream or system ID specified"); systemId = XMLParser.absolutize(null, systemId); in = new URL(systemId).openStream(); opened = true; parser = new XMLParser(in, systemId, validating, namespaceAware, coalescing, replaceERefs, externalEntities, supportDTD, baseAware, stringInterning, this, this); } reader = parser; baseURI = systemId; if (xIncludeAware) reader = new XIncludeFilter(parser, systemId, namespaceAware, validating, true); if (contentHandler != null) contentHandler.setDocumentLocator(this); boolean startDocumentDone = false; try { while (parser.hasNext()) { int event = parser.next(); if (baseAware) baseURI = parser.getXMLBase(); switch (event) { case XMLStreamConstants.CHARACTERS: if (contentHandler != null) { char[] b = reader.getTextCharacters(); contentHandler.characters(b, 0, b.length); } break; case XMLStreamConstants.SPACE: if (contentHandler != null) { char[] b = reader.getTextCharacters(); if (isIgnorableWhitespace(parser, b, false)) contentHandler.ignorableWhitespace(b, 0, b.length); else contentHandler.characters(b, 0, b.length); } break; case XMLStreamConstants.CDATA: if (lexicalHandler != null) lexicalHandler.startCDATA(); if (contentHandler != null) { char[] b = reader.getTextCharacters(); if (isIgnorableWhitespace(parser, b, true)) contentHandler.ignorableWhitespace(b, 0, b.length); else contentHandler.characters(b, 0, b.length); } if (lexicalHandler != null) lexicalHandler.endCDATA(); break; case XMLStreamConstants.START_ELEMENT: if (contentHandler != null) { QName name = reader.getName(); String uri = name.getNamespaceURI(); String localName = name.getLocalPart(); String prefix = name.getPrefix(); String qName = localName; if (!"".equals(prefix)) qName = prefix + ":" + localName; if (!namespaceAware) { uri = ""; localName = ""; } else { int nc = reader.getNamespaceCount(); for (int i = 0; i < nc; i++) { String nsuri = reader.getNamespaceURI(i); String nsprefix = reader.getNamespacePrefix(i); if ("xml".equals(nsprefix)) continue; contentHandler.startPrefixMapping(nsprefix, nsuri); } } contentHandler.startElement(uri, localName, qName, this); } break; case XMLStreamConstants.END_ELEMENT: if (contentHandler != null) { QName name = reader.getName(); String uri = name.getNamespaceURI(); String localName = name.getLocalPart(); String prefix = name.getPrefix(); String qName = localName; if (!"".equals(prefix)) qName = prefix + ":" + localName; if (!namespaceAware) { uri = ""; localName = ""; } contentHandler.endElement(uri, localName, qName); if (namespaceAware) { int nc = reader.getNamespaceCount(); for (int i = 0; i < nc; i++) { String nsprefix = reader.getNamespacePrefix(i); if ("xml".equals(nsprefix)) continue; contentHandler.endPrefixMapping(nsprefix); } } } break; case XMLStreamConstants.COMMENT: if (lexicalHandler != null) { char[] b = reader.getTextCharacters(); lexicalHandler.comment(b, 0, b.length); } break; case XMLStreamConstants.PROCESSING_INSTRUCTION: if (contentHandler != null) { String target = reader.getPITarget(); String data = reader.getPIData(); if (data == null) data = ""; contentHandler.processingInstruction(target, data); } break; case XMLStreamConstants.START_ENTITY: if (lexicalHandler != null) { String name = reader.getText(); lexicalHandler.startEntity(name); } break; case XMLStreamConstants.END_ENTITY: if (lexicalHandler != null) { String name = reader.getText(); lexicalHandler.endEntity(name); } break; case XMLStreamConstants.START_DOCUMENT: encoding = reader.getEncoding(); xmlVersion = reader.getVersion(); xmlStandalone = reader.isStandalone(); xmlEncoding = reader.getCharacterEncodingScheme(); if (contentHandler != null) contentHandler.startDocument(); startDocumentDone = true; break; case XMLStreamConstants.END_DOCUMENT: if (contentHandler != null) contentHandler.endDocument(); break; case XMLStreamConstants.DTD: XMLParser.Doctype doctype = parser.doctype; if (lexicalHandler != null) { String rootName = doctype.rootName; String publicId = doctype.publicId; String systemId2 = doctype.systemId; lexicalHandler.startDTD(rootName, publicId, systemId2); } for (Iterator i = doctype.entryIterator(); i.hasNext(); ) { String entry = (String) i.next(); char c = entry.charAt(0); String name = entry.substring(1); if ('E' == c) { // Element decl if (declHandler != null) { XMLParser.ContentModel model = doctype.getElementModel(name); declHandler.elementDecl(name, model.text); } } else if ('A' == c) { // Attlist decl if (declHandler != null) { for (Iterator j = doctype.attlistIterator(name); j.hasNext(); ) { Map.Entry att = (Map.Entry) j.next(); String aname = (String) att.getKey(); XMLParser.AttributeDecl decl = (XMLParser.AttributeDecl) att.getValue(); String type = decl.type; String value = decl.value; String mode = null; switch (decl.valueType) { case XMLParser.ATTRIBUTE_DEFAULT_FIXED: mode = "#FIXED"; break; case XMLParser.ATTRIBUTE_DEFAULT_REQUIRED: mode = "#REQUIRED"; break; case XMLParser.ATTRIBUTE_DEFAULT_IMPLIED: mode = "#IMPLIED"; break; } declHandler.attributeDecl(name, aname, type, mode, value); } } } else if ('e' == c) { // Entity decl Object entity = doctype.getEntity(name); if (entity instanceof String) { if (declHandler != null) declHandler.internalEntityDecl(name, (String) entity); } else { XMLParser.ExternalIds ids = (XMLParser.ExternalIds) entity; if (ids.notationName != null) { if (dtdHandler != null) { String pub = ids.publicId; String url = ids.systemId; String not = ids.notationName; dtdHandler.unparsedEntityDecl(name, pub, url, not); } } else { if (declHandler != null) { String pub = ids.publicId; String url = ids.systemId; declHandler.externalEntityDecl(name, pub, url); } } } } else if ('n' == c) { // Notation decl if (dtdHandler != null) { XMLParser.ExternalIds ids = doctype.getNotation(name); String pub = ids.publicId; String url = ids.systemId; dtdHandler.notationDecl(name, pub, url); } } else if ('c' == c) { // Comment if (lexicalHandler != null) { String comment = doctype.getComment(name); char[] b = comment.toCharArray(); lexicalHandler.comment(b, 0, b.length); } } else if ('p' == c) { // Processing instruction if (contentHandler != null) { String[] pi = doctype.getPI(name); String target = pi[0]; String data = pi[1]; if (data == null) data = ""; contentHandler.processingInstruction(target, data); } } } if (lexicalHandler != null) lexicalHandler.endDTD(); } } reset(); if (opened) in.close(); } catch (Exception e) { if (!startDocumentDone && contentHandler != null) contentHandler.startDocument(); SAXParseException e2 = new SAXParseException(e.getMessage(), this); e2.initCause(e); if (errorHandler != null) errorHandler.fatalError(e2); if (contentHandler != null) contentHandler.endDocument(); reset(); if (opened) in.close(); if (e instanceof IOException) throw (IOException) e; else throw e2; } }
public synchronized void parse(InputSource input) throws IOException, SAXException { reset(); String systemId = input.getSystemId(); InputStream in = input.getByteStream(); boolean opened = false; if (in != null) parser = new XMLParser(in, systemId, validating, namespaceAware, coalescing, replaceERefs, externalEntities, supportDTD, baseAware, stringInterning, this, this); else { Reader r = input.getCharacterStream(); if (r != null) parser = new XMLParser(r, systemId, validating, namespaceAware, coalescing, replaceERefs, externalEntities, supportDTD, baseAware, stringInterning, this, this); } if (parser == null) { if (systemId == null) throw new SAXException("No stream or system ID specified"); systemId = XMLParser.absolutize(null, systemId); in = new URL(systemId).openStream(); opened = true; parser = new XMLParser(in, systemId, validating, namespaceAware, coalescing, replaceERefs, externalEntities, supportDTD, baseAware, stringInterning, this, this); } reader = parser; baseURI = systemId; if (xIncludeAware) reader = new XIncludeFilter(parser, systemId, namespaceAware, validating, true); if (contentHandler != null) contentHandler.setDocumentLocator(this); boolean startDocumentDone = false; try { while (parser.hasNext()) { int event = parser.next(); if (baseAware) baseURI = parser.getXMLBase(); switch (event) { case XMLStreamConstants.CHARACTERS: if (contentHandler != null) { char[] b = reader.getTextCharacters(); contentHandler.characters(b, 0, b.length); } break; case XMLStreamConstants.SPACE: if (contentHandler != null) { char[] b = reader.getTextCharacters(); if (isIgnorableWhitespace(parser, b, false)) contentHandler.ignorableWhitespace(b, 0, b.length); else contentHandler.characters(b, 0, b.length); } break; case XMLStreamConstants.CDATA: if (lexicalHandler != null) lexicalHandler.startCDATA(); if (contentHandler != null) { char[] b = reader.getTextCharacters(); if (isIgnorableWhitespace(parser, b, true)) contentHandler.ignorableWhitespace(b, 0, b.length); else contentHandler.characters(b, 0, b.length); } if (lexicalHandler != null) lexicalHandler.endCDATA(); break; case XMLStreamConstants.START_ELEMENT: if (contentHandler != null) { QName name = reader.getName(); String uri = name.getNamespaceURI(); String localName = name.getLocalPart(); String prefix = name.getPrefix(); String qName = localName; if (!"".equals(prefix)) qName = prefix + ":" + localName; if (!namespaceAware) { uri = ""; localName = ""; } else { int nc = reader.getNamespaceCount(); for (int i = 0; i < nc; i++) { String nsuri = reader.getNamespaceURI(i); String nsprefix = reader.getNamespacePrefix(i); if ("xml".equals(nsprefix)) continue; contentHandler.startPrefixMapping(nsprefix, nsuri); } } contentHandler.startElement(uri, localName, qName, this); } break; case XMLStreamConstants.END_ELEMENT: if (contentHandler != null) { QName name = reader.getName(); String uri = name.getNamespaceURI(); String localName = name.getLocalPart(); String prefix = name.getPrefix(); String qName = localName; if (!"".equals(prefix)) qName = prefix + ":" + localName; if (!namespaceAware) { uri = ""; localName = ""; } contentHandler.endElement(uri, localName, qName); if (namespaceAware) { int nc = reader.getNamespaceCount(); for (int i = 0; i < nc; i++) { String nsprefix = reader.getNamespacePrefix(i); if ("xml".equals(nsprefix)) continue; contentHandler.endPrefixMapping(nsprefix); } } } break; case XMLStreamConstants.COMMENT: if (lexicalHandler != null) { char[] b = reader.getTextCharacters(); lexicalHandler.comment(b, 0, b.length); } break; case XMLStreamConstants.PROCESSING_INSTRUCTION: if (contentHandler != null) { String target = reader.getPITarget(); String data = reader.getPIData(); if (data == null) data = ""; contentHandler.processingInstruction(target, data); } break; case XMLParser.START_ENTITY: if (lexicalHandler != null) { String name = reader.getText(); lexicalHandler.startEntity(name); } break; case XMLStreamConstants.END_ENTITY: if (lexicalHandler != null) { String name = reader.getText(); lexicalHandler.endEntity(name); } break; case XMLStreamConstants.START_DOCUMENT: encoding = reader.getEncoding(); xmlVersion = reader.getVersion(); xmlStandalone = reader.isStandalone(); xmlEncoding = reader.getCharacterEncodingScheme(); if (contentHandler != null) contentHandler.startDocument(); startDocumentDone = true; break; case XMLStreamConstants.END_DOCUMENT: if (contentHandler != null) contentHandler.endDocument(); break; case XMLStreamConstants.DTD: XMLParser.Doctype doctype = parser.doctype; if (lexicalHandler != null) { String rootName = doctype.rootName; String publicId = doctype.publicId; String systemId2 = doctype.systemId; lexicalHandler.startDTD(rootName, publicId, systemId2); } for (Iterator i = doctype.entryIterator(); i.hasNext(); ) { String entry = (String) i.next(); char c = entry.charAt(0); String name = entry.substring(1); if ('E' == c) { // Element decl if (declHandler != null) { XMLParser.ContentModel model = doctype.getElementModel(name); declHandler.elementDecl(name, model.text); } } else if ('A' == c) { // Attlist decl if (declHandler != null) { for (Iterator j = doctype.attlistIterator(name); j.hasNext(); ) { Map.Entry att = (Map.Entry) j.next(); String aname = (String) att.getKey(); XMLParser.AttributeDecl decl = (XMLParser.AttributeDecl) att.getValue(); String type = decl.type; String value = decl.value; String mode = null; switch (decl.valueType) { case XMLParser.ATTRIBUTE_DEFAULT_FIXED: mode = "#FIXED"; break; case XMLParser.ATTRIBUTE_DEFAULT_REQUIRED: mode = "#REQUIRED"; break; case XMLParser.ATTRIBUTE_DEFAULT_IMPLIED: mode = "#IMPLIED"; break; } declHandler.attributeDecl(name, aname, type, mode, value); } } } else if ('e' == c) { // Entity decl Object entity = doctype.getEntity(name); if (entity instanceof String) { if (declHandler != null) declHandler.internalEntityDecl(name, (String) entity); } else { XMLParser.ExternalIds ids = (XMLParser.ExternalIds) entity; if (ids.notationName != null) { if (dtdHandler != null) { String pub = ids.publicId; String url = ids.systemId; String not = ids.notationName; dtdHandler.unparsedEntityDecl(name, pub, url, not); } } else { if (declHandler != null) { String pub = ids.publicId; String url = ids.systemId; declHandler.externalEntityDecl(name, pub, url); } } } } else if ('n' == c) { // Notation decl if (dtdHandler != null) { XMLParser.ExternalIds ids = doctype.getNotation(name); String pub = ids.publicId; String url = ids.systemId; dtdHandler.notationDecl(name, pub, url); } } else if ('c' == c) { // Comment if (lexicalHandler != null) { String comment = doctype.getComment(name); char[] b = comment.toCharArray(); lexicalHandler.comment(b, 0, b.length); } } else if ('p' == c) { // Processing instruction if (contentHandler != null) { String[] pi = doctype.getPI(name); String target = pi[0]; String data = pi[1]; if (data == null) data = ""; contentHandler.processingInstruction(target, data); } } } if (lexicalHandler != null) lexicalHandler.endDTD(); } } reset(); if (opened) in.close(); } catch (Exception e) { if (!startDocumentDone && contentHandler != null) contentHandler.startDocument(); SAXParseException e2 = new SAXParseException(e.getMessage(), this); e2.initCause(e); if (errorHandler != null) errorHandler.fatalError(e2); if (contentHandler != null) contentHandler.endDocument(); reset(); if (opened) in.close(); if (e instanceof IOException) throw (IOException) e; else throw e2; } }
13,466
public synchronized void parse(InputSource input) throws IOException, SAXException { reset(); String systemId = input.getSystemId(); InputStream in = input.getByteStream(); boolean opened = false; if (in != null) parser = new XMLParser(in, systemId, validating, namespaceAware, coalescing, replaceERefs, externalEntities, supportDTD, baseAware, stringInterning, this, this); else { Reader r = input.getCharacterStream(); if (r != null) parser = new XMLParser(r, systemId, validating, namespaceAware, coalescing, replaceERefs, externalEntities, supportDTD, baseAware, stringInterning, this, this); } if (parser == null) { if (systemId == null) throw new SAXException("No stream or system ID specified"); systemId = XMLParser.absolutize(null, systemId); in = new URL(systemId).openStream(); opened = true; parser = new XMLParser(in, systemId, validating, namespaceAware, coalescing, replaceERefs, externalEntities, supportDTD, baseAware, stringInterning, this, this); } reader = parser; baseURI = systemId; if (xIncludeAware) reader = new XIncludeFilter(parser, systemId, namespaceAware, validating, true); if (contentHandler != null) contentHandler.setDocumentLocator(this); boolean startDocumentDone = false; try { while (parser.hasNext()) { int event = parser.next(); if (baseAware) baseURI = parser.getXMLBase(); switch (event) { case XMLStreamConstants.CHARACTERS: if (contentHandler != null) { char[] b = reader.getTextCharacters(); contentHandler.characters(b, 0, b.length); } break; case XMLStreamConstants.SPACE: if (contentHandler != null) { char[] b = reader.getTextCharacters(); if (isIgnorableWhitespace(parser, b, false)) contentHandler.ignorableWhitespace(b, 0, b.length); else contentHandler.characters(b, 0, b.length); } break; case XMLStreamConstants.CDATA: if (lexicalHandler != null) lexicalHandler.startCDATA(); if (contentHandler != null) { char[] b = reader.getTextCharacters(); if (isIgnorableWhitespace(parser, b, true)) contentHandler.ignorableWhitespace(b, 0, b.length); else contentHandler.characters(b, 0, b.length); } if (lexicalHandler != null) lexicalHandler.endCDATA(); break; case XMLStreamConstants.START_ELEMENT: if (contentHandler != null) { QName name = reader.getName(); String uri = name.getNamespaceURI(); String localName = name.getLocalPart(); String prefix = name.getPrefix(); String qName = localName; if (!"".equals(prefix)) qName = prefix + ":" + localName; if (!namespaceAware) { uri = ""; localName = ""; } else { int nc = reader.getNamespaceCount(); for (int i = 0; i < nc; i++) { String nsuri = reader.getNamespaceURI(i); String nsprefix = reader.getNamespacePrefix(i); if ("xml".equals(nsprefix)) continue; contentHandler.startPrefixMapping(nsprefix, nsuri); } } contentHandler.startElement(uri, localName, qName, this); } break; case XMLStreamConstants.END_ELEMENT: if (contentHandler != null) { QName name = reader.getName(); String uri = name.getNamespaceURI(); String localName = name.getLocalPart(); String prefix = name.getPrefix(); String qName = localName; if (!"".equals(prefix)) qName = prefix + ":" + localName; if (!namespaceAware) { uri = ""; localName = ""; } contentHandler.endElement(uri, localName, qName); if (namespaceAware) { int nc = reader.getNamespaceCount(); for (int i = 0; i < nc; i++) { String nsprefix = reader.getNamespacePrefix(i); if ("xml".equals(nsprefix)) continue; contentHandler.endPrefixMapping(nsprefix); } } } break; case XMLStreamConstants.COMMENT: if (lexicalHandler != null) { char[] b = reader.getTextCharacters(); lexicalHandler.comment(b, 0, b.length); } break; case XMLStreamConstants.PROCESSING_INSTRUCTION: if (contentHandler != null) { String target = reader.getPITarget(); String data = reader.getPIData(); if (data == null) data = ""; contentHandler.processingInstruction(target, data); } break; case XMLStreamConstants.START_ENTITY: if (lexicalHandler != null) { String name = reader.getText(); lexicalHandler.startEntity(name); } break; case XMLStreamConstants.END_ENTITY: if (lexicalHandler != null) { String name = reader.getText(); lexicalHandler.endEntity(name); } break; case XMLStreamConstants.START_DOCUMENT: encoding = reader.getEncoding(); xmlVersion = reader.getVersion(); xmlStandalone = reader.isStandalone(); xmlEncoding = reader.getCharacterEncodingScheme(); if (contentHandler != null) contentHandler.startDocument(); startDocumentDone = true; break; case XMLStreamConstants.END_DOCUMENT: if (contentHandler != null) contentHandler.endDocument(); break; case XMLStreamConstants.DTD: XMLParser.Doctype doctype = parser.doctype; if (lexicalHandler != null) { String rootName = doctype.rootName; String publicId = doctype.publicId; String systemId2 = doctype.systemId; lexicalHandler.startDTD(rootName, publicId, systemId2); } for (Iterator i = doctype.entryIterator(); i.hasNext(); ) { String entry = (String) i.next(); char c = entry.charAt(0); String name = entry.substring(1); if ('E' == c) { // Element decl if (declHandler != null) { XMLParser.ContentModel model = doctype.getElementModel(name); declHandler.elementDecl(name, model.text); } } else if ('A' == c) { // Attlist decl if (declHandler != null) { for (Iterator j = doctype.attlistIterator(name); j.hasNext(); ) { Map.Entry att = (Map.Entry) j.next(); String aname = (String) att.getKey(); XMLParser.AttributeDecl decl = (XMLParser.AttributeDecl) att.getValue(); String type = decl.type; String value = decl.value; String mode = null; switch (decl.valueType) { case XMLParser.ATTRIBUTE_DEFAULT_FIXED: mode = "#FIXED"; break; case XMLParser.ATTRIBUTE_DEFAULT_REQUIRED: mode = "#REQUIRED"; break; case XMLParser.ATTRIBUTE_DEFAULT_IMPLIED: mode = "#IMPLIED"; break; } declHandler.attributeDecl(name, aname, type, mode, value); } } } else if ('e' == c) { // Entity decl Object entity = doctype.getEntity(name); if (entity instanceof String) { if (declHandler != null) declHandler.internalEntityDecl(name, (String) entity); } else { XMLParser.ExternalIds ids = (XMLParser.ExternalIds) entity; if (ids.notationName != null) { if (dtdHandler != null) { String pub = ids.publicId; String url = ids.systemId; String not = ids.notationName; dtdHandler.unparsedEntityDecl(name, pub, url, not); } } else { if (declHandler != null) { String pub = ids.publicId; String url = ids.systemId; declHandler.externalEntityDecl(name, pub, url); } } } } else if ('n' == c) { // Notation decl if (dtdHandler != null) { XMLParser.ExternalIds ids = doctype.getNotation(name); String pub = ids.publicId; String url = ids.systemId; dtdHandler.notationDecl(name, pub, url); } } else if ('c' == c) { // Comment if (lexicalHandler != null) { String comment = doctype.getComment(name); char[] b = comment.toCharArray(); lexicalHandler.comment(b, 0, b.length); } } else if ('p' == c) { // Processing instruction if (contentHandler != null) { String[] pi = doctype.getPI(name); String target = pi[0]; String data = pi[1]; if (data == null) data = ""; contentHandler.processingInstruction(target, data); } } } if (lexicalHandler != null) lexicalHandler.endDTD(); } } reset(); if (opened) in.close(); } catch (Exception e) { if (!startDocumentDone && contentHandler != null) contentHandler.startDocument(); SAXParseException e2 = new SAXParseException(e.getMessage(), this); e2.initCause(e); if (errorHandler != null) errorHandler.fatalError(e2); if (contentHandler != null) contentHandler.endDocument(); reset(); if (opened) in.close(); if (e instanceof IOException) throw (IOException) e; else throw e2; } }
public synchronized void parse(InputSource input) throws IOException, SAXException { reset(); String systemId = input.getSystemId(); InputStream in = input.getByteStream(); boolean opened = false; if (in != null) parser = new XMLParser(in, systemId, validating, namespaceAware, coalescing, replaceERefs, externalEntities, supportDTD, baseAware, stringInterning, this, this); else { Reader r = input.getCharacterStream(); if (r != null) parser = new XMLParser(r, systemId, validating, namespaceAware, coalescing, replaceERefs, externalEntities, supportDTD, baseAware, stringInterning, this, this); } if (parser == null) { if (systemId == null) throw new SAXException("No stream or system ID specified"); systemId = XMLParser.absolutize(null, systemId); in = new URL(systemId).openStream(); opened = true; parser = new XMLParser(in, systemId, validating, namespaceAware, coalescing, replaceERefs, externalEntities, supportDTD, baseAware, stringInterning, this, this); } reader = parser; baseURI = systemId; if (xIncludeAware) reader = new XIncludeFilter(parser, systemId, namespaceAware, validating, true); if (contentHandler != null) contentHandler.setDocumentLocator(this); boolean startDocumentDone = false; try { while (parser.hasNext()) { int event = parser.next(); if (baseAware) baseURI = parser.getXMLBase(); switch (event) { case XMLStreamConstants.CHARACTERS: if (contentHandler != null) { char[] b = reader.getTextCharacters(); contentHandler.characters(b, 0, b.length); } break; case XMLStreamConstants.SPACE: if (contentHandler != null) { char[] b = reader.getTextCharacters(); if (isIgnorableWhitespace(parser, b, false)) contentHandler.ignorableWhitespace(b, 0, b.length); else contentHandler.characters(b, 0, b.length); } break; case XMLStreamConstants.CDATA: if (lexicalHandler != null) lexicalHandler.startCDATA(); if (contentHandler != null) { char[] b = reader.getTextCharacters(); if (isIgnorableWhitespace(parser, b, true)) contentHandler.ignorableWhitespace(b, 0, b.length); else contentHandler.characters(b, 0, b.length); } if (lexicalHandler != null) lexicalHandler.endCDATA(); break; case XMLStreamConstants.START_ELEMENT: if (contentHandler != null) { QName name = reader.getName(); String uri = name.getNamespaceURI(); String localName = name.getLocalPart(); String prefix = name.getPrefix(); String qName = localName; if (!"".equals(prefix)) qName = prefix + ":" + localName; if (!namespaceAware) { uri = ""; localName = ""; } else { int nc = reader.getNamespaceCount(); for (int i = 0; i < nc; i++) { String nsuri = reader.getNamespaceURI(i); String nsprefix = reader.getNamespacePrefix(i); if ("xml".equals(nsprefix)) continue; contentHandler.startPrefixMapping(nsprefix, nsuri); } } contentHandler.startElement(uri, localName, qName, this); } break; case XMLStreamConstants.END_ELEMENT: if (contentHandler != null) { QName name = reader.getName(); String uri = name.getNamespaceURI(); String localName = name.getLocalPart(); String prefix = name.getPrefix(); String qName = localName; if (!"".equals(prefix)) qName = prefix + ":" + localName; if (!namespaceAware) { uri = ""; localName = ""; } contentHandler.endElement(uri, localName, qName); if (namespaceAware) { int nc = reader.getNamespaceCount(); for (int i = 0; i < nc; i++) { String nsprefix = reader.getNamespacePrefix(i); if ("xml".equals(nsprefix)) continue; contentHandler.endPrefixMapping(nsprefix); } } } break; case XMLStreamConstants.COMMENT: if (lexicalHandler != null) { char[] b = reader.getTextCharacters(); lexicalHandler.comment(b, 0, b.length); } break; case XMLStreamConstants.PROCESSING_INSTRUCTION: if (contentHandler != null) { String target = reader.getPITarget(); String data = reader.getPIData(); if (data == null) data = ""; contentHandler.processingInstruction(target, data); } break; case XMLStreamConstants.START_ENTITY: if (lexicalHandler != null) { String name = reader.getText(); lexicalHandler.startEntity(name); } break; case XMLParser.END_ENTITY: if (lexicalHandler != null) { String name = reader.getText(); lexicalHandler.endEntity(name); } break; case XMLStreamConstants.START_DOCUMENT: encoding = reader.getEncoding(); xmlVersion = reader.getVersion(); xmlStandalone = reader.isStandalone(); xmlEncoding = reader.getCharacterEncodingScheme(); if (contentHandler != null) contentHandler.startDocument(); startDocumentDone = true; break; case XMLStreamConstants.END_DOCUMENT: if (contentHandler != null) contentHandler.endDocument(); break; case XMLStreamConstants.DTD: XMLParser.Doctype doctype = parser.doctype; if (lexicalHandler != null) { String rootName = doctype.rootName; String publicId = doctype.publicId; String systemId2 = doctype.systemId; lexicalHandler.startDTD(rootName, publicId, systemId2); } for (Iterator i = doctype.entryIterator(); i.hasNext(); ) { String entry = (String) i.next(); char c = entry.charAt(0); String name = entry.substring(1); if ('E' == c) { // Element decl if (declHandler != null) { XMLParser.ContentModel model = doctype.getElementModel(name); declHandler.elementDecl(name, model.text); } } else if ('A' == c) { // Attlist decl if (declHandler != null) { for (Iterator j = doctype.attlistIterator(name); j.hasNext(); ) { Map.Entry att = (Map.Entry) j.next(); String aname = (String) att.getKey(); XMLParser.AttributeDecl decl = (XMLParser.AttributeDecl) att.getValue(); String type = decl.type; String value = decl.value; String mode = null; switch (decl.valueType) { case XMLParser.ATTRIBUTE_DEFAULT_FIXED: mode = "#FIXED"; break; case XMLParser.ATTRIBUTE_DEFAULT_REQUIRED: mode = "#REQUIRED"; break; case XMLParser.ATTRIBUTE_DEFAULT_IMPLIED: mode = "#IMPLIED"; break; } declHandler.attributeDecl(name, aname, type, mode, value); } } } else if ('e' == c) { // Entity decl Object entity = doctype.getEntity(name); if (entity instanceof String) { if (declHandler != null) declHandler.internalEntityDecl(name, (String) entity); } else { XMLParser.ExternalIds ids = (XMLParser.ExternalIds) entity; if (ids.notationName != null) { if (dtdHandler != null) { String pub = ids.publicId; String url = ids.systemId; String not = ids.notationName; dtdHandler.unparsedEntityDecl(name, pub, url, not); } } else { if (declHandler != null) { String pub = ids.publicId; String url = ids.systemId; declHandler.externalEntityDecl(name, pub, url); } } } } else if ('n' == c) { // Notation decl if (dtdHandler != null) { XMLParser.ExternalIds ids = doctype.getNotation(name); String pub = ids.publicId; String url = ids.systemId; dtdHandler.notationDecl(name, pub, url); } } else if ('c' == c) { // Comment if (lexicalHandler != null) { String comment = doctype.getComment(name); char[] b = comment.toCharArray(); lexicalHandler.comment(b, 0, b.length); } } else if ('p' == c) { // Processing instruction if (contentHandler != null) { String[] pi = doctype.getPI(name); String target = pi[0]; String data = pi[1]; if (data == null) data = ""; contentHandler.processingInstruction(target, data); } } } if (lexicalHandler != null) lexicalHandler.endDTD(); } } reset(); if (opened) in.close(); } catch (Exception e) { if (!startDocumentDone && contentHandler != null) contentHandler.startDocument(); SAXParseException e2 = new SAXParseException(e.getMessage(), this); e2.initCause(e); if (errorHandler != null) errorHandler.fatalError(e2); if (contentHandler != null) contentHandler.endDocument(); reset(); if (opened) in.close(); if (e instanceof IOException) throw (IOException) e; else throw e2; } }
13,467
public synchronized void parse(InputSource input) throws IOException, SAXException { reset(); String systemId = input.getSystemId(); InputStream in = input.getByteStream(); boolean opened = false; if (in != null) parser = new XMLParser(in, systemId, validating, namespaceAware, coalescing, replaceERefs, externalEntities, supportDTD, baseAware, stringInterning, this, this); else { Reader r = input.getCharacterStream(); if (r != null) parser = new XMLParser(r, systemId, validating, namespaceAware, coalescing, replaceERefs, externalEntities, supportDTD, baseAware, stringInterning, this, this); } if (parser == null) { if (systemId == null) throw new SAXException("No stream or system ID specified"); systemId = XMLParser.absolutize(null, systemId); in = new URL(systemId).openStream(); opened = true; parser = new XMLParser(in, systemId, validating, namespaceAware, coalescing, replaceERefs, externalEntities, supportDTD, baseAware, stringInterning, this, this); } reader = parser; baseURI = systemId; if (xIncludeAware) reader = new XIncludeFilter(parser, systemId, namespaceAware, validating, true); if (contentHandler != null) contentHandler.setDocumentLocator(this); boolean startDocumentDone = false; try { while (parser.hasNext()) { int event = parser.next(); if (baseAware) baseURI = parser.getXMLBase(); switch (event) { case XMLStreamConstants.CHARACTERS: if (contentHandler != null) { char[] b = reader.getTextCharacters(); contentHandler.characters(b, 0, b.length); } break; case XMLStreamConstants.SPACE: if (contentHandler != null) { char[] b = reader.getTextCharacters(); if (isIgnorableWhitespace(parser, b, false)) contentHandler.ignorableWhitespace(b, 0, b.length); else contentHandler.characters(b, 0, b.length); } break; case XMLStreamConstants.CDATA: if (lexicalHandler != null) lexicalHandler.startCDATA(); if (contentHandler != null) { char[] b = reader.getTextCharacters(); if (isIgnorableWhitespace(parser, b, true)) contentHandler.ignorableWhitespace(b, 0, b.length); else contentHandler.characters(b, 0, b.length); } if (lexicalHandler != null) lexicalHandler.endCDATA(); break; case XMLStreamConstants.START_ELEMENT: if (contentHandler != null) { QName name = reader.getName(); String uri = name.getNamespaceURI(); String localName = name.getLocalPart(); String prefix = name.getPrefix(); String qName = localName; if (!"".equals(prefix)) qName = prefix + ":" + localName; if (!namespaceAware) { uri = ""; localName = ""; } else { int nc = reader.getNamespaceCount(); for (int i = 0; i < nc; i++) { String nsuri = reader.getNamespaceURI(i); String nsprefix = reader.getNamespacePrefix(i); if ("xml".equals(nsprefix)) continue; contentHandler.startPrefixMapping(nsprefix, nsuri); } } contentHandler.startElement(uri, localName, qName, this); } break; case XMLStreamConstants.END_ELEMENT: if (contentHandler != null) { QName name = reader.getName(); String uri = name.getNamespaceURI(); String localName = name.getLocalPart(); String prefix = name.getPrefix(); String qName = localName; if (!"".equals(prefix)) qName = prefix + ":" + localName; if (!namespaceAware) { uri = ""; localName = ""; } contentHandler.endElement(uri, localName, qName); if (namespaceAware) { int nc = reader.getNamespaceCount(); for (int i = 0; i < nc; i++) { String nsprefix = reader.getNamespacePrefix(i); if ("xml".equals(nsprefix)) continue; contentHandler.endPrefixMapping(nsprefix); } } } break; case XMLStreamConstants.COMMENT: if (lexicalHandler != null) { char[] b = reader.getTextCharacters(); lexicalHandler.comment(b, 0, b.length); } break; case XMLStreamConstants.PROCESSING_INSTRUCTION: if (contentHandler != null) { String target = reader.getPITarget(); String data = reader.getPIData(); if (data == null) data = ""; contentHandler.processingInstruction(target, data); } break; case XMLStreamConstants.START_ENTITY: if (lexicalHandler != null) { String name = reader.getText(); lexicalHandler.startEntity(name); } break; case XMLStreamConstants.END_ENTITY: if (lexicalHandler != null) { String name = reader.getText(); lexicalHandler.endEntity(name); } break; case XMLStreamConstants.START_DOCUMENT: encoding = reader.getEncoding(); xmlVersion = reader.getVersion(); xmlStandalone = reader.isStandalone(); xmlEncoding = reader.getCharacterEncodingScheme(); if (contentHandler != null) contentHandler.startDocument(); startDocumentDone = true; break; case XMLStreamConstants.END_DOCUMENT: if (contentHandler != null) contentHandler.endDocument(); break; case XMLStreamConstants.DTD: XMLParser.Doctype doctype = parser.doctype; if (lexicalHandler != null) { String rootName = doctype.rootName; String publicId = doctype.publicId; String systemId2 = doctype.systemId; lexicalHandler.startDTD(rootName, publicId, systemId2); } for (Iterator i = doctype.entryIterator(); i.hasNext(); ) { String entry = (String) i.next(); char c = entry.charAt(0); String name = entry.substring(1); if ('E' == c) { // Element decl if (declHandler != null) { XMLParser.ContentModel model = doctype.getElementModel(name); declHandler.elementDecl(name, model.text); } } else if ('A' == c) { // Attlist decl if (declHandler != null) { for (Iterator j = doctype.attlistIterator(name); j.hasNext(); ) { Map.Entry att = (Map.Entry) j.next(); String aname = (String) att.getKey(); XMLParser.AttributeDecl decl = (XMLParser.AttributeDecl) att.getValue(); String type = decl.type; String value = decl.value; String mode = null; switch (decl.valueType) { case XMLParser.ATTRIBUTE_DEFAULT_FIXED: mode = "#FIXED"; break; case XMLParser.ATTRIBUTE_DEFAULT_REQUIRED: mode = "#REQUIRED"; break; case XMLParser.ATTRIBUTE_DEFAULT_IMPLIED: mode = "#IMPLIED"; break; } declHandler.attributeDecl(name, aname, type, mode, value); } } } else if ('e' == c) { // Entity decl Object entity = doctype.getEntity(name); if (entity instanceof String) { if (declHandler != null) declHandler.internalEntityDecl(name, (String) entity); } else { XMLParser.ExternalIds ids = (XMLParser.ExternalIds) entity; if (ids.notationName != null) { if (dtdHandler != null) { String pub = ids.publicId; String url = ids.systemId; String not = ids.notationName; dtdHandler.unparsedEntityDecl(name, pub, url, not); } } else { if (declHandler != null) { String pub = ids.publicId; String url = ids.systemId; declHandler.externalEntityDecl(name, pub, url); } } } } else if ('n' == c) { // Notation decl if (dtdHandler != null) { XMLParser.ExternalIds ids = doctype.getNotation(name); String pub = ids.publicId; String url = ids.systemId; dtdHandler.notationDecl(name, pub, url); } } else if ('c' == c) { // Comment if (lexicalHandler != null) { String comment = doctype.getComment(name); char[] b = comment.toCharArray(); lexicalHandler.comment(b, 0, b.length); } } else if ('p' == c) { // Processing instruction if (contentHandler != null) { String[] pi = doctype.getPI(name); String target = pi[0]; String data = pi[1]; if (data == null) data = ""; contentHandler.processingInstruction(target, data); } } } if (lexicalHandler != null) lexicalHandler.endDTD(); } } reset(); if (opened) in.close(); } catch (Exception e) { if (!startDocumentDone && contentHandler != null) contentHandler.startDocument(); SAXParseException e2 = new SAXParseException(e.getMessage(), this); e2.initCause(e); if (errorHandler != null) errorHandler.fatalError(e2); if (contentHandler != null) contentHandler.endDocument(); reset(); if (opened) in.close(); if (e instanceof IOException) throw (IOException) e; else throw e2; } }
public synchronized void parse(InputSource input) throws IOException, SAXException { reset(); String systemId = input.getSystemId(); InputStream in = input.getByteStream(); boolean opened = false; if (in != null) parser = new XMLParser(in, systemId, validating, namespaceAware, coalescing, replaceERefs, externalEntities, supportDTD, baseAware, stringInterning, this, this); else { Reader r = input.getCharacterStream(); if (r != null) parser = new XMLParser(r, systemId, validating, namespaceAware, coalescing, replaceERefs, externalEntities, supportDTD, baseAware, stringInterning, this, this); } if (parser == null) { if (systemId == null) throw new SAXException("No stream or system ID specified"); systemId = XMLParser.absolutize(null, systemId); in = new URL(systemId).openStream(); opened = true; parser = new XMLParser(in, systemId, validating, namespaceAware, coalescing, replaceERefs, externalEntities, supportDTD, baseAware, stringInterning, this, this); } reader = parser; baseURI = systemId; if (xIncludeAware) reader = new XIncludeFilter(parser, systemId, namespaceAware, validating, true); if (contentHandler != null) contentHandler.setDocumentLocator(this); boolean startDocumentDone = false; try { while (parser.hasNext()) { int event = parser.next(); if (baseAware) baseURI = parser.getXMLBase(); switch (event) { case XMLStreamConstants.CHARACTERS: if (contentHandler != null) { char[] b = reader.getTextCharacters(); contentHandler.characters(b, 0, b.length); } break; case XMLStreamConstants.SPACE: if (contentHandler != null) { char[] b = reader.getTextCharacters(); if (isIgnorableWhitespace(parser, b, false)) contentHandler.ignorableWhitespace(b, 0, b.length); else contentHandler.characters(b, 0, b.length); } break; case XMLStreamConstants.CDATA: if (lexicalHandler != null) lexicalHandler.startCDATA(); if (contentHandler != null) { char[] b = reader.getTextCharacters(); if (isIgnorableWhitespace(parser, b, true)) contentHandler.ignorableWhitespace(b, 0, b.length); else contentHandler.characters(b, 0, b.length); } if (lexicalHandler != null) lexicalHandler.endCDATA(); break; case XMLStreamConstants.START_ELEMENT: if (contentHandler != null) { QName name = reader.getName(); String uri = name.getNamespaceURI(); String localName = name.getLocalPart(); String prefix = name.getPrefix(); String qName = localName; if (!"".equals(prefix)) qName = prefix + ":" + localName; if (!namespaceAware) { uri = ""; localName = ""; } else { int nc = reader.getNamespaceCount(); for (int i = 0; i < nc; i++) { String nsuri = reader.getNamespaceURI(i); String nsprefix = reader.getNamespacePrefix(i); if ("xml".equals(nsprefix)) continue; contentHandler.startPrefixMapping(nsprefix, nsuri); } } contentHandler.startElement(uri, localName, qName, this); } break; case XMLStreamConstants.END_ELEMENT: if (contentHandler != null) { QName name = reader.getName(); String uri = name.getNamespaceURI(); String localName = name.getLocalPart(); String prefix = name.getPrefix(); String qName = localName; if (!"".equals(prefix)) qName = prefix + ":" + localName; if (!namespaceAware) { uri = ""; localName = ""; } contentHandler.endElement(uri, localName, qName); if (namespaceAware) { int nc = reader.getNamespaceCount(); for (int i = 0; i < nc; i++) { String nsprefix = reader.getNamespacePrefix(i); if ("xml".equals(nsprefix)) continue; contentHandler.endPrefixMapping(nsprefix); } } } break; case XMLStreamConstants.COMMENT: if (lexicalHandler != null) { char[] b = reader.getTextCharacters(); lexicalHandler.comment(b, 0, b.length); } break; case XMLStreamConstants.PROCESSING_INSTRUCTION: if (contentHandler != null) { String target = reader.getPITarget(); String data = reader.getPIData(); if (data == null) data = ""; contentHandler.processingInstruction(target, data); } break; case XMLStreamConstants.START_ENTITY: if (lexicalHandler != null) { String name = reader.getText(); lexicalHandler.startEntity(name); } break; case XMLStreamConstants.END_ENTITY: if (lexicalHandler != null) { String name = reader.getText(); lexicalHandler.endEntity(name); } break; case XMLStreamConstants.START_DOCUMENT: encoding = reader.getEncoding(); xmlVersion = reader.getVersion(); xmlStandalone = reader.isStandalone(); xmlEncoding = reader.getCharacterEncodingScheme(); if (contentHandler != null) contentHandler.startDocument(); startDocumentDone = true; break; case XMLStreamConstants.END_DOCUMENT: if (contentHandler != null) contentHandler.endDocument(); break; case XMLStreamConstants.DTD: XMLParser.Doctype doctype = parser.doctype; if (lexicalHandler != null) { String rootName = doctype.rootName; String publicId = doctype.publicId; String systemId2 = doctype.systemId; lexicalHandler.startDTD(rootName, publicId, systemId2); } for (Iterator i = doctype.entryIterator(); i.hasNext(); ) { String entry = (String) i.next(); char c = entry.charAt(0); String name = entry.substring(1); if ('E' == c) { // Element decl if (declHandler != null) { XMLParser.ContentModel model = doctype.getElementModel(name); declHandler.elementDecl(name, model.text); } } else if ('A' == c) { // Attlist decl if (declHandler != null) { for (Iterator j = doctype.attlistIterator(name); j.hasNext(); ) { Map.Entry att = (Map.Entry) j.next(); String aname = (String) att.getKey(); XMLParser.AttributeDecl decl = (XMLParser.AttributeDecl) att.getValue(); String type = decl.type; String value = decl.value; String mode = null; switch (decl.valueType) { case XMLParser.ATTRIBUTE_DEFAULT_FIXED: mode = "#FIXED"; break; case XMLParser.ATTRIBUTE_DEFAULT_REQUIRED: mode = "#REQUIRED"; break; case XMLParser.ATTRIBUTE_DEFAULT_IMPLIED: mode = "#IMPLIED"; break; } declHandler.attributeDecl(name, aname, type, mode, value); } } } else if ('e' == c) { // Entity decl Object entity = doctype.getEntity(name); if (entity instanceof String) { if (declHandler != null) declHandler.internalEntityDecl(name, (String) entity); } else { XMLParser.ExternalIds ids = (XMLParser.ExternalIds) entity; if (ids.notationName != null) { if (dtdHandler != null) { String pub = ids.publicId; String url = ids.systemId; String not = ids.notationName; dtdHandler.unparsedEntityDecl(name, pub, url, not); } } else { if (declHandler != null) { String pub = ids.publicId; String url = ids.systemId; declHandler.externalEntityDecl(name, pub, url); } } } } else if ('n' == c) { // Notation decl if (dtdHandler != null) { XMLParser.ExternalIds ids = doctype.getNotation(name); String pub = ids.publicId; String url = ids.systemId; dtdHandler.notationDecl(name, pub, url); } } else if ('c' == c) { // Comment if (lexicalHandler != null) { String comment = doctype.getComment(name); char[] b = comment.toCharArray(); lexicalHandler.comment(b, 0, b.length); } } else if ('p' == c) { // Processing instruction if (contentHandler != null) { String[] pi = doctype.getPI(name); String target = pi[0]; String data = pi[1]; if (data == null) data = ""; contentHandler.processingInstruction(target, data); } } } if (lexicalHandler != null) lexicalHandler.endDTD(); } } reset(); if (opened) in.close(); } catch (Exception e) { if (!startDocumentDone && contentHandler != null) contentHandler.startDocument(); SAXParseException e2 = new SAXParseException(e.getMessage(), this); e2.initCause(e); if (errorHandler != null) errorHandler.fatalError(e2); if (contentHandler != null) contentHandler.endDocument(); reset(); if (opened) in.close(); if (e instanceof IOException) throw (IOException) e; else throw e2; } }
13,468
public BindingTypeHolder(BindingType initialValue) { value = initialValue; }
public BindingTypeHolder() { value = initialValue; }
13,470
public BindingTypeHolder(BindingType initialValue) { value = initialValue; }
public BindingTypeHolder(BindingType initialValue) { }
13,471
public void add(int field, int amount) { switch (field) { case YEAR: complete(); fields[YEAR] += amount; isTimeSet = false; break; case MONTH: complete(); int months = fields[MONTH] + amount; fields[YEAR] += months / 12; fields[MONTH] = months % 12; if (fields[MONTH] < 0) { fields[MONTH] += 12; fields[YEAR]--; } isTimeSet = false; int maxDay = getActualMaximum(DAY_OF_MONTH); if (fields[DAY_OF_MONTH] > maxDay) { fields[DAY_OF_MONTH] = maxDay; isTimeSet = false; } break; case DAY_OF_MONTH: case DAY_OF_YEAR: case DAY_OF_WEEK: if (!isTimeSet) computeTime(); time += amount * (24 * 60 * 60 * 1000L); areFieldsSet = false; break; case WEEK_OF_YEAR: case WEEK_OF_MONTH: case DAY_OF_WEEK_IN_MONTH: if (!isTimeSet) computeTime(); time += amount * (7 * 24 * 60 * 60 * 1000L); areFieldsSet = false; break; case AM_PM: if (!isTimeSet) computeTime(); time += amount * (12 * 60 * 60 * 1000L); areFieldsSet = false; break; case HOUR: case HOUR_OF_DAY: if (!isTimeSet) computeTime(); time += amount * (60 * 60 * 1000L); areFieldsSet = false; break; case MINUTE: if (!isTimeSet) computeTime(); time += amount * (60 * 1000L); areFieldsSet = false; break; case SECOND: if (!isTimeSet) computeTime(); time += amount * (1000L); areFieldsSet = false; break; case MILLISECOND: if (!isTimeSet) computeTime(); time += amount; areFieldsSet = false; break; case ZONE_OFFSET: complete(); fields[ZONE_OFFSET] += amount; time -= amount; break; case DST_OFFSET: complete(); fields[DST_OFFSET] += amount; isTimeSet = false; break; default: throw new IllegalArgumentException ("Unknown Calendar field: " + field); } }
public void add(int field, int amount) { switch (field) { case YEAR: complete(); fields[YEAR] += amount; isTimeSet = false; break; case MONTH: complete(); int months = fields[MONTH] + amount; fields[YEAR] += months / 12; fields[MONTH] = months % 12; if (fields[MONTH] < 0) { fields[MONTH] += 12; fields[YEAR]--; } isTimeSet = false; int maxDay = getActualMaximum(DAY_OF_MONTH); if (fields[DAY_OF_MONTH] > maxDay) { fields[DAY_OF_MONTH] = maxDay; isTimeSet = false; } break; case DAY_OF_MONTH: case DAY_OF_YEAR: case DAY_OF_WEEK: if (!isTimeSet) computeTime(); time += amount * (24 * 60 * 60 * 1000L); areFieldsSet = false; break; case WEEK_OF_YEAR: case WEEK_OF_MONTH: case DAY_OF_WEEK_IN_MONTH: if (!isTimeSet) computeTime(); time += amount * (7 * 24 * 60 * 60 * 1000L); areFieldsSet = false; break; case AM_PM: if (!isTimeSet) computeTime(); time += amount * (12 * 60 * 60 * 1000L); areFieldsSet = false; break; case HOUR: case HOUR_OF_DAY: if (!isTimeSet) computeTime(); time += amount * (60 * 60 * 1000L); areFieldsSet = false; break; case MINUTE: if (!isTimeSet) computeTime(); time += amount * (60 * 1000L); areFieldsSet = false; break; case SECOND: if (!isTimeSet) computeTime(); time += amount * (1000L); areFieldsSet = false; break; case MILLISECOND: if (!isTimeSet) computeTime(); time += amount; areFieldsSet = false; break; case ZONE_OFFSET: complete(); fields[ZONE_OFFSET] += amount; time -= amount; break; case DST_OFFSET: complete(); fields[DST_OFFSET] += amount; isTimeSet = false; break; default: throw new IllegalArgumentException ("Unknown Calendar field: " + field); } }
13,472
public void add(int field, int amount) { switch (field) { case YEAR: complete(); fields[YEAR] += amount; isTimeSet = false; break; case MONTH: complete(); int months = fields[MONTH] + amount; fields[YEAR] += months / 12; fields[MONTH] = months % 12; if (fields[MONTH] < 0) { fields[MONTH] += 12; fields[YEAR]--; } isTimeSet = false; int maxDay = getActualMaximum(DAY_OF_MONTH); if (fields[DAY_OF_MONTH] > maxDay) { fields[DAY_OF_MONTH] = maxDay; isTimeSet = false; } break; case DAY_OF_MONTH: case DAY_OF_YEAR: case DAY_OF_WEEK: if (!isTimeSet) computeTime(); time += amount * (24 * 60 * 60 * 1000L); areFieldsSet = false; break; case WEEK_OF_YEAR: case WEEK_OF_MONTH: case DAY_OF_WEEK_IN_MONTH: if (!isTimeSet) computeTime(); time += amount * (7 * 24 * 60 * 60 * 1000L); areFieldsSet = false; break; case AM_PM: if (!isTimeSet) computeTime(); time += amount * (12 * 60 * 60 * 1000L); areFieldsSet = false; break; case HOUR: case HOUR_OF_DAY: if (!isTimeSet) computeTime(); time += amount * (60 * 60 * 1000L); areFieldsSet = false; break; case MINUTE: if (!isTimeSet) computeTime(); time += amount * (60 * 1000L); areFieldsSet = false; break; case SECOND: if (!isTimeSet) computeTime(); time += amount * (1000L); areFieldsSet = false; break; case MILLISECOND: if (!isTimeSet) computeTime(); time += amount; areFieldsSet = false; break; case ZONE_OFFSET: complete(); fields[ZONE_OFFSET] += amount; time -= amount; break; case DST_OFFSET: complete(); fields[DST_OFFSET] += amount; isTimeSet = false; break; default: throw new IllegalArgumentException ("Unknown Calendar field: " + field); } }
public void add(int field, int amount) { switch (field) { case YEAR: complete(); fields[YEAR] += amount; isTimeSet = false; break; case MONTH: complete(); int months = fields[MONTH] + amount; fields[YEAR] += months / 12; fields[MONTH] = months % 12; if (fields[MONTH] < 0) { fields[MONTH] += 12; fields[YEAR]--; } isTimeSet = false; int maxDay = getActualMaximum(DAY_OF_MONTH); if (fields[DAY_OF_MONTH] > maxDay) { fields[DAY_OF_MONTH] = maxDay; isTimeSet = false; } break; case DAY_OF_MONTH: case DAY_OF_YEAR: case DAY_OF_WEEK: if (!isTimeSet) computeTime(); time += amount * (24 * 60 * 60 * 1000L); areFieldsSet = false; break; case WEEK_OF_YEAR: case WEEK_OF_MONTH: case DAY_OF_WEEK_IN_MONTH: if (!isTimeSet) computeTime(); time += amount * (7 * 24 * 60 * 60 * 1000L); areFieldsSet = false; break; case AM_PM: if (!isTimeSet) computeTime(); time += amount * (12 * 60 * 60 * 1000L); areFieldsSet = false; break; case HOUR: case HOUR_OF_DAY: if (!isTimeSet) computeTime(); time += amount * (60 * 60 * 1000L); areFieldsSet = false; break; case MINUTE: if (!isTimeSet) computeTime(); time += amount * (60 * 1000L); areFieldsSet = false; break; case SECOND: if (!isTimeSet) computeTime(); time += amount * (1000L); areFieldsSet = false; break; case MILLISECOND: if (!isTimeSet) computeTime(); time += amount; areFieldsSet = false; break; case ZONE_OFFSET: complete(); fields[ZONE_OFFSET] += amount; time -= amount; break; case DST_OFFSET: complete(); fields[DST_OFFSET] += amount; isTimeSet = false; break; default: throw new IllegalArgumentException ("Unknown Calendar field: " + field); } }
13,473
public void add(int field, int amount) { switch (field) { case YEAR: complete(); fields[YEAR] += amount; isTimeSet = false; break; case MONTH: complete(); int months = fields[MONTH] + amount; fields[YEAR] += months / 12; fields[MONTH] = months % 12; if (fields[MONTH] < 0) { fields[MONTH] += 12; fields[YEAR]--; } isTimeSet = false; int maxDay = getActualMaximum(DAY_OF_MONTH); if (fields[DAY_OF_MONTH] > maxDay) { fields[DAY_OF_MONTH] = maxDay; isTimeSet = false; } break; case DAY_OF_MONTH: case DAY_OF_YEAR: case DAY_OF_WEEK: if (!isTimeSet) computeTime(); time += amount * (24 * 60 * 60 * 1000L); areFieldsSet = false; break; case WEEK_OF_YEAR: case WEEK_OF_MONTH: case DAY_OF_WEEK_IN_MONTH: if (!isTimeSet) computeTime(); time += amount * (7 * 24 * 60 * 60 * 1000L); areFieldsSet = false; break; case AM_PM: if (!isTimeSet) computeTime(); time += amount * (12 * 60 * 60 * 1000L); areFieldsSet = false; break; case HOUR: case HOUR_OF_DAY: if (!isTimeSet) computeTime(); time += amount * (60 * 60 * 1000L); areFieldsSet = false; break; case MINUTE: if (!isTimeSet) computeTime(); time += amount * (60 * 1000L); areFieldsSet = false; break; case SECOND: if (!isTimeSet) computeTime(); time += amount * (1000L); areFieldsSet = false; break; case MILLISECOND: if (!isTimeSet) computeTime(); time += amount; areFieldsSet = false; break; case ZONE_OFFSET: complete(); fields[ZONE_OFFSET] += amount; time -= amount; break; case DST_OFFSET: complete(); fields[DST_OFFSET] += amount; isTimeSet = false; break; default: throw new IllegalArgumentException ("Unknown Calendar field: " + field); } }
public void add(int field, int amount) { switch (field) { case YEAR: complete(); fields[YEAR] += amount; isTimeSet = false; break; case MONTH: complete(); int months = fields[MONTH] + amount; fields[YEAR] += months / 12; fields[MONTH] = months % 12; if (fields[MONTH] < 0) { fields[MONTH] += 12; fields[YEAR]--; } isTimeSet = false; int maxDay = getActualMaximum(DAY_OF_MONTH); if (fields[DAY_OF_MONTH] > maxDay) { fields[DAY_OF_MONTH] = maxDay; isTimeSet = false; } break; case DAY_OF_MONTH: case DAY_OF_YEAR: case DAY_OF_WEEK: if (!isTimeSet) computeTime(); time += amount * (24 * 60 * 60 * 1000L); areFieldsSet = false; break; case WEEK_OF_YEAR: case WEEK_OF_MONTH: case DAY_OF_WEEK_IN_MONTH: if (!isTimeSet) computeTime(); time += amount * (7 * 24 * 60 * 60 * 1000L); areFieldsSet = false; break; case AM_PM: if (!isTimeSet) computeTime(); time += amount * (12 * 60 * 60 * 1000L); areFieldsSet = false; break; case HOUR: case HOUR_OF_DAY: if (!isTimeSet) computeTime(); time += amount * (60 * 60 * 1000L); areFieldsSet = false; break; case MINUTE: if (!isTimeSet) computeTime(); time += amount * (60 * 1000L); areFieldsSet = false; break; case SECOND: if (!isTimeSet) computeTime(); time += amount * (1000L); areFieldsSet = false; break; case MILLISECOND: if (!isTimeSet) computeTime(); time += amount; areFieldsSet = false; break; case ZONE_OFFSET: complete(); fields[ZONE_OFFSET] += amount; time -= amount; break; case DST_OFFSET: complete(); fields[DST_OFFSET] += amount; isTimeSet = false; break; default: throw new IllegalArgumentException ("Unknown Calendar field: " + field); } }
13,474
private void calculateDay(int day, boolean gregorian) { // the epoch is a Thursday. int weekday = (day + THURSDAY) % 7; if (weekday <= 0) weekday += 7; fields[DAY_OF_WEEK] = weekday; // get a first approximation of the year. This may be one // year to big. int year = 1970 + (gregorian ? ((day - 100) * 400) / (365 * 400 + 100 - 4 + 1) : ((day - 100) * 4) / (365 * 4 + 1)); if (day >= 0) year++; int firstDayOfYear = getLinearDay(year, 1, gregorian); // Now look in which year day really lies. if (day < firstDayOfYear) { year--; firstDayOfYear = getLinearDay(year, 1, gregorian); } day -= firstDayOfYear - 1; // day of year, one based. fields[DAY_OF_YEAR] = day; if (year <= 0) { fields[ERA] = BC; fields[YEAR] = 1 - year; } else { fields[ERA] = AD; fields[YEAR] = year; } int leapday = isLeapYear(year, gregorian) ? 1 : 0; if (day <= 31 + 28 + leapday) { fields[MONTH] = day / 32; // 31->JANUARY, 32->FEBRUARY fields[DAY_OF_MONTH] = day - 31 * fields[MONTH]; } else { // A few more magic formulas int scaledDay = (day - leapday) * 5 + 8; fields[MONTH] = scaledDay / (31 + 30 + 31 + 30 + 31); fields[DAY_OF_MONTH] = (scaledDay % (31 + 30 + 31 + 30 + 31)) / 5 + 1; } }
private void calculateDay(int[] fields, long day, boolean gregorian) { // the epoch is a Thursday. int weekday = (day + THURSDAY) % 7; if (weekday <= 0) weekday += 7; fields[DAY_OF_WEEK] = weekday; // get a first approximation of the year. This may be one // year to big. int year = 1970 + (gregorian ? ((day - 100) * 400) / (365 * 400 + 100 - 4 + 1) : ((day - 100) * 4) / (365 * 4 + 1)); if (day >= 0) year++; int firstDayOfYear = getLinearDay(year, 1, gregorian); // Now look in which year day really lies. if (day < firstDayOfYear) { year--; firstDayOfYear = getLinearDay(year, 1, gregorian); } day -= firstDayOfYear - 1; // day of year, one based. fields[DAY_OF_YEAR] = day; if (year <= 0) { fields[ERA] = BC; fields[YEAR] = 1 - year; } else { fields[ERA] = AD; fields[YEAR] = year; } int leapday = isLeapYear(year, gregorian) ? 1 : 0; if (day <= 31 + 28 + leapday) { fields[MONTH] = day / 32; // 31->JANUARY, 32->FEBRUARY fields[DAY_OF_MONTH] = day - 31 * fields[MONTH]; } else { // A few more magic formulas int scaledDay = (day - leapday) * 5 + 8; fields[MONTH] = scaledDay / (31 + 30 + 31 + 30 + 31); fields[DAY_OF_MONTH] = (scaledDay % (31 + 30 + 31 + 30 + 31)) / 5 + 1; } }
13,475
private void calculateDay(int day, boolean gregorian) { // the epoch is a Thursday. int weekday = (day + THURSDAY) % 7; if (weekday <= 0) weekday += 7; fields[DAY_OF_WEEK] = weekday; // get a first approximation of the year. This may be one // year to big. int year = 1970 + (gregorian ? ((day - 100) * 400) / (365 * 400 + 100 - 4 + 1) : ((day - 100) * 4) / (365 * 4 + 1)); if (day >= 0) year++; int firstDayOfYear = getLinearDay(year, 1, gregorian); // Now look in which year day really lies. if (day < firstDayOfYear) { year--; firstDayOfYear = getLinearDay(year, 1, gregorian); } day -= firstDayOfYear - 1; // day of year, one based. fields[DAY_OF_YEAR] = day; if (year <= 0) { fields[ERA] = BC; fields[YEAR] = 1 - year; } else { fields[ERA] = AD; fields[YEAR] = year; } int leapday = isLeapYear(year, gregorian) ? 1 : 0; if (day <= 31 + 28 + leapday) { fields[MONTH] = day / 32; // 31->JANUARY, 32->FEBRUARY fields[DAY_OF_MONTH] = day - 31 * fields[MONTH]; } else { // A few more magic formulas int scaledDay = (day - leapday) * 5 + 8; fields[MONTH] = scaledDay / (31 + 30 + 31 + 30 + 31); fields[DAY_OF_MONTH] = (scaledDay % (31 + 30 + 31 + 30 + 31)) / 5 + 1; } }
private void calculateDay(int day, boolean gregorian) { // the epoch is a Thursday. int weekday = (int)(day + THURSDAY) % 7; if (weekday <= 0) weekday += 7; fields[DAY_OF_WEEK] = weekday; // get a first approximation of the year. This may be one // year to big. int year = 1970 + (gregorian ? ((day - 100) * 400) / (365 * 400 + 100 - 4 + 1) : ((day - 100) * 4) / (365 * 4 + 1)); if (day >= 0) year++; int firstDayOfYear = getLinearDay(year, 1, gregorian); // Now look in which year day really lies. if (day < firstDayOfYear) { year--; firstDayOfYear = getLinearDay(year, 1, gregorian); } day -= firstDayOfYear - 1; // day of year, one based. fields[DAY_OF_YEAR] = day; if (year <= 0) { fields[ERA] = BC; fields[YEAR] = 1 - year; } else { fields[ERA] = AD; fields[YEAR] = year; } int leapday = isLeapYear(year, gregorian) ? 1 : 0; if (day <= 31 + 28 + leapday) { fields[MONTH] = day / 32; // 31->JANUARY, 32->FEBRUARY fields[DAY_OF_MONTH] = day - 31 * fields[MONTH]; } else { // A few more magic formulas int scaledDay = (day - leapday) * 5 + 8; fields[MONTH] = scaledDay / (31 + 30 + 31 + 30 + 31); fields[DAY_OF_MONTH] = (scaledDay % (31 + 30 + 31 + 30 + 31)) / 5 + 1; } }
13,476
private void calculateDay(int day, boolean gregorian) { // the epoch is a Thursday. int weekday = (day + THURSDAY) % 7; if (weekday <= 0) weekday += 7; fields[DAY_OF_WEEK] = weekday; // get a first approximation of the year. This may be one // year to big. int year = 1970 + (gregorian ? ((day - 100) * 400) / (365 * 400 + 100 - 4 + 1) : ((day - 100) * 4) / (365 * 4 + 1)); if (day >= 0) year++; int firstDayOfYear = getLinearDay(year, 1, gregorian); // Now look in which year day really lies. if (day < firstDayOfYear) { year--; firstDayOfYear = getLinearDay(year, 1, gregorian); } day -= firstDayOfYear - 1; // day of year, one based. fields[DAY_OF_YEAR] = day; if (year <= 0) { fields[ERA] = BC; fields[YEAR] = 1 - year; } else { fields[ERA] = AD; fields[YEAR] = year; } int leapday = isLeapYear(year, gregorian) ? 1 : 0; if (day <= 31 + 28 + leapday) { fields[MONTH] = day / 32; // 31->JANUARY, 32->FEBRUARY fields[DAY_OF_MONTH] = day - 31 * fields[MONTH]; } else { // A few more magic formulas int scaledDay = (day - leapday) * 5 + 8; fields[MONTH] = scaledDay / (31 + 30 + 31 + 30 + 31); fields[DAY_OF_MONTH] = (scaledDay % (31 + 30 + 31 + 30 + 31)) / 5 + 1; } }
private void calculateDay(int day, boolean gregorian) { // the epoch is a Thursday. int weekday = (day + THURSDAY) % 7; if (weekday <= 0) weekday += 7; fields[DAY_OF_WEEK] = weekday; // get a first approximation of the year. This may be one // year to big. int year = 1970 + (int)(gregorian ? ((day - 100) * 400) / (365 * 400 + 100 - 4 + 1) : ((day - 100) * 4) / (365 * 4 + 1)); if (day >= 0) year++; int firstDayOfYear = getLinearDay(year, 1, gregorian); // Now look in which year day really lies. if (day < firstDayOfYear) { year--; firstDayOfYear = getLinearDay(year, 1, gregorian); } day -= firstDayOfYear - 1; // day of year, one based. fields[DAY_OF_YEAR] = day; if (year <= 0) { fields[ERA] = BC; fields[YEAR] = 1 - year; } else { fields[ERA] = AD; fields[YEAR] = year; } int leapday = isLeapYear(year, gregorian) ? 1 : 0; if (day <= 31 + 28 + leapday) { fields[MONTH] = day / 32; // 31->JANUARY, 32->FEBRUARY fields[DAY_OF_MONTH] = day - 31 * fields[MONTH]; } else { // A few more magic formulas int scaledDay = (day - leapday) * 5 + 8; fields[MONTH] = scaledDay / (31 + 30 + 31 + 30 + 31); fields[DAY_OF_MONTH] = (scaledDay % (31 + 30 + 31 + 30 + 31)) / 5 + 1; } }
13,477
private void calculateDay(int day, boolean gregorian) { // the epoch is a Thursday. int weekday = (day + THURSDAY) % 7; if (weekday <= 0) weekday += 7; fields[DAY_OF_WEEK] = weekday; // get a first approximation of the year. This may be one // year to big. int year = 1970 + (gregorian ? ((day - 100) * 400) / (365 * 400 + 100 - 4 + 1) : ((day - 100) * 4) / (365 * 4 + 1)); if (day >= 0) year++; int firstDayOfYear = getLinearDay(year, 1, gregorian); // Now look in which year day really lies. if (day < firstDayOfYear) { year--; firstDayOfYear = getLinearDay(year, 1, gregorian); } day -= firstDayOfYear - 1; // day of year, one based. fields[DAY_OF_YEAR] = day; if (year <= 0) { fields[ERA] = BC; fields[YEAR] = 1 - year; } else { fields[ERA] = AD; fields[YEAR] = year; } int leapday = isLeapYear(year, gregorian) ? 1 : 0; if (day <= 31 + 28 + leapday) { fields[MONTH] = day / 32; // 31->JANUARY, 32->FEBRUARY fields[DAY_OF_MONTH] = day - 31 * fields[MONTH]; } else { // A few more magic formulas int scaledDay = (day - leapday) * 5 + 8; fields[MONTH] = scaledDay / (31 + 30 + 31 + 30 + 31); fields[DAY_OF_MONTH] = (scaledDay % (31 + 30 + 31 + 30 + 31)) / 5 + 1; } }
private void calculateDay(int day, boolean gregorian) { // the epoch is a Thursday. int weekday = (day + THURSDAY) % 7; if (weekday <= 0) weekday += 7; fields[DAY_OF_WEEK] = weekday; // get a first approximation of the year. This may be one // year to big. int year = 1970 + (gregorian ? ((day - 100) * 400) / (365 * 400 + 100 - 4 + 1) : ((day - 100) * 4) / (365 * 4 + 1)); if (day >= 0) year++; long firstDayOfYear = getLinearDay(year, 1, gregorian); // Now look in which year day really lies. if (day < firstDayOfYear) { year--; firstDayOfYear = getLinearDay(year, 1, gregorian); } day -= firstDayOfYear - 1; // day of year, one based. fields[DAY_OF_YEAR] = day; if (year <= 0) { fields[ERA] = BC; fields[YEAR] = 1 - year; } else { fields[ERA] = AD; fields[YEAR] = year; } int leapday = isLeapYear(year, gregorian) ? 1 : 0; if (day <= 31 + 28 + leapday) { fields[MONTH] = day / 32; // 31->JANUARY, 32->FEBRUARY fields[DAY_OF_MONTH] = day - 31 * fields[MONTH]; } else { // A few more magic formulas int scaledDay = (day - leapday) * 5 + 8; fields[MONTH] = scaledDay / (31 + 30 + 31 + 30 + 31); fields[DAY_OF_MONTH] = (scaledDay % (31 + 30 + 31 + 30 + 31)) / 5 + 1; } }
13,478
private void calculateDay(int day, boolean gregorian) { // the epoch is a Thursday. int weekday = (day + THURSDAY) % 7; if (weekday <= 0) weekday += 7; fields[DAY_OF_WEEK] = weekday; // get a first approximation of the year. This may be one // year to big. int year = 1970 + (gregorian ? ((day - 100) * 400) / (365 * 400 + 100 - 4 + 1) : ((day - 100) * 4) / (365 * 4 + 1)); if (day >= 0) year++; int firstDayOfYear = getLinearDay(year, 1, gregorian); // Now look in which year day really lies. if (day < firstDayOfYear) { year--; firstDayOfYear = getLinearDay(year, 1, gregorian); } day -= firstDayOfYear - 1; // day of year, one based. fields[DAY_OF_YEAR] = day; if (year <= 0) { fields[ERA] = BC; fields[YEAR] = 1 - year; } else { fields[ERA] = AD; fields[YEAR] = year; } int leapday = isLeapYear(year, gregorian) ? 1 : 0; if (day <= 31 + 28 + leapday) { fields[MONTH] = day / 32; // 31->JANUARY, 32->FEBRUARY fields[DAY_OF_MONTH] = day - 31 * fields[MONTH]; } else { // A few more magic formulas int scaledDay = (day - leapday) * 5 + 8; fields[MONTH] = scaledDay / (31 + 30 + 31 + 30 + 31); fields[DAY_OF_MONTH] = (scaledDay % (31 + 30 + 31 + 30 + 31)) / 5 + 1; } }
private void calculateDay(int day, boolean gregorian) { // the epoch is a Thursday. int weekday = (day + THURSDAY) % 7; if (weekday <= 0) weekday += 7; fields[DAY_OF_WEEK] = weekday; // get a first approximation of the year. This may be one // year to big. int year = 1970 + (gregorian ? ((day - 100) * 400) / (365 * 400 + 100 - 4 + 1) : ((day - 100) * 4) / (365 * 4 + 1)); if (day >= 0) year++; int firstDayOfYear = getLinearDay(year, 1, gregorian); // Now look in which year day really lies. if (day < firstDayOfYear) { year--; firstDayOfYear = getLinearDay(year, 1, gregorian); } day -= firstDayOfYear - 1; // day of year, one based. fields[DAY_OF_YEAR] = (int)day; if (year <= 0) { fields[ERA] = BC; fields[YEAR] = 1 - year; } else { fields[ERA] = AD; fields[YEAR] = year; } int leapday = isLeapYear(year, gregorian) ? 1 : 0; if (day <= 31 + 28 + leapday) { fields[MONTH] = day / 32; // 31->JANUARY, 32->FEBRUARY fields[DAY_OF_MONTH] = day - 31 * fields[MONTH]; } else { // A few more magic formulas int scaledDay = (day - leapday) * 5 + 8; fields[MONTH] = scaledDay / (31 + 30 + 31 + 30 + 31); fields[DAY_OF_MONTH] = (scaledDay % (31 + 30 + 31 + 30 + 31)) / 5 + 1; } }
13,479
private void calculateDay(int day, boolean gregorian) { // the epoch is a Thursday. int weekday = (day + THURSDAY) % 7; if (weekday <= 0) weekday += 7; fields[DAY_OF_WEEK] = weekday; // get a first approximation of the year. This may be one // year to big. int year = 1970 + (gregorian ? ((day - 100) * 400) / (365 * 400 + 100 - 4 + 1) : ((day - 100) * 4) / (365 * 4 + 1)); if (day >= 0) year++; int firstDayOfYear = getLinearDay(year, 1, gregorian); // Now look in which year day really lies. if (day < firstDayOfYear) { year--; firstDayOfYear = getLinearDay(year, 1, gregorian); } day -= firstDayOfYear - 1; // day of year, one based. fields[DAY_OF_YEAR] = day; if (year <= 0) { fields[ERA] = BC; fields[YEAR] = 1 - year; } else { fields[ERA] = AD; fields[YEAR] = year; } int leapday = isLeapYear(year, gregorian) ? 1 : 0; if (day <= 31 + 28 + leapday) { fields[MONTH] = day / 32; // 31->JANUARY, 32->FEBRUARY fields[DAY_OF_MONTH] = day - 31 * fields[MONTH]; } else { // A few more magic formulas int scaledDay = (day - leapday) * 5 + 8; fields[MONTH] = scaledDay / (31 + 30 + 31 + 30 + 31); fields[DAY_OF_MONTH] = (scaledDay % (31 + 30 + 31 + 30 + 31)) / 5 + 1; } }
private void calculateDay(int day, boolean gregorian) { // the epoch is a Thursday. int weekday = (day + THURSDAY) % 7; if (weekday <= 0) weekday += 7; fields[DAY_OF_WEEK] = weekday; // get a first approximation of the year. This may be one // year to big. int year = 1970 + (gregorian ? ((day - 100) * 400) / (365 * 400 + 100 - 4 + 1) : ((day - 100) * 4) / (365 * 4 + 1)); if (day >= 0) year++; int firstDayOfYear = getLinearDay(year, 1, gregorian); // Now look in which year day really lies. if (day < firstDayOfYear) { year--; firstDayOfYear = getLinearDay(year, 1, gregorian); } day -= firstDayOfYear - 1; // day of year, one based. fields[DAY_OF_YEAR] = day; if (year <= 0) { fields[ERA] = BC; fields[YEAR] = 1 - year; } else { fields[ERA] = AD; fields[YEAR] = year; } int leapday = isLeapYear(year, gregorian) ? 1 : 0; if (day <= 31 + 28 + leapday) { fields[MONTH] = day / 32; // 31->JANUARY, 32->FEBRUARY fields[DAY_OF_MONTH] = day - 31 * fields[MONTH]; } else { // A few more magic formulas int scaledDay = (day - leapday) * 5 + 8; fields[MONTH] = scaledDay / (31 + 30 + 31 + 30 + 31); fields[DAY_OF_MONTH] = (scaledDay % (31 + 30 + 31 + 30 + 31)) / 5 + 1; } }
13,480
private void calculateDay(int day, boolean gregorian) { // the epoch is a Thursday. int weekday = (day + THURSDAY) % 7; if (weekday <= 0) weekday += 7; fields[DAY_OF_WEEK] = weekday; // get a first approximation of the year. This may be one // year to big. int year = 1970 + (gregorian ? ((day - 100) * 400) / (365 * 400 + 100 - 4 + 1) : ((day - 100) * 4) / (365 * 4 + 1)); if (day >= 0) year++; int firstDayOfYear = getLinearDay(year, 1, gregorian); // Now look in which year day really lies. if (day < firstDayOfYear) { year--; firstDayOfYear = getLinearDay(year, 1, gregorian); } day -= firstDayOfYear - 1; // day of year, one based. fields[DAY_OF_YEAR] = day; if (year <= 0) { fields[ERA] = BC; fields[YEAR] = 1 - year; } else { fields[ERA] = AD; fields[YEAR] = year; } int leapday = isLeapYear(year, gregorian) ? 1 : 0; if (day <= 31 + 28 + leapday) { fields[MONTH] = day / 32; // 31->JANUARY, 32->FEBRUARY fields[DAY_OF_MONTH] = day - 31 * fields[MONTH]; } else { // A few more magic formulas int scaledDay = (day - leapday) * 5 + 8; fields[MONTH] = scaledDay / (31 + 30 + 31 + 30 + 31); fields[DAY_OF_MONTH] = (scaledDay % (31 + 30 + 31 + 30 + 31)) / 5 + 1; } }
private void calculateDay(int day, boolean gregorian) { // the epoch is a Thursday. int weekday = (day + THURSDAY) % 7; if (weekday <= 0) weekday += 7; fields[DAY_OF_WEEK] = weekday; // get a first approximation of the year. This may be one // year to big. int year = 1970 + (gregorian ? ((day - 100) * 400) / (365 * 400 + 100 - 4 + 1) : ((day - 100) * 4) / (365 * 4 + 1)); if (day >= 0) year++; int firstDayOfYear = getLinearDay(year, 1, gregorian); // Now look in which year day really lies. if (day < firstDayOfYear) { year--; firstDayOfYear = getLinearDay(year, 1, gregorian); } day -= firstDayOfYear - 1; // day of year, one based. fields[DAY_OF_YEAR] = day; if (year <= 0) { fields[ERA] = BC; fields[YEAR] = 1 - year; } else { fields[ERA] = AD; fields[YEAR] = year; } int leapday = isLeapYear(year, gregorian) ? 1 : 0; if (day <= 31 + 28 + leapday) { fields[MONTH] = day / 32; // 31->JANUARY, 32->FEBRUARY fields[DAY_OF_MONTH] = day - 31 * fields[MONTH]; } else { // A few more magic formulas int scaledDay = ((int)day - leapday) * 5 + 8; fields[MONTH] = scaledDay / (31 + 30 + 31 + 30 + 31); fields[DAY_OF_MONTH] = (scaledDay % (31 + 30 + 31 + 30 + 31)) / 5 + 1; } }
13,481
protected synchronized void computeFields() { boolean gregorian = (time >= gregorianCutover); TimeZone zone = getTimeZone(); fields[ZONE_OFFSET] = zone.getRawOffset(); long localTime = time + fields[ZONE_OFFSET]; int day = (int) (localTime / (24 * 60 * 60 * 1000L)); int millisInDay = (int) (localTime % (24 * 60 * 60 * 1000L)); if (millisInDay < 0) { millisInDay += (24 * 60 * 60 * 1000); day--; } calculateDay(day, gregorian); fields[DST_OFFSET] = zone.getOffset(fields[ERA], fields[YEAR], fields[MONTH], fields[DAY_OF_MONTH], fields[DAY_OF_WEEK], millisInDay) - fields[ZONE_OFFSET]; millisInDay += fields[DST_OFFSET]; if (millisInDay >= 24 * 60 * 60 * 1000) { millisInDay -= 24 * 60 * 60 * 1000; calculateDay(++day, gregorian); } fields[DAY_OF_WEEK_IN_MONTH] = (fields[DAY_OF_MONTH] + 6) / 7; // which day of the week are we (0..6), relative to getFirstDayOfWeek int relativeWeekday = (7 + fields[DAY_OF_WEEK] - getFirstDayOfWeek()) % 7; fields[WEEK_OF_MONTH] = (fields[DAY_OF_MONTH] - relativeWeekday + 12) / 7; int weekOfYear = (fields[DAY_OF_YEAR] - relativeWeekday + 6) / 7; // Do the Correction: getMinimalDaysInFirstWeek() is always in the // first week. int minDays = getMinimalDaysInFirstWeek(); int firstWeekday = (7 + getWeekDay(fields[YEAR], minDays) - getFirstDayOfWeek()) % 7; if (minDays - firstWeekday < 1) weekOfYear++; fields[WEEK_OF_YEAR] = weekOfYear; int hourOfDay = millisInDay / (60 * 60 * 1000); fields[AM_PM] = (hourOfDay < 12) ? AM : PM; int hour = hourOfDay % 12; fields[HOUR] = (hour == 0) ? 12 : hour; fields[HOUR_OF_DAY] = hourOfDay; millisInDay %= (60 * 60 * 1000); fields[MINUTE] = millisInDay / (60 * 1000); millisInDay %= (60 * 1000); fields[SECOND] = millisInDay / (1000); fields[MILLISECOND] = millisInDay % 1000; areFieldsSet = isSet[ERA] = isSet[YEAR] = isSet[MONTH] = isSet[WEEK_OF_YEAR] = isSet[WEEK_OF_MONTH] = isSet[DAY_OF_MONTH] = isSet[DAY_OF_YEAR] = isSet[DAY_OF_WEEK] = isSet[DAY_OF_WEEK_IN_MONTH] = isSet[AM_PM] = isSet[HOUR] = isSet[HOUR_OF_DAY] = isSet[MINUTE] = isSet[SECOND] = isSet[MILLISECOND] = isSet[ZONE_OFFSET] = isSet[DST_OFFSET] = true; }
protected synchronized void computeFields() { boolean gregorian = (time >= gregorianCutover); TimeZone zone = getTimeZone(); fields[ZONE_OFFSET] = zone.getRawOffset(); long localTime = time + fields[ZONE_OFFSET]; long day = localTime / (24 * 60 * 60 * 1000L); int millisInDay = (int) (localTime % (24 * 60 * 60 * 1000L)); if (millisInDay < 0) { millisInDay += (24 * 60 * 60 * 1000); day--; } calculateDay(day, gregorian); fields[DST_OFFSET] = zone.getOffset(fields[ERA], fields[YEAR], fields[MONTH], fields[DAY_OF_MONTH], fields[DAY_OF_WEEK], millisInDay) - fields[ZONE_OFFSET]; millisInDay += fields[DST_OFFSET]; if (millisInDay >= 24 * 60 * 60 * 1000) { millisInDay -= 24 * 60 * 60 * 1000; calculateDay(++day, gregorian); } fields[DAY_OF_WEEK_IN_MONTH] = (fields[DAY_OF_MONTH] + 6) / 7; // which day of the week are we (0..6), relative to getFirstDayOfWeek int relativeWeekday = (7 + fields[DAY_OF_WEEK] - getFirstDayOfWeek()) % 7; fields[WEEK_OF_MONTH] = (fields[DAY_OF_MONTH] - relativeWeekday + 12) / 7; int weekOfYear = (fields[DAY_OF_YEAR] - relativeWeekday + 6) / 7; // Do the Correction: getMinimalDaysInFirstWeek() is always in the // first week. int minDays = getMinimalDaysInFirstWeek(); int firstWeekday = (7 + getWeekDay(fields[YEAR], minDays) - getFirstDayOfWeek()) % 7; if (minDays - firstWeekday < 1) weekOfYear++; fields[WEEK_OF_YEAR] = weekOfYear; int hourOfDay = millisInDay / (60 * 60 * 1000); fields[AM_PM] = (hourOfDay < 12) ? AM : PM; int hour = hourOfDay % 12; fields[HOUR] = (hour == 0) ? 12 : hour; fields[HOUR_OF_DAY] = hourOfDay; millisInDay %= (60 * 60 * 1000); fields[MINUTE] = millisInDay / (60 * 1000); millisInDay %= (60 * 1000); fields[SECOND] = millisInDay / (1000); fields[MILLISECOND] = millisInDay % 1000; areFieldsSet = isSet[ERA] = isSet[YEAR] = isSet[MONTH] = isSet[WEEK_OF_YEAR] = isSet[WEEK_OF_MONTH] = isSet[DAY_OF_MONTH] = isSet[DAY_OF_YEAR] = isSet[DAY_OF_WEEK] = isSet[DAY_OF_WEEK_IN_MONTH] = isSet[AM_PM] = isSet[HOUR] = isSet[HOUR_OF_DAY] = isSet[MINUTE] = isSet[SECOND] = isSet[MILLISECOND] = isSet[ZONE_OFFSET] = isSet[DST_OFFSET] = true; }
13,482
protected synchronized void computeFields() { boolean gregorian = (time >= gregorianCutover); TimeZone zone = getTimeZone(); fields[ZONE_OFFSET] = zone.getRawOffset(); long localTime = time + fields[ZONE_OFFSET]; int day = (int) (localTime / (24 * 60 * 60 * 1000L)); int millisInDay = (int) (localTime % (24 * 60 * 60 * 1000L)); if (millisInDay < 0) { millisInDay += (24 * 60 * 60 * 1000); day--; } calculateDay(day, gregorian); fields[DST_OFFSET] = zone.getOffset(fields[ERA], fields[YEAR], fields[MONTH], fields[DAY_OF_MONTH], fields[DAY_OF_WEEK], millisInDay) - fields[ZONE_OFFSET]; millisInDay += fields[DST_OFFSET]; if (millisInDay >= 24 * 60 * 60 * 1000) { millisInDay -= 24 * 60 * 60 * 1000; calculateDay(++day, gregorian); } fields[DAY_OF_WEEK_IN_MONTH] = (fields[DAY_OF_MONTH] + 6) / 7; // which day of the week are we (0..6), relative to getFirstDayOfWeek int relativeWeekday = (7 + fields[DAY_OF_WEEK] - getFirstDayOfWeek()) % 7; fields[WEEK_OF_MONTH] = (fields[DAY_OF_MONTH] - relativeWeekday + 12) / 7; int weekOfYear = (fields[DAY_OF_YEAR] - relativeWeekday + 6) / 7; // Do the Correction: getMinimalDaysInFirstWeek() is always in the // first week. int minDays = getMinimalDaysInFirstWeek(); int firstWeekday = (7 + getWeekDay(fields[YEAR], minDays) - getFirstDayOfWeek()) % 7; if (minDays - firstWeekday < 1) weekOfYear++; fields[WEEK_OF_YEAR] = weekOfYear; int hourOfDay = millisInDay / (60 * 60 * 1000); fields[AM_PM] = (hourOfDay < 12) ? AM : PM; int hour = hourOfDay % 12; fields[HOUR] = (hour == 0) ? 12 : hour; fields[HOUR_OF_DAY] = hourOfDay; millisInDay %= (60 * 60 * 1000); fields[MINUTE] = millisInDay / (60 * 1000); millisInDay %= (60 * 1000); fields[SECOND] = millisInDay / (1000); fields[MILLISECOND] = millisInDay % 1000; areFieldsSet = isSet[ERA] = isSet[YEAR] = isSet[MONTH] = isSet[WEEK_OF_YEAR] = isSet[WEEK_OF_MONTH] = isSet[DAY_OF_MONTH] = isSet[DAY_OF_YEAR] = isSet[DAY_OF_WEEK] = isSet[DAY_OF_WEEK_IN_MONTH] = isSet[AM_PM] = isSet[HOUR] = isSet[HOUR_OF_DAY] = isSet[MINUTE] = isSet[SECOND] = isSet[MILLISECOND] = isSet[ZONE_OFFSET] = isSet[DST_OFFSET] = true; }
protected synchronized void computeFields() { boolean gregorian = (time >= gregorianCutover); TimeZone zone = getTimeZone(); fields[ZONE_OFFSET] = zone.getRawOffset(); long localTime = time + fields[ZONE_OFFSET]; int day = (int) (localTime / (24 * 60 * 60 * 1000L)); int millisInDay = (int) (localTime % (24 * 60 * 60 * 1000L)); if (millisInDay < 0) { millisInDay += (24 * 60 * 60 * 1000); day--; } calculateDay(fields, day, gregorian); fields[DST_OFFSET] = zone.getOffset(fields[ERA], fields[YEAR], fields[MONTH], fields[DAY_OF_MONTH], fields[DAY_OF_WEEK], millisInDay) - fields[ZONE_OFFSET]; millisInDay += fields[DST_OFFSET]; if (millisInDay >= 24 * 60 * 60 * 1000) { millisInDay -= 24 * 60 * 60 * 1000; calculateDay(++day, gregorian); } fields[DAY_OF_WEEK_IN_MONTH] = (fields[DAY_OF_MONTH] + 6) / 7; // which day of the week are we (0..6), relative to getFirstDayOfWeek int relativeWeekday = (7 + fields[DAY_OF_WEEK] - getFirstDayOfWeek()) % 7; fields[WEEK_OF_MONTH] = (fields[DAY_OF_MONTH] - relativeWeekday + 12) / 7; int weekOfYear = (fields[DAY_OF_YEAR] - relativeWeekday + 6) / 7; // Do the Correction: getMinimalDaysInFirstWeek() is always in the // first week. int minDays = getMinimalDaysInFirstWeek(); int firstWeekday = (7 + getWeekDay(fields[YEAR], minDays) - getFirstDayOfWeek()) % 7; if (minDays - firstWeekday < 1) weekOfYear++; fields[WEEK_OF_YEAR] = weekOfYear; int hourOfDay = millisInDay / (60 * 60 * 1000); fields[AM_PM] = (hourOfDay < 12) ? AM : PM; int hour = hourOfDay % 12; fields[HOUR] = (hour == 0) ? 12 : hour; fields[HOUR_OF_DAY] = hourOfDay; millisInDay %= (60 * 60 * 1000); fields[MINUTE] = millisInDay / (60 * 1000); millisInDay %= (60 * 1000); fields[SECOND] = millisInDay / (1000); fields[MILLISECOND] = millisInDay % 1000; areFieldsSet = isSet[ERA] = isSet[YEAR] = isSet[MONTH] = isSet[WEEK_OF_YEAR] = isSet[WEEK_OF_MONTH] = isSet[DAY_OF_MONTH] = isSet[DAY_OF_YEAR] = isSet[DAY_OF_WEEK] = isSet[DAY_OF_WEEK_IN_MONTH] = isSet[AM_PM] = isSet[HOUR] = isSet[HOUR_OF_DAY] = isSet[MINUTE] = isSet[SECOND] = isSet[MILLISECOND] = isSet[ZONE_OFFSET] = isSet[DST_OFFSET] = true; }
13,483
protected synchronized void computeFields() { boolean gregorian = (time >= gregorianCutover); TimeZone zone = getTimeZone(); fields[ZONE_OFFSET] = zone.getRawOffset(); long localTime = time + fields[ZONE_OFFSET]; int day = (int) (localTime / (24 * 60 * 60 * 1000L)); int millisInDay = (int) (localTime % (24 * 60 * 60 * 1000L)); if (millisInDay < 0) { millisInDay += (24 * 60 * 60 * 1000); day--; } calculateDay(day, gregorian); fields[DST_OFFSET] = zone.getOffset(fields[ERA], fields[YEAR], fields[MONTH], fields[DAY_OF_MONTH], fields[DAY_OF_WEEK], millisInDay) - fields[ZONE_OFFSET]; millisInDay += fields[DST_OFFSET]; if (millisInDay >= 24 * 60 * 60 * 1000) { millisInDay -= 24 * 60 * 60 * 1000; calculateDay(++day, gregorian); } fields[DAY_OF_WEEK_IN_MONTH] = (fields[DAY_OF_MONTH] + 6) / 7; // which day of the week are we (0..6), relative to getFirstDayOfWeek int relativeWeekday = (7 + fields[DAY_OF_WEEK] - getFirstDayOfWeek()) % 7; fields[WEEK_OF_MONTH] = (fields[DAY_OF_MONTH] - relativeWeekday + 12) / 7; int weekOfYear = (fields[DAY_OF_YEAR] - relativeWeekday + 6) / 7; // Do the Correction: getMinimalDaysInFirstWeek() is always in the // first week. int minDays = getMinimalDaysInFirstWeek(); int firstWeekday = (7 + getWeekDay(fields[YEAR], minDays) - getFirstDayOfWeek()) % 7; if (minDays - firstWeekday < 1) weekOfYear++; fields[WEEK_OF_YEAR] = weekOfYear; int hourOfDay = millisInDay / (60 * 60 * 1000); fields[AM_PM] = (hourOfDay < 12) ? AM : PM; int hour = hourOfDay % 12; fields[HOUR] = (hour == 0) ? 12 : hour; fields[HOUR_OF_DAY] = hourOfDay; millisInDay %= (60 * 60 * 1000); fields[MINUTE] = millisInDay / (60 * 1000); millisInDay %= (60 * 1000); fields[SECOND] = millisInDay / (1000); fields[MILLISECOND] = millisInDay % 1000; areFieldsSet = isSet[ERA] = isSet[YEAR] = isSet[MONTH] = isSet[WEEK_OF_YEAR] = isSet[WEEK_OF_MONTH] = isSet[DAY_OF_MONTH] = isSet[DAY_OF_YEAR] = isSet[DAY_OF_WEEK] = isSet[DAY_OF_WEEK_IN_MONTH] = isSet[AM_PM] = isSet[HOUR] = isSet[HOUR_OF_DAY] = isSet[MINUTE] = isSet[SECOND] = isSet[MILLISECOND] = isSet[ZONE_OFFSET] = isSet[DST_OFFSET] = true; }
protected synchronized void computeFields() { boolean gregorian = (time >= gregorianCutover); TimeZone zone = getTimeZone(); fields[ZONE_OFFSET] = zone.getRawOffset(); long localTime = time + fields[ZONE_OFFSET]; int day = (int) (localTime / (24 * 60 * 60 * 1000L)); int millisInDay = (int) (localTime % (24 * 60 * 60 * 1000L)); if (millisInDay < 0) { millisInDay += (24 * 60 * 60 * 1000); day--; } calculateDay(day, gregorian); fields[DST_OFFSET] = zone.getOffset(fields[ERA], fields[YEAR], fields[MONTH], fields[DAY_OF_MONTH], fields[DAY_OF_WEEK], millisInDay) - fields[ZONE_OFFSET]; millisInDay += fields[DST_OFFSET]; if (millisInDay >= 24 * 60 * 60 * 1000) { millisInDay -= 24 * 60 * 60 * 1000; calculateDay(fields, ++day, gregorian); } fields[DAY_OF_WEEK_IN_MONTH] = (fields[DAY_OF_MONTH] + 6) / 7; // which day of the week are we (0..6), relative to getFirstDayOfWeek int relativeWeekday = (7 + fields[DAY_OF_WEEK] - getFirstDayOfWeek()) % 7; fields[WEEK_OF_MONTH] = (fields[DAY_OF_MONTH] - relativeWeekday + 12) / 7; int weekOfYear = (fields[DAY_OF_YEAR] - relativeWeekday + 6) / 7; // Do the Correction: getMinimalDaysInFirstWeek() is always in the // first week. int minDays = getMinimalDaysInFirstWeek(); int firstWeekday = (7 + getWeekDay(fields[YEAR], minDays) - getFirstDayOfWeek()) % 7; if (minDays - firstWeekday < 1) weekOfYear++; fields[WEEK_OF_YEAR] = weekOfYear; int hourOfDay = millisInDay / (60 * 60 * 1000); fields[AM_PM] = (hourOfDay < 12) ? AM : PM; int hour = hourOfDay % 12; fields[HOUR] = (hour == 0) ? 12 : hour; fields[HOUR_OF_DAY] = hourOfDay; millisInDay %= (60 * 60 * 1000); fields[MINUTE] = millisInDay / (60 * 1000); millisInDay %= (60 * 1000); fields[SECOND] = millisInDay / (1000); fields[MILLISECOND] = millisInDay % 1000; areFieldsSet = isSet[ERA] = isSet[YEAR] = isSet[MONTH] = isSet[WEEK_OF_YEAR] = isSet[WEEK_OF_MONTH] = isSet[DAY_OF_MONTH] = isSet[DAY_OF_YEAR] = isSet[DAY_OF_WEEK] = isSet[DAY_OF_WEEK_IN_MONTH] = isSet[AM_PM] = isSet[HOUR] = isSet[HOUR_OF_DAY] = isSet[MINUTE] = isSet[SECOND] = isSet[MILLISECOND] = isSet[ZONE_OFFSET] = isSet[DST_OFFSET] = true; }
13,484
protected synchronized void computeTime() { int era = isSet[ERA] ? fields[ERA] : AD; int year = isSet[YEAR] ? fields[YEAR] : 1970; if (era == BC) year = 1 - year; int[] daysOfYear = getDayOfYear(year); int hour = 0; if (isSet[HOUR_OF_DAY]) hour = fields[HOUR_OF_DAY]; else if (isSet[HOUR]) { hour = fields[HOUR]; if (isSet[AM_PM] && fields[AM_PM] == PM) if (hour != 12) /* not Noon */ hour += 12; /* Fix the problem of the status of 12:00 AM (midnight). */ if (isSet[AM_PM] && fields[AM_PM] == AM && hour == 12) hour = 0; } int minute = isSet[MINUTE] ? fields[MINUTE] : 0; int second = isSet[SECOND] ? fields[SECOND] : 0; int millis = isSet[MILLISECOND] ? fields[MILLISECOND] : 0; int millisInDay; if (isLenient()) { // prevent overflow long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis; daysOfYear[1] += allMillis / (24 * 60 * 60 * 1000L); millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L)); } else { if (hour < 0 || hour >= 24 || minute < 0 || minute > 59 || second < 0 || second > 59 || millis < 0 || millis >= 1000) throw new IllegalArgumentException(); millisInDay = (((hour * 60) + minute) * 60 + second) * 1000 + millis; } time = getLinearTime(year, daysOfYear[0], millisInDay); // Add the relative days after calculating the linear time, to // get right behaviour when jumping over the gregorianCutover. time += daysOfYear[1] * (24 * 60 * 60 * 1000L); TimeZone zone = getTimeZone(); int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset(); int dayOfYear = daysOfYear[0] + daysOfYear[1]; // This formula isn't right, so check for month as a quick fix. // It doesn't compensate for leap years and puts day 30 in month 1 // instead of month 0. int month = isSet[MONTH] ? fields[MONTH] : (dayOfYear * 5 + 3) / (31 + 30 + 31 + 30 + 31); // This formula isn't right, so check for day as a quick fix. It // doesn't compensate for leap years, either. int day = isSet[DAY_OF_MONTH] ? fields[DAY_OF_MONTH] : (6 + (dayOfYear * 5 + 3) % (31 + 30 + 31 + 30 + 31)) / 5; int weekday = ((int) (time / (24 * 60 * 60 * 1000L)) + THURSDAY) % 7; if (weekday <= 0) weekday += 7; int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset()); time -= rawOffset + dstOffset; isTimeSet = true; }
protected synchronized void computeTime() { int era = isSet[ERA] ? fields[ERA] : AD; int year = isSet[YEAR] ? fields[YEAR] : 1970; if (era == BC) year = 1 - year; int[] daysOfYear = getDayOfYear(year); int hour = 0; if (isSet[HOUR_OF_DAY]) hour = fields[HOUR_OF_DAY]; else if (isSet[HOUR]) { hour = fields[HOUR]; if (isSet[AM_PM] && fields[AM_PM] == PM) if (hour != 12) /* not Noon */ hour += 12; /* Fix the problem of the status of 12:00 AM (midnight). */ if (isSet[AM_PM] && fields[AM_PM] == AM && hour == 12) hour = 0; } int minute = isSet[MINUTE] ? fields[MINUTE] : 0; int second = isSet[SECOND] ? fields[SECOND] : 0; int millis = isSet[MILLISECOND] ? fields[MILLISECOND] : 0; int millisInDay; if (isLenient()) { // prevent overflow long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis; daysOfYear[1] += allMillis / (24 * 60 * 60 * 1000L); millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L)); } else { if (hour < 0 || hour >= 24 || minute < 0 || minute > 59 || second < 0 || second > 59 || millis < 0 || millis >= 1000) throw new IllegalArgumentException(); millisInDay = (((hour * 60) + minute) * 60 + second) * 1000 + millis; } time = getLinearTime(year, daysOfYear[0], millisInDay); // Add the relative days after calculating the linear time, to // get right behaviour when jumping over the gregorianCutover. time += daysOfYear[1] * (24 * 60 * 60 * 1000L); TimeZone zone = getTimeZone(); int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset(); int dayOfYear = daysOfYear[0] + daysOfYear[1]; // This formula isn't right, so check for month as a quick fix. // It doesn't compensate for leap years and puts day 30 in month 1 // instead of month 0. int month = isSet[MONTH] ? fields[MONTH] : (dayOfYear * 5 + 3) / (31 + 30 + 31 + 30 + 31); // This formula isn't right, so check for day as a quick fix. It // doesn't compensate for leap years, either. int day = isSet[DAY_OF_MONTH] ? fields[DAY_OF_MONTH] : (6 + (dayOfYear * 5 + 3) % (31 + 30 + 31 + 30 + 31)) / 5; int weekday = ((int) (time / (24 * 60 * 60 * 1000L)) + THURSDAY) % 7; if (weekday <= 0) weekday += 7; int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset()); time -= rawOffset + dstOffset; isTimeSet = true; }
13,485
private int getLinearDay(int year, int dayOfYear, boolean gregorian) { // The 13 is the number of days, that were omitted in the Gregorian // Calender until the epoch. // We shift right by 2 instead of dividing by 4, to get correct // results for negative years (and this is even more efficient). int julianDay = ((year * (365 * 4 + 1)) >> 2) + dayOfYear - ((1970 * (365 * 4 + 1)) / 4 + 1 - 13); if (gregorian) { // subtract the days that are missing in gregorian calendar // with respect to julian calendar. // // Okay, here we rely on the fact that the gregorian // calendar was introduced in the AD era. This doesn't work // with negative years. // // The additional leap year factor accounts for the fact that // a leap day is not seen on Jan 1 of the leap year. int gregOffset = (year / 400) - (year / 100) + 2; if (isLeapYear (year, true) && dayOfYear < 31 + 29) --gregOffset; julianDay += gregOffset; } return julianDay; }
private long getLinearDay(int year, int dayOfYear, boolean gregorian) { // The 13 is the number of days, that were omitted in the Gregorian // Calender until the epoch. // We shift right by 2 instead of dividing by 4, to get correct // results for negative years (and this is even more efficient). int julianDay = ((year * (365 * 4 + 1)) >> 2) + dayOfYear - ((1970 * (365 * 4 + 1)) / 4 + 1 - 13); if (gregorian) { // subtract the days that are missing in gregorian calendar // with respect to julian calendar. // // Okay, here we rely on the fact that the gregorian // calendar was introduced in the AD era. This doesn't work // with negative years. // // The additional leap year factor accounts for the fact that // a leap day is not seen on Jan 1 of the leap year. int gregOffset = (year / 400) - (year / 100) + 2; if (isLeapYear (year, true) && dayOfYear < 31 + 29) --gregOffset; julianDay += gregOffset; } return julianDay; }
13,486
private int getLinearDay(int year, int dayOfYear, boolean gregorian) { // The 13 is the number of days, that were omitted in the Gregorian // Calender until the epoch. // We shift right by 2 instead of dividing by 4, to get correct // results for negative years (and this is even more efficient). int julianDay = ((year * (365 * 4 + 1)) >> 2) + dayOfYear - ((1970 * (365 * 4 + 1)) / 4 + 1 - 13); if (gregorian) { // subtract the days that are missing in gregorian calendar // with respect to julian calendar. // // Okay, here we rely on the fact that the gregorian // calendar was introduced in the AD era. This doesn't work // with negative years. // // The additional leap year factor accounts for the fact that // a leap day is not seen on Jan 1 of the leap year. int gregOffset = (year / 400) - (year / 100) + 2; if (isLeapYear (year, true) && dayOfYear < 31 + 29) --gregOffset; julianDay += gregOffset; } return julianDay; }
private int getLinearDay(int year, int dayOfYear, boolean gregorian) { // The 13 is the number of days, that were omitted in the Gregorian // Calender until the epoch. // We shift right by 2 instead of dividing by 4, to get correct // results for negative years (and this is even more efficient). long julianDay = ((year * (365L * 4 + 1)) >> 2) + dayOfYear - ((1970 * (365 * 4 + 1)) / 4 + 1 - 13); if (gregorian) { // subtract the days that are missing in gregorian calendar // with respect to julian calendar. // // Okay, here we rely on the fact that the gregorian // calendar was introduced in the AD era. This doesn't work // with negative years. // // The additional leap year factor accounts for the fact that // a leap day is not seen on Jan 1 of the leap year. int gregOffset = (year / 400) - (year / 100) + 2; if (isLeapYear (year, true) && dayOfYear < 31 + 29) --gregOffset; julianDay += gregOffset; } return julianDay; }
13,487
public Rectangle getCellBounds(int index0, int index1) { return ((ListUI) ui).getCellBounds(this, index0, index1); }
public Rectangle getCellBounds(int index0, int index1) { return getUI().getCellBounds(this, index0, index1); }
13,488
public Point indexToLocation(int index){ return getCellBounds(index, index).getLocation(); }
public Point indexToLocation(int index){ return getCellBounds(index, index).getLocation(); }
13,489
public static synchronized UnicastConnectionManager getInstance(int port, RMIServerSocketFactory ssf) throws RemoteException {//System.out.println("getInstance: " + port + "," + ssf); if (ssf == null) { ssf = defaultSocketFactory; } TripleKey key = new TripleKey(localhost, port, ssf); UnicastConnectionManager man = (UnicastConnectionManager)servers.get(key); if (man == null) { man = new UnicastConnectionManager(port, ssf); if (debug) { nsmanager++; System.out.println("\n\n ****** " + nsmanager + " server managers.\n\n"); } // The provided port might not be the set port. key.port = man.serverPort; servers.put(key, man); } return (man);}
public static synchronized UnicastConnectionManager getInstance(int port, RMIServerSocketFactory ssf) throws RemoteException {//System.out.println("getInstance: " + port + "," + ssf); if (ssf == null) { ssf = defaultSocketFactory; } TripleKey key = new TripleKey(localhost, port, ssf); UnicastConnectionManager man = (UnicastConnectionManager)servers.get(key); if (man == null) { man = new UnicastConnectionManager(port, ssf); if (debug) { nsmanager++; System.out.println("\n\n ****** " + nsmanager + " server managers.\n\n"); } // The provided port might not be the set port. key.port = man.serverPort; servers.put(key, man); } return (man);}
13,490
public static synchronized UnicastConnectionManager getInstance(int port, RMIServerSocketFactory ssf) throws RemoteException {//System.out.println("getInstance: " + port + "," + ssf); if (ssf == null) { ssf = defaultSocketFactory; } TripleKey key = new TripleKey(localhost, port, ssf); UnicastConnectionManager man = (UnicastConnectionManager)servers.get(key); if (man == null) { man = new UnicastConnectionManager(port, ssf); if (debug) { nsmanager++; System.out.println("\n\n ****** " + nsmanager + " server managers.\n\n"); } // The provided port might not be the set port. key.port = man.serverPort; servers.put(key, man); } return (man);}
public static synchronized UnicastConnectionManager getInstance(int port, RMIServerSocketFactory ssf) throws RemoteException {//System.out.println("getInstance: " + port + "," + ssf); if (ssf == null) { ssf = defaultSocketFactory; } TripleKey key = new TripleKey(localhost, port, ssf); UnicastConnectionManager man = (UnicastConnectionManager)servers.get(key); if (man == null) { man = new UnicastConnectionManager(port, ssf); if (debug) { nsmanager++; System.out.println("\n\n ****** " + nsmanager + " server managers.\n\n"); } // The provided port might not be the set port. key.port = man.serverPort; servers.put(key, man); } return (man);}
13,491
public static synchronized UnicastConnectionManager getInstance(int port, RMIServerSocketFactory ssf) throws RemoteException {//System.out.println("getInstance: " + port + "," + ssf); if (ssf == null) { ssf = defaultSocketFactory; } TripleKey key = new TripleKey(localhost, port, ssf); UnicastConnectionManager man = (UnicastConnectionManager)servers.get(key); if (man == null) { man = new UnicastConnectionManager(port, ssf); if (debug) { nsmanager++; System.out.println("\n\n ****** " + nsmanager + " server managers.\n\n"); } // The provided port might not be the set port. key.port = man.serverPort; servers.put(key, man); } return (man);}
public static synchronized UnicastConnectionManager getInstance(int port, RMIServerSocketFactory ssf) throws RemoteException {//System.out.println("getInstance: " + port + "," + ssf); if (ssf == null) { ssf = defaultSocketFactory; } TripleKey key = new TripleKey(localhost, port, ssf); UnicastConnectionManager man = (UnicastConnectionManager)servers.get(key); if (man == null) { man = new UnicastConnectionManager(host, port, csf); if (debug) { nsmanager++; System.out.println("\n\n ****** " + nsmanager + " server managers.\n\n"); } // The provided port might not be the set port. key.port = man.serverPort; servers.put(key, man); } return (man);}
13,492
public static synchronized UnicastConnectionManager getInstance(int port, RMIServerSocketFactory ssf) throws RemoteException {//System.out.println("getInstance: " + port + "," + ssf); if (ssf == null) { ssf = defaultSocketFactory; } TripleKey key = new TripleKey(localhost, port, ssf); UnicastConnectionManager man = (UnicastConnectionManager)servers.get(key); if (man == null) { man = new UnicastConnectionManager(port, ssf); if (debug) { nsmanager++; System.out.println("\n\n ****** " + nsmanager + " server managers.\n\n"); } // The provided port might not be the set port. key.port = man.serverPort; servers.put(key, man); } return (man);}
public static synchronized UnicastConnectionManager getInstance(int port, RMIServerSocketFactory ssf) throws RemoteException {//System.out.println("getInstance: " + port + "," + ssf); if (ssf == null) { ssf = defaultSocketFactory; } TripleKey key = new TripleKey(localhost, port, ssf); UnicastConnectionManager man = (UnicastConnectionManager)servers.get(key); if (man == null) { man = new UnicastConnectionManager(port, ssf); if (debug) { nsmanager++; System.out.println("\n\n ****** " + nsmanager + " server managers.\n\n"); } // The provided port might not be the set port. key.port = man.serverPort; servers.put(key, man); } return (man);}
13,493
public static synchronized UnicastConnectionManager getInstance(int port, RMIServerSocketFactory ssf) throws RemoteException {//System.out.println("getInstance: " + port + "," + ssf); if (ssf == null) { ssf = defaultSocketFactory; } TripleKey key = new TripleKey(localhost, port, ssf); UnicastConnectionManager man = (UnicastConnectionManager)servers.get(key); if (man == null) { man = new UnicastConnectionManager(port, ssf); if (debug) { nsmanager++; System.out.println("\n\n ****** " + nsmanager + " server managers.\n\n"); } // The provided port might not be the set port. key.port = man.serverPort; servers.put(key, man); } return (man);}
public static synchronized UnicastConnectionManager getInstance(int port, RMIServerSocketFactory ssf) throws RemoteException {//System.out.println("getInstance: " + port + "," + ssf); if (ssf == null) { ssf = defaultSocketFactory; } TripleKey key = new TripleKey(localhost, port, ssf); UnicastConnectionManager man = (UnicastConnectionManager)servers.get(key); if (man == null) { man = new UnicastConnectionManager(port, ssf); if (debug) { nsmanager++; System.out.println("\n\n ****** " + nsmanager + " server managers.\n\n"); } // The provided port might not be the set port. key.port = man.serverPort; servers.put(key, man); } return (man);}
13,494
public void setSelectionPath(TreePath value0) { // TODO }
public void setSelectionPath(TreePath path) { // TODO }
13,496
public SwingFrame(Frame awtFrame) { this.awtComponent = awtFrame; }
public SwingFrame(Frame awtFrame) { super(awtFrame); }
13,498
public void setVisible(final boolean b) { SwingToolkit.invokeNowOrLater(new Runnable() { public void run() { if (b) { jComponent.invalidate(); VMContainer.invalidateTree(component); VMContainer.invalidateTree(jComponent); jComponent.validate(); } jComponent.setVisible(b); jComponent.repaint(); toolkit.getAwtContext().getDesktop().repaint(); } }); }
public void setVisible(final boolean b) { SwingToolkit.invokeNowOrLater(new Runnable() { public void run() { if (b) { jComponent.invalidate(); VMContainer.invalidateTree(component); VMContainer.invalidateTree(jComponent); jComponent.validate(); } jComponent.setVisible(b); jComponent.repaint(); toolkit.getAwtContext().getDesktop().repaint(); } }); }
13,499
public void run() { if (b) { jComponent.invalidate(); VMContainer.invalidateTree(component); VMContainer.invalidateTree(jComponent); jComponent.validate(); } jComponent.setVisible(b); jComponent.repaint(); toolkit.getAwtContext().getDesktop().repaint(); }
public void run() { if (b) { jComponent.invalidate(); VMContainer.invalidateTree(component); VMContainer.invalidateTree(jComponent); jComponent.validate(); } jComponent.setVisible(b); jComponent.repaint(); toolkit.getAwtContext().getDesktop().repaint(); }
13,500
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); } }
protected 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); } }
13,501
private Class findStubSkelClass(Class startCls) { Class cls = startCls; while (true) { try { String stubClassname = cls.getName() + "_Stub"; ClassLoader cl = cls.getClassLoader(); Class scls = cl == null ? Class.forName(stubClassname) : cl.loadClass(stubClassname); return cls; // found it } catch (ClassNotFoundException e) { Class superCls = cls.getSuperclass(); if (superCls == null || superCls == java.rmi.server.UnicastRemoteObject.class) { return null; } cls = superCls; } } }
protected Class findStubSkelClass(Class startCls) { Class cls = startCls; while (true) { try { String stubClassname = cls.getName() + "_Stub"; ClassLoader cl = cls.getClassLoader(); Class scls = cl == null ? Class.forName(stubClassname) : cl.loadClass(stubClassname); return cls; // found it } catch (ClassNotFoundException e) { Class superCls = cls.getSuperclass(); if (superCls == null || superCls == java.rmi.server.UnicastRemoteObject.class) { return null; } cls = superCls; } } }
13,502
private Object getHelperClass(Class cls, String type) { try { String classname = cls.getName(); ClassLoader cl = cls.getClassLoader(); Class scls = cl == null ? Class.forName(classname + type) : cl.loadClass(classname + type); if (type.equals("_Stub")) { try { // JDK 1.2 stubs Constructor con = scls.getConstructor(stubprototype); return (con.newInstance(new Object[] { this })); } catch (NoSuchMethodException e) { } catch (InstantiationException e) { } catch (IllegalAccessException e) { } catch (IllegalArgumentException e) { } catch (InvocationTargetException e) { } // JDK 1.1 stubs RemoteStub stub = (RemoteStub) scls.newInstance(); UnicastRemoteStub.setStubRef(stub, this); return (stub); } else { // JDK 1.1 skel return (scls.newInstance()); } } catch (ClassNotFoundException e) { } catch (InstantiationException e) { } catch (IllegalAccessException e) { } return (null); }
protected Object getHelperClass(Class cls, String type) { try { String classname = cls.getName(); ClassLoader cl = cls.getClassLoader(); Class scls = cl == null ? Class.forName(classname + type) : cl.loadClass(classname + type); if (type.equals("_Stub")) { try { // JDK 1.2 stubs Constructor con = scls.getConstructor(stubprototype); return (con.newInstance(new Object[] { this })); } catch (NoSuchMethodException e) { } catch (InstantiationException e) { } catch (IllegalAccessException e) { } catch (IllegalArgumentException e) { } catch (InvocationTargetException e) { } // JDK 1.1 stubs RemoteStub stub = (RemoteStub) scls.newInstance(); UnicastRemoteStub.setStubRef(stub, this); return (stub); } else { // JDK 1.1 skel return (scls.newInstance()); } } catch (ClassNotFoundException e) { } catch (InstantiationException e) { } catch (IllegalAccessException e) { } return (null); }
13,503