bugged
stringlengths 6
599k
| fixed
stringlengths 6
40.8M
| __index_level_0__
int64 0
3.24M
|
|---|---|---|
protected boolean isLocationInExpandControl(TreePath path, int mouseX, int mouseY) { boolean cntlClick = false; int row = getRowForPath(tree, path); if (!isLeaf(row)) { if (bounds == null) bounds = getPathBounds(tree, path); if (hasControlIcons() && (mouseX < bounds.x) && (mouseX > (bounds.x - getCurrentControlIcon(path).getIconWidth()))) cntlClick = true; } return cntlClick; }
|
protected boolean isLocationInExpandControl(TreePath path, int mouseX, int mouseY) { boolean cntlClick = false; int row = getRowForPath(tree, path); if (!isLeaf(row)) { bounds = getPathBounds(tree, path); if (hasControlIcons() && (mouseX < bounds.x) && (mouseX > (bounds.x - getCurrentControlIcon(path).getIconWidth()))) cntlClick = true; } return cntlClick; }
| 9,369
|
protected boolean isLocationInExpandControl(TreePath path, int mouseX, int mouseY) { boolean cntlClick = false; int row = getRowForPath(tree, path); if (!isLeaf(row)) { if (bounds == null) bounds = getPathBounds(tree, path); if (hasControlIcons() && (mouseX < bounds.x) && (mouseX > (bounds.x - getCurrentControlIcon(path).getIconWidth()))) cntlClick = true; } return cntlClick; }
|
protected boolean isLocationInExpandControl(TreePath path, int mouseX, int mouseY) { boolean cntlClick = false; int row = getRowForPath(tree, path); if (!isLeaf(row)) { if (bounds == null) bounds = getPathBounds(tree, path); if (hasControlIcons() && (mouseX < bounds.x) && (mouseX > (bounds.x - getCurrentControlIcon(path).getIconWidth() - gap))) cntlClick = true; } return cntlClick; }
| 9,370
|
public void paint(Graphics g, JComponent c) { JTree tree = (JTree) c; if (treeModel != null) { Object root = treeModel.getRoot(); paintRecursive(g, 0, 0, 0, tree, treeModel, root); if (hasControlIcons()) paintControlIcons(g, 0, 0, 0, 0, tree, treeModel, root); } }
|
public void paint(Graphics g, JComponent c) { JTree tree = (JTree) c; if (treeModel != null) { Object root = treeModel.getRoot(); paintRecursive(g, 0, 0, 0, tree, treeModel, root); if (hasControlIcons()) paintControlIcons(g, 0, 0, 0, tree, treeModel, root); } }
| 9,371
|
int paintControlIcons(Graphics g, int indentation, int descent, int childNumber, int depth, JTree tree, TreeModel mod, Object node) { int h = descent; int rowHeight = getRowHeight(); TreePath path = new TreePath(getPathToRoot(node, 0)); Icon icon = getCurrentControlIcon(path); Rectangle clip = tree.getVisibleRect(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; if (mod.isLeaf(node)) descent += rowHeight; else { if (depth > 0 || tree.isRootVisible()) descent += rowHeight; int max = 0; if (!mod.isLeaf(node)) max = mod.getChildCount(node); if (!node.equals(mod.getRoot()) && (tree.isRootVisible() || getLevel(node) != 1)) icon.paintIcon(tree, g, indentation - rightChildIndent - 3, h); if (tree.isExpanded(path)) { for (int i = 0; i < max; i++) { int indent = indentation + rightChildIndent; if (depth == 0 && !tree.isRootVisible()) indent = 1; descent = paintControlIcons(g, indent, descent, i, depth + 1, tree, mod, mod.getChild(node, i)); } } } return descent; }
|
int paintControlIcons(Graphics g, int indentation, int descent, int depth, JTree tree, TreeModel mod, Object node) { int h = descent; int rowHeight = getRowHeight(); TreePath path = new TreePath(getPathToRoot(node, 0)); Icon icon = getCurrentControlIcon(path); Rectangle clip = tree.getVisibleRect(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; if (mod.isLeaf(node)) descent += rowHeight; else { if (depth > 0 || tree.isRootVisible()) descent += rowHeight; int max = 0; if (!mod.isLeaf(node)) max = mod.getChildCount(node); if (!node.equals(mod.getRoot()) && (tree.isRootVisible() || getLevel(node) != 1)) icon.paintIcon(tree, g, indentation - rightChildIndent - 3, h); if (tree.isExpanded(path)) { for (int i = 0; i < max; i++) { int indent = indentation + rightChildIndent; if (depth == 0 && !tree.isRootVisible()) indent = 1; descent = paintControlIcons(g, indent, descent, i, depth + 1, tree, mod, mod.getChild(node, i)); } } } return descent; }
| 9,372
|
int paintControlIcons(Graphics g, int indentation, int descent, int childNumber, int depth, JTree tree, TreeModel mod, Object node) { int h = descent; int rowHeight = getRowHeight(); TreePath path = new TreePath(getPathToRoot(node, 0)); Icon icon = getCurrentControlIcon(path); Rectangle clip = tree.getVisibleRect(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; if (mod.isLeaf(node)) descent += rowHeight; else { if (depth > 0 || tree.isRootVisible()) descent += rowHeight; int max = 0; if (!mod.isLeaf(node)) max = mod.getChildCount(node); if (!node.equals(mod.getRoot()) && (tree.isRootVisible() || getLevel(node) != 1)) icon.paintIcon(tree, g, indentation - rightChildIndent - 3, h); if (tree.isExpanded(path)) { for (int i = 0; i < max; i++) { int indent = indentation + rightChildIndent; if (depth == 0 && !tree.isRootVisible()) indent = 1; descent = paintControlIcons(g, indent, descent, i, depth + 1, tree, mod, mod.getChild(node, i)); } } } return descent; }
|
int paintControlIcons(Graphics g, int indentation, int descent, int childNumber, int depth, JTree tree, TreeModel mod, Object node) { int rowHeight = getRowHeight(); TreePath path = new TreePath(getPathToRoot(node, 0)); Icon icon = getCurrentControlIcon(path); Rectangle clip = tree.getVisibleRect(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; if (mod.isLeaf(node)) descent += rowHeight; else { if (depth > 0 || tree.isRootVisible()) descent += rowHeight; int max = 0; if (!mod.isLeaf(node)) max = mod.getChildCount(node); if (!node.equals(mod.getRoot()) && (tree.isRootVisible() || getLevel(node) != 1)) icon.paintIcon(tree, g, indentation - rightChildIndent - 3, h); if (tree.isExpanded(path)) { for (int i = 0; i < max; i++) { int indent = indentation + rightChildIndent; if (depth == 0 && !tree.isRootVisible()) indent = 1; descent = paintControlIcons(g, indent, descent, i, depth + 1, tree, mod, mod.getChild(node, i)); } } } return descent; }
| 9,373
|
int paintControlIcons(Graphics g, int indentation, int descent, int childNumber, int depth, JTree tree, TreeModel mod, Object node) { int h = descent; int rowHeight = getRowHeight(); TreePath path = new TreePath(getPathToRoot(node, 0)); Icon icon = getCurrentControlIcon(path); Rectangle clip = tree.getVisibleRect(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; if (mod.isLeaf(node)) descent += rowHeight; else { if (depth > 0 || tree.isRootVisible()) descent += rowHeight; int max = 0; if (!mod.isLeaf(node)) max = mod.getChildCount(node); if (!node.equals(mod.getRoot()) && (tree.isRootVisible() || getLevel(node) != 1)) icon.paintIcon(tree, g, indentation - rightChildIndent - 3, h); if (tree.isExpanded(path)) { for (int i = 0; i < max; i++) { int indent = indentation + rightChildIndent; if (depth == 0 && !tree.isRootVisible()) indent = 1; descent = paintControlIcons(g, indent, descent, i, depth + 1, tree, mod, mod.getChild(node, i)); } } } return descent; }
|
int paintControlIcons(Graphics g, int indentation, int descent, int childNumber, int depth, JTree tree, TreeModel mod, Object node) { int h = descent; int rowHeight = getRowHeight(); TreePath path = new TreePath(getPathToRoot(node, 0)); Icon icon = getCurrentControlIcon(path); Rectangle clip = tree.getVisibleRect(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; if (mod.isLeaf(node)) descent += rowHeight; else { if (depth > 0 || tree.isRootVisible()) descent += rowHeight; int max = 0; if (!mod.isLeaf(node)) max = mod.getChildCount(node); if (!node.equals(mod.getRoot()) && (tree.isRootVisible() || getLevel(node) != 1)) icon.paintIcon(tree, g, indentation - rightChildIndent - 3, h); if (tree.isExpanded(path)) { for (int i = 0; i < max; i++) { int indent = indentation + rightChildIndent; if (depth == 0 && !tree.isRootVisible()) indent = 1; descent = paintControlIcons(g, indent, descent, i, depth + 1, tree, mod, mod.getChild(node, i)); } } } return descent; }
| 9,374
|
int paintControlIcons(Graphics g, int indentation, int descent, int childNumber, int depth, JTree tree, TreeModel mod, Object node) { int h = descent; int rowHeight = getRowHeight(); TreePath path = new TreePath(getPathToRoot(node, 0)); Icon icon = getCurrentControlIcon(path); Rectangle clip = tree.getVisibleRect(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; if (mod.isLeaf(node)) descent += rowHeight; else { if (depth > 0 || tree.isRootVisible()) descent += rowHeight; int max = 0; if (!mod.isLeaf(node)) max = mod.getChildCount(node); if (!node.equals(mod.getRoot()) && (tree.isRootVisible() || getLevel(node) != 1)) icon.paintIcon(tree, g, indentation - rightChildIndent - 3, h); if (tree.isExpanded(path)) { for (int i = 0; i < max; i++) { int indent = indentation + rightChildIndent; if (depth == 0 && !tree.isRootVisible()) indent = 1; descent = paintControlIcons(g, indent, descent, i, depth + 1, tree, mod, mod.getChild(node, i)); } } } return descent; }
|
int paintControlIcons(Graphics g, int indentation, int descent, int childNumber, int depth, JTree tree, TreeModel mod, Object node) { int h = descent; int rowHeight = getRowHeight(); TreePath path = new TreePath(getPathToRoot(node, 0)); Icon icon = getCurrentControlIcon(path); Rectangle clip = tree.getVisibleRect(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; if (mod.isLeaf(node)) descent += rowHeight; else { if (depth > 0 || tree.isRootVisible()) descent += rowHeight; int max = 0; if (!mod.isLeaf(node)) max = mod.getChildCount(node); if (!node.equals(mod.getRoot()) && (tree.isRootVisible() || getLevel(node) != 1)) icon.paintIcon(tree, g, indentation - rightChildIndent - 3, h); if (tree.isExpanded(path)) { for (int i = 0; i < max; i++) { int indent = indentation + rightChildIndent; if (depth == 0 && !tree.isRootVisible()) indent = 1; descent = paintControlIcons(g, indent, descent, depth + 1, tree, mod, mod.getChild(node, i)); } } } return descent; }
| 9,375
|
protected void paintExpandControl(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf) { if (treeModel != null && hasControlIcons()) paintControlIcons(g, 0, 0, 0, 0, tree, treeModel, path.getLastPathComponent()); }
|
protected void paintExpandControl(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf) { if (treeModel != null && hasControlIcons()) paintControlIcons(g, 0, 0, 0, tree, treeModel, path.getLastPathComponent()); }
| 9,376
|
int paintRecursive(Graphics g, int indentation, int descent, int depth, JTree tree, TreeModel mod, Object curr) { Rectangle clip = tree.getVisibleRect(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; TreePath path = new TreePath(getPathToRoot(curr, 0)); int halfHeight = getRowHeight() / 2; int halfWidth = rightChildIndent / 2; int y0 = descent + halfHeight; int heightOfLine = descent + halfHeight; int row = getRowForPath(tree, path); boolean isRootVisible = tree.isRootVisible(); boolean isExpanded = tree.isExpanded(path); boolean isLeaf = mod.isLeaf(curr); Rectangle bounds = getPathBounds(tree, path); Object root = mod.getRoot(); int iconWidth = 0; if (!isLeaf && hasControlIcons()) iconWidth += getCurrentControlIcon(path).getIconWidth(); bounds.width += bounds.x + iconWidth + gap; if (isLeaf) { paintRow(g, clip, null, bounds, path, row, true, false, true); descent += getRowHeight(); } else { if (depth > 0 || isRootVisible) { paintRow(g, clip, null, bounds, path, row, isExpanded, false, false); descent += getRowHeight(); y0 += halfHeight; } int max = mod.getChildCount(curr); if (isExpanded) { for (int i = 0; i < max; i++) { int indent = indentation + rightChildIndent; if (!isRootVisible && depth == 0) indent = 0; else if (isRootVisible || (!isRootVisible && !curr.equals(root))) { g.setColor(getHashColor()); heightOfLine = descent + halfHeight; paintHorizontalLine(g, (JComponent) tree, heightOfLine, indentation + halfWidth, indentation + rightChildIndent); } descent = paintRecursive(g, indent, descent, depth + 1, tree, mod, mod.getChild(curr, i)); } } } if (isExpanded) if (y0 != heightOfLine && !isLeaf && mod.getChildCount(curr) > 0) { g.setColor(getHashColor()); paintVerticalLine(g, (JComponent) tree, indentation + halfWidth, y0, heightOfLine); } return descent; }
|
int paintRecursive(Graphics g, int indentation, int descent, int depth, JTree tree, TreeModel mod, Object curr) { Rectangle clip = tree.getVisibleRect(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; TreePath path = new TreePath(getPathToRoot(curr, 0)); int halfHeight = getRowHeight() / 2; int halfWidth = rightChildIndent / 2; int y0 = descent + halfHeight; int heightOfLine = descent + halfHeight; int row = getRowForPath(tree, path); boolean isRootVisible = tree.isRootVisible(); boolean isExpanded = tree.isExpanded(path); boolean isLeaf = mod.isLeaf(curr); Rectangle bounds = getPathBounds(tree, path); Object root = mod.getRoot(); int iconWidth = 0; if (!isLeaf && hasControlIcons()) iconWidth += getCurrentControlIcon(path).getIconWidth(); bounds.width += bounds.x + iconWidth + gap; if (isLeaf) { paintRow(g, clip, null, bounds, path, row, true, false, true); descent += getRowHeight(); } else { if (depth > 0 || isRootVisible) { paintRow(g, clip, null, bounds, path, row, isExpanded, false, false); descent += getRowHeight(); y0 += halfHeight; } int max = mod.getChildCount(curr); if (isExpanded) { for (int i = 0; i < max; i++) { int indent = indentation + rightChildIndent; if (!isRootVisible && depth == 0) indent = 0; else if (isRootVisible || (!isRootVisible && !curr.equals(root))) { g.setColor(getHashColor()); heightOfLine = descent + halfHeight; paintHorizontalLine(g, (JComponent) tree, heightOfLine, indentation + halfWidth, indentation + rightChildIndent); } descent = paintRecursive(g, indent, descent, depth + 1, tree, mod, mod.getChild(curr, i)); } } } if (isExpanded) if (y0 != heightOfLine && !isLeaf && mod.getChildCount(curr) > 0) { g.setColor(getHashColor()); paintVerticalLine(g, (JComponent) tree, indentation + halfWidth, y0, heightOfLine); } return descent; }
| 9,377
|
protected void paintRow(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf) { boolean selected = tree.isPathSelected(path); boolean hasIcons = false; Object node = path.getLastPathComponent(); if (tree.isVisible(path)) { if (editingComponent != null && editingPath != null && isEditing(tree) && node.equals(editingPath.getLastPathComponent())) { rendererPane.paintComponent(g, editingComponent.getParent(), null, bounds); } else { TreeCellRenderer dtcr = tree.getCellRenderer(); if (dtcr == null) dtcr = createDefaultCellRenderer(); Component c = dtcr.getTreeCellRendererComponent(tree, node, selected, isExpanded, isLeaf, row, false); bounds.x += gap; rendererPane.paintComponent(g, c, c.getParent(), bounds); } } }
|
protected void paintRow(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf) { boolean selected = tree.isPathSelected(path); boolean hasIcons = false; Object node = path.getLastPathComponent(); if (tree.isVisible(path)) { if (editingComponent != null && editingPath != null && isEditing(tree) && node.equals(editingPath.getLastPathComponent())) { rendererPane.paintComponent(g, editingComponent.getParent(), null, bounds); } else { TreeCellRenderer dtcr = tree.getCellRenderer(); if (dtcr == null) dtcr = createDefaultCellRenderer(); Component c = dtcr.getTreeCellRendererComponent(tree, node, selected, isExpanded, isLeaf, row, false); rendererPane.paintComponent(g, c, c.getParent(), bounds); } } }
| 9,378
|
protected void uninstallListeners() { tree.removePropertyChangeListener(propertyChangeListener); tree.removeFocusListener(focusListener); tree.removeTreeSelectionListener(treeSelectionListener); tree.removeMouseListener(mouseInputListener); tree.removeKeyListener(keyListener); tree.removePropertyChangeListener(selectionModelPropertyChangeListener); tree.removeComponentListener(componentListener); tree.removeTreeExpansionListener(treeExpansionListener); TreeCellEditor tce = tree.getCellEditor(); if (tce != null) tce.removeCellEditorListener(cellEditorListener); if (treeModel != null) treeModel.removeTreeModelListener(treeModelListener); }
|
protected void uninstallListeners() { tree.removePropertyChangeListener(propertyChangeListener); tree.removeFocusListener(focusListener); tree.removeTreeSelectionListener(treeSelectionListener); tree.removeMouseListener(mouseListener); tree.removeKeyListener(keyListener); tree.removePropertyChangeListener(selectionModelPropertyChangeListener); tree.removeComponentListener(componentListener); tree.removeTreeExpansionListener(treeExpansionListener); TreeCellEditor tce = tree.getCellEditor(); if (tce != null) tce.removeCellEditorListener(cellEditorListener); if (treeModel != null) treeModel.removeTreeModelListener(treeModelListener); }
| 9,382
|
void updateCurrentVisiblePath() { Object next = treeModel.getRoot(); Rectangle bounds = getCellBounds(0, 0, next); // If root is not a valid size to be visible, or is // not visible and the tree is expanded, then the next node acts // as the root if ((bounds.width == 0 && bounds.height == 0) || (!isRootVisible() && tree.isExpanded(new TreePath(next)))) next = getNextNode(next); TreePath current = null; while (next != null) { if (current != null) current = current.pathByAddingChild(next); else current = new TreePath(next); // FIXME: Inefficent to have 2 loops when the // tree is very large. Find a better way. do next = getNextNode(next); while (next != null && !tree.isVisible(new TreePath(getPathToRoot(next, 0)))); } currentVisiblePath = current; }
|
void updateCurrentVisiblePath() { Object next = treeModel.getRoot(); Rectangle bounds = getCellBounds(0, 0, next); // If root is not a valid size to be visible, or is // not visible and the tree is expanded, then the next node acts // as the root if ((bounds.width == 0 && bounds.height == 0) || (!isRootVisible() && tree.isExpanded(new TreePath(next)))) next = getNextNode(next); TreePath current = null; while (next != null) { if (current != null) current = current.pathByAddingChild(next); else current = new TreePath(next); // FIXME: Inefficent to have 2 loops when the // tree is very large. Find a better way. do next = getNextNode(next); while (next != null && !tree.isVisible(new TreePath(getPathToRoot(next, 0)))); } currentVisiblePath = current; }
| 9,383
|
void updateCurrentVisiblePath() { Object next = treeModel.getRoot(); Rectangle bounds = getCellBounds(0, 0, next); // If root is not a valid size to be visible, or is // not visible and the tree is expanded, then the next node acts // as the root if ((bounds.width == 0 && bounds.height == 0) || (!isRootVisible() && tree.isExpanded(new TreePath(next)))) next = getNextNode(next); TreePath current = null; while (next != null) { if (current != null) current = current.pathByAddingChild(next); else current = new TreePath(next); // FIXME: Inefficent to have 2 loops when the // tree is very large. Find a better way. do next = getNextNode(next); while (next != null && !tree.isVisible(new TreePath(getPathToRoot(next, 0)))); } currentVisiblePath = current; }
|
void updateCurrentVisiblePath() {else current = current.pathByAddingChild(next); Object next = treeModel.getRoot();else current = current.pathByAddingChild(next); Rectangle bounds = getCellBounds(0, 0, next);else current = current.pathByAddingChild(next); else current = current.pathByAddingChild(next); // If root is not a valid size to be visible, or iselse current = current.pathByAddingChild(next); // not visible and the tree is expanded, then the next node actselse current = current.pathByAddingChild(next); // as the rootelse current = current.pathByAddingChild(next); if ((bounds.width == 0 && bounds.height == 0) || (!isRootVisible()else current = current.pathByAddingChild(next); else current = current.pathByAddingChild(next); else current = current.pathByAddingChild(next); && tree.isExpanded(new TreePath(next))))else current = current.pathByAddingChild(next); else current = current.pathByAddingChild(next); next = getNextNode(next);else current = current.pathByAddingChild(next); TreePath current = null;else current = current.pathByAddingChild(next); while (next != null)else current = current.pathByAddingChild(next); else current = current.pathByAddingChild(next); {else current = current.pathByAddingChild(next); else current = current.pathByAddingChild(next); if (current != null)else current = current.pathByAddingChild(next); else current = current.pathByAddingChild(next); else current = current.pathByAddingChild(next); current = current.pathByAddingChild(next);else current = current.pathByAddingChild(next); else current = current.pathByAddingChild(next); elseelse current = current.pathByAddingChild(next); else current = current.pathByAddingChild(next); else current = current.pathByAddingChild(next); current = new TreePath(next);else current = current.pathByAddingChild(next); else current = current.pathByAddingChild(next); else current = current.pathByAddingChild(next); else current = current.pathByAddingChild(next); else current = current.pathByAddingChild(next); // FIXME: Inefficent to have 2 loops when theelse current = current.pathByAddingChild(next); else current = current.pathByAddingChild(next); else current = current.pathByAddingChild(next); // tree is very large. Find a better way.else current = current.pathByAddingChild(next); else current = current.pathByAddingChild(next); doelse current = current.pathByAddingChild(next); else current = current.pathByAddingChild(next); else current = current.pathByAddingChild(next); next = getNextNode(next);else current = current.pathByAddingChild(next); else current = current.pathByAddingChild(next); while (next != nullelse current = current.pathByAddingChild(next); else current = current.pathByAddingChild(next); else current = current.pathByAddingChild(next); else current = current.pathByAddingChild(next); else current = current.pathByAddingChild(next); && !tree.isVisible(new TreePath(getPathToRoot(next, 0))));else current = current.pathByAddingChild(next); else current = current.pathByAddingChild(next); }else current = current.pathByAddingChild(next); currentVisiblePath = current; }
| 9,384
|
void updateCurrentVisiblePath() { Object next = treeModel.getRoot(); Rectangle bounds = getCellBounds(0, 0, next); // If root is not a valid size to be visible, or is // not visible and the tree is expanded, then the next node acts // as the root if ((bounds.width == 0 && bounds.height == 0) || (!isRootVisible() && tree.isExpanded(new TreePath(next)))) next = getNextNode(next); TreePath current = null; while (next != null) { if (current != null) current = current.pathByAddingChild(next); else current = new TreePath(next); // FIXME: Inefficent to have 2 loops when the // tree is very large. Find a better way. do next = getNextNode(next); while (next != null && !tree.isVisible(new TreePath(getPathToRoot(next, 0)))); } currentVisiblePath = current; }
|
void updateCurrentVisiblePath() { Object next = treeModel.getRoot(); Rectangle bounds = getCellBounds(0, 0, next); // If root is not a valid size to be visible, or is // not visible and the tree is expanded, then the next node acts // as the root if ((bounds.width == 0 && bounds.height == 0) || (!isRootVisible() && tree.isExpanded(new TreePath(next)))) next = getNextNode(next); TreePath current = null; while (next != null) { if (current != null) current = current.pathByAddingChild(next); else current = new TreePath(next); // FIXME: Inefficent to have 2 loops when the // tree is very large. Find a better way. do next = getNextNode(next); while (next != null && !tree.isVisible(new TreePath(getPathToRoot(next, 0)))); } currentVisiblePath = current; }
| 9,385
|
public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("DONE")) { if (mods) { mapper.saveKeyMap(); mapper.fireKeyChangeEvent(); } setVisible(false); } if (e.getActionCommand().equals("MAP")) { mapIt(); } if (e.getActionCommand().equals("REMOVE")) { removeIt(); } if (e.getActionCommand().equals("MAP-Prime")) { altKey = false; mapIt(); } if (e.getActionCommand().equals("REMOVE-Prime")) { altKey = false; removeIt(); } if (e.getActionCommand().equals("MAP-Alt")) { altKey = true; mapIt(); } if (e.getActionCommand().equals("REMOVE-Alt")) { altKey = true; removeIt(); } }
|
public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("DONE")) { if (mods) { mapper.saveKeyMap(); mapper.fireKeyChangeEvent(); } setVisible(false); } if (e.getActionCommand().equals("MAP")) { mapIt(); } if (e.getActionCommand().equals("REMOVE")) { removeIt(); } if (e.getActionCommand().equals("MAP-Prime")) { altKey = false; mapIt(); } if (e.getActionCommand().equals("REMOVE-Prime")) { altKey = false; removeIt(); } if (e.getActionCommand().equals("MAP-Alt")) { altKey = true; mapIt(); } if (e.getActionCommand().equals("REMOVE-Alt")) { altKey = true; removeIt(); } }
| 9,387
|
private String getKeyDescription(KeyEvent ke) { String desc; if (isLinux) desc = mapper.getKeyStrokeMnemonic(ke,isAltGr); else desc = mapper.getKeyStrokeMnemonic(ke,isAltGr); if (desc != null && desc.length() > 1 && desc.startsWith("[")) desc = LangTool.getString("key."+ desc); return desc; }
|
private String getKeyDescription(KeyEvent ke) { String desc; if (isLinux) desc = KeyMapper.getKeyStrokeMnemonic(ke,isAltGr); else desc = KeyMapper.getKeyStrokeMnemonic(ke,isAltGr); if (desc != null && desc.length() > 1 && desc.startsWith("[")) desc = LangTool.getString("key."+ desc); return desc; }
| 9,388
|
private String getKeyDescription(KeyEvent ke) { String desc; if (isLinux) desc = mapper.getKeyStrokeMnemonic(ke,isAltGr); else desc = mapper.getKeyStrokeMnemonic(ke,isAltGr); if (desc != null && desc.length() > 1 && desc.startsWith("[")) desc = LangTool.getString("key."+ desc); return desc; }
|
private String getKeyDescription(KeyEvent ke) { String desc; if (isLinux) desc = KeyMapper.getKeyStrokeMnemonic(ke,isAltGr); else desc = KeyMapper.getKeyStrokeMnemonic(ke,isAltGr); if (desc != null && desc.length() > 1 && desc.startsWith("[")) desc = LangTool.getString("key."+ desc); return desc; }
| 9,389
|
private String getLocationDesc(String keyDesc) { String locStr = LangTool.getString("key.labelLocUnknown"); if (mapper.isKeyStrokeDefined(keyDesc)) { switch (mapper.getKeyStroker(keyDesc).getLocation()) { case KeyStroker.KEY_LOCATION_LEFT: locStr = LangTool.getString("key.labelLocLeft"); break; case KeyStroker.KEY_LOCATION_RIGHT: locStr = LangTool.getString("key.labelLocRight"); break; case KeyStroker.KEY_LOCATION_STANDARD: locStr = LangTool.getString("key.labelLocStandard"); break; case KeyStroker.KEY_LOCATION_NUMPAD: locStr = LangTool.getString("key.labelLocNumPad"); break; } } return locStr; }
|
private String getLocationDesc(String keyDesc) { String locStr = LangTool.getString("key.labelLocUnknown"); if (KeyMapper.isKeyStrokeDefined(keyDesc)) { switch (mapper.getKeyStroker(keyDesc).getLocation()) { case KeyStroker.KEY_LOCATION_LEFT: locStr = LangTool.getString("key.labelLocLeft"); break; case KeyStroker.KEY_LOCATION_RIGHT: locStr = LangTool.getString("key.labelLocRight"); break; case KeyStroker.KEY_LOCATION_STANDARD: locStr = LangTool.getString("key.labelLocStandard"); break; case KeyStroker.KEY_LOCATION_NUMPAD: locStr = LangTool.getString("key.labelLocNumPad"); break; } } return locStr; }
| 9,390
|
private String getLocationDesc(String keyDesc) { String locStr = LangTool.getString("key.labelLocUnknown"); if (mapper.isKeyStrokeDefined(keyDesc)) { switch (mapper.getKeyStroker(keyDesc).getLocation()) { case KeyStroker.KEY_LOCATION_LEFT: locStr = LangTool.getString("key.labelLocLeft"); break; case KeyStroker.KEY_LOCATION_RIGHT: locStr = LangTool.getString("key.labelLocRight"); break; case KeyStroker.KEY_LOCATION_STANDARD: locStr = LangTool.getString("key.labelLocStandard"); break; case KeyStroker.KEY_LOCATION_NUMPAD: locStr = LangTool.getString("key.labelLocNumPad"); break; } } return locStr; }
|
private String getLocationDesc(String keyDesc) { String locStr = LangTool.getString("key.labelLocUnknown"); if (mapper.isKeyStrokeDefined(keyDesc)) { switch (KeyMapper.getKeyStroker(keyDesc).getLocation()) { case KeyStroker.KEY_LOCATION_LEFT: locStr = LangTool.getString("key.labelLocLeft"); break; case KeyStroker.KEY_LOCATION_RIGHT: locStr = LangTool.getString("key.labelLocRight"); break; case KeyStroker.KEY_LOCATION_STANDARD: locStr = LangTool.getString("key.labelLocStandard"); break; case KeyStroker.KEY_LOCATION_NUMPAD: locStr = LangTool.getString("key.labelLocNumPad"); break; } } return locStr; }
| 9,391
|
private boolean isAvailable(KeyEvent ke) { boolean exists = true; if (isLinux) { exists = mapper.isKeyStrokeDefined(ke,isAltGr); } else { exists = mapper.isKeyStrokeDefined(ke); } if (exists) { Object[] args = {getKeyDescription(ke)}; int result = JOptionPane.showConfirmDialog(this, LangTool.messageFormat("messages.mapKeyWarning",args), LangTool.getString("key.labelKeyExists"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if (result == JOptionPane.YES_OPTION) return true; else return false; } return !exists; }
|
private boolean isAvailable(KeyEvent ke) { boolean exists = true; if (isLinux) { exists = KeyMapper.isKeyStrokeDefined(ke,isAltGr); } else { exists = mapper.isKeyStrokeDefined(ke); } if (exists) { Object[] args = {getKeyDescription(ke)}; int result = JOptionPane.showConfirmDialog(this, LangTool.messageFormat("messages.mapKeyWarning",args), LangTool.getString("key.labelKeyExists"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if (result == JOptionPane.YES_OPTION) return true; else return false; } return !exists; }
| 9,392
|
private boolean isAvailable(KeyEvent ke) { boolean exists = true; if (isLinux) { exists = mapper.isKeyStrokeDefined(ke,isAltGr); } else { exists = mapper.isKeyStrokeDefined(ke); } if (exists) { Object[] args = {getKeyDescription(ke)}; int result = JOptionPane.showConfirmDialog(this, LangTool.messageFormat("messages.mapKeyWarning",args), LangTool.getString("key.labelKeyExists"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if (result == JOptionPane.YES_OPTION) return true; else return false; } return !exists; }
|
private boolean isAvailable(KeyEvent ke) { boolean exists = true; if (isLinux) { exists = mapper.isKeyStrokeDefined(ke,isAltGr); } else { exists = KeyMapper.isKeyStrokeDefined(ke); } if (exists) { Object[] args = {getKeyDescription(ke)}; int result = JOptionPane.showConfirmDialog(this, LangTool.messageFormat("messages.mapKeyWarning",args), LangTool.getString("key.labelKeyExists"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if (result == JOptionPane.YES_OPTION) return true; else return false; } return !exists; }
| 9,393
|
void jbInit() throws Exception { // create some reusable borders and layouts BorderLayout borderLayout = new BorderLayout(); mapper = new KeyMapper(); mapper.init(); keyPanel.setLayout(borderLayout); keyPanel.add(createFunctionsPanel(),BorderLayout.WEST); keyPanel.add(createMappingPanel(),BorderLayout.CENTER); // add the panels to our dialog getContentPane().add(keyPanel,BorderLayout.CENTER); getContentPane().add(options, BorderLayout.SOUTH); // add option buttons to options panel addOptButton(LangTool.getString("key.labelDone","Done"),"DONE",options,true); this.setModal(true); this.setTitle(LangTool.getString("key.title")); // pack it and center it on the screen pack(); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = getSize(); if (frameSize.height > screenSize.height) frameSize.height = screenSize.height; if (frameSize.width > screenSize.width) frameSize.width = screenSize.width; setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); // now show the world what we can do show(); }
|
void jbInit() throws Exception { // create some reusable borders and layouts BorderLayout borderLayout = new BorderLayout(); mapper = new KeyMapper(); KeyMapper.init(); keyPanel.setLayout(borderLayout); keyPanel.add(createFunctionsPanel(),BorderLayout.WEST); keyPanel.add(createMappingPanel(),BorderLayout.CENTER); // add the panels to our dialog getContentPane().add(keyPanel,BorderLayout.CENTER); getContentPane().add(options, BorderLayout.SOUTH); // add option buttons to options panel addOptButton(LangTool.getString("key.labelDone","Done"),"DONE",options,true); this.setModal(true); this.setTitle(LangTool.getString("key.title")); // pack it and center it on the screen pack(); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = getSize(); if (frameSize.height > screenSize.height) frameSize.height = screenSize.height; if (frameSize.width > screenSize.width) frameSize.width = screenSize.width; setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); // now show the world what we can do show(); }
| 9,394
|
private void removeIt() { if (!macros && !special) { int index = ((KeyDescription)functions.getSelectedValue()).getIndex(); String function = mnemonicData[index]; if (altKey) function += KeyStroker.altSuffix; mapper.removeKeyStroke(function); setKeyInformation(function); } else { if (macros) { Object o = functions.getSelectedValue(); String name; if (o instanceof Macro) { name = ((Macro)o).getFullName(); } else { name = (String)o; } if (altKey) name += KeyStroker.altSuffix; mapper.removeKeyStroke(name); setKeyInformation(name); } if (special) { String k = ""; k += ((String)functions.getSelectedValue()).charAt(7); if (altKey) k += KeyStroker.altSuffix; mapper.removeKeyStroke(k); setKeyInformation(k); } } mods = true; }
|
private void removeIt() { if (!macros && !special) { int index = ((KeyDescription)functions.getSelectedValue()).getIndex(); String function = mnemonicData[index]; if (altKey) function += KeyStroker.altSuffix; KeyMapper.removeKeyStroke(function); setKeyInformation(function); } else { if (macros) { Object o = functions.getSelectedValue(); String name; if (o instanceof Macro) { name = ((Macro)o).getFullName(); } else { name = (String)o; } if (altKey) name += KeyStroker.altSuffix; mapper.removeKeyStroke(name); setKeyInformation(name); } if (special) { String k = ""; k += ((String)functions.getSelectedValue()).charAt(7); if (altKey) k += KeyStroker.altSuffix; mapper.removeKeyStroke(k); setKeyInformation(k); } } mods = true; }
| 9,395
|
private void removeIt() { if (!macros && !special) { int index = ((KeyDescription)functions.getSelectedValue()).getIndex(); String function = mnemonicData[index]; if (altKey) function += KeyStroker.altSuffix; mapper.removeKeyStroke(function); setKeyInformation(function); } else { if (macros) { Object o = functions.getSelectedValue(); String name; if (o instanceof Macro) { name = ((Macro)o).getFullName(); } else { name = (String)o; } if (altKey) name += KeyStroker.altSuffix; mapper.removeKeyStroke(name); setKeyInformation(name); } if (special) { String k = ""; k += ((String)functions.getSelectedValue()).charAt(7); if (altKey) k += KeyStroker.altSuffix; mapper.removeKeyStroke(k); setKeyInformation(k); } } mods = true; }
|
private void removeIt() { if (!macros && !special) { int index = ((KeyDescription)functions.getSelectedValue()).getIndex(); String function = mnemonicData[index]; if (altKey) function += KeyStroker.altSuffix; mapper.removeKeyStroke(function); setKeyInformation(function); } else { if (macros) { Object o = functions.getSelectedValue(); String name; if (o instanceof Macro) { name = ((Macro)o).getFullName(); } else { name = (String)o; } if (altKey) name += KeyStroker.altSuffix; KeyMapper.removeKeyStroke(name); setKeyInformation(name); } if (special) { String k = ""; k += ((String)functions.getSelectedValue()).charAt(7); if (altKey) k += KeyStroker.altSuffix; mapper.removeKeyStroke(k); setKeyInformation(k); } } mods = true; }
| 9,396
|
private void removeIt() { if (!macros && !special) { int index = ((KeyDescription)functions.getSelectedValue()).getIndex(); String function = mnemonicData[index]; if (altKey) function += KeyStroker.altSuffix; mapper.removeKeyStroke(function); setKeyInformation(function); } else { if (macros) { Object o = functions.getSelectedValue(); String name; if (o instanceof Macro) { name = ((Macro)o).getFullName(); } else { name = (String)o; } if (altKey) name += KeyStroker.altSuffix; mapper.removeKeyStroke(name); setKeyInformation(name); } if (special) { String k = ""; k += ((String)functions.getSelectedValue()).charAt(7); if (altKey) k += KeyStroker.altSuffix; mapper.removeKeyStroke(k); setKeyInformation(k); } } mods = true; }
|
private void removeIt() { if (!macros && !special) { int index = ((KeyDescription)functions.getSelectedValue()).getIndex(); String function = mnemonicData[index]; if (altKey) function += KeyStroker.altSuffix; mapper.removeKeyStroke(function); setKeyInformation(function); } else { if (macros) { Object o = functions.getSelectedValue(); String name; if (o instanceof Macro) { name = ((Macro)o).getFullName(); } else { name = (String)o; } if (altKey) name += KeyStroker.altSuffix; mapper.removeKeyStroke(name); setKeyInformation(name); } if (special) { String k = ""; k += ((String)functions.getSelectedValue()).charAt(7); if (altKey) k += KeyStroker.altSuffix; KeyMapper.removeKeyStroke(k); setKeyInformation(k); } } mods = true; }
| 9,397
|
private void setKeyInformation(String keyDesc) { if (keyDesc.endsWith(KeyStroker.altSuffix)) { keyDesc = keyDesc.substring(0,keyDesc.indexOf(KeyStroker.altSuffix)); } strokeDesc.setText(mapper.getKeyStrokeDesc(keyDesc)); strokeDescAlt.setText(mapper.getKeyStrokeDesc(keyDesc + KeyStroker.altSuffix)); strokeLocation.setText(getLocationDesc(keyDesc)); strokeLocationAlt.setText(getLocationDesc(keyDesc + KeyStroker.altSuffix)); }
|
private void setKeyInformation(String keyDesc) { if (keyDesc.endsWith(KeyStroker.altSuffix)) { keyDesc = keyDesc.substring(0,keyDesc.indexOf(KeyStroker.altSuffix)); } strokeDesc.setText(mapper.getKeyStrokeDesc(keyDesc)); strokeDescAlt.setText(mapper.getKeyStrokeDesc(keyDesc + KeyStroker.altSuffix)); strokeLocation.setText(getLocationDesc(keyDesc)); strokeLocationAlt.setText(getLocationDesc(keyDesc + KeyStroker.altSuffix)); }
| 9,398
|
private void setNewKeyStrokes(KeyEvent ke) { if (!macros && !special) { int index = ((KeyDescription)functions.getSelectedValue()).getIndex(); String stroke = mnemonicData[index]; if (altKey) stroke += KeyStroker.altSuffix; if (isLinux) { mapper.setKeyStroke(stroke,ke,isAltGr); } else { mapper.setKeyStroke(stroke,ke); } setKeyInformation(stroke); } else { if (macros) { Object o = functions.getSelectedValue(); String macro; if (o instanceof Macro) macro = ((Macro)o).getFullName(); else macro = (String)o; if (altKey) macro += KeyStroker.altSuffix; System.out.println(macro); if (isLinux) mapper.setKeyStroke(macro,ke,isAltGr); else mapper.setKeyStroke(macro,ke); setKeyInformation(macro); } if (special) { System.out.println((String)functions.getSelectedValue()); String k = parseSpecialCharacter((String)functions.getSelectedValue()); if (altKey) k += KeyStroker.altSuffix; mapper.removeKeyStroke(k); if (isLinux) { mapper.setKeyStroke(k,ke,isAltGr); } else { mapper.setKeyStroke(k,ke); } setKeyInformation(k); } } mods = true; }
|
private void setNewKeyStrokes(KeyEvent ke) { if (!macros && !special) { int index = ((KeyDescription)functions.getSelectedValue()).getIndex(); String stroke = mnemonicData[index]; if (altKey) stroke += KeyStroker.altSuffix; if (isLinux) { KeyMapper.setKeyStroke(stroke,ke,isAltGr); } else { mapper.setKeyStroke(stroke,ke); } setKeyInformation(stroke); } else { if (macros) { Object o = functions.getSelectedValue(); String macro; if (o instanceof Macro) macro = ((Macro)o).getFullName(); else macro = (String)o; if (altKey) macro += KeyStroker.altSuffix; System.out.println(macro); if (isLinux) mapper.setKeyStroke(macro,ke,isAltGr); else mapper.setKeyStroke(macro,ke); setKeyInformation(macro); } if (special) { System.out.println((String)functions.getSelectedValue()); String k = parseSpecialCharacter((String)functions.getSelectedValue()); if (altKey) k += KeyStroker.altSuffix; mapper.removeKeyStroke(k); if (isLinux) { mapper.setKeyStroke(k,ke,isAltGr); } else { mapper.setKeyStroke(k,ke); } setKeyInformation(k); } } mods = true; }
| 9,399
|
private void setNewKeyStrokes(KeyEvent ke) { if (!macros && !special) { int index = ((KeyDescription)functions.getSelectedValue()).getIndex(); String stroke = mnemonicData[index]; if (altKey) stroke += KeyStroker.altSuffix; if (isLinux) { mapper.setKeyStroke(stroke,ke,isAltGr); } else { mapper.setKeyStroke(stroke,ke); } setKeyInformation(stroke); } else { if (macros) { Object o = functions.getSelectedValue(); String macro; if (o instanceof Macro) macro = ((Macro)o).getFullName(); else macro = (String)o; if (altKey) macro += KeyStroker.altSuffix; System.out.println(macro); if (isLinux) mapper.setKeyStroke(macro,ke,isAltGr); else mapper.setKeyStroke(macro,ke); setKeyInformation(macro); } if (special) { System.out.println((String)functions.getSelectedValue()); String k = parseSpecialCharacter((String)functions.getSelectedValue()); if (altKey) k += KeyStroker.altSuffix; mapper.removeKeyStroke(k); if (isLinux) { mapper.setKeyStroke(k,ke,isAltGr); } else { mapper.setKeyStroke(k,ke); } setKeyInformation(k); } } mods = true; }
|
private void setNewKeyStrokes(KeyEvent ke) { if (!macros && !special) { int index = ((KeyDescription)functions.getSelectedValue()).getIndex(); String stroke = mnemonicData[index]; if (altKey) stroke += KeyStroker.altSuffix; if (isLinux) { mapper.setKeyStroke(stroke,ke,isAltGr); } else { KeyMapper.setKeyStroke(stroke,ke); } setKeyInformation(stroke); } else { if (macros) { Object o = functions.getSelectedValue(); String macro; if (o instanceof Macro) macro = ((Macro)o).getFullName(); else macro = (String)o; if (altKey) macro += KeyStroker.altSuffix; System.out.println(macro); if (isLinux) mapper.setKeyStroke(macro,ke,isAltGr); else mapper.setKeyStroke(macro,ke); setKeyInformation(macro); } if (special) { System.out.println((String)functions.getSelectedValue()); String k = parseSpecialCharacter((String)functions.getSelectedValue()); if (altKey) k += KeyStroker.altSuffix; mapper.removeKeyStroke(k); if (isLinux) { mapper.setKeyStroke(k,ke,isAltGr); } else { mapper.setKeyStroke(k,ke); } setKeyInformation(k); } } mods = true; }
| 9,400
|
private void setNewKeyStrokes(KeyEvent ke) { if (!macros && !special) { int index = ((KeyDescription)functions.getSelectedValue()).getIndex(); String stroke = mnemonicData[index]; if (altKey) stroke += KeyStroker.altSuffix; if (isLinux) { mapper.setKeyStroke(stroke,ke,isAltGr); } else { mapper.setKeyStroke(stroke,ke); } setKeyInformation(stroke); } else { if (macros) { Object o = functions.getSelectedValue(); String macro; if (o instanceof Macro) macro = ((Macro)o).getFullName(); else macro = (String)o; if (altKey) macro += KeyStroker.altSuffix; System.out.println(macro); if (isLinux) mapper.setKeyStroke(macro,ke,isAltGr); else mapper.setKeyStroke(macro,ke); setKeyInformation(macro); } if (special) { System.out.println((String)functions.getSelectedValue()); String k = parseSpecialCharacter((String)functions.getSelectedValue()); if (altKey) k += KeyStroker.altSuffix; mapper.removeKeyStroke(k); if (isLinux) { mapper.setKeyStroke(k,ke,isAltGr); } else { mapper.setKeyStroke(k,ke); } setKeyInformation(k); } } mods = true; }
|
private void setNewKeyStrokes(KeyEvent ke) { if (!macros && !special) { int index = ((KeyDescription)functions.getSelectedValue()).getIndex(); String stroke = mnemonicData[index]; if (altKey) stroke += KeyStroker.altSuffix; if (isLinux) { mapper.setKeyStroke(stroke,ke,isAltGr); } else { mapper.setKeyStroke(stroke,ke); } setKeyInformation(stroke); } else { if (macros) { Object o = functions.getSelectedValue(); String macro; if (o instanceof Macro) macro = ((Macro)o).getFullName(); else macro = (String)o; if (altKey) macro += KeyStroker.altSuffix; System.out.println(macro); if (isLinux) KeyMapper.setKeyStroke(macro,ke,isAltGr); else mapper.setKeyStroke(macro,ke); setKeyInformation(macro); } if (special) { System.out.println((String)functions.getSelectedValue()); String k = parseSpecialCharacter((String)functions.getSelectedValue()); if (altKey) k += KeyStroker.altSuffix; mapper.removeKeyStroke(k); if (isLinux) { mapper.setKeyStroke(k,ke,isAltGr); } else { mapper.setKeyStroke(k,ke); } setKeyInformation(k); } } mods = true; }
| 9,401
|
private void setNewKeyStrokes(KeyEvent ke) { if (!macros && !special) { int index = ((KeyDescription)functions.getSelectedValue()).getIndex(); String stroke = mnemonicData[index]; if (altKey) stroke += KeyStroker.altSuffix; if (isLinux) { mapper.setKeyStroke(stroke,ke,isAltGr); } else { mapper.setKeyStroke(stroke,ke); } setKeyInformation(stroke); } else { if (macros) { Object o = functions.getSelectedValue(); String macro; if (o instanceof Macro) macro = ((Macro)o).getFullName(); else macro = (String)o; if (altKey) macro += KeyStroker.altSuffix; System.out.println(macro); if (isLinux) mapper.setKeyStroke(macro,ke,isAltGr); else mapper.setKeyStroke(macro,ke); setKeyInformation(macro); } if (special) { System.out.println((String)functions.getSelectedValue()); String k = parseSpecialCharacter((String)functions.getSelectedValue()); if (altKey) k += KeyStroker.altSuffix; mapper.removeKeyStroke(k); if (isLinux) { mapper.setKeyStroke(k,ke,isAltGr); } else { mapper.setKeyStroke(k,ke); } setKeyInformation(k); } } mods = true; }
|
private void setNewKeyStrokes(KeyEvent ke) { if (!macros && !special) { int index = ((KeyDescription)functions.getSelectedValue()).getIndex(); String stroke = mnemonicData[index]; if (altKey) stroke += KeyStroker.altSuffix; if (isLinux) { mapper.setKeyStroke(stroke,ke,isAltGr); } else { mapper.setKeyStroke(stroke,ke); } setKeyInformation(stroke); } else { if (macros) { Object o = functions.getSelectedValue(); String macro; if (o instanceof Macro) macro = ((Macro)o).getFullName(); else macro = (String)o; if (altKey) macro += KeyStroker.altSuffix; System.out.println(macro); if (isLinux) mapper.setKeyStroke(macro,ke,isAltGr); else KeyMapper.setKeyStroke(macro,ke); setKeyInformation(macro); } if (special) { System.out.println((String)functions.getSelectedValue()); String k = parseSpecialCharacter((String)functions.getSelectedValue()); if (altKey) k += KeyStroker.altSuffix; mapper.removeKeyStroke(k); if (isLinux) { mapper.setKeyStroke(k,ke,isAltGr); } else { mapper.setKeyStroke(k,ke); } setKeyInformation(k); } } mods = true; }
| 9,402
|
private void setNewKeyStrokes(KeyEvent ke) { if (!macros && !special) { int index = ((KeyDescription)functions.getSelectedValue()).getIndex(); String stroke = mnemonicData[index]; if (altKey) stroke += KeyStroker.altSuffix; if (isLinux) { mapper.setKeyStroke(stroke,ke,isAltGr); } else { mapper.setKeyStroke(stroke,ke); } setKeyInformation(stroke); } else { if (macros) { Object o = functions.getSelectedValue(); String macro; if (o instanceof Macro) macro = ((Macro)o).getFullName(); else macro = (String)o; if (altKey) macro += KeyStroker.altSuffix; System.out.println(macro); if (isLinux) mapper.setKeyStroke(macro,ke,isAltGr); else mapper.setKeyStroke(macro,ke); setKeyInformation(macro); } if (special) { System.out.println((String)functions.getSelectedValue()); String k = parseSpecialCharacter((String)functions.getSelectedValue()); if (altKey) k += KeyStroker.altSuffix; mapper.removeKeyStroke(k); if (isLinux) { mapper.setKeyStroke(k,ke,isAltGr); } else { mapper.setKeyStroke(k,ke); } setKeyInformation(k); } } mods = true; }
|
private void setNewKeyStrokes(KeyEvent ke) { if (!macros && !special) { int index = ((KeyDescription)functions.getSelectedValue()).getIndex(); String stroke = mnemonicData[index]; if (altKey) stroke += KeyStroker.altSuffix; if (isLinux) { mapper.setKeyStroke(stroke,ke,isAltGr); } else { mapper.setKeyStroke(stroke,ke); } setKeyInformation(stroke); } else { if (macros) { Object o = functions.getSelectedValue(); String macro; if (o instanceof Macro) macro = ((Macro)o).getFullName(); else macro = (String)o; if (altKey) macro += KeyStroker.altSuffix; System.out.println(macro); if (isLinux) mapper.setKeyStroke(macro,ke,isAltGr); else mapper.setKeyStroke(macro,ke); setKeyInformation(macro); } if (special) { System.out.println((String)functions.getSelectedValue()); String k = parseSpecialCharacter((String)functions.getSelectedValue()); if (altKey) k += KeyStroker.altSuffix; KeyMapper.removeKeyStroke(k); if (isLinux) { mapper.setKeyStroke(k,ke,isAltGr); } else { mapper.setKeyStroke(k,ke); } setKeyInformation(k); } } mods = true; }
| 9,403
|
private void setNewKeyStrokes(KeyEvent ke) { if (!macros && !special) { int index = ((KeyDescription)functions.getSelectedValue()).getIndex(); String stroke = mnemonicData[index]; if (altKey) stroke += KeyStroker.altSuffix; if (isLinux) { mapper.setKeyStroke(stroke,ke,isAltGr); } else { mapper.setKeyStroke(stroke,ke); } setKeyInformation(stroke); } else { if (macros) { Object o = functions.getSelectedValue(); String macro; if (o instanceof Macro) macro = ((Macro)o).getFullName(); else macro = (String)o; if (altKey) macro += KeyStroker.altSuffix; System.out.println(macro); if (isLinux) mapper.setKeyStroke(macro,ke,isAltGr); else mapper.setKeyStroke(macro,ke); setKeyInformation(macro); } if (special) { System.out.println((String)functions.getSelectedValue()); String k = parseSpecialCharacter((String)functions.getSelectedValue()); if (altKey) k += KeyStroker.altSuffix; mapper.removeKeyStroke(k); if (isLinux) { mapper.setKeyStroke(k,ke,isAltGr); } else { mapper.setKeyStroke(k,ke); } setKeyInformation(k); } } mods = true; }
|
private void setNewKeyStrokes(KeyEvent ke) { if (!macros && !special) { int index = ((KeyDescription)functions.getSelectedValue()).getIndex(); String stroke = mnemonicData[index]; if (altKey) stroke += KeyStroker.altSuffix; if (isLinux) { mapper.setKeyStroke(stroke,ke,isAltGr); } else { mapper.setKeyStroke(stroke,ke); } setKeyInformation(stroke); } else { if (macros) { Object o = functions.getSelectedValue(); String macro; if (o instanceof Macro) macro = ((Macro)o).getFullName(); else macro = (String)o; if (altKey) macro += KeyStroker.altSuffix; System.out.println(macro); if (isLinux) mapper.setKeyStroke(macro,ke,isAltGr); else mapper.setKeyStroke(macro,ke); setKeyInformation(macro); } if (special) { System.out.println((String)functions.getSelectedValue()); String k = parseSpecialCharacter((String)functions.getSelectedValue()); if (altKey) k += KeyStroker.altSuffix; mapper.removeKeyStroke(k); if (isLinux) { KeyMapper.setKeyStroke(k,ke,isAltGr); } else { mapper.setKeyStroke(k,ke); } setKeyInformation(k); } } mods = true; }
| 9,404
|
private void setNewKeyStrokes(KeyEvent ke) { if (!macros && !special) { int index = ((KeyDescription)functions.getSelectedValue()).getIndex(); String stroke = mnemonicData[index]; if (altKey) stroke += KeyStroker.altSuffix; if (isLinux) { mapper.setKeyStroke(stroke,ke,isAltGr); } else { mapper.setKeyStroke(stroke,ke); } setKeyInformation(stroke); } else { if (macros) { Object o = functions.getSelectedValue(); String macro; if (o instanceof Macro) macro = ((Macro)o).getFullName(); else macro = (String)o; if (altKey) macro += KeyStroker.altSuffix; System.out.println(macro); if (isLinux) mapper.setKeyStroke(macro,ke,isAltGr); else mapper.setKeyStroke(macro,ke); setKeyInformation(macro); } if (special) { System.out.println((String)functions.getSelectedValue()); String k = parseSpecialCharacter((String)functions.getSelectedValue()); if (altKey) k += KeyStroker.altSuffix; mapper.removeKeyStroke(k); if (isLinux) { mapper.setKeyStroke(k,ke,isAltGr); } else { mapper.setKeyStroke(k,ke); } setKeyInformation(k); } } mods = true; }
|
private void setNewKeyStrokes(KeyEvent ke) { if (!macros && !special) { int index = ((KeyDescription)functions.getSelectedValue()).getIndex(); String stroke = mnemonicData[index]; if (altKey) stroke += KeyStroker.altSuffix; if (isLinux) { mapper.setKeyStroke(stroke,ke,isAltGr); } else { mapper.setKeyStroke(stroke,ke); } setKeyInformation(stroke); } else { if (macros) { Object o = functions.getSelectedValue(); String macro; if (o instanceof Macro) macro = ((Macro)o).getFullName(); else macro = (String)o; if (altKey) macro += KeyStroker.altSuffix; System.out.println(macro); if (isLinux) mapper.setKeyStroke(macro,ke,isAltGr); else mapper.setKeyStroke(macro,ke); setKeyInformation(macro); } if (special) { System.out.println((String)functions.getSelectedValue()); String k = parseSpecialCharacter((String)functions.getSelectedValue()); if (altKey) k += KeyStroker.altSuffix; mapper.removeKeyStroke(k); if (isLinux) { mapper.setKeyStroke(k,ke,isAltGr); } else { KeyMapper.setKeyStroke(k,ke); } setKeyInformation(k); } } mods = true; }
| 9,405
|
private void doPopup (MouseEvent me) { JMenuItem menuItem; Action action; popup = new JPopupMenu(); final Gui5250 g = this; final int pos = screen.getRowColFromPoint(me.getX(),me.getY()) - (screen.getCols()-1); if (!rubberband.isAreaSelected() && screen.isInField(pos,false) ) { action = new AbstractAction(LangTool.getString("popup.copy")) { public void actionPerformed(ActionEvent e) { screen.copyField(pos); getFocusForMe(); } }; popup.add(action); action = new AbstractAction(LangTool.getString("popup.paste")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(false); getFocusForMe(); } }; popup.add(action); action = new AbstractAction(LangTool.getString("popup.pasteSpecial")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(true); getFocusForMe(); } }; popup.add(action); } else { action = new AbstractAction(LangTool.getString("popup.copy")) { public void actionPerformed(ActionEvent e) { screen.copyMe(); getFocusForMe(); } }; popup.add(action); action = new AbstractAction(LangTool.getString("popup.paste")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(false); getFocusForMe(); } }; popup.add(action); action = new AbstractAction(LangTool.getString("popup.pasteSpecial")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(true); getFocusForMe(); } }; popup.add(action); Rectangle workR = new Rectangle(); if (rubberband.isAreaSelected()) { rubberband.getBoundingArea(workR); // get the width and height int ePos = screen.getRowColFromPoint(workR.width , workR.height ); popup.addSeparator(); menuItem = new JMenuItem(LangTool.getString("popup.selectedColumns") + " " + screen.getCol(ePos)); menuItem.setArmed(false); popup.add(menuItem); menuItem = new JMenuItem(LangTool.getString("popup.selectedRows") + " " + screen.getRow(ePos)); menuItem.setArmed(false); popup.add(menuItem);// JMenu sumMenu = new JMenu(LangTool.getString("popup.macros")); JMenu sumMenu = new JMenu(LangTool.getString("popup.calc")); popup.add(sumMenu); action = new AbstractAction(LangTool.getString("popup.calcGroupCD")) { public void actionPerformed(ActionEvent e) { sumArea(true); } }; sumMenu.add(action); action = new AbstractAction(LangTool.getString("popup.calcGroupDC")) { public void actionPerformed(ActionEvent e) { sumArea(false); } }; sumMenu.add(action); } popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.printScreen")) { public void actionPerformed(ActionEvent e) { screen.printMe(); getFocusForMe(); } }; popup.add(action); popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.systemRequest")) { public void actionPerformed(ActionEvent e) { vt.systemRequest(); } }; popup.add(action); action = new AbstractAction(LangTool.getString("popup.help")) { public void actionPerformed(ActionEvent e) { vt.sendHelpRequest(); } }; popup.add(action); action = new AbstractAction(LangTool.getString("popup.hostPrint")) { public void actionPerformed(ActionEvent e) { vt.hostPrint(1); } }; popup.add(action); if (screen.isMessageWait()) { action = new AbstractAction(LangTool.getString("popup.displayMessages")) { public void actionPerformed(ActionEvent e) { vt.systemRequest('4'); } }; popup.add(action); } popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.hexMap")) { public void actionPerformed(ActionEvent e) { showHexMap(); } }; popup.add(action); action = new AbstractAction(LangTool.getString("popup.mapKeys")) { public void actionPerformed(ActionEvent e) { mapMeKeys(); } }; popup.add(action); action = new AbstractAction(LangTool.getString("popup.settings")) { public void actionPerformed(ActionEvent e) { doAttributes(); } }; popup.add(action); popup.addSeparator(); JMenu macMenu = new JMenu(LangTool.getString("popup.macros")); if (recording) { action = new AbstractAction(LangTool.getString("popup.stop")) { public void actionPerformed(ActionEvent e) { stopRecordingMe(); getFocusForMe(); } }; } else { action = new AbstractAction(LangTool.getString("popup.record")) { public void actionPerformed(ActionEvent e) { startRecordingMe(); } }; } macMenu.add(action); if (macros.isMacrosExist()) { macMenu.addSeparator(); String[] macrosList = macros.getMacroList(); for (int x = 0; x < macrosList.length; x++) { action = new AbstractAction(macrosList[x]) { public void actionPerformed(ActionEvent e) { executeMeMacro(e); } }; macMenu.add(action); } } popup.add(macMenu); popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.xtfrFile")) { public void actionPerformed(ActionEvent e) { doMeTransfer(); } }; popup.add(action); JMenu sendMenu = new JMenu(LangTool.getString("popup.send")); popup.add(sendMenu); action = new AbstractAction(LangTool.getString("popup.email")) { public void actionPerformed(ActionEvent e) { sendScreenEMail(); } }; sendMenu.add(action); action = new AbstractAction(LangTool.getString("popup.file")) { public void actionPerformed(ActionEvent e) { sendMeToFile(); } }; sendMenu.add(action); popup.addSeparator(); if (vt.isConnected()) { action = new AbstractAction(LangTool.getString("popup.disconnect")) { public void actionPerformed(ActionEvent e) { vt.disconnect(); getFocusForMe(); } }; } else { action = new AbstractAction(LangTool.getString("popup.connect")) { public void actionPerformed(ActionEvent e) { vt.connect(); getFocusForMe(); } }; } popup.add(action); } action = new AbstractAction(LangTool.getString("popup.close")) { public void actionPerformed(ActionEvent e) { closeSession(); } }; popup.add(action); popup.show(me.getComponent(), me.getX(),me.getY()); }
|
private void doPopup (MouseEvent me) { JMenuItem menuItem; Action action; popup = new JPopupMenu(); final Gui5250 g = this; final int pos = screen.getRowColFromPoint(me.getX(),me.getY()) - (screen.getCols()-1); if (!rubberband.isAreaSelected() && screen.isInField(pos,false) ) { action = new AbstractAction(LangTool.getString("popup.copy")) { public void actionPerformed(ActionEvent e) { screen.copyField(pos); getFocusForMe(); } }; popup.add(action); action = new AbstractAction(LangTool.getString("popup.paste")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(false); getFocusForMe(); } }; popup.add(action); action = new AbstractAction(LangTool.getString("popup.pasteSpecial")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(true); getFocusForMe(); } }; popup.add(action); } else { action = new AbstractAction(LangTool.getString("popup.copy")) { public void actionPerformed(ActionEvent e) { screen.copyMe(); getFocusForMe(); } }; popup.add(action); action = new AbstractAction(LangTool.getString("popup.paste")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(false); getFocusForMe(); } }; popup.add(action); action = new AbstractAction(LangTool.getString("popup.pasteSpecial")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(true); getFocusForMe(); } }; popup.add(action); Rectangle workR = new Rectangle(); if (rubberband.isAreaSelected()) { rubberband.getBoundingArea(workR); // get the width and height int ePos = screen.getRowColFromPoint(workR.width , workR.height ); popup.addSeparator(); menuItem = new JMenuItem(LangTool.getString("popup.selectedColumns") + " " + screen.getCol(ePos)); menuItem.setArmed(false); popup.add(menuItem); menuItem = new JMenuItem(LangTool.getString("popup.selectedRows") + " " + screen.getRow(ePos)); menuItem.setArmed(false); popup.add(menuItem);// JMenu sumMenu = new JMenu(LangTool.getString("popup.macros")); JMenu sumMenu = new JMenu(LangTool.getString("popup.calc")); popup.add(sumMenu); action = new AbstractAction(LangTool.getString("popup.calcGroupCD")) { public void actionPerformed(ActionEvent e) { sumArea(true); } }; sumMenu.add(action); action = new AbstractAction(LangTool.getString("popup.calcGroupDC")) { public void actionPerformed(ActionEvent e) { sumArea(false); } }; sumMenu.add(action); } popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.printScreen")) { public void actionPerformed(ActionEvent e) { screen.printMe(); getFocusForMe(); } }; popup.add(action); popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.systemRequest")) { public void actionPerformed(ActionEvent e) { vt.systemRequest(); } }; popup.add(action); action = new AbstractAction(LangTool.getString("popup.help")) { public void actionPerformed(ActionEvent e) { vt.sendHelpRequest(); } }; popup.add(action); action = new AbstractAction(LangTool.getString("popup.hostPrint")) { public void actionPerformed(ActionEvent e) { vt.hostPrint(1); } }; popup.add(action); if (screen.isMessageWait()) { action = new AbstractAction(LangTool.getString("popup.displayMessages")) { public void actionPerformed(ActionEvent e) { vt.systemRequest('4'); } }; popup.add(action); } popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.hexMap")) { public void actionPerformed(ActionEvent e) { showHexMap(); } }; popup.add(action); action = new AbstractAction(LangTool.getString("popup.mapKeys")) { public void actionPerformed(ActionEvent e) { mapMeKeys(); } }; popup.add(action); action = new AbstractAction(LangTool.getString("popup.settings")) { public void actionPerformed(ActionEvent e) { doAttributes(); } }; popup.add(action); popup.addSeparator(); JMenu macMenu = new JMenu(LangTool.getString("popup.macros")); if (recording) { action = new AbstractAction(LangTool.getString("popup.stop")) { public void actionPerformed(ActionEvent e) { stopRecordingMe(); getFocusForMe(); } }; } else { action = new AbstractAction(LangTool.getString("popup.record")) { public void actionPerformed(ActionEvent e) { startRecordingMe(); } }; } macMenu.add(action); if (macros.isMacrosExist()) { macMenu.addSeparator(); String[] macrosList = macros.getMacroList(); for (int x = 0; x < macrosList.length; x++) { action = new AbstractAction(macrosList[x]) { public void actionPerformed(ActionEvent e) { executeMeMacro(e); } }; macMenu.add(action); } } popup.add(macMenu); popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.xtfrFile")) { public void actionPerformed(ActionEvent e) { doMeTransfer(); } }; popup.add(action); JMenu sendMenu = new JMenu(LangTool.getString("popup.send")); popup.add(sendMenu); action = new AbstractAction(LangTool.getString("popup.email")) { public void actionPerformed(ActionEvent e) { sendScreenEMail(); } }; sendMenu.add(action); action = new AbstractAction(LangTool.getString("popup.file")) { public void actionPerformed(ActionEvent e) { sendMeToFile(); } }; sendMenu.add(action); popup.addSeparator(); if (vt.isConnected()) { action = new AbstractAction(LangTool.getString("popup.disconnect")) { public void actionPerformed(ActionEvent e) { vt.disconnect(); getFocusForMe(); } }; } else { action = new AbstractAction(LangTool.getString("popup.connect")) { public void actionPerformed(ActionEvent e) { vt.connect(); getFocusForMe(); } }; } popup.add(action); } action = new AbstractAction(LangTool.getString("popup.close")) { public void actionPerformed(ActionEvent e) { closeSession(); } }; popup.add(action); popup.show(me.getComponent(), me.getX(),me.getY()); }
| 9,406
|
private void doPopup (MouseEvent me) { JMenuItem menuItem; Action action; popup = new JPopupMenu(); final Gui5250 g = this; final int pos = screen.getRowColFromPoint(me.getX(),me.getY()) - (screen.getCols()-1); if (!rubberband.isAreaSelected() && screen.isInField(pos,false) ) { action = new AbstractAction(LangTool.getString("popup.copy")) { public void actionPerformed(ActionEvent e) { screen.copyField(pos); getFocusForMe(); } }; popup.add(action); action = new AbstractAction(LangTool.getString("popup.paste")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(false); getFocusForMe(); } }; popup.add(action); action = new AbstractAction(LangTool.getString("popup.pasteSpecial")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(true); getFocusForMe(); } }; popup.add(action); } else { action = new AbstractAction(LangTool.getString("popup.copy")) { public void actionPerformed(ActionEvent e) { screen.copyMe(); getFocusForMe(); } }; popup.add(action); action = new AbstractAction(LangTool.getString("popup.paste")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(false); getFocusForMe(); } }; popup.add(action); action = new AbstractAction(LangTool.getString("popup.pasteSpecial")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(true); getFocusForMe(); } }; popup.add(action); Rectangle workR = new Rectangle(); if (rubberband.isAreaSelected()) { rubberband.getBoundingArea(workR); // get the width and height int ePos = screen.getRowColFromPoint(workR.width , workR.height ); popup.addSeparator(); menuItem = new JMenuItem(LangTool.getString("popup.selectedColumns") + " " + screen.getCol(ePos)); menuItem.setArmed(false); popup.add(menuItem); menuItem = new JMenuItem(LangTool.getString("popup.selectedRows") + " " + screen.getRow(ePos)); menuItem.setArmed(false); popup.add(menuItem);// JMenu sumMenu = new JMenu(LangTool.getString("popup.macros")); JMenu sumMenu = new JMenu(LangTool.getString("popup.calc")); popup.add(sumMenu); action = new AbstractAction(LangTool.getString("popup.calcGroupCD")) { public void actionPerformed(ActionEvent e) { sumArea(true); } }; sumMenu.add(action); action = new AbstractAction(LangTool.getString("popup.calcGroupDC")) { public void actionPerformed(ActionEvent e) { sumArea(false); } }; sumMenu.add(action); } popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.printScreen")) { public void actionPerformed(ActionEvent e) { screen.printMe(); getFocusForMe(); } }; popup.add(action); popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.systemRequest")) { public void actionPerformed(ActionEvent e) { vt.systemRequest(); } }; popup.add(action); action = new AbstractAction(LangTool.getString("popup.help")) { public void actionPerformed(ActionEvent e) { vt.sendHelpRequest(); } }; popup.add(action); action = new AbstractAction(LangTool.getString("popup.hostPrint")) { public void actionPerformed(ActionEvent e) { vt.hostPrint(1); } }; popup.add(action); if (screen.isMessageWait()) { action = new AbstractAction(LangTool.getString("popup.displayMessages")) { public void actionPerformed(ActionEvent e) { vt.systemRequest('4'); } }; popup.add(action); } popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.hexMap")) { public void actionPerformed(ActionEvent e) { showHexMap(); } }; popup.add(action); action = new AbstractAction(LangTool.getString("popup.mapKeys")) { public void actionPerformed(ActionEvent e) { mapMeKeys(); } }; popup.add(action); action = new AbstractAction(LangTool.getString("popup.settings")) { public void actionPerformed(ActionEvent e) { doAttributes(); } }; popup.add(action); popup.addSeparator(); JMenu macMenu = new JMenu(LangTool.getString("popup.macros")); if (recording) { action = new AbstractAction(LangTool.getString("popup.stop")) { public void actionPerformed(ActionEvent e) { stopRecordingMe(); getFocusForMe(); } }; } else { action = new AbstractAction(LangTool.getString("popup.record")) { public void actionPerformed(ActionEvent e) { startRecordingMe(); } }; } macMenu.add(action); if (macros.isMacrosExist()) { macMenu.addSeparator(); String[] macrosList = macros.getMacroList(); for (int x = 0; x < macrosList.length; x++) { action = new AbstractAction(macrosList[x]) { public void actionPerformed(ActionEvent e) { executeMeMacro(e); } }; macMenu.add(action); } } popup.add(macMenu); popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.xtfrFile")) { public void actionPerformed(ActionEvent e) { doMeTransfer(); } }; popup.add(action); JMenu sendMenu = new JMenu(LangTool.getString("popup.send")); popup.add(sendMenu); action = new AbstractAction(LangTool.getString("popup.email")) { public void actionPerformed(ActionEvent e) { sendScreenEMail(); } }; sendMenu.add(action); action = new AbstractAction(LangTool.getString("popup.file")) { public void actionPerformed(ActionEvent e) { sendMeToFile(); } }; sendMenu.add(action); popup.addSeparator(); if (vt.isConnected()) { action = new AbstractAction(LangTool.getString("popup.disconnect")) { public void actionPerformed(ActionEvent e) { vt.disconnect(); getFocusForMe(); } }; } else { action = new AbstractAction(LangTool.getString("popup.connect")) { public void actionPerformed(ActionEvent e) { vt.connect(); getFocusForMe(); } }; } popup.add(action); } action = new AbstractAction(LangTool.getString("popup.close")) { public void actionPerformed(ActionEvent e) { closeSession(); } }; popup.add(action); popup.show(me.getComponent(), me.getX(),me.getY()); }
|
private void doPopup (MouseEvent me) { JMenuItem menuItem; Action action; popup = new JPopupMenu(); final Gui5250 g = this; final int pos = screen.getRowColFromPoint(me.getX(),me.getY()) - (screen.getCols()-1); if (!rubberband.isAreaSelected() && screen.isInField(pos,false) ) { action = new AbstractAction(LangTool.getString("popup.copy")) { public void actionPerformed(ActionEvent e) { screen.copyField(pos); getFocusForMe(); } }; kbMenu.add(action); action = new AbstractAction(LangTool.getString("popup.paste")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(false); getFocusForMe(); } }; kbMenu.add(action); action = new AbstractAction(LangTool.getString("popup.pasteSpecial")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(true); getFocusForMe(); } }; kbMenu.add(action); } else { action = new AbstractAction(LangTool.getString("popup.copy")) { public void actionPerformed(ActionEvent e) { screen.copyMe(); getFocusForMe(); } }; kbMenu.add(action); action = new AbstractAction(LangTool.getString("popup.paste")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(false); getFocusForMe(); } }; kbMenu.add(action); action = new AbstractAction(LangTool.getString("popup.pasteSpecial")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(true); getFocusForMe(); } }; kbMenu.add(action); Rectangle workR = new Rectangle(); if (rubberband.isAreaSelected()) { rubberband.getBoundingArea(workR); // get the width and height int ePos = screen.getRowColFromPoint(workR.width , workR.height ); popup.addSeparator(); menuItem = new JMenuItem(LangTool.getString("popup.selectedColumns") + " " + screen.getCol(ePos)); menuItem.setArmed(false); popup.add(menuItem); menuItem = new JMenuItem(LangTool.getString("popup.selectedRows") + " " + screen.getRow(ePos)); menuItem.setArmed(false); popup.add(menuItem);// JMenu sumMenu = new JMenu(LangTool.getString("popup.macros")); JMenu sumMenu = new JMenu(LangTool.getString("popup.calc")); popup.add(sumMenu); action = new AbstractAction(LangTool.getString("popup.calcGroupCD")) { public void actionPerformed(ActionEvent e) { sumArea(true); } }; sumMenu.add(action); action = new AbstractAction(LangTool.getString("popup.calcGroupDC")) { public void actionPerformed(ActionEvent e) { sumArea(false); } }; sumMenu.add(action); } popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.printScreen")) { public void actionPerformed(ActionEvent e) { screen.printMe(); getFocusForMe(); } }; kbMenu.add(action); popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.systemRequest")) { public void actionPerformed(ActionEvent e) { vt.systemRequest(); } }; kbMenu.add(action); action = new AbstractAction(LangTool.getString("popup.help")) { public void actionPerformed(ActionEvent e) { vt.sendHelpRequest(); } }; kbMenu.add(action); action = new AbstractAction(LangTool.getString("popup.hostPrint")) { public void actionPerformed(ActionEvent e) { vt.hostPrint(1); } }; kbMenu.add(action); if (screen.isMessageWait()) { action = new AbstractAction(LangTool.getString("popup.displayMessages")) { public void actionPerformed(ActionEvent e) { vt.systemRequest('4'); } }; kbMenu.add(action); } popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.hexMap")) { public void actionPerformed(ActionEvent e) { showHexMap(); } }; kbMenu.add(action); action = new AbstractAction(LangTool.getString("popup.mapKeys")) { public void actionPerformed(ActionEvent e) { mapMeKeys(); } }; kbMenu.add(action); action = new AbstractAction(LangTool.getString("popup.settings")) { public void actionPerformed(ActionEvent e) { doAttributes(); } }; kbMenu.add(action); popup.addSeparator(); JMenu macMenu = new JMenu(LangTool.getString("popup.macros")); if (recording) { action = new AbstractAction(LangTool.getString("popup.stop")) { public void actionPerformed(ActionEvent e) { stopRecordingMe(); getFocusForMe(); } }; } else { action = new AbstractAction(LangTool.getString("popup.record")) { public void actionPerformed(ActionEvent e) { startRecordingMe(); } }; } macMenu.add(action); if (macros.isMacrosExist()) { macMenu.addSeparator(); String[] macrosList = macros.getMacroList(); for (int x = 0; x < macrosList.length; x++) { action = new AbstractAction(macrosList[x]) { public void actionPerformed(ActionEvent e) { executeMeMacro(e); } }; macMenu.add(action); } } popup.add(macMenu); popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.xtfrFile")) { public void actionPerformed(ActionEvent e) { doMeTransfer(); } }; kbMenu.add(action); JMenu sendMenu = new JMenu(LangTool.getString("popup.send")); popup.add(sendMenu); action = new AbstractAction(LangTool.getString("popup.email")) { public void actionPerformed(ActionEvent e) { sendScreenEMail(); } }; sendMenu.add(action); action = new AbstractAction(LangTool.getString("popup.file")) { public void actionPerformed(ActionEvent e) { sendMeToFile(); } }; sendMenu.add(action); popup.addSeparator(); if (vt.isConnected()) { action = new AbstractAction(LangTool.getString("popup.disconnect")) { public void actionPerformed(ActionEvent e) { vt.disconnect(); getFocusForMe(); } }; } else { action = new AbstractAction(LangTool.getString("popup.connect")) { public void actionPerformed(ActionEvent e) { vt.connect(); getFocusForMe(); } }; } kbMenu.add(action); } action = new AbstractAction(LangTool.getString("popup.close")) { public void actionPerformed(ActionEvent e) { closeSession(); } }; kbMenu.add(action); popup.show(me.getComponent(), me.getX(),me.getY()); }
| 9,407
|
public void actionPerformed(ActionEvent e) { vt.systemRequest(); }
|
public void actionPerformed(ActionEvent e) { mapMeKeys(); }
| 9,408
|
public void actionPerformed(ActionEvent e) { vt.sendHelpRequest(); }
|
public void actionPerformed(ActionEvent e) { screen.sendKeys("[attn]"); }
| 9,409
|
public void actionPerformed(ActionEvent e) { vt.hostPrint(1); }
|
public void actionPerformed(ActionEvent e) { screen.sendKeys("[reset]"); }
| 9,410
|
public void actionPerformed(ActionEvent e) { vt.systemRequest('4'); }
|
public void actionPerformed(ActionEvent e) { vt.systemRequest('4'); }
| 9,411
|
public void actionPerformed(ActionEvent e) { showHexMap(); }
|
public void actionPerformed(ActionEvent e) { showHexMap(); }
| 9,412
|
public void actionPerformed(ActionEvent e) { mapMeKeys(); }
|
public void actionPerformed(ActionEvent e) { screen.sendKeys("[dupfield]"); }
| 9,413
|
public void actionPerformed(ActionEvent e) { doAttributes(); }
|
public void actionPerformed(ActionEvent e) { screen.sendKeys("[help]"); }
| 9,414
|
public void actionPerformed(ActionEvent e) { stopRecordingMe(); getFocusForMe(); }
|
public void actionPerformed(ActionEvent e) { stopRecordingMe(); getFocusForMe(); }
| 9,415
|
public void actionPerformed(ActionEvent e) { startRecordingMe(); }
|
public void actionPerformed(ActionEvent e) { startRecordingMe(); }
| 9,416
|
public void actionPerformed(ActionEvent e) { executeMeMacro(e); }
|
public void actionPerformed(ActionEvent e) { executeMeMacro(e); }
| 9,417
|
public void actionPerformed(ActionEvent e) { doMeTransfer(); }
|
public void actionPerformed(ActionEvent e) { screen.sendKeys("[newline]"); }
| 9,418
|
public void actionPerformed(ActionEvent e) { sendScreenEMail(); }
|
public void actionPerformed(ActionEvent e) { vt.hostPrint(1); }
| 9,419
|
public void actionPerformed(ActionEvent e) { sendMeToFile(); }
|
public void actionPerformed(ActionEvent e) { sendMeToFile(); }
| 9,420
|
public void actionPerformed(ActionEvent e) { vt.disconnect(); getFocusForMe(); }
|
public void actionPerformed(ActionEvent e) { vt.disconnect(); getFocusForMe(); }
| 9,421
|
public void actionPerformed(ActionEvent e) { vt.connect(); getFocusForMe(); }
|
public void actionPerformed(ActionEvent e) { vt.connect(); getFocusForMe(); }
| 9,422
|
public void actionPerformed(ActionEvent e) { closeSession(); }
|
public void actionPerformed(ActionEvent e) { closeSession(); }
| 9,423
|
private void processVTKeyReleased(KeyEvent e){ if (isLinux && e.getKeyCode() == e.VK_ALT_GRAPH) { isAltGr = false; }// displayInfo(e,"Released " + keyProcessed); if (keyProcessed || e.isConsumed()) return; String s = keyMap.getKeyStrokeText(e); if (s != null) { if (s.startsWith("[")) { screen.sendKeys(s); if (recording) recordBuffer.append(s); } else executeMeMacro(s); } else keyProcessed = false; if (keyProcessed) e.consume(); }
|
private void processVTKeyReleased(KeyEvent e){ if (isLinux && e.getKeyCode() == e.VK_ALT_GRAPH) { isAltGr = false; }// displayInfo(e,"Released " + keyProcessed); if (Character.isISOControl(e.getKeyChar()) || keyProcessed || e.isConsumed() ) return; String s = keyMap.getKeyStrokeText(e); if (s != null) { if (s.startsWith("[")) { screen.sendKeys(s); if (recording) recordBuffer.append(s); } else executeMeMacro(s); } else keyProcessed = false; if (keyProcessed) e.consume(); }
| 9,424
|
private void processVTKeyTyped(KeyEvent e){ char kc = e.getKeyChar();// displayInfo(e,"Typed processed " + keyProcessed); if (Character.isISOControl(kc) || keyProcessed)// if (keyProcessed) return;// displayInfo(e,"Typed "); String s = "";// if (isLinux) {// lastKeyStroke = keyMap.getKeyStrokeText(e,isAltGr);// System.out.println("last " + lastKeyStroke);// if (lastKeyStroke != null) {// s = lastKeyStroke;// System.out.println("last " + s);// }// else// s +=kc;// }// else s += kc; if (!vt.isConnected() ) return; screen.sendKeys(s); if (recording) recordBuffer.append(s); keyProcessed = true; e.consume(); }
|
private void processVTKeyTyped(KeyEvent e){ char kc = e.getKeyChar();// displayInfo(e,"Typed processed " + keyProcessed); if (Character.isISOControl(kc) || keyProcessed)// if (keyProcessed) return;// displayInfo(e,"Typed "); String s = "";// if (isLinux) {// lastKeyStroke = keyMap.getKeyStrokeText(e,isAltGr);// System.out.println("last " + lastKeyStroke);// if (lastKeyStroke != null) {// s = lastKeyStroke;// System.out.println("last " + s);// }// else// s +=kc;// }// else s += kc; if (!vt.isConnected() ) return; screen.sendKeys(s); if (recording) recordBuffer.append(s); keyProcessed = true; e.consume(); }
| 9,425
|
public AttributeSet getAttributes() { // FIXME: Implement this multiplexing thing. return super.getAttributes(); }
|
public AttributeSet getAttributes() { // FIXME: Implement this multiplexing thing. if (attributes == null) { attributes = getStyleSheet().getViewAttributes(this); } return attributes; }
| 9,427
|
public void paintIcon(Component c, Graphics g, int x, int y) { boolean focus = false; if (c != null) focus = c.hasFocus(); // TODO: pick up the colors from the look and feel // draw the outline g.setColor(Color.black); g.drawLine(x + 1, y, x + 13, y); g.drawLine(x + 14, y + 1, x + 14, y + 7); g.drawLine(x + 14, y + 8, x + 7, y + 15); g.drawLine(x + 6, y + 14, x, y + 8); g.drawLine(x, y + 7, x, y + 1); // fill the icon g.setColor(focus ? new Color(153, 153, 204) : new Color(204, 204, 204)); // medium g.fillRect(x + 2, y + 2, 12, 7); g.drawLine(x + 2, y + 9, x + 12, y + 9); g.drawLine(x + 3, y + 10, x + 11, y + 10); g.drawLine(x + 4, y + 11, x + 10, y + 11); g.drawLine(x + 5, y + 12, x + 9, y + 12); g.drawLine(x + 6, y + 13, x + 8, y + 13); g.drawLine(x + 7, y + 14, x + 7, y + 14); // draw highlights g.setColor(focus ? new Color(204, 204, 255) : new Color(255, 255, 255)); // light g.drawLine(x + 1, y + 1, x + 13, y + 1); g.drawLine(x + 1, y + 2, x + 1, y + 8); g.drawLine(x + 2, y + 2, x + 2, y + 2); g.drawLine(x + 6, y + 2, x + 6, y + 2); g.drawLine(x + 10, y + 2, x + 10, y + 2); g.drawLine(x + 4, y + 4, x + 4, y + 4); g.drawLine(x + 8, y + 4, x + 8, y + 4); g.drawLine(x + 2, y + 6, x + 2, y + 6); g.drawLine(x + 6, y + 6, x + 6, y + 6); g.drawLine(x + 10, y + 6, x + 10, y + 6); // draw dots g.setColor(focus ? new Color(102, 102, 153) : Color.black); // dark g.drawLine(x + 3, y + 3, x + 3, y + 3); g.drawLine(x + 7, y + 3, x + 7, y + 3); g.drawLine(x + 11, y + 3, x + 11, y + 3); g.drawLine(x + 5, y + 5, x + 5, y + 5); g.drawLine(x + 9, y + 5, x + 9, y + 5); g.drawLine(x + 3, y + 7, x + 3, y + 7); g.drawLine(x + 7, y + 7, x + 7, y + 7); g.drawLine(x + 11, y + 7, x + 11, y + 7); }
|
} } } } public} void} paintIcon(Component} c,} Graphics} g,} int} x,} int} y)} } } } } {} } } } } } boolean} focus} =} false;} } } } } } if} (c} !=} null)} } } } } } } } } focus} =} c.hasFocus();} } } } } } } } } } //} TODO:} pick} up} the} colors} from} the} look} and} feel} } } } } } } } } } } } //} draw} the} outline} } } } } } g.setColor(Color.black);} } } } } } g.drawLine(x} +} 1,} y,} x} +} 13,} y);} } } } } } g.drawLine(x} +} 14,} y} +} 1,} x} +} 14,} y} +} 7);} } } } } } g.drawLine(x} +} 14,} y} +} 8,} x} +} 7,} y} +} 15);} } } } } } g.drawLine(x} +} 6,} y} +} 14,} x,} y} +} 8);} } } } } } g.drawLine(x,} y} +} 7,} x,} y} +} 1);} } } } } } } } } } } } //} fill} the} icon} } } } } } g.setColor(focus} ?} new} Color(153,} 153,} 204)} :} new} Color(204,} 204,} 204));} } //} medium} } } } } } g.fillRect(x} +} 2,} y} +} 2,} 12,} 7);} } } } } } g.drawLine(x} +} 2,} y} +} 9,} x} +} 12,} y} +} 9);} } } } } } g.drawLine(x} +} 3,} y} +} 10,} x} +} 11,} y} +} 10);} } } } } } g.drawLine(x} +} 4,} y} +} 11,} x} +} 10,} y} +} 11);} } } } } } g.drawLine(x} +} 5,} y} +} 12,} x} +} 9,} y} +} 12);} } } } } } g.drawLine(x} +} 6,} y} +} 13,} x} +} 8,} y} +} 13);} } } } } } g.drawLine(x} +} 7,} y} +} 14,} x} +} 7,} y} +} 14);} } } } } } } } } } } } //} draw} highlights} } } } } } g.setColor(focus} ?} new} Color(204,} 204,} 255)} :} new} Color(255,} 255,} 255));} } //} light} } } } } } g.drawLine(x} +} 1,} y} +} 1,} x} +} 13,} y} +} 1);} } } } } } g.drawLine(x} +} 1,} y} +} 2,} x} +} 1,} y} +} 8);} } } } } } g.drawLine(x} +} 2,} y} +} 2,} x} +} 2,} y} +} 2);} } } } } } g.drawLine(x} +} 6,} y} +} 2,} x} +} 6,} y} +} 2);} } } } } } g.drawLine(x} +} 10,} y} +} 2,} x} +} 10,} y} +} 2);} } } } } } g.drawLine(x} +} 4,} y} +} 4,} x} +} 4,} y} +} 4);} } } } } } g.drawLine(x} +} 8,} y} +} 4,} x} +} 8,} y} +} 4);} } } } } } g.drawLine(x} +} 2,} y} +} 6,} x} +} 2,} y} +} 6);} } } } } } g.drawLine(x} +} 6,} y} +} 6,} x} +} 6,} y} +} 6);} } } } } } g.drawLine(x} +} 10,} y} +} 6,} x} +} 10,} y} +} 6);} } } } } } //} draw} dots} } } } } } g.setColor(focus} ?} new} Color(102,} 102,} 153)} :} Color.black);} } } } } } } } } } } } } } } } } //} dark} } } } } } g.drawLine(x} +} 3,} y} +} 3,} x} +} 3,} y} +} 3);} } } } } } g.drawLine(x} +} 7,} y} +} 3,} x} +} 7,} y} +} 3);} } } } } } g.drawLine(x} +} 11,} y} +} 3,} x} +} 11,} y} +} 3);} } } } } } g.drawLine(x} +} 5,} y} +} 5,} x} +} 5,} y} +} 5);} } } } } } g.drawLine(x} +} 9,} y} +} 5,} x} +} 9,} y} +} 5);} } } } } } g.drawLine(x} +} 3,} y} +} 7,} x} +} 3,} y} +} 7);} } } } } } g.drawLine(x} +} 7,} y} +} 7,} x} +} 7,} y} +} 7);} } } } } } g.drawLine(x} +} 11,} y} +} 7,} x} +} 11,} y} +} 7);} } } } }} } } } } } } }
| 9,428
|
public void paintIcon(Component c, Graphics g, int x, int y) { boolean focus = false; if (c != null) focus = c.hasFocus(); // TODO: pick up the colors from the look and feel // draw the outline g.setColor(Color.black); g.drawLine(x + 1, y, x + 13, y); g.drawLine(x + 14, y + 1, x + 14, y + 7); g.drawLine(x + 14, y + 8, x + 7, y + 15); g.drawLine(x + 6, y + 14, x, y + 8); g.drawLine(x, y + 7, x, y + 1); // fill the icon g.setColor(focus ? new Color(153, 153, 204) : new Color(204, 204, 204)); // medium g.fillRect(x + 2, y + 2, 12, 7); g.drawLine(x + 2, y + 9, x + 12, y + 9); g.drawLine(x + 3, y + 10, x + 11, y + 10); g.drawLine(x + 4, y + 11, x + 10, y + 11); g.drawLine(x + 5, y + 12, x + 9, y + 12); g.drawLine(x + 6, y + 13, x + 8, y + 13); g.drawLine(x + 7, y + 14, x + 7, y + 14); // draw highlights g.setColor(focus ? new Color(204, 204, 255) : new Color(255, 255, 255)); // light g.drawLine(x + 1, y + 1, x + 13, y + 1); g.drawLine(x + 1, y + 2, x + 1, y + 8); g.drawLine(x + 2, y + 2, x + 2, y + 2); g.drawLine(x + 6, y + 2, x + 6, y + 2); g.drawLine(x + 10, y + 2, x + 10, y + 2); g.drawLine(x + 4, y + 4, x + 4, y + 4); g.drawLine(x + 8, y + 4, x + 8, y + 4); g.drawLine(x + 2, y + 6, x + 2, y + 6); g.drawLine(x + 6, y + 6, x + 6, y + 6); g.drawLine(x + 10, y + 6, x + 10, y + 6); // draw dots g.setColor(focus ? new Color(102, 102, 153) : Color.black); // dark g.drawLine(x + 3, y + 3, x + 3, y + 3); g.drawLine(x + 7, y + 3, x + 7, y + 3); g.drawLine(x + 11, y + 3, x + 11, y + 3); g.drawLine(x + 5, y + 5, x + 5, y + 5); g.drawLine(x + 9, y + 5, x + 9, y + 5); g.drawLine(x + 3, y + 7, x + 3, y + 7); g.drawLine(x + 7, y + 7, x + 7, y + 7); g.drawLine(x + 11, y + 7, x + 11, y + 7); }
|
public void paintIcon(Component c, Graphics g, int x, int y) { boolean focus = false; if (c != null) focus = c.hasFocus(); // TODO: pick up the colors from the look and feel // draw the outline if (enabled) g.setColor(MetalLookAndFeel.getBlack()); else g.setColor(MetalLookAndFeel.getControlDarkShadow()); g.drawLine(x + 1, y, x + 13, y); g.drawLine(x + 14, y + 1, x + 14, y + 7); g.drawLine(x + 14, y + 8, x + 7, y + 15); g.drawLine(x + 6, y + 14, x, y + 8); g.drawLine(x, y + 7, x, y + 1); // fill the icon g.setColor(focus ? new Color(153, 153, 204) : new Color(204, 204, 204)); // medium g.fillRect(x + 2, y + 2, 12, 7); g.drawLine(x + 2, y + 9, x + 12, y + 9); g.drawLine(x + 3, y + 10, x + 11, y + 10); g.drawLine(x + 4, y + 11, x + 10, y + 11); g.drawLine(x + 5, y + 12, x + 9, y + 12); g.drawLine(x + 6, y + 13, x + 8, y + 13); g.drawLine(x + 7, y + 14, x + 7, y + 14); // draw highlights g.setColor(focus ? new Color(204, 204, 255) : new Color(255, 255, 255)); // light g.drawLine(x + 1, y + 1, x + 13, y + 1); g.drawLine(x + 1, y + 2, x + 1, y + 8); g.drawLine(x + 2, y + 2, x + 2, y + 2); g.drawLine(x + 6, y + 2, x + 6, y + 2); g.drawLine(x + 10, y + 2, x + 10, y + 2); g.drawLine(x + 4, y + 4, x + 4, y + 4); g.drawLine(x + 8, y + 4, x + 8, y + 4); g.drawLine(x + 2, y + 6, x + 2, y + 6); g.drawLine(x + 6, y + 6, x + 6, y + 6); g.drawLine(x + 10, y + 6, x + 10, y + 6); // draw dots g.setColor(focus ? new Color(102, 102, 153) : Color.black); // dark g.drawLine(x + 3, y + 3, x + 3, y + 3); g.drawLine(x + 7, y + 3, x + 7, y + 3); g.drawLine(x + 11, y + 3, x + 11, y + 3); g.drawLine(x + 5, y + 5, x + 5, y + 5); g.drawLine(x + 9, y + 5, x + 9, y + 5); g.drawLine(x + 3, y + 7, x + 3, y + 7); g.drawLine(x + 7, y + 7, x + 7, y + 7); g.drawLine(x + 11, y + 7, x + 11, y + 7); }
| 9,429
|
public void paintIcon(Component c, Graphics g, int x, int y) { boolean focus = false; if (c != null) focus = c.hasFocus(); // TODO: pick up the colors from the look and feel // draw the outline g.setColor(Color.black); g.drawLine(x + 1, y, x + 13, y); g.drawLine(x + 14, y + 1, x + 14, y + 7); g.drawLine(x + 14, y + 8, x + 7, y + 15); g.drawLine(x + 6, y + 14, x, y + 8); g.drawLine(x, y + 7, x, y + 1); // fill the icon g.setColor(focus ? new Color(153, 153, 204) : new Color(204, 204, 204)); // medium g.fillRect(x + 2, y + 2, 12, 7); g.drawLine(x + 2, y + 9, x + 12, y + 9); g.drawLine(x + 3, y + 10, x + 11, y + 10); g.drawLine(x + 4, y + 11, x + 10, y + 11); g.drawLine(x + 5, y + 12, x + 9, y + 12); g.drawLine(x + 6, y + 13, x + 8, y + 13); g.drawLine(x + 7, y + 14, x + 7, y + 14); // draw highlights g.setColor(focus ? new Color(204, 204, 255) : new Color(255, 255, 255)); // light g.drawLine(x + 1, y + 1, x + 13, y + 1); g.drawLine(x + 1, y + 2, x + 1, y + 8); g.drawLine(x + 2, y + 2, x + 2, y + 2); g.drawLine(x + 6, y + 2, x + 6, y + 2); g.drawLine(x + 10, y + 2, x + 10, y + 2); g.drawLine(x + 4, y + 4, x + 4, y + 4); g.drawLine(x + 8, y + 4, x + 8, y + 4); g.drawLine(x + 2, y + 6, x + 2, y + 6); g.drawLine(x + 6, y + 6, x + 6, y + 6); g.drawLine(x + 10, y + 6, x + 10, y + 6); // draw dots g.setColor(focus ? new Color(102, 102, 153) : Color.black); // dark g.drawLine(x + 3, y + 3, x + 3, y + 3); g.drawLine(x + 7, y + 3, x + 7, y + 3); g.drawLine(x + 11, y + 3, x + 11, y + 3); g.drawLine(x + 5, y + 5, x + 5, y + 5); g.drawLine(x + 9, y + 5, x + 9, y + 5); g.drawLine(x + 3, y + 7, x + 3, y + 7); g.drawLine(x + 7, y + 7, x + 7, y + 7); g.drawLine(x + 11, y + 7, x + 11, y + 7); }
|
public void paintIcon(Component c, Graphics g, int x, int y) { boolean focus = false; if (c != null) focus = c.hasFocus(); // TODO: pick up the colors from the look and feel // draw the outline g.setColor(Color.black); g.drawLine(x + 1, y, x + 13, y); g.drawLine(x + 14, y + 1, x + 14, y + 7); g.drawLine(x + 14, y + 8, x + 7, y + 15); g.drawLine(x + 6, y + 14, x, y + 8); g.drawLine(x, y + 7, x, y + 1); // fill the icon g.setColor(focus ? new Color(153, 153, 204) : new Color(204, 204, 204)); // medium g.fillRect(x + 2, y + 2, 12, 7); g.drawLine(x + 2, y + 9, x + 12, y + 9); g.drawLine(x + 3, y + 10, x + 11, y + 10); g.drawLine(x + 4, y + 11, x + 10, y + 11); g.drawLine(x + 5, y + 12, x + 9, y + 12); g.drawLine(x + 6, y + 13, x + 8, y + 13); g.drawLine(x + 7, y + 14, x + 7, y + 14); // draw highlights g.setColor(focus ? new Color(204, 204, 255) : new Color(255, 255, 255)); // light g.drawLine(x + 1, y + 1, x + 13, y + 1); g.drawLine(x + 1, y + 2, x + 1, y + 8); g.drawLine(x + 2, y + 2, x + 2, y + 2); g.drawLine(x + 6, y + 2, x + 6, y + 2); g.drawLine(x + 10, y + 2, x + 10, y + 2); g.drawLine(x + 4, y + 4, x + 4, y + 4); g.drawLine(x + 8, y + 4, x + 8, y + 4); g.drawLine(x + 2, y + 6, x + 2, y + 6); g.drawLine(x + 6, y + 6, x + 6, y + 6); g.drawLine(x + 10, y + 6, x + 10, y + 6); // draw dots g.setColor(focus ? new Color(102, 102, 153) : Color.black); // dark g.drawLine(x + 3, y + 3, x + 3, y + 3); g.drawLine(x + 7, y + 3, x + 7, y + 3); g.drawLine(x + 11, y + 3, x + 11, y + 3); g.drawLine(x + 5, y + 5, x + 5, y + 5); g.drawLine(x + 9, y + 5, x + 9, y + 5); g.drawLine(x + 3, y + 7, x + 3, y + 7); g.drawLine(x + 7, y + 7, x + 7, y + 7); g.drawLine(x + 11, y + 7, x + 11, y + 7); }
| 9,430
|
public void paintIcon(Component c, Graphics g, int x, int y) { boolean focus = false; if (c != null) focus = c.hasFocus(); // TODO: pick up the colors from the look and feel // draw the outline g.setColor(Color.black); g.drawLine(x + 1, y, x + 13, y); g.drawLine(x + 14, y + 1, x + 14, y + 7); g.drawLine(x + 14, y + 8, x + 7, y + 15); g.drawLine(x + 6, y + 14, x, y + 8); g.drawLine(x, y + 7, x, y + 1); // fill the icon g.setColor(focus ? new Color(153, 153, 204) : new Color(204, 204, 204)); // medium g.fillRect(x + 2, y + 2, 12, 7); g.drawLine(x + 2, y + 9, x + 12, y + 9); g.drawLine(x + 3, y + 10, x + 11, y + 10); g.drawLine(x + 4, y + 11, x + 10, y + 11); g.drawLine(x + 5, y + 12, x + 9, y + 12); g.drawLine(x + 6, y + 13, x + 8, y + 13); g.drawLine(x + 7, y + 14, x + 7, y + 14); // draw highlights g.setColor(focus ? new Color(204, 204, 255) : new Color(255, 255, 255)); // light g.drawLine(x + 1, y + 1, x + 13, y + 1); g.drawLine(x + 1, y + 2, x + 1, y + 8); g.drawLine(x + 2, y + 2, x + 2, y + 2); g.drawLine(x + 6, y + 2, x + 6, y + 2); g.drawLine(x + 10, y + 2, x + 10, y + 2); g.drawLine(x + 4, y + 4, x + 4, y + 4); g.drawLine(x + 8, y + 4, x + 8, y + 4); g.drawLine(x + 2, y + 6, x + 2, y + 6); g.drawLine(x + 6, y + 6, x + 6, y + 6); g.drawLine(x + 10, y + 6, x + 10, y + 6); // draw dots g.setColor(focus ? new Color(102, 102, 153) : Color.black); // dark g.drawLine(x + 3, y + 3, x + 3, y + 3); g.drawLine(x + 7, y + 3, x + 7, y + 3); g.drawLine(x + 11, y + 3, x + 11, y + 3); g.drawLine(x + 5, y + 5, x + 5, y + 5); g.drawLine(x + 9, y + 5, x + 9, y + 5); g.drawLine(x + 3, y + 7, x + 3, y + 7); g.drawLine(x + 7, y + 7, x + 7, y + 7); g.drawLine(x + 11, y + 7, x + 11, y + 7); }
|
public void paintIcon(Component c, Graphics g, int x, int y) { boolean focus = false; if (c != null) focus = c.hasFocus(); // TODO: pick up the colors from the look and feel // draw the outline g.setColor(Color.black); g.drawLine(x + 1, y, x + 13, y); g.drawLine(x + 14, y + 1, x + 14, y + 7); g.drawLine(x + 14, y + 8, x + 7, y + 15); g.drawLine(x + 6, y + 14, x, y + 8); g.drawLine(x, y + 7, x, y + 1); // fill the icon g.setColor(focus ? new Color(153, 153, 204) : new Color(204, 204, 204)); // medium g.fillRect(x + 2, y + 2, 12, 7); g.drawLine(x + 2, y + 9, x + 12, y + 9); g.drawLine(x + 3, y + 10, x + 11, y + 10); g.drawLine(x + 4, y + 11, x + 10, y + 11); g.drawLine(x + 5, y + 12, x + 9, y + 12); g.drawLine(x + 6, y + 13, x + 8, y + 13); g.drawLine(x + 7, y + 14, x + 7, y + 14); // draw highlights if (focus) g.setColor(MetalLookAndFeel.getPrimaryControl()); else g.setColor(MetalLookAndFeel.getWhite()); // light g.drawLine(x + 1, y + 1, x + 13, y + 1); g.drawLine(x + 1, y + 2, x + 1, y + 8); g.drawLine(x + 2, y + 2, x + 2, y + 2); g.drawLine(x + 6, y + 2, x + 6, y + 2); g.drawLine(x + 10, y + 2, x + 10, y + 2); g.drawLine(x + 4, y + 4, x + 4, y + 4); g.drawLine(x + 8, y + 4, x + 8, y + 4); g.drawLine(x + 2, y + 6, x + 2, y + 6); g.drawLine(x + 6, y + 6, x + 6, y + 6); g.drawLine(x + 10, y + 6, x + 10, y + 6); // draw dots g.setColor(focus ? new Color(102, 102, 153) : Color.black); // dark g.drawLine(x + 3, y + 3, x + 3, y + 3); g.drawLine(x + 7, y + 3, x + 7, y + 3); g.drawLine(x + 11, y + 3, x + 11, y + 3); g.drawLine(x + 5, y + 5, x + 5, y + 5); g.drawLine(x + 9, y + 5, x + 9, y + 5); g.drawLine(x + 3, y + 7, x + 3, y + 7); g.drawLine(x + 7, y + 7, x + 7, y + 7); g.drawLine(x + 11, y + 7, x + 11, y + 7); }
| 9,431
|
public void paintIcon(Component c, Graphics g, int x, int y) { boolean focus = false; if (c != null) focus = c.hasFocus(); // TODO: pick up the colors from the look and feel // draw the outline g.setColor(Color.black); g.drawLine(x + 1, y, x + 13, y); g.drawLine(x + 14, y + 1, x + 14, y + 7); g.drawLine(x + 14, y + 8, x + 7, y + 15); g.drawLine(x + 6, y + 14, x, y + 8); g.drawLine(x, y + 7, x, y + 1); // fill the icon g.setColor(focus ? new Color(153, 153, 204) : new Color(204, 204, 204)); // medium g.fillRect(x + 2, y + 2, 12, 7); g.drawLine(x + 2, y + 9, x + 12, y + 9); g.drawLine(x + 3, y + 10, x + 11, y + 10); g.drawLine(x + 4, y + 11, x + 10, y + 11); g.drawLine(x + 5, y + 12, x + 9, y + 12); g.drawLine(x + 6, y + 13, x + 8, y + 13); g.drawLine(x + 7, y + 14, x + 7, y + 14); // draw highlights g.setColor(focus ? new Color(204, 204, 255) : new Color(255, 255, 255)); // light g.drawLine(x + 1, y + 1, x + 13, y + 1); g.drawLine(x + 1, y + 2, x + 1, y + 8); g.drawLine(x + 2, y + 2, x + 2, y + 2); g.drawLine(x + 6, y + 2, x + 6, y + 2); g.drawLine(x + 10, y + 2, x + 10, y + 2); g.drawLine(x + 4, y + 4, x + 4, y + 4); g.drawLine(x + 8, y + 4, x + 8, y + 4); g.drawLine(x + 2, y + 6, x + 2, y + 6); g.drawLine(x + 6, y + 6, x + 6, y + 6); g.drawLine(x + 10, y + 6, x + 10, y + 6); // draw dots g.setColor(focus ? new Color(102, 102, 153) : Color.black); // dark g.drawLine(x + 3, y + 3, x + 3, y + 3); g.drawLine(x + 7, y + 3, x + 7, y + 3); g.drawLine(x + 11, y + 3, x + 11, y + 3); g.drawLine(x + 5, y + 5, x + 5, y + 5); g.drawLine(x + 9, y + 5, x + 9, y + 5); g.drawLine(x + 3, y + 7, x + 3, y + 7); g.drawLine(x + 7, y + 7, x + 7, y + 7); g.drawLine(x + 11, y + 7, x + 11, y + 7); }
|
public void paintIcon(Component c, Graphics g, int x, int y) { boolean focus = false; if (c != null) focus = c.hasFocus(); // TODO: pick up the colors from the look and feel // draw the outline g.setColor(Color.black); g.drawLine(x + 1, y, x + 13, y); g.drawLine(x + 14, y + 1, x + 14, y + 7); g.drawLine(x + 14, y + 8, x + 7, y + 15); g.drawLine(x + 6, y + 14, x, y + 8); g.drawLine(x, y + 7, x, y + 1); // fill the icon g.setColor(focus ? new Color(153, 153, 204) : new Color(204, 204, 204)); // medium g.fillRect(x + 2, y + 2, 12, 7); g.drawLine(x + 2, y + 9, x + 12, y + 9); g.drawLine(x + 3, y + 10, x + 11, y + 10); g.drawLine(x + 4, y + 11, x + 10, y + 11); g.drawLine(x + 5, y + 12, x + 9, y + 12); g.drawLine(x + 6, y + 13, x + 8, y + 13); g.drawLine(x + 7, y + 14, x + 7, y + 14); // draw highlights g.setColor(focus ? new Color(204, 204, 255) : new Color(255, 255, 255)); // light g.drawLine(x + 1, y + 1, x + 13, y + 1); g.drawLine(x + 1, y + 2, x + 1, y + 8); g.drawLine(x + 2, y + 2, x + 2, y + 2); g.drawLine(x + 6, y + 2, x + 6, y + 2); g.drawLine(x + 10, y + 2, x + 10, y + 2); g.drawLine(x + 4, y + 4, x + 4, y + 4); g.drawLine(x + 8, y + 4, x + 8, y + 4); g.drawLine(x + 2, y + 6, x + 2, y + 6); g.drawLine(x + 6, y + 6, x + 6, y + 6); g.drawLine(x + 10, y + 6, x + 10, y + 6); // draw dots g.setColor(focus ? new Color(102, 102, 153) : Color.black); // dark g.drawLine(x + 3, y + 3, x + 3, y + 3); g.drawLine(x + 7, y + 3, x + 7, y + 3); g.drawLine(x + 11, y + 3, x + 11, y + 3); g.drawLine(x + 5, y + 5, x + 5, y + 5); g.drawLine(x + 9, y + 5, x + 9, y + 5); g.drawLine(x + 3, y + 7, x + 3, y + 7); g.drawLine(x + 7, y + 7, x + 7, y + 7); g.drawLine(x + 11, y + 7, x + 11, y + 7); }
| 9,432
|
public void paintIcon(Component c, Graphics g, int x, int y) { Color dark = MetalLookAndFeel.getControlDarkShadow(); Color light = MetalLookAndFeel.getWhite(); g.translate(x, y); // The light 'circle' g.setColor(light); g.drawLine(4, 1, 10, 1); g.drawLine(2, 2, 3, 2); g.drawLine(8, 2, 11, 2); g.drawLine(2, 3, 2, 3); g.drawLine(11, 2, 11, 9); g.drawLine(1, 4, 1, 7); g.drawLine(12, 4, 12, 7); g.drawLine(2, 8, 2, 11); g.drawLine(11, 8, 11, 9); g.drawLine(10, 10, 10, 10); g.drawLine(2, 11, 9, 11); g.drawLine(4, 12, 7, 12); // The dark 'circle' g.setColor(dark); g.drawLine(4, 0, 7, 0); g.drawLine(2, 1, 3, 1); g.drawLine(8, 1, 9, 1); g.drawLine(1, 2, 1, 3); g.drawLine(10, 2, 10, 3); g.drawLine(0, 4, 0, 7); g.drawLine(11, 4, 11, 7); g.drawLine(1, 8, 1, 9); g.drawLine(10, 8, 10, 9); g.drawLine(2, 10, 3, 10); g.drawLine(8, 10, 9, 10); g.drawLine(4, 11, 7, 11); JRadioButton rb = (JRadioButton) c; if (rb.isSelected()) drawCheck(c, g); g.translate(-x, -y); }
|
public void paintIcon(Component c, Graphics g, int x, int y) { Color dark = MetalLookAndFeel.getControlDarkShadow(); Color light = MetalLookAndFeel.getWhite(); g.translate(x, y); // The light 'circle' g.setColor(light); g.drawLine(4, 1, 10, 1); g.drawLine(2, 2, 3, 2); g.drawLine(8, 2, 11, 2); g.drawLine(2, 3, 2, 3); g.drawLine(11, 2, 11, 9); g.drawLine(1, 4, 1, 7); g.drawLine(12, 4, 12, 7); g.drawLine(2, 8, 2, 11); g.drawLine(11, 8, 11, 9); g.drawLine(10, 10, 10, 10); g.drawLine(2, 11, 9, 11); g.drawLine(4, 12, 7, 12); // The dark 'circle' g.setColor(dark); g.drawLine(4, 0, 7, 0); g.drawLine(2, 1, 3, 1); g.drawLine(8, 1, 9, 1); g.drawLine(1, 2, 1, 3); g.drawLine(10, 2, 10, 3); g.drawLine(0, 4, 0, 7); g.drawLine(11, 4, 11, 7); g.drawLine(1, 8, 1, 9); g.drawLine(10, 8, 10, 9); g.drawLine(2, 10, 3, 10); g.drawLine(8, 10, 9, 10); g.drawLine(4, 11, 7, 11); JRadioButton rb = (JRadioButton) c; if (rb.isSelected()) drawCheck(c, g); g.translate(-x, -y); }
| 9,433
|
public void paintIcon(Component c, Graphics g, int x, int y) { Color dark = MetalLookAndFeel.getControlDarkShadow(); Color light = MetalLookAndFeel.getWhite(); g.translate(x, y); // The light 'circle' g.setColor(light); g.drawLine(4, 1, 10, 1); g.drawLine(2, 2, 3, 2); g.drawLine(8, 2, 11, 2); g.drawLine(2, 3, 2, 3); g.drawLine(11, 2, 11, 9); g.drawLine(1, 4, 1, 7); g.drawLine(12, 4, 12, 7); g.drawLine(2, 8, 2, 11); g.drawLine(11, 8, 11, 9); g.drawLine(10, 10, 10, 10); g.drawLine(2, 11, 9, 11); g.drawLine(4, 12, 7, 12); // The dark 'circle' g.setColor(dark); g.drawLine(4, 0, 7, 0); g.drawLine(2, 1, 3, 1); g.drawLine(8, 1, 9, 1); g.drawLine(1, 2, 1, 3); g.drawLine(10, 2, 10, 3); g.drawLine(0, 4, 0, 7); g.drawLine(11, 4, 11, 7); g.drawLine(1, 8, 1, 9); g.drawLine(10, 8, 10, 9); g.drawLine(2, 10, 3, 10); g.drawLine(8, 10, 9, 10); g.drawLine(4, 11, 7, 11); JRadioButton rb = (JRadioButton) c; if (rb.isSelected()) drawCheck(c, g); g.translate(-x, -y); }
|
public void paintIcon(Component c, Graphics g, int x, int y) { Color dark = MetalLookAndFeel.getControlDarkShadow(); Color light = MetalLookAndFeel.getWhite(); g.translate(x, y); // The light 'circle' g.setColor(light); g.drawLine(4, 1, 10, 1); g.drawLine(2, 2, 3, 2); g.drawLine(8, 2, 11, 2); g.drawLine(2, 3, 2, 3); g.drawLine(11, 2, 11, 9); g.drawLine(1, 4, 1, 7); g.drawLine(12, 4, 12, 7); g.drawLine(2, 8, 2, 11); g.drawLine(11, 8, 11, 9); g.drawLine(10, 10, 10, 10); g.drawLine(2, 11, 9, 11); g.drawLine(4, 12, 7, 12); // The dark 'circle' g.setColor(dark); g.drawLine(4, 0, 7, 0); g.drawLine(2, 1, 3, 1); g.drawLine(8, 1, 9, 1); g.drawLine(1, 2, 1, 3); g.drawLine(10, 2, 10, 3); g.drawLine(0, 4, 0, 7); g.drawLine(11, 4, 11, 7); g.drawLine(1, 8, 1, 9); g.drawLine(10, 8, 10, 9); g.drawLine(2, 10, 3, 10); g.drawLine(8, 10, 9, 10); g.drawLine(4, 11, 7, 11); JRadioButton rb = (JRadioButton) c; if (rb.isSelected()) drawCheck(c, g); g.translate(-x, -y); }
| 9,434
|
public void paintIcon(Component c, Graphics g, int x, int y) { Color dark = MetalLookAndFeel.getControlDarkShadow(); Color light = MetalLookAndFeel.getWhite(); g.translate(x, y); // The light 'circle' g.setColor(light); g.drawLine(4, 1, 10, 1); g.drawLine(2, 2, 3, 2); g.drawLine(8, 2, 11, 2); g.drawLine(2, 3, 2, 3); g.drawLine(11, 2, 11, 9); g.drawLine(1, 4, 1, 7); g.drawLine(12, 4, 12, 7); g.drawLine(2, 8, 2, 11); g.drawLine(11, 8, 11, 9); g.drawLine(10, 10, 10, 10); g.drawLine(2, 11, 9, 11); g.drawLine(4, 12, 7, 12); // The dark 'circle' g.setColor(dark); g.drawLine(4, 0, 7, 0); g.drawLine(2, 1, 3, 1); g.drawLine(8, 1, 9, 1); g.drawLine(1, 2, 1, 3); g.drawLine(10, 2, 10, 3); g.drawLine(0, 4, 0, 7); g.drawLine(11, 4, 11, 7); g.drawLine(1, 8, 1, 9); g.drawLine(10, 8, 10, 9); g.drawLine(2, 10, 3, 10); g.drawLine(8, 10, 9, 10); g.drawLine(4, 11, 7, 11); JRadioButton rb = (JRadioButton) c; if (rb.isSelected()) drawCheck(c, g); g.translate(-x, -y); }
|
public void paintIcon(Component c, Graphics g, int x, int y) { Color dark = MetalLookAndFeel.getControlDarkShadow(); Color light = MetalLookAndFeel.getWhite(); g.translate(x, y); // The light 'circle' g.setColor(light); g.drawLine(4, 1, 10, 1); g.drawLine(2, 2, 3, 2); g.drawLine(8, 2, 11, 2); g.drawLine(2, 3, 2, 3); g.drawLine(11, 2, 11, 9); g.drawLine(1, 4, 1, 7); g.drawLine(12, 4, 12, 7); g.drawLine(2, 8, 2, 11); g.drawLine(11, 8, 11, 9); g.drawLine(10, 10, 10, 10); g.drawLine(2, 11, 9, 11); g.drawLine(4, 12, 7, 12); // The dark 'circle' g.setColor(dark); g.drawLine(4, 0, 7, 0); g.drawLine(2, 1, 3, 1); g.drawLine(8, 1, 9, 1); g.drawLine(1, 2, 1, 3); g.drawLine(10, 2, 10, 3); g.drawLine(0, 4, 0, 7); g.drawLine(11, 4, 11, 7); g.drawLine(1, 8, 1, 9); g.drawLine(10, 8, 10, 9); g.drawLine(2, 10, 3, 10); g.drawLine(8, 10, 9, 10); g.drawLine(4, 11, 7, 11); JRadioButton rb = (JRadioButton) c; if (rb.isSelected()) drawCheck(c, g); g.translate(-x, -y); }
| 9,435
|
public void paintIcon(Component c, Graphics g, int x, int y) { Color dark = MetalLookAndFeel.getControlDarkShadow(); Color light = MetalLookAndFeel.getWhite(); g.translate(x, y); // The light 'circle' g.setColor(light); g.drawLine(4, 1, 10, 1); g.drawLine(2, 2, 3, 2); g.drawLine(8, 2, 11, 2); g.drawLine(2, 3, 2, 3); g.drawLine(11, 2, 11, 9); g.drawLine(1, 4, 1, 7); g.drawLine(12, 4, 12, 7); g.drawLine(2, 8, 2, 11); g.drawLine(11, 8, 11, 9); g.drawLine(10, 10, 10, 10); g.drawLine(2, 11, 9, 11); g.drawLine(4, 12, 7, 12); // The dark 'circle' g.setColor(dark); g.drawLine(4, 0, 7, 0); g.drawLine(2, 1, 3, 1); g.drawLine(8, 1, 9, 1); g.drawLine(1, 2, 1, 3); g.drawLine(10, 2, 10, 3); g.drawLine(0, 4, 0, 7); g.drawLine(11, 4, 11, 7); g.drawLine(1, 8, 1, 9); g.drawLine(10, 8, 10, 9); g.drawLine(2, 10, 3, 10); g.drawLine(8, 10, 9, 10); g.drawLine(4, 11, 7, 11); JRadioButton rb = (JRadioButton) c; if (rb.isSelected()) drawCheck(c, g); g.translate(-x, -y); }
|
public void paintIcon(Component c, Graphics g, int x, int y) { Color dark = MetalLookAndFeel.getControlDarkShadow(); Color light = MetalLookAndFeel.getWhite(); g.translate(x, y); // The light 'circle' g.setColor(light); g.drawLine(4, 1, 10, 1); g.drawLine(2, 2, 3, 2); g.drawLine(8, 2, 11, 2); g.drawLine(2, 3, 2, 3); g.drawLine(11, 2, 11, 9); g.drawLine(1, 4, 1, 7); g.drawLine(12, 4, 12, 7); g.drawLine(2, 8, 2, 11); g.drawLine(11, 8, 11, 9); g.drawLine(10, 10, 10, 10); g.drawLine(2, 11, 9, 11); g.drawLine(4, 12, 7, 12); // The dark 'circle' g.setColor(dark); g.drawLine(4, 0, 7, 0); g.drawLine(2, 1, 3, 1); g.drawLine(8, 1, 9, 1); g.drawLine(1, 2, 1, 3); g.drawLine(10, 2, 10, 3); g.drawLine(0, 4, 0, 7); g.drawLine(11, 4, 11, 7); g.drawLine(1, 8, 1, 9); g.drawLine(10, 8, 10, 9); g.drawLine(2, 10, 3, 10); g.drawLine(8, 10, 9, 10); g.drawLine(4, 11, 7, 11); JRadioButton rb = (JRadioButton) c; if (rb.isSelected()) drawCheck(c, g); g.translate(-x, -y); }
| 9,436
|
public void paintIcon(Component c, Graphics g, int x, int y) { boolean focus = false; if (c != null) focus = c.hasFocus(); // TODO: pick up the colors from the look and feel // draw the outline g.setColor(Color.black); g.drawLine(x + 1, y, x + 7, y); g.drawLine(x + 8, y, x + 15, y + 7); g.drawLine(x + 14, y + 8, x + 8, y + 14); g.drawLine(x + 8, y + 14, x + 1, y + 14); g.drawLine(x, y + 13, x, y + 1); // fill the icon g.setColor(focus ? new Color(153, 153, 204) : new Color(204, 204, 204)); // medium g.fillRect(x + 2, y + 2, 7, 12); g.drawLine(x + 9, y + 2, x + 9, y + 12); g.drawLine(x + 10, y + 3, x + 10, y + 11); g.drawLine(x + 11, y + 4, x + 11, y + 10); g.drawLine(x + 12, y + 5, x + 12, y + 9); g.drawLine(x + 13, y + 6, x + 13, y + 8); g.drawLine(x + 14, y + 7, x + 14, y + 7); // draw highlights g.setColor(focus ? new Color(204, 204, 255) : new Color(255, 255, 255)); // light g.drawLine(x + 1, y + 1, x + 8, y + 1); g.drawLine(x + 1, y + 2, x + 1, y + 13); g.drawLine(x + 2, y + 2, x + 2, y + 2); g.drawLine(x + 2, y + 6, x + 2, y + 6); g.drawLine(x + 2, y + 10, x + 2, y + 10); g.drawLine(x + 4, y + 4, x + 4, y + 4); g.drawLine(x + 4, y + 8, x + 4, y + 8); g.drawLine(x + 6, y + 2, x + 6, y + 2); g.drawLine(x + 6, y + 6, x + 6, y + 6); g.drawLine(x + 6, y + 10, x + 6, y + 10); // draw dots g.setColor(focus ? new Color(102, 102, 153) : Color.black); // dark g.drawLine(x + 3, y + 3, x + 3, y + 3); g.drawLine(x + 3, y + 7, x + 3, y + 7); g.drawLine(x + 3, y + 11, x + 3, y + 11); g.drawLine(x + 5, y + 5, x + 5, y + 5); g.drawLine(x + 5, y + 9, x + 5, y + 9); g.drawLine(x + 7, y + 3, x + 7, y + 3); g.drawLine(x + 7, y + 7, x + 7, y + 7); g.drawLine(x + 7, y + 11, x + 7, y + 11); }
|
} } } } public} void} paintIcon(Component} c,} Graphics} g,} int} x,} int} y)} } } } } {} } } } } } boolean} focus} =} false;} } } } } } if} (c} !=} null)} } } } } } } } } focus} =} c.hasFocus();} } } } } } } } } } //} TODO:} pick} up} the} colors} from} the} look} and} feel} } } } } } } } } } } } //} draw} the} outline} } } } } } g.setColor(Color.black);} } } } } } g.drawLine(x} +} 1,} y,} x} +} 7,} y);} } } } } } g.drawLine(x} +} 8,} y,} x} +} 15,} y} +} 7);} } } } } } g.drawLine(x} +} 14,} y} +} 8,} x} +} 8,} y} +} 14);} } } } } } g.drawLine(x} +} 8,} y} +} 14,} x} +} 1,} y} +} 14);} } } } } } g.drawLine(x,} y} +} 13,} x,} y} +} 1);} } } } } } } } } } } } //} fill} the} icon} } } } } } g.setColor(focus} ?} new} Color(153,} 153,} 204)} :} new} Color(204,} 204,} 204));} } //} medium} } } } } } g.fillRect(x} +} 2,} y} +} 2,} 7,} 12);} } } } } } g.drawLine(x} +} 9,} y} +} 2,} x} +} 9,} y} +} 12);} } } } } } g.drawLine(x} +} 10,} y} +} 3,} x} +} 10,} y} +} 11);} } } } } } g.drawLine(x} +} 11,} y} +} 4,} x} +} 11,} y} +} 10);} } } } } } g.drawLine(x} +} 12,} y} +} 5,} x} +} 12,} y} +} 9);} } } } } } g.drawLine(x} +} 13,} y} +} 6,} x} +} 13,} y} +} 8);} } } } } } g.drawLine(x} +} 14,} y} +} 7,} x} +} 14,} y} +} 7);} } } } } } } } } } } } //} draw} highlights} } } } } } g.setColor(focus} ?} new} Color(204,} 204,} 255)} :} new} Color(255,} 255,} 255));} } //} light} } } } } } g.drawLine(x} +} 1,} y} +} 1,} x} +} 8,} y} +} 1);} } } } } } g.drawLine(x} +} 1,} y} +} 2,} x} +} 1,} y} +} 13);} } } } } } g.drawLine(x} +} 2,} y} +} 2,} x} +} 2,} y} +} 2);} } } } } } g.drawLine(x} +} 2,} y} +} 6,} x} +} 2,} y} +} 6);} } } } } } g.drawLine(x} +} 2,} y} +} 10,} x} +} 2,} y} +} 10);} } } } } } g.drawLine(x} +} 4,} y} +} 4,} x} +} 4,} y} +} 4);} } } } } } g.drawLine(x} +} 4,} y} +} 8,} x} +} 4,} y} +} 8);} } } } } } g.drawLine(x} +} 6,} y} +} 2,} x} +} 6,} y} +} 2);} } } } } } g.drawLine(x} +} 6,} y} +} 6,} x} +} 6,} y} +} 6);} } } } } } g.drawLine(x} +} 6,} y} +} 10,} x} +} 6,} y} +} 10);} } } } } } //} draw} dots} } } } } } g.setColor(focus} ?} new} Color(102,} 102,} 153)} :} Color.black);} } } } } } } } } } } } } } } } } //} dark} } } } } } g.drawLine(x} +} 3,} y} +} 3,} x} +} 3,} y} +} 3);} } } } } } g.drawLine(x} +} 3,} y} +} 7,} x} +} 3,} y} +} 7);} } } } } } g.drawLine(x} +} 3,} y} +} 11,} x} +} 3,} y} +} 11);} } } } } } g.drawLine(x} +} 5,} y} +} 5,} x} +} 5,} y} +} 5);} } } } } } g.drawLine(x} +} 5,} y} +} 9,} x} +} 5,} y} +} 9);} } } } } } g.drawLine(x} +} 7,} y} +} 3,} x} +} 7,} y} +} 3);} } } } } } g.drawLine(x} +} 7,} y} +} 7,} x} +} 7,} y} +} 7);} } } } } } g.drawLine(x} +} 7,} y} +} 11,} x} +} 7,} y} +} 11);} } } } }} } } } } } } }
| 9,437
|
public void paintIcon(Component c, Graphics g, int x, int y) { boolean focus = false; if (c != null) focus = c.hasFocus(); // TODO: pick up the colors from the look and feel // draw the outline g.setColor(Color.black); g.drawLine(x + 1, y, x + 7, y); g.drawLine(x + 8, y, x + 15, y + 7); g.drawLine(x + 14, y + 8, x + 8, y + 14); g.drawLine(x + 8, y + 14, x + 1, y + 14); g.drawLine(x, y + 13, x, y + 1); // fill the icon g.setColor(focus ? new Color(153, 153, 204) : new Color(204, 204, 204)); // medium g.fillRect(x + 2, y + 2, 7, 12); g.drawLine(x + 9, y + 2, x + 9, y + 12); g.drawLine(x + 10, y + 3, x + 10, y + 11); g.drawLine(x + 11, y + 4, x + 11, y + 10); g.drawLine(x + 12, y + 5, x + 12, y + 9); g.drawLine(x + 13, y + 6, x + 13, y + 8); g.drawLine(x + 14, y + 7, x + 14, y + 7); // draw highlights g.setColor(focus ? new Color(204, 204, 255) : new Color(255, 255, 255)); // light g.drawLine(x + 1, y + 1, x + 8, y + 1); g.drawLine(x + 1, y + 2, x + 1, y + 13); g.drawLine(x + 2, y + 2, x + 2, y + 2); g.drawLine(x + 2, y + 6, x + 2, y + 6); g.drawLine(x + 2, y + 10, x + 2, y + 10); g.drawLine(x + 4, y + 4, x + 4, y + 4); g.drawLine(x + 4, y + 8, x + 4, y + 8); g.drawLine(x + 6, y + 2, x + 6, y + 2); g.drawLine(x + 6, y + 6, x + 6, y + 6); g.drawLine(x + 6, y + 10, x + 6, y + 10); // draw dots g.setColor(focus ? new Color(102, 102, 153) : Color.black); // dark g.drawLine(x + 3, y + 3, x + 3, y + 3); g.drawLine(x + 3, y + 7, x + 3, y + 7); g.drawLine(x + 3, y + 11, x + 3, y + 11); g.drawLine(x + 5, y + 5, x + 5, y + 5); g.drawLine(x + 5, y + 9, x + 5, y + 9); g.drawLine(x + 7, y + 3, x + 7, y + 3); g.drawLine(x + 7, y + 7, x + 7, y + 7); g.drawLine(x + 7, y + 11, x + 7, y + 11); }
|
public void paintIcon(Component c, Graphics g, int x, int y) { boolean focus = false; if (c != null) focus = c.hasFocus(); // TODO: pick up the colors from the look and feel // draw the outline if (enabled) g.setColor(MetalLookAndFeel.getBlack()); else g.setColor(MetalLookAndFeel.getControlDarkShadow()); g.drawLine(x + 1, y, x + 7, y); g.drawLine(x + 8, y, x + 15, y + 7); g.drawLine(x + 14, y + 8, x + 8, y + 14); g.drawLine(x + 8, y + 14, x + 1, y + 14); g.drawLine(x, y + 13, x, y + 1); // fill the icon g.setColor(focus ? new Color(153, 153, 204) : new Color(204, 204, 204)); // medium g.fillRect(x + 2, y + 2, 7, 12); g.drawLine(x + 9, y + 2, x + 9, y + 12); g.drawLine(x + 10, y + 3, x + 10, y + 11); g.drawLine(x + 11, y + 4, x + 11, y + 10); g.drawLine(x + 12, y + 5, x + 12, y + 9); g.drawLine(x + 13, y + 6, x + 13, y + 8); g.drawLine(x + 14, y + 7, x + 14, y + 7); // draw highlights g.setColor(focus ? new Color(204, 204, 255) : new Color(255, 255, 255)); // light g.drawLine(x + 1, y + 1, x + 8, y + 1); g.drawLine(x + 1, y + 2, x + 1, y + 13); g.drawLine(x + 2, y + 2, x + 2, y + 2); g.drawLine(x + 2, y + 6, x + 2, y + 6); g.drawLine(x + 2, y + 10, x + 2, y + 10); g.drawLine(x + 4, y + 4, x + 4, y + 4); g.drawLine(x + 4, y + 8, x + 4, y + 8); g.drawLine(x + 6, y + 2, x + 6, y + 2); g.drawLine(x + 6, y + 6, x + 6, y + 6); g.drawLine(x + 6, y + 10, x + 6, y + 10); // draw dots g.setColor(focus ? new Color(102, 102, 153) : Color.black); // dark g.drawLine(x + 3, y + 3, x + 3, y + 3); g.drawLine(x + 3, y + 7, x + 3, y + 7); g.drawLine(x + 3, y + 11, x + 3, y + 11); g.drawLine(x + 5, y + 5, x + 5, y + 5); g.drawLine(x + 5, y + 9, x + 5, y + 9); g.drawLine(x + 7, y + 3, x + 7, y + 3); g.drawLine(x + 7, y + 7, x + 7, y + 7); g.drawLine(x + 7, y + 11, x + 7, y + 11); }
| 9,438
|
public void paintIcon(Component c, Graphics g, int x, int y) { boolean focus = false; if (c != null) focus = c.hasFocus(); // TODO: pick up the colors from the look and feel // draw the outline g.setColor(Color.black); g.drawLine(x + 1, y, x + 7, y); g.drawLine(x + 8, y, x + 15, y + 7); g.drawLine(x + 14, y + 8, x + 8, y + 14); g.drawLine(x + 8, y + 14, x + 1, y + 14); g.drawLine(x, y + 13, x, y + 1); // fill the icon g.setColor(focus ? new Color(153, 153, 204) : new Color(204, 204, 204)); // medium g.fillRect(x + 2, y + 2, 7, 12); g.drawLine(x + 9, y + 2, x + 9, y + 12); g.drawLine(x + 10, y + 3, x + 10, y + 11); g.drawLine(x + 11, y + 4, x + 11, y + 10); g.drawLine(x + 12, y + 5, x + 12, y + 9); g.drawLine(x + 13, y + 6, x + 13, y + 8); g.drawLine(x + 14, y + 7, x + 14, y + 7); // draw highlights g.setColor(focus ? new Color(204, 204, 255) : new Color(255, 255, 255)); // light g.drawLine(x + 1, y + 1, x + 8, y + 1); g.drawLine(x + 1, y + 2, x + 1, y + 13); g.drawLine(x + 2, y + 2, x + 2, y + 2); g.drawLine(x + 2, y + 6, x + 2, y + 6); g.drawLine(x + 2, y + 10, x + 2, y + 10); g.drawLine(x + 4, y + 4, x + 4, y + 4); g.drawLine(x + 4, y + 8, x + 4, y + 8); g.drawLine(x + 6, y + 2, x + 6, y + 2); g.drawLine(x + 6, y + 6, x + 6, y + 6); g.drawLine(x + 6, y + 10, x + 6, y + 10); // draw dots g.setColor(focus ? new Color(102, 102, 153) : Color.black); // dark g.drawLine(x + 3, y + 3, x + 3, y + 3); g.drawLine(x + 3, y + 7, x + 3, y + 7); g.drawLine(x + 3, y + 11, x + 3, y + 11); g.drawLine(x + 5, y + 5, x + 5, y + 5); g.drawLine(x + 5, y + 9, x + 5, y + 9); g.drawLine(x + 7, y + 3, x + 7, y + 3); g.drawLine(x + 7, y + 7, x + 7, y + 7); g.drawLine(x + 7, y + 11, x + 7, y + 11); }
|
public void paintIcon(Component c, Graphics g, int x, int y) { boolean focus = false; if (c != null) focus = c.hasFocus(); // TODO: pick up the colors from the look and feel // draw the outline g.setColor(Color.black); g.drawLine(x + 1, y, x + 7, y); g.drawLine(x + 8, y, x + 15, y + 7); g.drawLine(x + 14, y + 8, x + 8, y + 14); g.drawLine(x + 8, y + 14, x + 1, y + 14); g.drawLine(x, y + 13, x, y + 1); // fill the icon g.setColor(focus ? new Color(153, 153, 204) : new Color(204, 204, 204)); // medium g.fillRect(x + 2, y + 2, 7, 12); g.drawLine(x + 9, y + 2, x + 9, y + 12); g.drawLine(x + 10, y + 3, x + 10, y + 11); g.drawLine(x + 11, y + 4, x + 11, y + 10); g.drawLine(x + 12, y + 5, x + 12, y + 9); g.drawLine(x + 13, y + 6, x + 13, y + 8); g.drawLine(x + 14, y + 7, x + 14, y + 7); // draw highlights g.setColor(focus ? new Color(204, 204, 255) : new Color(255, 255, 255)); // light g.drawLine(x + 1, y + 1, x + 8, y + 1); g.drawLine(x + 1, y + 2, x + 1, y + 13); g.drawLine(x + 2, y + 2, x + 2, y + 2); g.drawLine(x + 2, y + 6, x + 2, y + 6); g.drawLine(x + 2, y + 10, x + 2, y + 10); g.drawLine(x + 4, y + 4, x + 4, y + 4); g.drawLine(x + 4, y + 8, x + 4, y + 8); g.drawLine(x + 6, y + 2, x + 6, y + 2); g.drawLine(x + 6, y + 6, x + 6, y + 6); g.drawLine(x + 6, y + 10, x + 6, y + 10); // draw dots g.setColor(focus ? new Color(102, 102, 153) : Color.black); // dark g.drawLine(x + 3, y + 3, x + 3, y + 3); g.drawLine(x + 3, y + 7, x + 3, y + 7); g.drawLine(x + 3, y + 11, x + 3, y + 11); g.drawLine(x + 5, y + 5, x + 5, y + 5); g.drawLine(x + 5, y + 9, x + 5, y + 9); g.drawLine(x + 7, y + 3, x + 7, y + 3); g.drawLine(x + 7, y + 7, x + 7, y + 7); g.drawLine(x + 7, y + 11, x + 7, y + 11); }
| 9,439
|
public void paintIcon(Component c, Graphics g, int x, int y) { boolean focus = false; if (c != null) focus = c.hasFocus(); // TODO: pick up the colors from the look and feel // draw the outline g.setColor(Color.black); g.drawLine(x + 1, y, x + 7, y); g.drawLine(x + 8, y, x + 15, y + 7); g.drawLine(x + 14, y + 8, x + 8, y + 14); g.drawLine(x + 8, y + 14, x + 1, y + 14); g.drawLine(x, y + 13, x, y + 1); // fill the icon g.setColor(focus ? new Color(153, 153, 204) : new Color(204, 204, 204)); // medium g.fillRect(x + 2, y + 2, 7, 12); g.drawLine(x + 9, y + 2, x + 9, y + 12); g.drawLine(x + 10, y + 3, x + 10, y + 11); g.drawLine(x + 11, y + 4, x + 11, y + 10); g.drawLine(x + 12, y + 5, x + 12, y + 9); g.drawLine(x + 13, y + 6, x + 13, y + 8); g.drawLine(x + 14, y + 7, x + 14, y + 7); // draw highlights g.setColor(focus ? new Color(204, 204, 255) : new Color(255, 255, 255)); // light g.drawLine(x + 1, y + 1, x + 8, y + 1); g.drawLine(x + 1, y + 2, x + 1, y + 13); g.drawLine(x + 2, y + 2, x + 2, y + 2); g.drawLine(x + 2, y + 6, x + 2, y + 6); g.drawLine(x + 2, y + 10, x + 2, y + 10); g.drawLine(x + 4, y + 4, x + 4, y + 4); g.drawLine(x + 4, y + 8, x + 4, y + 8); g.drawLine(x + 6, y + 2, x + 6, y + 2); g.drawLine(x + 6, y + 6, x + 6, y + 6); g.drawLine(x + 6, y + 10, x + 6, y + 10); // draw dots g.setColor(focus ? new Color(102, 102, 153) : Color.black); // dark g.drawLine(x + 3, y + 3, x + 3, y + 3); g.drawLine(x + 3, y + 7, x + 3, y + 7); g.drawLine(x + 3, y + 11, x + 3, y + 11); g.drawLine(x + 5, y + 5, x + 5, y + 5); g.drawLine(x + 5, y + 9, x + 5, y + 9); g.drawLine(x + 7, y + 3, x + 7, y + 3); g.drawLine(x + 7, y + 7, x + 7, y + 7); g.drawLine(x + 7, y + 11, x + 7, y + 11); }
|
public void paintIcon(Component c, Graphics g, int x, int y) { boolean focus = false; if (c != null) focus = c.hasFocus(); // TODO: pick up the colors from the look and feel // draw the outline g.setColor(Color.black); g.drawLine(x + 1, y, x + 7, y); g.drawLine(x + 8, y, x + 15, y + 7); g.drawLine(x + 14, y + 8, x + 8, y + 14); g.drawLine(x + 8, y + 14, x + 1, y + 14); g.drawLine(x, y + 13, x, y + 1); // fill the icon g.setColor(focus ? new Color(153, 153, 204) : new Color(204, 204, 204)); // medium g.fillRect(x + 2, y + 2, 7, 12); g.drawLine(x + 9, y + 2, x + 9, y + 12); g.drawLine(x + 10, y + 3, x + 10, y + 11); g.drawLine(x + 11, y + 4, x + 11, y + 10); g.drawLine(x + 12, y + 5, x + 12, y + 9); g.drawLine(x + 13, y + 6, x + 13, y + 8); g.drawLine(x + 14, y + 7, x + 14, y + 7); // draw highlights if (focus) g.setColor(MetalLookAndFeel.getPrimaryControl()); else g.setColor(MetalLookAndFeel.getWhite()); // light g.drawLine(x + 1, y + 1, x + 8, y + 1); g.drawLine(x + 1, y + 2, x + 1, y + 13); g.drawLine(x + 2, y + 2, x + 2, y + 2); g.drawLine(x + 2, y + 6, x + 2, y + 6); g.drawLine(x + 2, y + 10, x + 2, y + 10); g.drawLine(x + 4, y + 4, x + 4, y + 4); g.drawLine(x + 4, y + 8, x + 4, y + 8); g.drawLine(x + 6, y + 2, x + 6, y + 2); g.drawLine(x + 6, y + 6, x + 6, y + 6); g.drawLine(x + 6, y + 10, x + 6, y + 10); // draw dots g.setColor(focus ? new Color(102, 102, 153) : Color.black); // dark g.drawLine(x + 3, y + 3, x + 3, y + 3); g.drawLine(x + 3, y + 7, x + 3, y + 7); g.drawLine(x + 3, y + 11, x + 3, y + 11); g.drawLine(x + 5, y + 5, x + 5, y + 5); g.drawLine(x + 5, y + 9, x + 5, y + 9); g.drawLine(x + 7, y + 3, x + 7, y + 3); g.drawLine(x + 7, y + 7, x + 7, y + 7); g.drawLine(x + 7, y + 11, x + 7, y + 11); }
| 9,440
|
public void paintIcon(Component c, Graphics g, int x, int y) { boolean focus = false; if (c != null) focus = c.hasFocus(); // TODO: pick up the colors from the look and feel // draw the outline g.setColor(Color.black); g.drawLine(x + 1, y, x + 7, y); g.drawLine(x + 8, y, x + 15, y + 7); g.drawLine(x + 14, y + 8, x + 8, y + 14); g.drawLine(x + 8, y + 14, x + 1, y + 14); g.drawLine(x, y + 13, x, y + 1); // fill the icon g.setColor(focus ? new Color(153, 153, 204) : new Color(204, 204, 204)); // medium g.fillRect(x + 2, y + 2, 7, 12); g.drawLine(x + 9, y + 2, x + 9, y + 12); g.drawLine(x + 10, y + 3, x + 10, y + 11); g.drawLine(x + 11, y + 4, x + 11, y + 10); g.drawLine(x + 12, y + 5, x + 12, y + 9); g.drawLine(x + 13, y + 6, x + 13, y + 8); g.drawLine(x + 14, y + 7, x + 14, y + 7); // draw highlights g.setColor(focus ? new Color(204, 204, 255) : new Color(255, 255, 255)); // light g.drawLine(x + 1, y + 1, x + 8, y + 1); g.drawLine(x + 1, y + 2, x + 1, y + 13); g.drawLine(x + 2, y + 2, x + 2, y + 2); g.drawLine(x + 2, y + 6, x + 2, y + 6); g.drawLine(x + 2, y + 10, x + 2, y + 10); g.drawLine(x + 4, y + 4, x + 4, y + 4); g.drawLine(x + 4, y + 8, x + 4, y + 8); g.drawLine(x + 6, y + 2, x + 6, y + 2); g.drawLine(x + 6, y + 6, x + 6, y + 6); g.drawLine(x + 6, y + 10, x + 6, y + 10); // draw dots g.setColor(focus ? new Color(102, 102, 153) : Color.black); // dark g.drawLine(x + 3, y + 3, x + 3, y + 3); g.drawLine(x + 3, y + 7, x + 3, y + 7); g.drawLine(x + 3, y + 11, x + 3, y + 11); g.drawLine(x + 5, y + 5, x + 5, y + 5); g.drawLine(x + 5, y + 9, x + 5, y + 9); g.drawLine(x + 7, y + 3, x + 7, y + 3); g.drawLine(x + 7, y + 7, x + 7, y + 7); g.drawLine(x + 7, y + 11, x + 7, y + 11); }
|
public void paintIcon(Component c, Graphics g, int x, int y) { boolean focus = false; if (c != null) focus = c.hasFocus(); // TODO: pick up the colors from the look and feel // draw the outline g.setColor(Color.black); g.drawLine(x + 1, y, x + 7, y); g.drawLine(x + 8, y, x + 15, y + 7); g.drawLine(x + 14, y + 8, x + 8, y + 14); g.drawLine(x + 8, y + 14, x + 1, y + 14); g.drawLine(x, y + 13, x, y + 1); // fill the icon g.setColor(focus ? new Color(153, 153, 204) : new Color(204, 204, 204)); // medium g.fillRect(x + 2, y + 2, 7, 12); g.drawLine(x + 9, y + 2, x + 9, y + 12); g.drawLine(x + 10, y + 3, x + 10, y + 11); g.drawLine(x + 11, y + 4, x + 11, y + 10); g.drawLine(x + 12, y + 5, x + 12, y + 9); g.drawLine(x + 13, y + 6, x + 13, y + 8); g.drawLine(x + 14, y + 7, x + 14, y + 7); // draw highlights g.setColor(focus ? new Color(204, 204, 255) : new Color(255, 255, 255)); // light g.drawLine(x + 1, y + 1, x + 8, y + 1); g.drawLine(x + 1, y + 2, x + 1, y + 13); g.drawLine(x + 2, y + 2, x + 2, y + 2); g.drawLine(x + 2, y + 6, x + 2, y + 6); g.drawLine(x + 2, y + 10, x + 2, y + 10); g.drawLine(x + 4, y + 4, x + 4, y + 4); g.drawLine(x + 4, y + 8, x + 4, y + 8); g.drawLine(x + 6, y + 2, x + 6, y + 2); g.drawLine(x + 6, y + 6, x + 6, y + 6); g.drawLine(x + 6, y + 10, x + 6, y + 10); // draw dots g.setColor(focus ? new Color(102, 102, 153) : Color.black); // dark g.drawLine(x + 3, y + 3, x + 3, y + 3); g.drawLine(x + 3, y + 7, x + 3, y + 7); g.drawLine(x + 3, y + 11, x + 3, y + 11); g.drawLine(x + 5, y + 5, x + 5, y + 5); g.drawLine(x + 5, y + 9, x + 5, y + 9); g.drawLine(x + 7, y + 3, x + 7, y + 3); g.drawLine(x + 7, y + 7, x + 7, y + 7); g.drawLine(x + 7, y + 11, x + 7, y + 11); }
| 9,441
|
public void flush() throws BadLocationException { }
|
public void flush() throws BadLocationException { }
| 9,442
|
public void handleSimpleTag(HTML.Tag tag, MutableAttributeSet attributes, int position ) { }
|
public void handleSimpleTag(HTML.Tag tag, MutableAttributeSet attributes, int position ) { }
| 9,448
|
public static ServantRetentionPolicyValue from_int(int code) { try { return enume [ code ]; } catch (ArrayIndexOutOfBoundsException ex) { throw new BAD_OPERATION("Invalid enumeration code " + code); } }
|
public static ServantRetentionPolicyValue from_int(int code) { try { return enume [ code ]; } catch (ArrayIndexOutOfBoundsException ex) { BAD_OPERATION bad = new BAD_OPERATION("Invalid policy code " + code); bad.minor = Minor.PolicyType; throw bad; } }
| 9,452
|
public static void loadKeyBindings(InputMap retMap, Object[] keys) { // TODO: Implement this properly. }
|
if (keys == null) return; for (int i = 0; i < keys.length - 1; i+= 2) { Object key = keys[i]; KeyStroke keyStroke; if (key instanceof KeyStroke) keyStroke = (KeyStroke)key; else keyStroke = KeyStroke.getKeyStroke((String)key); retMap.put(keyStroke, keys[i+1]); } if (keys == null) return; for (int i = 0; i < keys.length - 1; i+= 2) { Object key = keys[i]; KeyStroke keyStroke; if (key instanceof KeyStroke) keyStroke = (KeyStroke)key; else keyStroke = KeyStroke.getKeyStroke((String)key); retMap.put(keyStroke, keys[i+1]); } if (keys == null) return; for (int i = 0; i < keys.length - 1; i+= 2) { Object key = keys[i]; KeyStroke keyStroke; if (key instanceof KeyStroke) keyStroke = (KeyStroke)key; else keyStroke = KeyStroke.getKeyStroke((String)key); retMap.put(keyStroke, keys[i+1]); } if (keys == null) return; for (int i = 0; i < keys.length - 1; i+= 2) { Object key = keys[i]; KeyStroke keyStroke; if (key instanceof KeyStroke) keyStroke = (KeyStroke)key; else keyStroke = KeyStroke.getKeyStroke((String)key); retMap.put(keyStroke, keys[i+1]); } publicif (keys == null) return; for (int i = 0; i < keys.length - 1; i+= 2) { Object key = keys[i]; KeyStroke keyStroke; if (key instanceof KeyStroke) keyStroke = (KeyStroke)key; else keyStroke = KeyStroke.getKeyStroke((String)key); retMap.put(keyStroke, keys[i+1]); } staticif (keys == null) return; for (int i = 0; i < keys.length - 1; i+= 2) { Object key = keys[i]; KeyStroke keyStroke; if (key instanceof KeyStroke) keyStroke = (KeyStroke)key; else keyStroke = KeyStroke.getKeyStroke((String)key); retMap.put(keyStroke, keys[i+1]); } voidif (keys == null) return; for (int i = 0; i < keys.length - 1; i+= 2) { Object key = keys[i]; KeyStroke keyStroke; if (key instanceof KeyStroke) keyStroke = (KeyStroke)key; else keyStroke = KeyStroke.getKeyStroke((String)key); retMap.put(keyStroke, keys[i+1]); } loadKeyBindings(InputMapif (keys == null) return; for (int i = 0; i < keys.length - 1; i+= 2) { Object key = keys[i]; KeyStroke keyStroke; if (key instanceof KeyStroke) keyStroke = (KeyStroke)key; else keyStroke = KeyStroke.getKeyStroke((String)key); retMap.put(keyStroke, keys[i+1]); } retMap,if (keys == null) return; for (int i = 0; i < keys.length - 1; i+= 2) { Object key = keys[i]; KeyStroke keyStroke; if (key instanceof KeyStroke) keyStroke = (KeyStroke)key; else keyStroke = KeyStroke.getKeyStroke((String)key); retMap.put(keyStroke, keys[i+1]); } Object[]if (keys == null) return; for (int i = 0; i < keys.length - 1; i+= 2) { Object key = keys[i]; KeyStroke keyStroke; if (key instanceof KeyStroke) keyStroke = (KeyStroke)key; else keyStroke = KeyStroke.getKeyStroke((String)key); retMap.put(keyStroke, keys[i+1]); } keys)if (keys == null) return; for (int i = 0; i < keys.length - 1; i+= 2) { Object key = keys[i]; KeyStroke keyStroke; if (key instanceof KeyStroke) keyStroke = (KeyStroke)key; else keyStroke = KeyStroke.getKeyStroke((String)key); retMap.put(keyStroke, keys[i+1]); } if (keys == null) return; for (int i = 0; i < keys.length - 1; i+= 2) { Object key = keys[i]; KeyStroke keyStroke; if (key instanceof KeyStroke) keyStroke = (KeyStroke)key; else keyStroke = KeyStroke.getKeyStroke((String)key); retMap.put(keyStroke, keys[i+1]); } if (keys == null) return; for (int i = 0; i < keys.length - 1; i+= 2) { Object key = keys[i]; KeyStroke keyStroke; if (key instanceof KeyStroke) keyStroke = (KeyStroke)key; else keyStroke = KeyStroke.getKeyStroke((String)key); retMap.put(keyStroke, keys[i+1]); } if (keys == null) return; for (int i = 0; i < keys.length - 1; i+= 2) { Object key = keys[i]; KeyStroke keyStroke; if (key instanceof KeyStroke) keyStroke = (KeyStroke)key; else keyStroke = KeyStroke.getKeyStroke((String)key); retMap.put(keyStroke, keys[i+1]); } {if (keys == null) return; for (int i = 0; i < keys.length - 1; i+= 2) { Object key = keys[i]; KeyStroke keyStroke; if (key instanceof KeyStroke) keyStroke = (KeyStroke)key; else keyStroke = KeyStroke.getKeyStroke((String)key); retMap.put(keyStroke, keys[i+1]); } if (keys == null) return; for (int i = 0; i < keys.length - 1; i+= 2) { Object key = keys[i]; KeyStroke keyStroke; if (key instanceof KeyStroke) keyStroke = (KeyStroke)key; else keyStroke = KeyStroke.getKeyStroke((String)key); retMap.put(keyStroke, keys[i+1]); } if (keys == null) return; for (int i = 0; i < keys.length - 1; i+= 2) { Object key = keys[i]; KeyStroke keyStroke; if (key instanceof KeyStroke) keyStroke = (KeyStroke)key; else keyStroke = KeyStroke.getKeyStroke((String)key); retMap.put(keyStroke, keys[i+1]); } if (keys == null) return; for (int i = 0; i < keys.length - 1; i+= 2) { Object key = keys[i]; KeyStroke keyStroke; if (key instanceof KeyStroke) keyStroke = (KeyStroke)key; else keyStroke = KeyStroke.getKeyStroke((String)key); retMap.put(keyStroke, keys[i+1]); } //if (keys == null) return; for (int i = 0; i < keys.length - 1; i+= 2) { Object key = keys[i]; KeyStroke keyStroke; if (key instanceof KeyStroke) keyStroke = (KeyStroke)key; else keyStroke = KeyStroke.getKeyStroke((String)key); retMap.put(keyStroke, keys[i+1]); } TODO:if (keys == null) return; for (int i = 0; i < keys.length - 1; i+= 2) { Object key = keys[i]; KeyStroke keyStroke; if (key instanceof KeyStroke) keyStroke = (KeyStroke)key; else keyStroke = KeyStroke.getKeyStroke((String)key); retMap.put(keyStroke, keys[i+1]); } Implementif (keys == null) return; for (int i = 0; i < keys.length - 1; i+= 2) { Object key = keys[i]; KeyStroke keyStroke; if (key instanceof KeyStroke) keyStroke = (KeyStroke)key; else keyStroke = KeyStroke.getKeyStroke((String)key); retMap.put(keyStroke, keys[i+1]); } thisif (keys == null) return; for (int i = 0; i < keys.length - 1; i+= 2) { Object key = keys[i]; KeyStroke keyStroke; if (key instanceof KeyStroke) keyStroke = (KeyStroke)key; else keyStroke = KeyStroke.getKeyStroke((String)key); retMap.put(keyStroke, keys[i+1]); } properly.if (keys == null) return; for (int i = 0; i < keys.length - 1; i+= 2) { Object key = keys[i]; KeyStroke keyStroke; if (key instanceof KeyStroke) keyStroke = (KeyStroke)key; else keyStroke = KeyStroke.getKeyStroke((String)key); retMap.put(keyStroke, keys[i+1]); } if (keys == null) return; for (int i = 0; i < keys.length - 1; i+= 2) { Object key = keys[i]; KeyStroke keyStroke; if (key instanceof KeyStroke) keyStroke = (KeyStroke)key; else keyStroke = KeyStroke.getKeyStroke((String)key); retMap.put(keyStroke, keys[i+1]); } if (keys == null) return; for (int i = 0; i < keys.length - 1; i+= 2) { Object key = keys[i]; KeyStroke keyStroke; if (key instanceof KeyStroke) keyStroke = (KeyStroke)key; else keyStroke = KeyStroke.getKeyStroke((String)key); retMap.put(keyStroke, keys[i+1]); } if (keys == null) return; for (int i = 0; i < keys.length - 1; i+= 2) { Object key = keys[i]; KeyStroke keyStroke; if (key instanceof KeyStroke) keyStroke = (KeyStroke)key; else keyStroke = KeyStroke.getKeyStroke((String)key); retMap.put(keyStroke, keys[i+1]); } }
| 9,453
|
public static ComponentInputMap makeComponentInputMap(JComponent c, Object[] keys) { return null; }
|
public static ComponentInputMap makeComponentInputMap(JComponent c, Object[] keys) { ComponentInputMap retMap = new ComponentInputMapUIResource(c); loadKeyBindings(retMap, keys); return retMap; }
| 9,454
|
public static InputMap makeInputMap(Object[] keys) { return null; }
|
public static InputMap makeInputMap(Object[] keys) { InputMap retMap = new InputMapUIResource(); loadKeyBindings(retMap, keys); return retMap; }
| 9,455
|
public static JTextComponent.KeyBinding[] makeKeyBindings(Object[] keyBindingList) { return null; }
|
public static JTextComponent.KeyBinding[] makeKeyBindings(Object[] keyBindingList) { JTextComponent.KeyBinding[] retBindings = new JTextComponent.KeyBinding[keyBindingList.length / 2]; for (int i = 0; i < keyBindingList.length - 1; i+= 2) { KeyStroke stroke; if (keyBindingList[i] instanceof KeyStroke) stroke = (KeyStroke)keyBindingList[i]; else stroke = KeyStroke.getKeyStroke((String)keyBindingList[i]); retBindings[i/2] = new JTextComponent.KeyBinding(stroke, (String)keyBindingList[i+1]); } return retBindings; }
| 9,456
|
public Object clone() { try { return super.clone(); } catch (CloneNotSupportedException e) { throw (Error) new InternalError().initCause(e); // Impossible } }
|
public Object clone() { try { return super.clone(); } catch (CloneNotSupportedException e) { throw (Error) new InternalError().initCause(e); // Impossible } }
| 9,457
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
| 9,458
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
| 9,459
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
| 9,460
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
| 9,461
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
| 9,462
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
| 9,463
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
| 9,464
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
| 9,465
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
| 9,466
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
| 9,467
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
| 9,468
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
| 9,469
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
| 9,470
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
| 9,471
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
| 9,472
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
| 9,473
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
| 9,474
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
| 9,475
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
| 9,476
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
|
boolean match(CharIndexed input, REMatch mymatch) { int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; // Possible positions for the next repeat to match at REMatch newMatch = mymatch; REMatch last = null; REMatch current; // Add the '0-repeats' index // positions.elementAt(z) == position [] in input after <<z>> matches Vector positions = new Vector(); positions.addElement(newMatch); // Declare variables used in loop REMatch doables; REMatch doablesLast; REMatch recurrent; int lastIndex = mymatch.index; do { // Check for stingy match for each possibility. if ((stingy && (numRepeats >= min)) || alwaysEmpty) { REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); mymatch.empty = (mymatch.index == origin); return true; } else { // Special case of {0}. It must always match an empty string. if (alwaysEmpty) return false; } } doables = null; doablesLast = null; // try next repeat at all possible positions for (current = newMatch; current != null; current = current.next) { recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } } } // if none of the possibilities worked out, break out of do/while if (doables == null) break; // reassign where the next repeat can match newMatch = doables; // increment how many repeats we've successfully found ++numRepeats; positions.addElement(newMatch); // doables.index == lastIndex occurs either // (1) when an empty string was the longest // that matched this token. // And this case occurs either // (1-1) when this token is always empty, // for example "()" or "(())". // (1-2) when this token is not always empty // but can match an empty string, for example, // "a*", "(a|)". // or // (2) when the same string matches this token many times. // For example, "acbab" itself matches "a.*b" and // its substrings "acb" and "ab" also match. if (doables.index == lastIndex) { if (doables.empty) { // Case (1): We break here, otherwise we will fall // into an endless loop. if (numRepeats < min) numRepeats = min; break; } else { // Case (2): We cannot break here because, for example, // "acbacb" matches "a.*b" up to 2 times but // not 3 times. So we have to check numRepeats >= min. // But we do not have to go further until numRepeats == max // because the more numRepeats grows, the shorter the // substring matching this token becomes. if (numRepeats > min) { // This means the previous match was successful, // and that must be the best match. This match // resulted in shortening the matched substring. numRepeats--; positions.remove(positions.size() - 1); break; } if (numRepeats == min) break; } } lastIndex = doables.index; } while (numRepeats < max); // If there aren't enough repeats, then fail if (numRepeats < min) return false; // We're greedy, but ease off until a true match is found int posIndex = positions.size(); // At this point we've either got too many or just the right amount. // See if this numRepeats works with the rest of the regexp. REMatch allResults = null; REMatch allResultsLast = null; REMatch results = null; int indexCount = posIndex - min; if (indexCount <= 0) { // This case occurs when we exited the previous do loop before // numRepeats >= min because an empty string matched the token. // In this case, an empty string can match as many times as // desired. indexCount = 1; } while (indexCount-- > 0) { --posIndex; newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } } // else did not match rest of the tokens, try again on smaller sample // or break out when performing possessive matching if (possessive) break; } if (allResults != null) { mymatch.assignFrom(allResults); // does this get all? mymatch.empty = (mymatch.index == origin); return true; } // If we fall out, no matches. return false; }
| 9,477
|
private REMatch matchRest(CharIndexed input, final REMatch newMatch) { REMatch current, single; REMatch doneIndex = null; REMatch doneIndexLast = null; // Test all possible matches for this number of repeats for (current = newMatch; current != null; current = current.next) { // clone() separates a single match from the chain single = (REMatch) current.clone(); if (next(input, single)) { // chain results to doneIndex if (doneIndex == null) { doneIndex = single; doneIndexLast = single; } else { doneIndexLast.next = single; } // Find new doneIndexLast while (doneIndexLast.next != null) { doneIndexLast = doneIndexLast.next; } } } return doneIndex; }
|
private REMatch matchRest(CharIndexed input, final REMatch newMatch) { REMatch current, single; REMatch doneIndex = null; REMatch doneIndexLast = null; // Test all possible matches for this number of repeats for (current = newMatch; current != null; current = current.next) { // clone() separates a single match from the chain single = (REMatch) current.clone(); if (next(input, single)) { // chain results to doneIndex if (doneIndex == null) { doneIndex = single; doneIndexLast = single; } else { doneIndexLast.next = single; } // Find new doneIndexLast while (doneIndexLast.next != null) { doneIndexLast = doneIndexLast.next; } } } return doneIndex; }
| 9,478
|
private REMatch matchRest(CharIndexed input, final REMatch newMatch) { REMatch current, single; REMatch doneIndex = null; REMatch doneIndexLast = null; // Test all possible matches for this number of repeats for (current = newMatch; current != null; current = current.next) { // clone() separates a single match from the chain single = (REMatch) current.clone(); if (next(input, single)) { // chain results to doneIndex if (doneIndex == null) { doneIndex = single; doneIndexLast = single; } else { doneIndexLast.next = single; } // Find new doneIndexLast while (doneIndexLast.next != null) { doneIndexLast = doneIndexLast.next; } } } return doneIndex; }
|
private REMatch matchRest(CharIndexed input, final REMatch newMatch) { REMatch current, single; REMatch doneIndex = null; REMatch doneIndexLast = null; // Test all possible matches for this number of repeats for (current = newMatch; current != null; current = current.next) { // clone() separates a single match from the chain single = (REMatch) current.clone(); if (next(input, single)) { // chain results to doneIndex if (doneIndex == null) { doneIndex = single; doneIndexLast = single; } else { doneIndexLast.next = single; } // Find new doneIndexLast while (doneIndexLast.next != null) { doneIndexLast = doneIndexLast.next; } } } return doneIndex; }
| 9,479
|
private REMatch matchRest(CharIndexed input, final REMatch newMatch) { REMatch current, single; REMatch doneIndex = null; REMatch doneIndexLast = null; // Test all possible matches for this number of repeats for (current = newMatch; current != null; current = current.next) { // clone() separates a single match from the chain single = (REMatch) current.clone(); if (next(input, single)) { // chain results to doneIndex if (doneIndex == null) { doneIndex = single; doneIndexLast = single; } else { doneIndexLast.next = single; } // Find new doneIndexLast while (doneIndexLast.next != null) { doneIndexLast = doneIndexLast.next; } } } return doneIndex; }
|
private REMatch matchRest(CharIndexed input, final REMatch newMatch) { REMatch current, single; REMatch doneIndex = null; REMatch doneIndexLast = null; // Test all possible matches for this number of repeats for (current = newMatch; current != null; current = current.next) { // clone() separates a single match from the chain single = (REMatch) current.clone(); if (next(input, single)) { // chain results to doneIndex if (doneIndex == null) { doneIndex = single; doneIndexLast = single; } else { doneIndexLast.next = single; } // Find new doneIndexLast while (doneIndexLast.next != null) { doneIndexLast = doneIndexLast.next; } } } return doneIndex.head; }
| 9,480
|
static Frame getOwnerFrame() { if (ownerFrame == null) ownerFrame = new OwnerFrame(); return ownerFrame; }
|
static Window getOwnerFrame(Window owner) { Window result = owner; if (result == null) { if (ownerFrame == null) ownerFrame = new OwnerFrame(); return ownerFrame; }
| 9,481
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.