rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
|
---|---|---|
int todo = srcEnd - srcOffset; if (srcOffset < 0 || srcEnd > count || todo < 0) | if (srcOffset < 0 || srcEnd > count || srcEnd < srcOffset) | public synchronized void getChars(int srcOffset, int srcEnd, char[] dst, int dstOffset) { int todo = srcEnd - srcOffset; if (srcOffset < 0 || srcEnd > count || todo < 0) throw new StringIndexOutOfBoundsException(); System.arraycopy(value, srcOffset, dst, dstOffset, todo); } |
System.arraycopy(value, srcOffset, dst, dstOffset, todo); | System.arraycopy(value, srcOffset, dst, dstOffset, srcEnd - srcOffset); | public synchronized void getChars(int srcOffset, int srcEnd, char[] dst, int dstOffset) { int todo = srcEnd - srcOffset; if (srcOffset < 0 || srcEnd > count || todo < 0) throw new StringIndexOutOfBoundsException(); System.arraycopy(value, srcOffset, dst, dstOffset, todo); } |
|| str_offset < 0 || str_offset + len > str.length) | || str_offset < 0 || str_offset > str.length - len) | public synchronized StringBuffer insert(int offset, char[] str, int str_offset, int len) { if (offset < 0 || offset > count || len < 0 || str_offset < 0 || str_offset + len > str.length) throw new StringIndexOutOfBoundsException(); ensureCapacity_unsynchronized(count + len); System.arraycopy(value, offset, value, offset + len, count - offset); System.arraycopy(str, str_offset, value, offset, len); count += len; return this; } |
count = newLength; | } | public synchronized void setLength(int newLength) { if (newLength < 0) throw new StringIndexOutOfBoundsException(newLength); ensureCapacity_unsynchronized(newLength); while (count < newLength) value[count++] = '\0'; count = newLength; } |
public final void setAttributes(KeyEvent ke) { | public final void setAttributes(int keyCode, boolean isShiftDown, boolean isControlDown, boolean isAltDown, boolean isAltGrDown) { | public final void setAttributes(KeyEvent ke) { keyCode = ke.getKeyCode(); isShiftDown = ke.isShiftDown(); isControlDown = ke.isControlDown(); isAltDown = ke.isAltDown(); hashCode = keyCode + (isShiftDown ? 1 : 0) + (isControlDown ? 1 : 0) + (isAltDown ? 1 : 0) + (isAltGrDown ? 1 : 0); } |
keyCode = ke.getKeyCode(); isShiftDown = ke.isShiftDown(); isControlDown = ke.isControlDown(); isAltDown = ke.isAltDown(); | this.keyCode = keyCode; this.isShiftDown = isShiftDown; this.isControlDown = isControlDown; this.isAltDown = isAltDown; this.isAltGrDown = isAltGrDown; | public final void setAttributes(KeyEvent ke) { keyCode = ke.getKeyCode(); isShiftDown = ke.isShiftDown(); isControlDown = ke.isControlDown(); isAltDown = ke.isAltDown(); hashCode = keyCode + (isShiftDown ? 1 : 0) + (isControlDown ? 1 : 0) + (isAltDown ? 1 : 0) + (isAltGrDown ? 1 : 0); } |
(isAltDown ? 1 : 0) + (isAltGrDown ? 1 : 0); | (isAltDown ? 1 : 0); | public final void setAttributes(KeyEvent ke) { keyCode = ke.getKeyCode(); isShiftDown = ke.isShiftDown(); isControlDown = ke.isControlDown(); isAltDown = ke.isAltDown(); hashCode = keyCode + (isShiftDown ? 1 : 0) + (isControlDown ? 1 : 0) + (isAltDown ? 1 : 0) + (isAltGrDown ? 1 : 0); } |
Icon icon = b.getComboIcon(); | public Dimension getMinimumSize(JComponent c) { MetalComboBoxButton b = (MetalComboBoxButton) arrowButton; Icon icon = b.getComboIcon(); Insets insets = b.getInsets(); Dimension d = getDisplaySize(); int insetsH = insets.top + insets.bottom; int insetsW = insets.left + insets.right; int iconWidth = icon.getIconWidth() + 6; return new Dimension(d.width + insetsW + iconWidth, d.height + insetsH); } |
|
Dimension d = getDisplaySize(); | public Dimension getMinimumSize(JComponent c) { MetalComboBoxButton b = (MetalComboBoxButton) arrowButton; Icon icon = b.getComboIcon(); Insets insets = b.getInsets(); Dimension d = getDisplaySize(); int insetsH = insets.top + insets.bottom; int insetsW = insets.left + insets.right; int iconWidth = icon.getIconWidth() + 6; return new Dimension(d.width + insetsW + iconWidth, d.height + insetsH); } |
|
return new Dimension(d.width + insetsW + iconWidth, d.height + insetsH); | return new Dimension(d.width + insetsW + iconWidth, d.height + insetsH); } else return new Dimension(d.width + insetsW + (d.height + insetsH) - 4, d.height + insetsH + 1); | public Dimension getMinimumSize(JComponent c) { MetalComboBoxButton b = (MetalComboBoxButton) arrowButton; Icon icon = b.getComboIcon(); Insets insets = b.getInsets(); Dimension d = getDisplaySize(); int insetsH = insets.top + insets.bottom; int insetsW = insets.left + insets.right; int iconWidth = icon.getIconWidth() + 6; return new Dimension(d.width + insetsW + iconWidth, d.height + insetsH); } |
public NetworkArgument(String name, String description) { super(name, description); | public NetworkArgument(String name, String description, boolean multi) { super(name, description, multi); | public NetworkArgument(String name, String description) { super(name, description); } |
return Utilities.getTabbedTextWidth(buffer, metrics, 0, this, | return Utilities.getTabbedTextWidth(buffer, metrics, tabBase, this, | private int getLineLength(int line) { Element lineEl = getElement().getElement(line); Segment buffer = getLineBuffer(); try { Document doc = getDocument(); doc.getText(lineEl.getStartOffset(), lineEl.getEndOffset() - lineEl.getStartOffset() - 1, buffer); } catch (BadLocationException ex) { AssertionError err = new AssertionError("Unexpected bad location"); err.initCause(ex); throw err; } return Utilities.getTabbedTextWidth(buffer, metrics, 0, this, lineEl.getStartOffset()); } |
Rectangle rect = a.getBounds(); | Rectangle rect = a instanceof Rectangle ? (Rectangle) a : a.getBounds(); | protected Rectangle lineToRect(Shape a, int line) { // Ensure metrics are up-to-date. updateMetrics(); Rectangle rect = a.getBounds(); int fontHeight = metrics.getHeight(); return new Rectangle(rect.x, rect.y + (line * fontHeight), rect.width, fontHeight); } |
int xoffset = Utilities.getTabbedTextWidth(segment, metrics, rect.x, | int xoffset = Utilities.getTabbedTextWidth(segment, metrics, tabBase, | public Shape modelToView(int position, Shape a, Position.Bias b) throws BadLocationException { // Ensure metrics are up-to-date. updateMetrics(); Document document = getDocument(); // Get rectangle of the line containing position. int lineIndex = getElement().getElementIndex(position); Rectangle rect = lineToRect(a, lineIndex); // Get the rectangle for position. Element line = getElement().getElement(lineIndex); int lineStart = line.getStartOffset(); Segment segment = getLineBuffer(); document.getText(lineStart, position - lineStart, segment); int xoffset = Utilities.getTabbedTextWidth(segment, metrics, rect.x, this, lineStart); // Calc the real rectangle. rect.x += xoffset; rect.width = 1; rect.height = metrics.getHeight(); return rect; } |
float tabSizePixels = getTabSize() * metrics.charWidth('m'); return (float) (Math.floor(x / tabSizePixels) + 1) * tabSizePixels; | float next = x; if (tabSize != 0) { int numTabs = (((int) x) - tabBase) / tabSize; next = tabBase + (numTabs + 1) * tabSize; } return next; | public float nextTabStop(float x, int tabStop) { float tabSizePixels = getTabSize() * metrics.charWidth('m'); return (float) (Math.floor(x / tabSizePixels) + 1) * tabSizePixels; } |
Rectangle rect = s.getBounds(); | Rectangle rect = s instanceof Rectangle ? (Rectangle) s : s.getBounds(); tabBase = rect.x; | public void paint(Graphics g, Shape s) { // Ensure metrics are up-to-date. updateMetrics(); JTextComponent textComponent = (JTextComponent) getContainer(); selectedColor = textComponent.getSelectedTextColor(); unselectedColor = textComponent.getForeground(); disabledColor = textComponent.getDisabledTextColor(); selectionStart = textComponent.getSelectionStart(); selectionEnd = textComponent.getSelectionEnd(); Rectangle rect = s.getBounds(); // FIXME: Text may be scrolled. Document document = textComponent.getDocument(); Element root = document.getDefaultRootElement(); int y = rect.y + metrics.getAscent(); int height = metrics.getHeight(); int count = root.getElementCount(); for (int i = 0; i < count; i++) { drawLine(i, g, rect.x, y); y += height; } } |
Element root = document.getDefaultRootElement(); int y = rect.y + metrics.getAscent(); | Element root = getElement(); | public void paint(Graphics g, Shape s) { // Ensure metrics are up-to-date. updateMetrics(); JTextComponent textComponent = (JTextComponent) getContainer(); selectedColor = textComponent.getSelectedTextColor(); unselectedColor = textComponent.getForeground(); disabledColor = textComponent.getDisabledTextColor(); selectionStart = textComponent.getSelectionStart(); selectionEnd = textComponent.getSelectionEnd(); Rectangle rect = s.getBounds(); // FIXME: Text may be scrolled. Document document = textComponent.getDocument(); Element root = document.getDefaultRootElement(); int y = rect.y + metrics.getAscent(); int height = metrics.getHeight(); int count = root.getElementCount(); for (int i = 0; i < count; i++) { drawLine(i, g, rect.x, y); y += height; } } |
for (int i = 0; i < count; i++) | Rectangle clip = g.getClipBounds(); SwingUtilities.computeIntersection(rect.x, rect.y, rect.width, rect.height, clip); int line0 = (clip.y - rect.y) / height; line0 = Math.max(0, Math.min(line0, count - 1)); int line1 = (clip.y + clip.height - rect.y) / height; line1 = Math.max(0, Math.min(line1, count - 1)); int y = rect.y + metrics.getAscent() + height * line0; for (int i = line0; i <= line1; i++) | public void paint(Graphics g, Shape s) { // Ensure metrics are up-to-date. updateMetrics(); JTextComponent textComponent = (JTextComponent) getContainer(); selectedColor = textComponent.getSelectedTextColor(); unselectedColor = textComponent.getForeground(); disabledColor = textComponent.getDisabledTextColor(); selectionStart = textComponent.getSelectionStart(); selectionEnd = textComponent.getSelectionEnd(); Rectangle rect = s.getBounds(); // FIXME: Text may be scrolled. Document document = textComponent.getDocument(); Element root = document.getDefaultRootElement(); int y = rect.y + metrics.getAscent(); int height = metrics.getHeight(); int count = root.getElementCount(); for (int i = 0; i < count; i++) { drawLine(i, g, rect.x, y); y += height; } } |
if (hl != null) { Element lineEl = root.getElement(i); if (i == count) hl.paintLayeredHighlights(g, lineEl.getStartOffset(), lineEl.getEndOffset(), s, textComponent, this); else hl.paintLayeredHighlights(g, lineEl.getStartOffset(), lineEl.getEndOffset() - 1, s, textComponent, this); } | public void paint(Graphics g, Shape s) { // Ensure metrics are up-to-date. updateMetrics(); JTextComponent textComponent = (JTextComponent) getContainer(); selectedColor = textComponent.getSelectedTextColor(); unselectedColor = textComponent.getForeground(); disabledColor = textComponent.getDisabledTextColor(); selectionStart = textComponent.getSelectionStart(); selectionEnd = textComponent.getSelectionEnd(); Rectangle rect = s.getBounds(); // FIXME: Text may be scrolled. Document document = textComponent.getDocument(); Element root = document.getDefaultRootElement(); int y = rect.y + metrics.getAscent(); int height = metrics.getHeight(); int count = root.getElementCount(); for (int i = 0; i < count; i++) { drawLine(i, g, rect.x, y); y += height; } } |
|
tabSize = getTabSize() * metrics.charWidth('m'); | protected void updateMetrics() { Component component = getContainer(); Font font = component.getFont(); if (this.font != font) { this.font = font; metrics = component.getFontMetrics(font); } } |
|
Rectangle rec = a.getBounds(); | Rectangle rec = a instanceof Rectangle ? (Rectangle) a : a.getBounds(); tabBase = rec.x; int pos; if ((int) y < rec.y) pos = getStartOffset(); else if ((int) y > rec.y + rec.height) pos = getEndOffset() - 1; else { | public int viewToModel(float x, float y, Shape a, Position.Bias[] b) { Rectangle rec = a.getBounds(); Document doc = getDocument(); Element root = doc.getDefaultRootElement(); // PlainView doesn't support line-wrapping so we can find out which // Element was clicked on just by the y-position. // Since the coordinates may be outside of the coordinate space // of the allocation area (e.g. user dragged mouse outside // the component) we have to limit the values. // This has the nice effect that the user can drag the // mouse above or below the component and it will still // react to the x values (e.g. when selecting). int lineClicked = Math.min(Math.max((int) (y - rec.y) / metrics.getHeight(), 0), root.getElementCount() - 1); Element line = root.getElement(lineClicked); Segment s = getLineBuffer(); int start = line.getStartOffset(); // We don't want the \n at the end of the line. int end = line.getEndOffset() - 1; try { doc.getText(start, end - start, s); } catch (BadLocationException ble) { AssertionError ae = new AssertionError("Unexpected bad location"); ae.initCause(ble); throw ae; } int pos = Utilities.getTabbedTextOffset(s, metrics, rec.x, (int)x, this, start); return Math.max (0, pos); } |
int lineClicked = Math.min(Math.max((int) (y - rec.y) / metrics.getHeight(), 0), root.getElementCount() - 1); Element line = root.getElement(lineClicked); Segment s = getLineBuffer(); int start = line.getStartOffset(); int end = line.getEndOffset() - 1; | int line = Math.abs(((int) y - rec.y) / metrics.getHeight()); if (line >= root.getElementCount()) pos = getEndOffset() - 1; else { Element lineEl = root.getElement(line); if (x < rec.x) pos = lineEl.getStartOffset(); else if (x > rec.x + rec.width) pos = lineEl.getEndOffset() - 1; else { | public int viewToModel(float x, float y, Shape a, Position.Bias[] b) { Rectangle rec = a.getBounds(); Document doc = getDocument(); Element root = doc.getDefaultRootElement(); // PlainView doesn't support line-wrapping so we can find out which // Element was clicked on just by the y-position. // Since the coordinates may be outside of the coordinate space // of the allocation area (e.g. user dragged mouse outside // the component) we have to limit the values. // This has the nice effect that the user can drag the // mouse above or below the component and it will still // react to the x values (e.g. when selecting). int lineClicked = Math.min(Math.max((int) (y - rec.y) / metrics.getHeight(), 0), root.getElementCount() - 1); Element line = root.getElement(lineClicked); Segment s = getLineBuffer(); int start = line.getStartOffset(); // We don't want the \n at the end of the line. int end = line.getEndOffset() - 1; try { doc.getText(start, end - start, s); } catch (BadLocationException ble) { AssertionError ae = new AssertionError("Unexpected bad location"); ae.initCause(ble); throw ae; } int pos = Utilities.getTabbedTextOffset(s, metrics, rec.x, (int)x, this, start); return Math.max (0, pos); } |
doc.getText(start, end - start, s); | int p0 = lineEl.getStartOffset(); int p1 = lineEl.getEndOffset(); Segment s = new Segment(); doc.getText(p0, p1 - p0, s); tabBase = rec.x; pos = p0 + Utilities.getTabbedTextOffset(s, metrics, tabBase, (int) x, this, p0); | public int viewToModel(float x, float y, Shape a, Position.Bias[] b) { Rectangle rec = a.getBounds(); Document doc = getDocument(); Element root = doc.getDefaultRootElement(); // PlainView doesn't support line-wrapping so we can find out which // Element was clicked on just by the y-position. // Since the coordinates may be outside of the coordinate space // of the allocation area (e.g. user dragged mouse outside // the component) we have to limit the values. // This has the nice effect that the user can drag the // mouse above or below the component and it will still // react to the x values (e.g. when selecting). int lineClicked = Math.min(Math.max((int) (y - rec.y) / metrics.getHeight(), 0), root.getElementCount() - 1); Element line = root.getElement(lineClicked); Segment s = getLineBuffer(); int start = line.getStartOffset(); // We don't want the \n at the end of the line. int end = line.getEndOffset() - 1; try { doc.getText(start, end - start, s); } catch (BadLocationException ble) { AssertionError ae = new AssertionError("Unexpected bad location"); ae.initCause(ble); throw ae; } int pos = Utilities.getTabbedTextOffset(s, metrics, rec.x, (int)x, this, start); return Math.max (0, pos); } |
catch (BadLocationException ble) | catch (BadLocationException ex) | public int viewToModel(float x, float y, Shape a, Position.Bias[] b) { Rectangle rec = a.getBounds(); Document doc = getDocument(); Element root = doc.getDefaultRootElement(); // PlainView doesn't support line-wrapping so we can find out which // Element was clicked on just by the y-position. // Since the coordinates may be outside of the coordinate space // of the allocation area (e.g. user dragged mouse outside // the component) we have to limit the values. // This has the nice effect that the user can drag the // mouse above or below the component and it will still // react to the x values (e.g. when selecting). int lineClicked = Math.min(Math.max((int) (y - rec.y) / metrics.getHeight(), 0), root.getElementCount() - 1); Element line = root.getElement(lineClicked); Segment s = getLineBuffer(); int start = line.getStartOffset(); // We don't want the \n at the end of the line. int end = line.getEndOffset() - 1; try { doc.getText(start, end - start, s); } catch (BadLocationException ble) { AssertionError ae = new AssertionError("Unexpected bad location"); ae.initCause(ble); throw ae; } int pos = Utilities.getTabbedTextOffset(s, metrics, rec.x, (int)x, this, start); return Math.max (0, pos); } |
AssertionError ae = new AssertionError("Unexpected bad location"); ae.initCause(ble); throw ae; | pos = -1; } | public int viewToModel(float x, float y, Shape a, Position.Bias[] b) { Rectangle rec = a.getBounds(); Document doc = getDocument(); Element root = doc.getDefaultRootElement(); // PlainView doesn't support line-wrapping so we can find out which // Element was clicked on just by the y-position. // Since the coordinates may be outside of the coordinate space // of the allocation area (e.g. user dragged mouse outside // the component) we have to limit the values. // This has the nice effect that the user can drag the // mouse above or below the component and it will still // react to the x values (e.g. when selecting). int lineClicked = Math.min(Math.max((int) (y - rec.y) / metrics.getHeight(), 0), root.getElementCount() - 1); Element line = root.getElement(lineClicked); Segment s = getLineBuffer(); int start = line.getStartOffset(); // We don't want the \n at the end of the line. int end = line.getEndOffset() - 1; try { doc.getText(start, end - start, s); } catch (BadLocationException ble) { AssertionError ae = new AssertionError("Unexpected bad location"); ae.initCause(ble); throw ae; } int pos = Utilities.getTabbedTextOffset(s, metrics, rec.x, (int)x, this, start); return Math.max (0, pos); } |
int pos = Utilities.getTabbedTextOffset(s, metrics, rec.x, (int)x, this, start); return Math.max (0, pos); | } } b[0] = Position.Bias.Forward; return pos; | public int viewToModel(float x, float y, Shape a, Position.Bias[] b) { Rectangle rec = a.getBounds(); Document doc = getDocument(); Element root = doc.getDefaultRootElement(); // PlainView doesn't support line-wrapping so we can find out which // Element was clicked on just by the y-position. // Since the coordinates may be outside of the coordinate space // of the allocation area (e.g. user dragged mouse outside // the component) we have to limit the values. // This has the nice effect that the user can drag the // mouse above or below the component and it will still // react to the x values (e.g. when selecting). int lineClicked = Math.min(Math.max((int) (y - rec.y) / metrics.getHeight(), 0), root.getElementCount() - 1); Element line = root.getElement(lineClicked); Segment s = getLineBuffer(); int start = line.getStartOffset(); // We don't want the \n at the end of the line. int end = line.getEndOffset() - 1; try { doc.getText(start, end - start, s); } catch (BadLocationException ble) { AssertionError ae = new AssertionError("Unexpected bad location"); ae.initCause(ble); throw ae; } int pos = Utilities.getTabbedTextOffset(s, metrics, rec.x, (int)x, this, start); return Math.max (0, pos); } |
public synchronized long[] allocNew(int nrClusters) throws IOException { | public synchronized long allocNew() throws IOException { | public synchronized long[] allocNew(int nrClusters) throws IOException { long rc[] = new long[nrClusters]; rc[0] = allocNew(); for (int i = 1; i < nrClusters; i++) { rc[i] = allocAppend(rc[i - 1]); } return rc; } |
long rc[] = new long[nrClusters]; | int i; int entryIndex = -1; for (i = lastFreeCluster; i < entries.length; i++) { if (isFreeCluster(entries[i])) { entryIndex=i; break; } } if(entryIndex<0){ for(i = 2; i < lastFreeCluster;i++){ if (isFreeCluster(entries[i])) { entryIndex=i; break; } } } if(entryIndex < 0){ throw new IOException("FAT Full (" + entries.length + ", " + i + ")"); } entries[entryIndex] = eofMarker; lastFreeCluster = entryIndex+1; this.dirty = true; | public synchronized long[] allocNew(int nrClusters) throws IOException { long rc[] = new long[nrClusters]; rc[0] = allocNew(); for (int i = 1; i < nrClusters; i++) { rc[i] = allocAppend(rc[i - 1]); } return rc; } |
rc[0] = allocNew(); for (int i = 1; i < nrClusters; i++) { rc[i] = allocAppend(rc[i - 1]); } return rc; | return entryIndex; | public synchronized long[] allocNew(int nrClusters) throws IOException { long rc[] = new long[nrClusters]; rc[0] = allocNew(); for (int i = 1; i < nrClusters; i++) { rc[i] = allocAppend(rc[i - 1]); } return rc; } |
session.grabFocus(); | public void addSessionView(String tabText,Session session) { sessionPane.addTab(tabText,focused,session); sessionPane.setForegroundAt(sessionPane.getSelectedIndex(),Color.black); sessionPane.setIconAt(sessionPane.getSelectedIndex(),unfocused); sessionPane.setSelectedIndex(sessionPane.getTabCount()-1); sessionPane.setForegroundAt(sessionPane.getSelectedIndex(),Color.blue); sessionPane.setIconAt(sessionPane.getSelectedIndex(),focused); session.addSessionListener(this); session.addSessionJumpListener(this); } |
|
sessionPane.getComponent(sessionPane.getSelectedIndex()).requestFocus(); | ((Session)sessionPane.getComponent(sessionPane.getSelectedIndex())).grabFocus(); | private void nextSession() { int index = sessionPane.getSelectedIndex(); sessionPane.setForegroundAt(index,Color.black); sessionPane.setIconAt(index,unfocused); if (index < sessionPane.getTabCount() - 1) { sessionPane.setSelectedIndex(++index); sessionPane.setForegroundAt(index,Color.blue); sessionPane.setIconAt(index,focused); } else { sessionPane.setSelectedIndex(0); sessionPane.setForegroundAt(0,Color.blue); sessionPane.setIconAt(0,focused); } sessionPane.getComponent(sessionPane.getSelectedIndex()).requestFocus(); } |
sessionPane.getComponent(sessionPane.getSelectedIndex()).requestFocus(); | ((Session)sessionPane.getComponent(sessionPane.getSelectedIndex())).grabFocus(); | private void prevSession() { int index = sessionPane.getSelectedIndex(); sessionPane.setForegroundAt(index,Color.black); sessionPane.setIconAt(index,unfocused); if (index == 0) { sessionPane.setSelectedIndex(sessionPane.getTabCount() - 1); sessionPane.setForegroundAt(sessionPane.getSelectedIndex(),Color.blue); sessionPane.setIconAt(sessionPane.getSelectedIndex(),focused); } else { sessionPane.setSelectedIndex(--index); sessionPane.setForegroundAt(index,Color.blue); sessionPane.setIconAt(index,focused); } sessionPane.getComponent(sessionPane.getSelectedIndex()).requestFocus(); } |
((Session)sessionPane.getComponentAt(index)).requestFocus(); | ((Session)sessionPane.getComponentAt(index)).grabFocus(); | public void removeSessionView(Session targetSession) { int index = sessionPane.indexOfComponent(targetSession); System.out.println("session found and closing down " + index); targetSession.removeSessionListener(this); targetSession.removeSessionJumpListener(this); int tabs = sessionPane.getTabCount(); sessionPane.remove(index); tabs--; if (index < tabs) { sessionPane.setSelectedIndex(index); sessionPane.setForegroundAt(index,Color.blue); sessionPane.setIconAt(index,focused); ((Session)sessionPane.getComponentAt(index)).requestFocus(); } else { if (tabs > 0) { sessionPane.setSelectedIndex(0); sessionPane.setForegroundAt(0,Color.blue); sessionPane.setIconAt(0,focused); ((Session)sessionPane.getComponentAt(0)).requestFocus(); } } } |
((Session)sessionPane.getComponentAt(0)).requestFocus(); | ((Session)sessionPane.getComponentAt(0)).grabFocus(); | public void removeSessionView(Session targetSession) { int index = sessionPane.indexOfComponent(targetSession); System.out.println("session found and closing down " + index); targetSession.removeSessionListener(this); targetSession.removeSessionJumpListener(this); int tabs = sessionPane.getTabCount(); sessionPane.remove(index); tabs--; if (index < tabs) { sessionPane.setSelectedIndex(index); sessionPane.setForegroundAt(index,Color.blue); sessionPane.setIconAt(index,focused); ((Session)sessionPane.getComponentAt(index)).requestFocus(); } else { if (tabs > 0) { sessionPane.setSelectedIndex(0); sessionPane.setForegroundAt(0,Color.blue); sessionPane.setIconAt(0,focused); ((Session)sessionPane.getComponentAt(0)).requestFocus(); } } } |
sg.requestFocus(); | sg.grabFocus(); | public void stateChanged(ChangeEvent e) { JTabbedPane p = (JTabbedPane)e.getSource(); p.setForegroundAt(selectedIndex,Color.black); p.setIconAt(selectedIndex,unfocused); Session sg = (Session)p.getComponentAt(selectedIndex); sg.setVisible(false); sg = (Session)p.getSelectedComponent(); if (sg == null) return; sg.setVisible(true); sg.requestFocus(); selectedIndex = p.getSelectedIndex(); p.setForegroundAt(selectedIndex,Color.blue); p.setIconAt(selectedIndex,focused); } |
public void drawLine(int lineIndex, Graphics g, int x, int y) | protected void drawLine(int lineIndex, Graphics g, int x, int y) | public void drawLine(int lineIndex, Graphics g, int x, int y) { try { metrics = g.getFontMetrics(); // FIXME: Selected text are not drawn yet. Element line = getDocument().getDefaultRootElement().getElement(lineIndex); drawUnselectedText(g, x, y, line.getStartOffset(), line.getEndOffset()); //drawSelectedText(g, , , , ); } catch (BadLocationException e) { // This should never happen. } } |
public int getTabSize() | protected int getTabSize() | public int getTabSize() { return 8; } |
public Number decrementDimension() { Number dim = getDimension(); if (dim == null) { Log.error(" in DataCube, incrementDimentsion, the dimension is undef"); return null; | public int decrementDimension() { if (dimension == 0) { Log.error(" in DataCube, incrementDimentsion, the dimension is 0"); return 0; | public Number decrementDimension() { Number dim = getDimension(); if (dim == null) { Log.error(" in DataCube, incrementDimentsion, the dimension is undef"); return null; } else return setDimension(new Integer(dim.intValue()-1));} |
return setDimension(new Integer(dim.intValue()-1)); | return dimension--; | public Number decrementDimension() { Number dim = getDimension(); if (dim == null) { Log.error(" in DataCube, incrementDimentsion, the dimension is undef"); return null; } else return setDimension(new Integer(dim.intValue()-1));} |
public Number getDimension() { return (Number) ((XMLAttribute) attribHash.get("dimension")).getAttribValue(); | public int getDimension() { return dimension; | public Number getDimension() { return (Number) ((XMLAttribute) attribHash.get("dimension")).getAttribValue();} |
for(int i = 0; i < axes.size(); i++) { | int stop = axes.size(); for(int i = 0; i < stop; i++) { | public int[] getMaxDataIndex() { List axes = parentArray.getAxisList(); int[] maxDataIndices = new int[axes.size()]; for(int i = 0; i < axes.size(); i++) { maxDataIndices[i]=((Axis) axes.get(i)).getLength(); } //update the *maxDimensionIndex* attribute attribHash.put("maxDimensionIndex", maxDataIndices); return maxDataIndices;} |
attribHash.put("maxDimensionIndex", maxDataIndices); | public int[] getMaxDataIndex() { List axes = parentArray.getAxisList(); int[] maxDataIndices = new int[axes.size()]; for(int i = 0; i < axes.size(); i++) { maxDataIndices[i]=((Axis) axes.get(i)).getLength(); } //update the *maxDimensionIndex* attribute attribHash.put("maxDimensionIndex", maxDataIndices); return maxDataIndices;} |
|
public Number incrementDimension(Axis axis) { Number dim = getDimension(); if (dim.intValue()==0) { | public int incrementDimension(Axis axis) { if (dimension==0) { | public Number incrementDimension(Axis axis) { Number dim = getDimension(); if (dim.intValue()==0) { //add first dimension data.add(null); data.add(null); return setDimension(new Integer(1)); } if (dim.intValue() == 1) { //add second dimension int length = axis.getLength(); for (int i = 2; i < 2*length; i++) data.add(i,null); } else{ //dimension >= 2 List oldData = data; int length = axis.getLength(); data = Collections.synchronizedList(new ArrayList(length)); data.add(0,oldData); for (int i = 1; i < length; i++) data.add(i,null); } return setDimension(new Integer(dim.intValue()+1));} |
return setDimension(new Integer(1)); | return dimension++; | public Number incrementDimension(Axis axis) { Number dim = getDimension(); if (dim.intValue()==0) { //add first dimension data.add(null); data.add(null); return setDimension(new Integer(1)); } if (dim.intValue() == 1) { //add second dimension int length = axis.getLength(); for (int i = 2; i < 2*length; i++) data.add(i,null); } else{ //dimension >= 2 List oldData = data; int length = axis.getLength(); data = Collections.synchronizedList(new ArrayList(length)); data.add(0,oldData); for (int i = 1; i < length; i++) data.add(i,null); } return setDimension(new Integer(dim.intValue()+1));} |
if (dim.intValue() == 1) { | if (dimension == 1) { | public Number incrementDimension(Axis axis) { Number dim = getDimension(); if (dim.intValue()==0) { //add first dimension data.add(null); data.add(null); return setDimension(new Integer(1)); } if (dim.intValue() == 1) { //add second dimension int length = axis.getLength(); for (int i = 2; i < 2*length; i++) data.add(i,null); } else{ //dimension >= 2 List oldData = data; int length = axis.getLength(); data = Collections.synchronizedList(new ArrayList(length)); data.add(0,oldData); for (int i = 1; i < length; i++) data.add(i,null); } return setDimension(new Integer(dim.intValue()+1));} |
return setDimension(new Integer(dim.intValue()+1)); | return dimension++; | public Number incrementDimension(Axis axis) { Number dim = getDimension(); if (dim.intValue()==0) { //add first dimension data.add(null); data.add(null); return setDimension(new Integer(1)); } if (dim.intValue() == 1) { //add second dimension int length = axis.getLength(); for (int i = 2; i < 2*length; i++) data.add(i,null); } else{ //dimension >= 2 List oldData = data; int length = axis.getLength(); data = Collections.synchronizedList(new ArrayList(length)); data.add(0,oldData); for (int i = 1; i < length; i++) data.add(i,null); } return setDimension(new Integer(dim.intValue()+1));} |
attribOrder.add(0,"maxDimensionIndex"); attribOrder.add(0,"dimension"); | private void init() { classXDFNodeName = "data"; // order matters! these are in *reverse* order of their // occurence in the XDF DTD attribOrder.add(0,"maxDimensionIndex"); attribOrder.add(0,"dimension"); attribOrder.add(0,"compression"); attribOrder.add(0,"checksum"); attribOrder.add(0,"href"); //set up the attribute hashtable key with the default initial value attribHash.put("maxDimensionIndex", new XMLAttribute(Collections.synchronizedList(new ArrayList()), Constants.LIST_TYPE)); attribHash.put("dimension", new XMLAttribute(new Integer(0), Constants.NUMBER_TYPE)); attribHash.put("compression", new XMLAttribute(null, Constants.STRING_TYPE)); //double check init value attribHash.put("checksum", new XMLAttribute(new Double(0), Constants.NUMBER_TYPE)); //double check attribHash.put("href", new XMLAttribute(null, Constants.STRING_TYPE)); }; |
|
attribHash.put("maxDimensionIndex", new XMLAttribute(Collections.synchronizedList(new ArrayList()), Constants.LIST_TYPE)); attribHash.put("dimension", new XMLAttribute(new Integer(0), Constants.NUMBER_TYPE)); | private void init() { classXDFNodeName = "data"; // order matters! these are in *reverse* order of their // occurence in the XDF DTD attribOrder.add(0,"maxDimensionIndex"); attribOrder.add(0,"dimension"); attribOrder.add(0,"compression"); attribOrder.add(0,"checksum"); attribOrder.add(0,"href"); //set up the attribute hashtable key with the default initial value attribHash.put("maxDimensionIndex", new XMLAttribute(Collections.synchronizedList(new ArrayList()), Constants.LIST_TYPE)); attribHash.put("dimension", new XMLAttribute(new Integer(0), Constants.NUMBER_TYPE)); attribHash.put("compression", new XMLAttribute(null, Constants.STRING_TYPE)); //double check init value attribHash.put("checksum", new XMLAttribute(new Double(0), Constants.NUMBER_TYPE)); //double check attribHash.put("href", new XMLAttribute(null, Constants.STRING_TYPE)); }; |
|
attribHash.put("checksum", new XMLAttribute(new Double(0), Constants.NUMBER_TYPE)); | attribHash.put("encoding", new XMLAttribute(null, Constants.STRING_TYPE)); attribHash.put("checksum", new XMLAttribute(null, Constants.NUMBER_TYPE)); | private void init() { classXDFNodeName = "data"; // order matters! these are in *reverse* order of their // occurence in the XDF DTD attribOrder.add(0,"maxDimensionIndex"); attribOrder.add(0,"dimension"); attribOrder.add(0,"compression"); attribOrder.add(0,"checksum"); attribOrder.add(0,"href"); //set up the attribute hashtable key with the default initial value attribHash.put("maxDimensionIndex", new XMLAttribute(Collections.synchronizedList(new ArrayList()), Constants.LIST_TYPE)); attribHash.put("dimension", new XMLAttribute(new Integer(0), Constants.NUMBER_TYPE)); attribHash.put("compression", new XMLAttribute(null, Constants.STRING_TYPE)); //double check init value attribHash.put("checksum", new XMLAttribute(new Double(0), Constants.NUMBER_TYPE)); //double check attribHash.put("href", new XMLAttribute(null, Constants.STRING_TYPE)); }; |
if (!Utility.isValidDataCompression(strCompression)) return null; | public String setCompression (String strCompression) { return (String) ((XMLAttribute) attribHash.get("compression")).setAttribValue(strCompression); } |
|
String checksum = getChecksum().toString(); | Number checksum = getChecksum(); | public void toXDFOutputStream ( OutputStream outputstream, Hashtable XMLDeclAttribs, String strIndent ) { boolean niceOutput = sPrettyXDFOutput; String indent = ""; indent = indent + strIndent; String nodeName = getClassXDFNodeName(); //open node if (niceOutput) writeOut(outputstream, indent); writeOut(outputstream, "<" + nodeName ); String href = getHref(); if (href !=null) writeOut(outputstream, " href = \"" + href + "\""); String checksum = getChecksum().toString(); if (checksum !=null) writeOut(outputstream, " checksum = \"" + checksum + "\""); writeOut(outputstream, ">"); //end of opening code //write out just the data XMLDataIOStyle readObj = parentArray.getXMLDataIOStyle(); if (href !=null) { //write out to another file, double check } currentLocator = parentArray.createLocator(); if (readObj.getClass().getName().endsWith("TaggedXMLDataIOStyle")) { String[] tagOrder = ((TaggedXMLDataIOStyle)readObj).getAxisTags(); int stop = tagOrder.length; String[] tags = new String[stop]; for (int i = stop-1; i >= 0 ; i--) { tags[stop-i-1] = tagOrder[i]; // System.out.println(tagOrder.get(i)); } if (!parentArray.hasFieldAxis()) { //even with FieldAxis, it is ok, double check int[] axes = getMaxDataIndex(); stop =axes.length; int[] axisLength = new int[stop]; for (int i = 0; i < stop; i++) { axisLength[i] =axes[stop - 1 - i]; } writeTaggedData(outputstream, currentLocator, indent, axisLength, tags, 0); } } //done dealwith with TaggedXMLDataIOSytle //close the tagged data section if (niceOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "</" + nodeName + ">"); if (niceOutput) writeOut(outputstream, Constants.NEW_LINE); } |
writeOut(outputstream, " checksum = \"" + checksum + "\""); | writeOut(outputstream, " checksum = \"" + checksum.toString() + "\""); | public void toXDFOutputStream ( OutputStream outputstream, Hashtable XMLDeclAttribs, String strIndent ) { boolean niceOutput = sPrettyXDFOutput; String indent = ""; indent = indent + strIndent; String nodeName = getClassXDFNodeName(); //open node if (niceOutput) writeOut(outputstream, indent); writeOut(outputstream, "<" + nodeName ); String href = getHref(); if (href !=null) writeOut(outputstream, " href = \"" + href + "\""); String checksum = getChecksum().toString(); if (checksum !=null) writeOut(outputstream, " checksum = \"" + checksum + "\""); writeOut(outputstream, ">"); //end of opening code //write out just the data XMLDataIOStyle readObj = parentArray.getXMLDataIOStyle(); if (href !=null) { //write out to another file, double check } currentLocator = parentArray.createLocator(); if (readObj.getClass().getName().endsWith("TaggedXMLDataIOStyle")) { String[] tagOrder = ((TaggedXMLDataIOStyle)readObj).getAxisTags(); int stop = tagOrder.length; String[] tags = new String[stop]; for (int i = stop-1; i >= 0 ; i--) { tags[stop-i-1] = tagOrder[i]; // System.out.println(tagOrder.get(i)); } if (!parentArray.hasFieldAxis()) { //even with FieldAxis, it is ok, double check int[] axes = getMaxDataIndex(); stop =axes.length; int[] axisLength = new int[stop]; for (int i = 0; i < stop; i++) { axisLength[i] =axes[stop - 1 - i]; } writeTaggedData(outputstream, currentLocator, indent, axisLength, tags, 0); } } //done dealwith with TaggedXMLDataIOSytle //close the tagged data section if (niceOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "</" + nodeName + ">"); if (niceOutput) writeOut(outputstream, Constants.NEW_LINE); } |
public BasicStroke() | public BasicStroke(float width, int cap, int join, float miterlimit, float[] dash, float dashPhase) | public BasicStroke() { this(1, CAP_SQUARE, JOIN_MITER, 10, null, 0); } |
this(1, CAP_SQUARE, JOIN_MITER, 10, null, 0); | if (width < 0.0f ) throw new IllegalArgumentException("width " + width + " < 0"); else if (cap < CAP_BUTT || cap > CAP_SQUARE) throw new IllegalArgumentException("cap " + cap + " out of range [" + CAP_BUTT + ".." + CAP_SQUARE + "]"); else if (miterlimit < 1.0f && join == JOIN_MITER) throw new IllegalArgumentException("miterlimit " + miterlimit + " < 1.0f while join == JOIN_MITER"); else if (join < JOIN_MITER || join > JOIN_BEVEL) throw new IllegalArgumentException("join " + join + " out of range [" + JOIN_MITER + ".." + JOIN_BEVEL + "]"); else if (dashPhase < 0.0f && dash != null) throw new IllegalArgumentException("dashPhase " + dashPhase + " < 0.0f while dash != null"); else if (dash != null) if (dash.length == 0) throw new IllegalArgumentException("dash.length is 0"); else { boolean allZero = true; for ( int i = 0; i < dash.length; ++i) { if (dash[i] != 0.0f) { allZero = false; break; } } if (allZero) throw new IllegalArgumentException("all dashes are 0.0f"); } this.width = width; this.cap = cap; this.join = join; limit = miterlimit; this.dash = dash == null ? null : (float[]) dash.clone(); phase = dashPhase; | public BasicStroke() { this(1, CAP_SQUARE, JOIN_MITER, 10, null, 0); } |
double[] p0 = start.last.last(); double[] p1 = new double[]{start.last.P2.getX(), start.last.P2.getY()}; double[] p2 = new double[]{segments[0].P1.getX(), segments[0].P1.getY()}; double[] p3 = segments[0].first(); Point2D p; double det = (p1[0] - p0[0])*(p3[1] - p2[1]) - (p3[0] - p2[0])*(p1[1] - p0[1]); if( det > 0 ) { p = lineIntersection(p0[0],p0[1],p1[0],p1[1],p2[0],p2[1],p3[0],p3[1], false); if( p == null ) { start.add(new LineSegment(start.last.P2, segments[0].P1)); p = new Point2D.Double((segments[0].P1.getX()+ start.last.P2.getX())/2.0, (segments[0].P1.getY()+ start.last.P2.getY())/2.0); } else segments[0].P1 = start.last.P2 = p; start.add( segments[0] ); joinSegments(end, segments[1], p); } else { p0 = end.last.last(); p1 = new double[]{end.last.P2.getX(), end.last.P2.getY()}; p2 = new double[]{segments[1].P1.getX(), segments[1].P1.getY()}; p3 = segments[1].first(); p = lineIntersection(p0[0],p0[1],p1[0],p1[1], p2[0],p2[1],p3[0],p3[1], false); if( p == null ) { end.add(new LineSegment(end.last.P2, segments[1].P1)); p = new Point2D.Double((segments[1].P1.getX()+ end.last.P2.getX())/2.0, (segments[1].P1.getY()+ end.last.P2.getY())/2.0); } else segments[1].P1 = end.last.P2 = p; end.add( segments[1] ); joinSegments(start, segments[0], p); } | joinSegments(segments); start.add(segments[0]); end.add(segments[1]); | private void addSegments(Segment[] segments) { double[] p0 = start.last.last(); double[] p1 = new double[]{start.last.P2.getX(), start.last.P2.getY()}; double[] p2 = new double[]{segments[0].P1.getX(), segments[0].P1.getY()}; double[] p3 = segments[0].first(); Point2D p; double det = (p1[0] - p0[0])*(p3[1] - p2[1]) - (p3[0] - p2[0])*(p1[1] - p0[1]); if( det > 0 ) { // start and segment[0] form the 'inner' part of a join, // connect the overlapping segments p = lineIntersection(p0[0],p0[1],p1[0],p1[1],p2[0],p2[1],p3[0],p3[1], false); if( p == null ) { // Dodgy. start.add(new LineSegment(start.last.P2, segments[0].P1)); p = new Point2D.Double((segments[0].P1.getX()+ start.last.P2.getX())/2.0, (segments[0].P1.getY()+ start.last.P2.getY())/2.0); } else segments[0].P1 = start.last.P2 = p; start.add( segments[0] ); joinSegments(end, segments[1], p); } else { // end and segment[1] form the 'inner' part p0 = end.last.last(); p1 = new double[]{end.last.P2.getX(), end.last.P2.getY()}; p2 = new double[]{segments[1].P1.getX(), segments[1].P1.getY()}; p3 = segments[1].first(); p = lineIntersection(p0[0],p0[1],p1[0],p1[1], p2[0],p2[1],p3[0],p3[1], false); if( p == null ) { // Dodgy. end.add(new LineSegment(end.last.P2, segments[1].P1)); p = new Point2D.Double((segments[1].P1.getX()+ end.last.P2.getX())/2.0, (segments[1].P1.getY()+ end.last.P2.getY())/2.0); } else segments[1].P1 = end.last.P2 = p; end.add( segments[1] ); joinSegments(start, segments[0], p); } } |
p0 = a.last.last(); | p0 = a.last.cp2(); | private void capEnd(Segment a, Segment b) { double[] p0, p1; double dx, dy, l; Point2D c1,c2; switch( cap ) { case CAP_BUTT: a.add(new LineSegment(a.last.P2, b.P1)); break; case CAP_SQUARE: p0 = a.last.last(); p1 = new double[]{a.last.P2.getX(), a.last.P2.getY()}; dx = p1[0] - p0[0]; dy = p1[1] - p0[1]; l = Math.sqrt(dx * dx + dy * dy); dx = 0.5*width*dx/l; dy = 0.5*width*dy/l; c1 = new Point2D.Double(p1[0] + dx, p1[1] + dy); c2 = new Point2D.Double(b.P1.getX() + dx, b.P1.getY() + dy); a.add(new LineSegment(a.last.P2, c1)); a.add(new LineSegment(c1, c2)); a.add(new LineSegment(c2, b.P1)); break; case CAP_ROUND: p0 = a.last.last(); p1 = new double[]{a.last.P2.getX(), a.last.P2.getY()}; dx = p1[0] - p0[0]; dy = p1[1] - p0[1]; l = Math.sqrt(dx * dx + dy * dy); dx = (2.0/3.0)*width*dx/l; dy = (2.0/3.0)*width*dy/l; c1 = new Point2D.Double(p1[0] + dx, p1[1] + dy); c2 = new Point2D.Double(b.P1.getX() + dx, b.P1.getY() + dy); a.add(new CubicSegment(a.last.P2, c1, c2, b.P1)); break; } a.add(b); } |
PathIterator pi = s.getPathIterator( new AffineTransform() ); | PathIterator pi = s.getPathIterator(null); | public Shape createStrokedShape(Shape s) { PathIterator pi = s.getPathIterator( new AffineTransform() ); if( dash == null ) return solidStroke( pi ); return dashedStroke( pi ); } |
GeneralPath out = new GeneralPath(); return out; | FlatteningPathIterator flat = new FlatteningPathIterator(pi, Math.sqrt(width / 3)); double[] coords = new double[2]; double x, y, x0, y0; x = x0 = y = y0 = 0; boolean pathOpen = false; boolean dashOn = true; boolean offsetting = (phase != 0); double distance = 0; int dashIndex = 0; GeneralPath output = new GeneralPath(); Segment[] p; while (! flat.isDone()) { switch (flat.currentSegment(coords)) { case PathIterator.SEG_MOVETO: x0 = x = coords[0]; y0 = y = coords[1]; if (pathOpen) { capEnds(); convertPath(output, start); start = end = null; pathOpen = false; } break; case PathIterator.SEG_LINETO: boolean segmentConsumed = false; while (! segmentConsumed) { double segLength = Math.sqrt((x - coords[0]) * (x - coords[0]) + (y - coords[1]) * (y - coords[1])); boolean spanBoundary = true; double[] segmentEnd = null; if ((offsetting && distance + segLength <= phase) || distance + segLength <= dash[dashIndex]) { spanBoundary = false; } else { segmentEnd = (double[]) coords.clone(); double reqLength; if (offsetting) reqLength = phase - distance; else reqLength = dash[dashIndex] - distance; coords[0] = x + ((coords[0] - x) * reqLength / segLength); coords[1] = y + ((coords[1] - y) * reqLength / segLength); } if (offsetting || ! dashOn) { x0 = x = coords[0]; y0 = y = coords[1]; if (pathOpen) { capEnds(); convertPath(output, start); start = end = null; pathOpen = false; } } else { p = (new LineSegment(x, y, coords[0], coords[1])).getDisplacedSegments(width / 2.0); if (! pathOpen) { start = p[0]; end = p[1]; pathOpen = true; } else addSegments(p); x = coords[0]; y = coords[1]; } if (! spanBoundary) { distance += segLength; segmentConsumed = true; } else { if (offsetting) offsetting = false; dashOn = ! dashOn; distance = 0; coords = segmentEnd; if (dashIndex + 1 == dash.length) dashIndex = 0; else dashIndex++; } } break; } flat.next(); } if (pathOpen) { capEnds(); convertPath(output, start); } return output; | private Shape dashedStroke(PathIterator pi) { GeneralPath out = new GeneralPath(); return out; } |
private void joinSegments(Segment a, Segment b, Point2D insideP) | private void joinSegments(Segment[] segments) | private void joinSegments(Segment a, Segment b, Point2D insideP) { double[] p0, p1; double dx, dy, l; Point2D c1,c2; switch( join ) { case JOIN_MITER: p0 = a.last.last(); p1 = new double[]{a.last.P2.getX(), a.last.P2.getY()}; double[] p2 = new double[]{b.P1.getX(), b.P1.getY()}; double[] p3 = b.first(); Point2D p = lineIntersection(p0[0],p0[1],p1[0],p1[1],p2[0],p2[1],p3[0],p3[1], true); if( p == null || insideP == null ) a.add(new LineSegment(a.last.P2, b.P1)); else if((p.distance(insideP)/width) < limit) { a.add(new LineSegment(a.last.P2, p)); a.add(new LineSegment(p, b.P1)); } else { // outside miter limit, do a bevel join. a.add(new LineSegment(a.last.P2, b.P1)); } break; case JOIN_ROUND: p0 = a.last.last(); p1 = new double[]{a.last.P2.getX(), a.last.P2.getY()}; dx = p1[0] - p0[0]; dy = p1[1] - p0[1]; l = Math.sqrt(dx * dx + dy * dy); dx = 0.5*width*dx/l; dy = 0.5*width*dy/l; c1 = new Point2D.Double(p1[0] + dx, p1[1] + dy); p0 = new double[]{b.P1.getX(), b.P1.getY()}; p1 = b.first(); dx = p0[0] - p1[0]; // backwards direction. dy = p0[1] - p1[1]; l = Math.sqrt(dx * dx + dy * dy); dx = 0.5*width*dx/l; dy = 0.5*width*dy/l; c2 = new Point2D.Double(p0[0] + dx, p0[1] + dy); a.add(new CubicSegment(a.last.P2, c1, c2, b.P1)); break; case JOIN_BEVEL: a.add(new LineSegment(a.last.P2, b.P1)); break; } a.add(b); } |
double[] p0, p1; double dx, dy, l; Point2D c1,c2; | double[] p0 = start.last.cp2(); double[] p1 = new double[]{start.last.P2.getX(), start.last.P2.getY()}; double[] p2 = new double[]{segments[0].first.P1.getX(), segments[0].first.P1.getY()}; double[] p3 = segments[0].cp1(); Point2D p; | private void joinSegments(Segment a, Segment b, Point2D insideP) { double[] p0, p1; double dx, dy, l; Point2D c1,c2; switch( join ) { case JOIN_MITER: p0 = a.last.last(); p1 = new double[]{a.last.P2.getX(), a.last.P2.getY()}; double[] p2 = new double[]{b.P1.getX(), b.P1.getY()}; double[] p3 = b.first(); Point2D p = lineIntersection(p0[0],p0[1],p1[0],p1[1],p2[0],p2[1],p3[0],p3[1], true); if( p == null || insideP == null ) a.add(new LineSegment(a.last.P2, b.P1)); else if((p.distance(insideP)/width) < limit) { a.add(new LineSegment(a.last.P2, p)); a.add(new LineSegment(p, b.P1)); } else { // outside miter limit, do a bevel join. a.add(new LineSegment(a.last.P2, b.P1)); } break; case JOIN_ROUND: p0 = a.last.last(); p1 = new double[]{a.last.P2.getX(), a.last.P2.getY()}; dx = p1[0] - p0[0]; dy = p1[1] - p0[1]; l = Math.sqrt(dx * dx + dy * dy); dx = 0.5*width*dx/l; dy = 0.5*width*dy/l; c1 = new Point2D.Double(p1[0] + dx, p1[1] + dy); p0 = new double[]{b.P1.getX(), b.P1.getY()}; p1 = b.first(); dx = p0[0] - p1[0]; // backwards direction. dy = p0[1] - p1[1]; l = Math.sqrt(dx * dx + dy * dy); dx = 0.5*width*dx/l; dy = 0.5*width*dy/l; c2 = new Point2D.Double(p0[0] + dx, p0[1] + dy); a.add(new CubicSegment(a.last.P2, c1, c2, b.P1)); break; case JOIN_BEVEL: a.add(new LineSegment(a.last.P2, b.P1)); break; } a.add(b); } |
switch( join ) | p = lineIntersection(p0[0],p0[1],p1[0],p1[1], p2[0],p2[1],p3[0],p3[1], false); double det = (p1[0] - p0[0])*(p3[1] - p2[1]) - (p3[0] - p2[0])*(p1[1] - p0[1]); if( det > 0 ) | private void joinSegments(Segment a, Segment b, Point2D insideP) { double[] p0, p1; double dx, dy, l; Point2D c1,c2; switch( join ) { case JOIN_MITER: p0 = a.last.last(); p1 = new double[]{a.last.P2.getX(), a.last.P2.getY()}; double[] p2 = new double[]{b.P1.getX(), b.P1.getY()}; double[] p3 = b.first(); Point2D p = lineIntersection(p0[0],p0[1],p1[0],p1[1],p2[0],p2[1],p3[0],p3[1], true); if( p == null || insideP == null ) a.add(new LineSegment(a.last.P2, b.P1)); else if((p.distance(insideP)/width) < limit) { a.add(new LineSegment(a.last.P2, p)); a.add(new LineSegment(p, b.P1)); } else { // outside miter limit, do a bevel join. a.add(new LineSegment(a.last.P2, b.P1)); } break; case JOIN_ROUND: p0 = a.last.last(); p1 = new double[]{a.last.P2.getX(), a.last.P2.getY()}; dx = p1[0] - p0[0]; dy = p1[1] - p0[1]; l = Math.sqrt(dx * dx + dy * dy); dx = 0.5*width*dx/l; dy = 0.5*width*dy/l; c1 = new Point2D.Double(p1[0] + dx, p1[1] + dy); p0 = new double[]{b.P1.getX(), b.P1.getY()}; p1 = b.first(); dx = p0[0] - p1[0]; // backwards direction. dy = p0[1] - p1[1]; l = Math.sqrt(dx * dx + dy * dy); dx = 0.5*width*dx/l; dy = 0.5*width*dy/l; c2 = new Point2D.Double(p0[0] + dx, p0[1] + dy); a.add(new CubicSegment(a.last.P2, c1, c2, b.P1)); break; case JOIN_BEVEL: a.add(new LineSegment(a.last.P2, b.P1)); break; } a.add(b); } |
case JOIN_MITER: p0 = a.last.last(); p1 = new double[]{a.last.P2.getX(), a.last.P2.getY()}; double[] p2 = new double[]{b.P1.getX(), b.P1.getY()}; double[] p3 = b.first(); Point2D p = lineIntersection(p0[0],p0[1],p1[0],p1[1],p2[0],p2[1],p3[0],p3[1], true); if( p == null || insideP == null ) a.add(new LineSegment(a.last.P2, b.P1)); else if((p.distance(insideP)/width) < limit) { a.add(new LineSegment(a.last.P2, p)); a.add(new LineSegment(p, b.P1)); } else { a.add(new LineSegment(a.last.P2, b.P1)); } break; case JOIN_ROUND: p0 = a.last.last(); p1 = new double[]{a.last.P2.getX(), a.last.P2.getY()}; dx = p1[0] - p0[0]; dy = p1[1] - p0[1]; l = Math.sqrt(dx * dx + dy * dy); dx = 0.5*width*dx/l; dy = 0.5*width*dy/l; c1 = new Point2D.Double(p1[0] + dx, p1[1] + dy); p0 = new double[]{b.P1.getX(), b.P1.getY()}; p1 = b.first(); dx = p0[0] - p1[0]; dy = p0[1] - p1[1]; l = Math.sqrt(dx * dx + dy * dy); dx = 0.5*width*dx/l; dy = 0.5*width*dy/l; c2 = new Point2D.Double(p0[0] + dx, p0[1] + dy); a.add(new CubicSegment(a.last.P2, c1, c2, b.P1)); break; case JOIN_BEVEL: a.add(new LineSegment(a.last.P2, b.P1)); break; | joinInnerSegments(start, segments[0], p); joinOuterSegments(end, segments[1], p); | private void joinSegments(Segment a, Segment b, Point2D insideP) { double[] p0, p1; double dx, dy, l; Point2D c1,c2; switch( join ) { case JOIN_MITER: p0 = a.last.last(); p1 = new double[]{a.last.P2.getX(), a.last.P2.getY()}; double[] p2 = new double[]{b.P1.getX(), b.P1.getY()}; double[] p3 = b.first(); Point2D p = lineIntersection(p0[0],p0[1],p1[0],p1[1],p2[0],p2[1],p3[0],p3[1], true); if( p == null || insideP == null ) a.add(new LineSegment(a.last.P2, b.P1)); else if((p.distance(insideP)/width) < limit) { a.add(new LineSegment(a.last.P2, p)); a.add(new LineSegment(p, b.P1)); } else { // outside miter limit, do a bevel join. a.add(new LineSegment(a.last.P2, b.P1)); } break; case JOIN_ROUND: p0 = a.last.last(); p1 = new double[]{a.last.P2.getX(), a.last.P2.getY()}; dx = p1[0] - p0[0]; dy = p1[1] - p0[1]; l = Math.sqrt(dx * dx + dy * dy); dx = 0.5*width*dx/l; dy = 0.5*width*dy/l; c1 = new Point2D.Double(p1[0] + dx, p1[1] + dy); p0 = new double[]{b.P1.getX(), b.P1.getY()}; p1 = b.first(); dx = p0[0] - p1[0]; // backwards direction. dy = p0[1] - p1[1]; l = Math.sqrt(dx * dx + dy * dy); dx = 0.5*width*dx/l; dy = 0.5*width*dy/l; c2 = new Point2D.Double(p0[0] + dx, p0[1] + dy); a.add(new CubicSegment(a.last.P2, c1, c2, b.P1)); break; case JOIN_BEVEL: a.add(new LineSegment(a.last.P2, b.P1)); break; } a.add(b); } |
a.add(b); | else { joinInnerSegments(end, segments[1], p); joinOuterSegments(start, segments[0], p); } | private void joinSegments(Segment a, Segment b, Point2D insideP) { double[] p0, p1; double dx, dy, l; Point2D c1,c2; switch( join ) { case JOIN_MITER: p0 = a.last.last(); p1 = new double[]{a.last.P2.getX(), a.last.P2.getY()}; double[] p2 = new double[]{b.P1.getX(), b.P1.getY()}; double[] p3 = b.first(); Point2D p = lineIntersection(p0[0],p0[1],p1[0],p1[1],p2[0],p2[1],p3[0],p3[1], true); if( p == null || insideP == null ) a.add(new LineSegment(a.last.P2, b.P1)); else if((p.distance(insideP)/width) < limit) { a.add(new LineSegment(a.last.P2, p)); a.add(new LineSegment(p, b.P1)); } else { // outside miter limit, do a bevel join. a.add(new LineSegment(a.last.P2, b.P1)); } break; case JOIN_ROUND: p0 = a.last.last(); p1 = new double[]{a.last.P2.getX(), a.last.P2.getY()}; dx = p1[0] - p0[0]; dy = p1[1] - p0[1]; l = Math.sqrt(dx * dx + dy * dy); dx = 0.5*width*dx/l; dy = 0.5*width*dy/l; c1 = new Point2D.Double(p1[0] + dx, p1[1] + dy); p0 = new double[]{b.P1.getX(), b.P1.getY()}; p1 = b.first(); dx = p0[0] - p1[0]; // backwards direction. dy = p0[1] - p1[1]; l = Math.sqrt(dx * dx + dy * dy); dx = 0.5*width*dx/l; dy = 0.5*width*dy/l; c2 = new Point2D.Double(p0[0] + dx, p0[1] + dy); a.add(new CubicSegment(a.last.P2, c1, c2, b.P1)); break; case JOIN_BEVEL: a.add(new LineSegment(a.last.P2, b.P1)); break; } a.add(b); } |
x = coords[0]; y = coords[1]; | x = coords[2]; y = coords[3]; | private Shape solidStroke(PathIterator pi) { double[] coords = new double[6]; double x, y, x0, y0; boolean pathOpen = false; GeneralPath output = new GeneralPath( ); Segment[] p; x = x0 = y = y0 = 0; while( !pi.isDone() ) { switch( pi.currentSegment(coords) ) { case PathIterator.SEG_MOVETO: x0 = x = coords[0]; y0 = y = coords[1]; if( pathOpen ) { capEnds(); convertPath(output, start); start = end = null; pathOpen = false; } break; case PathIterator.SEG_LINETO: p = (new LineSegment(x, y, coords[0], coords[1])). getDisplacedSegments(width/2.0); if( !pathOpen ) { start = p[0]; end = p[1]; pathOpen = true; } else addSegments(p); x = coords[0]; y = coords[1]; break; case PathIterator.SEG_QUADTO: p = (new QuadSegment(x, y, coords[0], coords[1], coords[2], coords[3])).getDisplacedSegments(width/2.0); if( !pathOpen ) { start = p[0]; end = p[1]; pathOpen = true; } else addSegments(p); x = coords[0]; y = coords[1]; break; case PathIterator.SEG_CUBICTO: p = new CubicSegment(x, y, coords[0], coords[1], coords[2], coords[3], coords[4], coords[5]).getDisplacedSegments(width/2.0); if( !pathOpen ) { start = p[0]; end = p[1]; pathOpen = true; } else addSegments(p); x = coords[0]; y = coords[1]; break; case PathIterator.SEG_CLOSE: p = (new LineSegment(x, y, x0, y0)).getDisplacedSegments(width/2.0); addSegments(p); convertPath(output, start); convertPath(output, end); start = end = null; pathOpen = false; break; } pi.next(); } if( pathOpen ) { capEnds(); convertPath(output, start); } return output; } |
x = coords[0]; y = coords[1]; | x = coords[4]; y = coords[5]; | private Shape solidStroke(PathIterator pi) { double[] coords = new double[6]; double x, y, x0, y0; boolean pathOpen = false; GeneralPath output = new GeneralPath( ); Segment[] p; x = x0 = y = y0 = 0; while( !pi.isDone() ) { switch( pi.currentSegment(coords) ) { case PathIterator.SEG_MOVETO: x0 = x = coords[0]; y0 = y = coords[1]; if( pathOpen ) { capEnds(); convertPath(output, start); start = end = null; pathOpen = false; } break; case PathIterator.SEG_LINETO: p = (new LineSegment(x, y, coords[0], coords[1])). getDisplacedSegments(width/2.0); if( !pathOpen ) { start = p[0]; end = p[1]; pathOpen = true; } else addSegments(p); x = coords[0]; y = coords[1]; break; case PathIterator.SEG_QUADTO: p = (new QuadSegment(x, y, coords[0], coords[1], coords[2], coords[3])).getDisplacedSegments(width/2.0); if( !pathOpen ) { start = p[0]; end = p[1]; pathOpen = true; } else addSegments(p); x = coords[0]; y = coords[1]; break; case PathIterator.SEG_CUBICTO: p = new CubicSegment(x, y, coords[0], coords[1], coords[2], coords[3], coords[4], coords[5]).getDisplacedSegments(width/2.0); if( !pathOpen ) { start = p[0]; end = p[1]; pathOpen = true; } else addSegments(p); x = coords[0]; y = coords[1]; break; case PathIterator.SEG_CLOSE: p = (new LineSegment(x, y, x0, y0)).getDisplacedSegments(width/2.0); addSegments(p); convertPath(output, start); convertPath(output, end); start = end = null; pathOpen = false; break; } pi.next(); } if( pathOpen ) { capEnds(); convertPath(output, start); } return output; } |
p = (new LineSegment(x, y, x0, y0)).getDisplacedSegments(width/2.0); | if (x == x0 && y == y0) { joinSegments(new Segment[] { start.first, end.first }); } else { p = (new LineSegment(x, y, x0, y0)).getDisplacedSegments(width / 2.0); | private Shape solidStroke(PathIterator pi) { double[] coords = new double[6]; double x, y, x0, y0; boolean pathOpen = false; GeneralPath output = new GeneralPath( ); Segment[] p; x = x0 = y = y0 = 0; while( !pi.isDone() ) { switch( pi.currentSegment(coords) ) { case PathIterator.SEG_MOVETO: x0 = x = coords[0]; y0 = y = coords[1]; if( pathOpen ) { capEnds(); convertPath(output, start); start = end = null; pathOpen = false; } break; case PathIterator.SEG_LINETO: p = (new LineSegment(x, y, coords[0], coords[1])). getDisplacedSegments(width/2.0); if( !pathOpen ) { start = p[0]; end = p[1]; pathOpen = true; } else addSegments(p); x = coords[0]; y = coords[1]; break; case PathIterator.SEG_QUADTO: p = (new QuadSegment(x, y, coords[0], coords[1], coords[2], coords[3])).getDisplacedSegments(width/2.0); if( !pathOpen ) { start = p[0]; end = p[1]; pathOpen = true; } else addSegments(p); x = coords[0]; y = coords[1]; break; case PathIterator.SEG_CUBICTO: p = new CubicSegment(x, y, coords[0], coords[1], coords[2], coords[3], coords[4], coords[5]).getDisplacedSegments(width/2.0); if( !pathOpen ) { start = p[0]; end = p[1]; pathOpen = true; } else addSegments(p); x = coords[0]; y = coords[1]; break; case PathIterator.SEG_CLOSE: p = (new LineSegment(x, y, x0, y0)).getDisplacedSegments(width/2.0); addSegments(p); convertPath(output, start); convertPath(output, end); start = end = null; pathOpen = false; break; } pi.next(); } if( pathOpen ) { capEnds(); convertPath(output, start); } return output; } |
output.setWindingRule(GeneralPath.WIND_EVEN_ODD); | private Shape solidStroke(PathIterator pi) { double[] coords = new double[6]; double x, y, x0, y0; boolean pathOpen = false; GeneralPath output = new GeneralPath( ); Segment[] p; x = x0 = y = y0 = 0; while( !pi.isDone() ) { switch( pi.currentSegment(coords) ) { case PathIterator.SEG_MOVETO: x0 = x = coords[0]; y0 = y = coords[1]; if( pathOpen ) { capEnds(); convertPath(output, start); start = end = null; pathOpen = false; } break; case PathIterator.SEG_LINETO: p = (new LineSegment(x, y, coords[0], coords[1])). getDisplacedSegments(width/2.0); if( !pathOpen ) { start = p[0]; end = p[1]; pathOpen = true; } else addSegments(p); x = coords[0]; y = coords[1]; break; case PathIterator.SEG_QUADTO: p = (new QuadSegment(x, y, coords[0], coords[1], coords[2], coords[3])).getDisplacedSegments(width/2.0); if( !pathOpen ) { start = p[0]; end = p[1]; pathOpen = true; } else addSegments(p); x = coords[0]; y = coords[1]; break; case PathIterator.SEG_CUBICTO: p = new CubicSegment(x, y, coords[0], coords[1], coords[2], coords[3], coords[4], coords[5]).getDisplacedSegments(width/2.0); if( !pathOpen ) { start = p[0]; end = p[1]; pathOpen = true; } else addSegments(p); x = coords[0]; y = coords[1]; break; case PathIterator.SEG_CLOSE: p = (new LineSegment(x, y, x0, y0)).getDisplacedSegments(width/2.0); addSegments(p); convertPath(output, start); convertPath(output, end); start = end = null; pathOpen = false; break; } pi.next(); } if( pathOpen ) { capEnds(); convertPath(output, start); } return output; } |
|
last = last.next; | last = last.next.last; | public void add(Segment newsegment) { last.next = newsegment; last = last.next; } |
public LineSegment(Point2D p1, Point2D p2) | public LineSegment(double x1, double y1, double x2, double y2) | public LineSegment(Point2D p1, Point2D p2) { super(); P1 = (Point2D) p1.clone(); P2 = (Point2D) p2.clone(); } |
P1 = (Point2D) p1.clone(); P2 = (Point2D) p2.clone(); | P1 = new Point2D.Double(x1, y1); P2 = new Point2D.Double(x2, y2); | public LineSegment(Point2D p1, Point2D p2) { super(); P1 = (Point2D) p1.clone(); P2 = (Point2D) p2.clone(); } |
public CubicSegment(Point2D p1, Point2D cp1, Point2D cp2, Point2D p2) | public CubicSegment(double x1, double y1, double c1x, double c1y, double c2x, double c2y, double x2, double y2) | public CubicSegment(Point2D p1, Point2D cp1, Point2D cp2, Point2D p2) { super(); P1 = p1; P2 = p2; this.cp1 = cp1; this.cp2 = cp2; } |
P1 = p1; P2 = p2; this.cp1 = cp1; this.cp2 = cp2; | P1 = new Point2D.Double(x1, y1); P2 = new Point2D.Double(x2, y2); cp1 = new Point2D.Double(c1x, c1y); cp2 = new Point2D.Double(c2x, c2y); | public CubicSegment(Point2D p1, Point2D cp1, Point2D cp2, Point2D p2) { super(); P1 = p1; P2 = p2; this.cp1 = cp1; this.cp2 = cp2; } |
first = last; | public void reverseAll() { reverse(); Segment v = next; Segment former = this; next = null; while (v != null) { v.reverse(); v.last = this; Segment oldnext = v.next; v.next = former; former = v; v = oldnext; // move to the next in list } } |
|
double x0 = P1.getX(); double y0 = P1.getY(); double x1 = cp1.getX(); double y1 = cp1.getY(); double x2 = cp2.getX(); double y2 = cp2.getY(); double x3 = P2.getX(); double y3 = P2.getY(); double[] p1 = normal(x0, y0, x1, y1); double[] p2 = normal(x2, y2, x3, y3); | public Segment[] getDisplacedSegments(double radius) { this.radius = radius; double x0 = P1.getX(); double y0 = P1.getY(); double x1 = cp1.getX(); double y1 = cp1.getY(); double x2 = cp2.getX(); double y2 = cp2.getY(); double x3 = P2.getX(); double y3 = P2.getY(); double[] p1 = normal(x0, y0, x1, y1); double[] p2 = normal(x2, y2, x3, y3); // FIXME: Doesn't compile. // return new Segment[]{s1, s2}; return new Segment[0]; } |
|
return new Segment[0]; | return new Segment[] { segmentTop, segmentBottom }; | public Segment[] getDisplacedSegments(double radius) { this.radius = radius; double x0 = P1.getX(); double y0 = P1.getY(); double x1 = cp1.getX(); double y1 = cp1.getY(); double x2 = cp2.getX(); double y2 = cp2.getY(); double x3 = P2.getX(); double y3 = P2.getY(); double[] p1 = normal(x0, y0, x1, y1); double[] p2 = normal(x2, y2, x3, y3); // FIXME: Doesn't compile. // return new Segment[]{s1, s2}; return new Segment[0]; } |
protected void resolve() throws PluginException { | protected void resolve(PluginRegistryModel registry) throws PluginException { registry.registerExtensionPoint(this); | protected void resolve() throws PluginException { // Do nothing } |
protected void unresolve() throws PluginException { | protected void unresolve(PluginRegistryModel registry) throws PluginException { registry.unregisterExtensionPoint(this); | protected void unresolve() throws PluginException { // Do nothing } |
public DoubleSeqHolder(double[] initial_value) | public DoubleSeqHolder() | public DoubleSeqHolder(double[] initial_value) { value = initial_value; typecode.setLength(value.length); } |
value = initial_value; typecode.setLength(value.length); | public DoubleSeqHolder(double[] initial_value) { value = initial_value; typecode.setLength(value.length); } |
|
public void append(PathIterator iter, boolean connect) | public void append(Shape s, boolean connect) | public void append(PathIterator iter, boolean connect) { // A bad implementation of this method had caused Classpath bug #6076. float[] f = new float[6]; while (! iter.isDone()) { switch (iter.currentSegment(f)) { case PathIterator.SEG_MOVETO: if (! connect || (index == 0)) { moveTo(f[0], f[1]); break; } if ((index >= 1) && (types[index - 1] == PathIterator.SEG_CLOSE) && (f[0] == xpoints[index - 1]) && (f[1] == ypoints[index - 1])) break; // Fall through. case PathIterator.SEG_LINETO: lineTo(f[0], f[1]); break; case PathIterator.SEG_QUADTO: quadTo(f[0], f[1], f[2], f[3]); break; case PathIterator.SEG_CUBICTO: curveTo(f[0], f[1], f[2], f[3], f[4], f[5]); break; case PathIterator.SEG_CLOSE: closePath(); break; } connect = false; iter.next(); } } |
float[] f = new float[6]; while (! iter.isDone()) { switch (iter.currentSegment(f)) { case PathIterator.SEG_MOVETO: if (! connect || (index == 0)) { moveTo(f[0], f[1]); break; } if ((index >= 1) && (types[index - 1] == PathIterator.SEG_CLOSE) && (f[0] == xpoints[index - 1]) && (f[1] == ypoints[index - 1])) break; case PathIterator.SEG_LINETO: lineTo(f[0], f[1]); break; case PathIterator.SEG_QUADTO: quadTo(f[0], f[1], f[2], f[3]); break; case PathIterator.SEG_CUBICTO: curveTo(f[0], f[1], f[2], f[3], f[4], f[5]); break; case PathIterator.SEG_CLOSE: closePath(); break; } connect = false; iter.next(); } | append(s.getPathIterator(null), connect); | public void append(PathIterator iter, boolean connect) { // A bad implementation of this method had caused Classpath bug #6076. float[] f = new float[6]; while (! iter.isDone()) { switch (iter.currentSegment(f)) { case PathIterator.SEG_MOVETO: if (! connect || (index == 0)) { moveTo(f[0], f[1]); break; } if ((index >= 1) && (types[index - 1] == PathIterator.SEG_CLOSE) && (f[0] == xpoints[index - 1]) && (f[1] == ypoints[index - 1])) break; // Fall through. case PathIterator.SEG_LINETO: lineTo(f[0], f[1]); break; case PathIterator.SEG_QUADTO: quadTo(f[0], f[1], f[2], f[3]); break; case PathIterator.SEG_CUBICTO: curveTo(f[0], f[1], f[2], f[3], f[4], f[5]); break; case PathIterator.SEG_CLOSE: closePath(); break; } connect = false; iter.next(); } } |
rb.append ('\n'); | public void parseFields(byte[] cByte, ArrayList ffd, StringBuffer rb) { FileFieldDef f; // write out the html record information for each field that is selected for (int x = 0; x < ffd.size(); x++) { f = (FileFieldDef)ffd.get(x); if (f.isWriteField()) { switch (f.getFieldType()) { case 'P': case 'S': rb.append(f.parseData(cByte).trim() + delimiter); break; default: rb.append(stringQualifier + f.parseData(cByte).trim() + stringQualifier + delimiter); break; } } } rb.append ('\n'); fout.println(rb); } |
|
try { | FileFieldDef f; StringBuffer sb = new StringBuffer(); for (int x = 0; x < ffd.size(); x++) { f = (FileFieldDef)ffd.get(x); if (f.isWriteField()) { sb.append(f.getFieldName() + delimiter); } } | public void writeHeader(String fileName, String host, ArrayList ffd, char decChar) { try { FileFieldDef f; StringBuffer sb = new StringBuffer(); // loop through each of the fields and write out the field name for // each selected field for (int x = 0; x < ffd.size(); x++) { f = (FileFieldDef)ffd.get(x); if (f.isWriteField()) { sb.append(f.getFieldName() + delimiter); } } fout.write (sb.toString().getBytes()); fout.write ('\n'); } catch (IOException ioe) {// printFTPInfo(" error writing header " + ioe.getMessage()); } } |
FileFieldDef f; StringBuffer sb = new StringBuffer(); for (int x = 0; x < ffd.size(); x++) { f = (FileFieldDef)ffd.get(x); if (f.isWriteField()) { sb.append(f.getFieldName() + delimiter); } } fout.write (sb.toString().getBytes()); fout.write ('\n'); } catch (IOException ioe) { } | fout.println (sb.toString().toCharArray()); | public void writeHeader(String fileName, String host, ArrayList ffd, char decChar) { try { FileFieldDef f; StringBuffer sb = new StringBuffer(); // loop through each of the fields and write out the field name for // each selected field for (int x = 0; x < ffd.size(); x++) { f = (FileFieldDef)ffd.get(x); if (f.isWriteField()) { sb.append(f.getFieldName() + delimiter); } } fout.write (sb.toString().getBytes()); fout.write ('\n'); } catch (IOException ioe) {// printFTPInfo(" error writing header " + ioe.getMessage()); } } |
if (animationIndex > (numFrames) / 2) | if (animationIndex > numFrames / 2) | protected Rectangle getBox(Rectangle r) { if (!progressBar.isIndeterminate()) return null; if (r == null) r = new Rectangle(); Rectangle vr = new Rectangle(); SwingUtilities.calculateInnerArea(progressBar, vr); // Recalculate the metrics only when size of the progressbar has changed. if (incr == -1 || boxDependent == -1 || boxIndependent == -1) { //numFrames has to be an even number as defined by spec. int iterations = numFrames / 2; if (progressBar.getOrientation() == JProgressBar.HORIZONTAL) { boxDependent = vr.width / 6.; incr = ((double) (vr.width - boxDependent)) / (double) iterations; boxIndependent = vr.height; } else { boxDependent = vr.height / 6.; incr = ((double) (vr.height - boxDependent)) / (double) iterations; boxIndependent = vr.width; } } int index = getAnimationIndex(); if (animationIndex > (numFrames) / 2) index = numFrames - getAnimationIndex(); if (progressBar.getOrientation() == JProgressBar.HORIZONTAL) { r.x = vr.x + (int) (incr * index); r.y = vr.y; r.width = (int) boxDependent; r.height = (int) boxIndependent; } else { r.x = vr.x; r.y = vr.height - (int) (incr * index) + vr.y - (int) boxDependent; r.width = (int) boxIndependent; r.height = (int) boxDependent; } return r; } |
System.out.println("l1 % l2 =" + NumberUtils.hex(l1 % l2)); System.out.println("l1 & l2 =" + NumberUtils.hex(l1 & l2)); System.out.println("l1 | l2 =" + NumberUtils.hex(l1 | l2)); System.out.println("l1 ^ l2 =" + NumberUtils.hex(l1 ^ l2)); System.out.println("l1 >> 3 =" + NumberUtils.hex(l1 >> 3)); System.out.println("l1 >> 33 =" + NumberUtils.hex(l1 >> 33)); System.out.println("l1 >>> 3 =" + NumberUtils.hex(l1 >>> 3)); System.out.println("l1 >>> 33=" + NumberUtils.hex(l1 >>> 33)); | public static void main(String[] args) { final int i1 = 0x00450078; final int i2 = 0x45007800; System.out.println("i1 % i2=" + NumberUtils.hex(i1 % i2)); System.out.println("i1 & i2=" + NumberUtils.hex(i1 & i2)); System.out.println("i1 | i2=" + NumberUtils.hex(i1 | i2)); System.out.println("i1 ^ i2=" + NumberUtils.hex(i1 ^ i2)); } |
|
public final static VmArrayClass getPrimitiveArrayClass(int type) { | public final static VmType getPrimitiveArrayClass(char type) { | public final static VmArrayClass getPrimitiveArrayClass(int type) { switch (type) { case 4: return BooleanArrayClass; case 8: return ByteArrayClass; case 5: return CharArrayClass; case 9: return ShortArrayClass; case 10: return IntArrayClass; case 6: return FloatArrayClass; case 11: return LongArrayClass; case 7: return DoubleArrayClass; default: throw new IllegalArgumentException("Unknown type " + type); } } |
case 4: | case 'Z': | public final static VmArrayClass getPrimitiveArrayClass(int type) { switch (type) { case 4: return BooleanArrayClass; case 8: return ByteArrayClass; case 5: return CharArrayClass; case 9: return ShortArrayClass; case 10: return IntArrayClass; case 6: return FloatArrayClass; case 11: return LongArrayClass; case 7: return DoubleArrayClass; default: throw new IllegalArgumentException("Unknown type " + type); } } |
case 8: | case 'B': | public final static VmArrayClass getPrimitiveArrayClass(int type) { switch (type) { case 4: return BooleanArrayClass; case 8: return ByteArrayClass; case 5: return CharArrayClass; case 9: return ShortArrayClass; case 10: return IntArrayClass; case 6: return FloatArrayClass; case 11: return LongArrayClass; case 7: return DoubleArrayClass; default: throw new IllegalArgumentException("Unknown type " + type); } } |
case 5: | case 'C': | public final static VmArrayClass getPrimitiveArrayClass(int type) { switch (type) { case 4: return BooleanArrayClass; case 8: return ByteArrayClass; case 5: return CharArrayClass; case 9: return ShortArrayClass; case 10: return IntArrayClass; case 6: return FloatArrayClass; case 11: return LongArrayClass; case 7: return DoubleArrayClass; default: throw new IllegalArgumentException("Unknown type " + type); } } |
case 9: | case 'S': | public final static VmArrayClass getPrimitiveArrayClass(int type) { switch (type) { case 4: return BooleanArrayClass; case 8: return ByteArrayClass; case 5: return CharArrayClass; case 9: return ShortArrayClass; case 10: return IntArrayClass; case 6: return FloatArrayClass; case 11: return LongArrayClass; case 7: return DoubleArrayClass; default: throw new IllegalArgumentException("Unknown type " + type); } } |
case 10: | case 'I': | public final static VmArrayClass getPrimitiveArrayClass(int type) { switch (type) { case 4: return BooleanArrayClass; case 8: return ByteArrayClass; case 5: return CharArrayClass; case 9: return ShortArrayClass; case 10: return IntArrayClass; case 6: return FloatArrayClass; case 11: return LongArrayClass; case 7: return DoubleArrayClass; default: throw new IllegalArgumentException("Unknown type " + type); } } |
case 6: | case 'F': | public final static VmArrayClass getPrimitiveArrayClass(int type) { switch (type) { case 4: return BooleanArrayClass; case 8: return ByteArrayClass; case 5: return CharArrayClass; case 9: return ShortArrayClass; case 10: return IntArrayClass; case 6: return FloatArrayClass; case 11: return LongArrayClass; case 7: return DoubleArrayClass; default: throw new IllegalArgumentException("Unknown type " + type); } } |
case 11: | case 'J': | public final static VmArrayClass getPrimitiveArrayClass(int type) { switch (type) { case 4: return BooleanArrayClass; case 8: return ByteArrayClass; case 5: return CharArrayClass; case 9: return ShortArrayClass; case 10: return IntArrayClass; case 6: return FloatArrayClass; case 11: return LongArrayClass; case 7: return DoubleArrayClass; default: throw new IllegalArgumentException("Unknown type " + type); } } |
case 7: | case 'D': | public final static VmArrayClass getPrimitiveArrayClass(int type) { switch (type) { case 4: return BooleanArrayClass; case 8: return ByteArrayClass; case 5: return CharArrayClass; case 9: return ShortArrayClass; case 10: return IntArrayClass; case 6: return FloatArrayClass; case 11: return LongArrayClass; case 7: return DoubleArrayClass; default: throw new IllegalArgumentException("Unknown type " + type); } } |
{ super(); | { | public NoSuchFieldError() { super(); } |
public StackOverflowError() { super(); | public StackOverflowError() { | public StackOverflowError() { super(); } |
public UnknownError(String s) { super(s); | public UnknownError() { | public UnknownError(String s) { super(s); } |
public AddressPcEntry(VmMethod method, int pc, int offset) { | public AddressPcEntry(VmMethod method, int pc, int offset, int inlineDepth) { | public AddressPcEntry(VmMethod method, int pc, int offset) { this.method = method; this.pc = (char)pc; this.offset = offset; } |
this.inlineDepth = (byte)inlineDepth; | public AddressPcEntry(VmMethod method, int pc, int offset) { this.method = method; this.pc = (char)pc; this.offset = offset; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.