bugged
stringlengths 6
599k
| fixed
stringlengths 10
599k
| __index_level_0__
int64 0
1.13M
|
|---|---|---|
public void mousePressed(MouseEvent e) { Point click = e.getPoint(); TreePath path = getClosestPathForLocation(tree, click.x, click.y); if (path != null) { bounds = getPathBounds(tree, path); int row = getRowForPath(tree, path); boolean cntlClick = isLocationInExpandControl(path, click.x, click.y); boolean isLeaf = isLeaf(row); if (isLeaf) bounds.width += rightChildIndent + gap; else if (hasControlIcons()) bounds.width += getCurrentControlIcon(path).getIconWidth() + gap; boolean inBounds = bounds.contains(click.x, click.y); if ((inBounds || cntlClick) && tree.isVisible(path)) { selectPath(tree, path); if (inBounds && e.getClickCount() == 2 && !isLeaf(row)) toggleExpandState(path); if (cntlClick) { handleExpandControlClick(path, click.x, click.y); if (cellEditor != null) cellEditor.cancelCellEditing(); } else if (tree.isEditable()) startEditing(path, e); } } }
|
public void mousePressed(MouseEvent e) { Point click = e.getPoint(); TreePath path = getClosestPathForLocation(tree, click.x, click.y); if (path != null) { bounds = getPathBounds(tree, path); int row = getRowForPath(tree, path); boolean cntlClick = isLocationInExpandControl(path, click.x, click.y); boolean isLeaf = isLeaf(row); if (isLeaf) bounds.width += rightChildIndent + gap; else if (hasControlIcons()) bounds.width += getCurrentControlIcon(path).getIconWidth() + gap; boolean inBounds = bounds.contains(click.x, click.y); if ((inBounds || cntlClick) && tree.isVisible(path)) { selectPath(tree, path); if (inBounds && e.getClickCount() == 2 && !isLeaf(row)) toggleExpandState(path); if (cntlClick) { handleExpandControlClick(path, click.x, click.y); if (cellEditor != null) cellEditor.cancelCellEditing(); } else if (tree.isEditable()) startEditing(path, e); } } }
| 5,840
|
public BasicTreeUI() { validCachedPreferredSize = false; drawingCache = new Hashtable(); nodeDimensions = createNodeDimensions(); configureLayoutCache(); propertyChangeListener = createPropertyChangeListener(); focusListener = createFocusListener(); treeSelectionListener = createTreeSelectionListener(); mouseInputListener = new MouseInputHandler(null, null, null); keyListener = createKeyListener(); selectionModelPropertyChangeListener = createSelectionModelPropertyChangeListener(); componentListener = createComponentListener(); cellEditorListener = createCellEditorListener(); treeExpansionListener = createTreeExpansionListener(); treeModelListener = createTreeModelListener(); editingRow = -1; lastSelectedRow = -1; leafIcon = UIManager.getIcon("Tree.leafIcon"); }
|
public BasicTreeUI() { validCachedPreferredSize = false; drawingCache = new Hashtable(); nodeDimensions = createNodeDimensions(); configureLayoutCache(); propertyChangeListener = createPropertyChangeListener(); focusListener = createFocusListener(); treeSelectionListener = createTreeSelectionListener(); mouseListener = createMouseListener(); keyListener = createKeyListener(); selectionModelPropertyChangeListener = createSelectionModelPropertyChangeListener(); componentListener = createComponentListener(); cellEditorListener = createCellEditorListener(); treeExpansionListener = createTreeExpansionListener(); treeModelListener = createTreeModelListener(); editingRow = -1; lastSelectedRow = -1; leafIcon = UIManager.getIcon("Tree.leafIcon"); }
| 5,849
|
public BasicTreeUI() { validCachedPreferredSize = false; drawingCache = new Hashtable(); nodeDimensions = createNodeDimensions(); configureLayoutCache(); propertyChangeListener = createPropertyChangeListener(); focusListener = createFocusListener(); treeSelectionListener = createTreeSelectionListener(); mouseInputListener = new MouseInputHandler(null, null, null); keyListener = createKeyListener(); selectionModelPropertyChangeListener = createSelectionModelPropertyChangeListener(); componentListener = createComponentListener(); cellEditorListener = createCellEditorListener(); treeExpansionListener = createTreeExpansionListener(); treeModelListener = createTreeModelListener(); editingRow = -1; lastSelectedRow = -1; leafIcon = UIManager.getIcon("Tree.leafIcon"); }
|
public BasicTreeUI() { validCachedPreferredSize = false; drawingCache = new Hashtable(); nodeDimensions = createNodeDimensions(); configureLayoutCache(); propertyChangeListener = createPropertyChangeListener(); focusListener = createFocusListener(); treeSelectionListener = createTreeSelectionListener(); mouseInputListener = new MouseInputHandler(null, null, null); keyListener = createKeyListener(); selectionModelPropertyChangeListener = createSelectionModelPropertyChangeListener(); componentListener = createComponentListener(); cellEditorListener = createCellEditorListener(); treeExpansionListener = createTreeExpansionListener(); treeModelListener = createTreeModelListener(); editingRow = -1; lastSelectedRow = -1; }
| 5,850
|
Rectangle getCellBounds(int x, int y, Object cell) { if (cell != null) { String s = cell.toString(); Font f = tree.getFont(); FontMetrics fm = tree.getToolkit().getFontMetrics(f); if (s != null) return new Rectangle(x, y, SwingUtilities.computeStringWidth(fm, s) + gap, fm.getHeight()); } return new Rectangle(x, y, 0, 0); }
|
Rectangle getCellBounds(int x, int y, Object cell) { if (cell != null) { String s = cell.toString(); Font f = tree.getFont(); FontMetrics fm = tree.getToolkit().getFontMetrics(f); if (s != null) return new Rectangle(x, y, SwingUtilities.computeStringWidth(fm, s), fm.getHeight()); } return new Rectangle(x, y, 0, 0); }
| 5,851
|
Icon getCurrentControlIcon(TreePath path) { if (tree.isExpanded(path)) return UIManager.getLookAndFeelDefaults().getIcon("Tree.expandedIcon"); return UIManager.getLookAndFeelDefaults().getIcon("Tree.collapsedIcon"); }
|
Icon getCurrentControlIcon(TreePath path) { if (tree.isExpanded(path)) return UIManager.getLookAndFeelDefaults().getIcon("Tree.expandedIcon"); return UIManager.getLookAndFeelDefaults().getIcon("Tree.collapsedIcon"); }
| 5,852
|
boolean hasControlIcons() { if (UIManager.getLookAndFeelDefaults().getIcon("Tree.expandedIcon") != null || UIManager.getLookAndFeelDefaults().getIcon("Tree.collapsedIcon") != null) return true; return false; }
|
boolean hasControlIcons() { if (UIManager.getLookAndFeelDefaults().getIcon("Tree.expandedIcon") != null || UIManager.getLookAndFeelDefaults().getIcon("Tree.collapsedIcon") != null) return true; return false; }
| 5,853
|
protected void installDefaults() { LookAndFeel.installColorsAndFont(tree, "Tree.background", "Tree.foreground", "Tree.font"); tree.setOpaque(true); rightChildIndent = UIManager.getInt("Tree.rightChildIndent"); leftChildIndent = UIManager.getInt("Tree.leftChildIndent"); setRowHeight(UIManager.getInt("Tree.rowHeight")); tree.requestFocusInWindow(false); tree.setScrollsOnExpand(UIManager.getBoolean("Tree.scrollsOnExpand")); setExpandedIcon(UIManager.getIcon("Tree.openIcon")); setCollapsedIcon(UIManager.getIcon("Tree.closedIcon")); }
|
protected void installDefaults() { LookAndFeel.installColorsAndFont(tree, "Tree.background", "Tree.foreground", "Tree.font"); tree.setOpaque(true); rightChildIndent = UIManager.getInt("Tree.rightChildIndent"); leftChildIndent = UIManager.getInt("Tree.leftChildIndent"); setRowHeight(UIManager.getInt("Tree.rowHeight")); tree.requestFocusInWindow(false); tree.setScrollsOnExpand(UIManager.getBoolean("Tree.scrollsOnExpand")); setExpandedIcon(UIManager.getIcon("Tree.openIcon")); setCollapsedIcon(UIManager.getIcon("Tree.closedIcon")); }
| 5,854
|
protected void installListeners() { tree.addPropertyChangeListener(propertyChangeListener); tree.addFocusListener(focusListener); tree.addTreeSelectionListener(treeSelectionListener); tree.addMouseListener(mouseInputListener); tree.addKeyListener(keyListener); tree.addPropertyChangeListener(selectionModelPropertyChangeListener); tree.addComponentListener(componentListener); tree.addTreeExpansionListener(treeExpansionListener); if (treeModel != null) treeModel.addTreeModelListener(treeModelListener); }
|
protected void installListeners() { tree.addPropertyChangeListener(propertyChangeListener); tree.addFocusListener(focusListener); tree.addTreeSelectionListener(treeSelectionListener); tree.addMouseListener(mouseListener); tree.addKeyListener(keyListener); tree.addPropertyChangeListener(selectionModelPropertyChangeListener); tree.addComponentListener(componentListener); tree.addTreeExpansionListener(treeExpansionListener); if (treeModel != null) treeModel.addTreeModelListener(treeModelListener); }
| 5,855
|
public void installUI(JComponent c) { tree = (JTree) c; prepareForUIInstall(); super.installUI(c); installDefaults(); installComponents(); setCellEditor(createDefaultCellEditor()); createdCellEditor = true; isEditing = false; TreeModel mod = tree.getModel(); setModel(mod); if (mod != null) { TreePath path = new TreePath(mod.getRoot()); if (!tree.isExpanded(path)) toggleExpandState(path); } treeSelectionModel = tree.getSelectionModel(); installKeyboardActions(); installListeners(); completeUIInstall(); }
|
public void installUI(JComponent c) { tree = (JTree) c; prepareForUIInstall(); super.installUI(c); installDefaults(); installComponents(); setCellEditor(createDefaultCellEditor()); createdCellEditor = true; isEditing = false; TreeModel mod = tree.getModel(); setModel(mod); if (mod != null) { TreePath path = new TreePath(mod.getRoot()); if (!tree.isExpanded(path)) toggleExpandState(path); } treeSelectionModel = tree.getSelectionModel(); installKeyboardActions(); installListeners(); completeUIInstall(); }
| 5,856
|
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; }
| 5,857
|
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; }
| 5,858
|
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); } }
| 5,859
|
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; }
| 5,860
|
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; }
| 5,861
|
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; }
| 5,862
|
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; }
| 5,863
|
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()); }
| 5,864
|
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; }
| 5,865
|
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); } } }
| 5,866
|
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); }
| 5,867
|
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; }
| 5,868
|
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(); } }
| 5,871
|
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; }
| 5,872
|
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; }
| 5,873
|
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; }
| 5,874
|
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; }
| 5,875
|
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; }
| 5,876
|
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(); }
| 5,877
|
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; }
| 5,878
|
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; }
| 5,879
|
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; }
| 5,880
|
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)); }
| 5,881
|
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; }
| 5,882
|
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; }
| 5,883
|
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; }
| 5,884
|
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; }
| 5,885
|
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; }
| 5,886
|
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; }
| 5,887
|
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; }
| 5,888
|
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()); }
| 5,889
|
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()); }
| 5,890
|
public void actionPerformed(ActionEvent e) { vt.systemRequest(); }
|
public void actionPerformed(ActionEvent e) { mapMeKeys(); }
| 5,891
|
public void actionPerformed(ActionEvent e) { vt.sendHelpRequest(); }
|
public void actionPerformed(ActionEvent e) { screen.sendKeys("[attn]"); }
| 5,892
|
public void actionPerformed(ActionEvent e) { vt.hostPrint(1); }
|
public void actionPerformed(ActionEvent e) { screen.sendKeys("[reset]"); }
| 5,893
|
public void actionPerformed(ActionEvent e) { vt.systemRequest('4'); }
|
public void actionPerformed(ActionEvent e) { vt.systemRequest('4'); }
| 5,894
|
public void actionPerformed(ActionEvent e) { showHexMap(); }
|
public void actionPerformed(ActionEvent e) { showHexMap(); }
| 5,895
|
public void actionPerformed(ActionEvent e) { mapMeKeys(); }
|
public void actionPerformed(ActionEvent e) { screen.sendKeys("[dupfield]"); }
| 5,896
|
public void actionPerformed(ActionEvent e) { doAttributes(); }
|
public void actionPerformed(ActionEvent e) { screen.sendKeys("[help]"); }
| 5,897
|
public void actionPerformed(ActionEvent e) { stopRecordingMe(); getFocusForMe(); }
|
public void actionPerformed(ActionEvent e) { stopRecordingMe(); getFocusForMe(); }
| 5,898
|
public void actionPerformed(ActionEvent e) { startRecordingMe(); }
|
public void actionPerformed(ActionEvent e) { startRecordingMe(); }
| 5,899
|
public void actionPerformed(ActionEvent e) { executeMeMacro(e); }
|
public void actionPerformed(ActionEvent e) { executeMeMacro(e); }
| 5,900
|
public void actionPerformed(ActionEvent e) { doMeTransfer(); }
|
public void actionPerformed(ActionEvent e) { screen.sendKeys("[newline]"); }
| 5,901
|
public void actionPerformed(ActionEvent e) { sendScreenEMail(); }
|
public void actionPerformed(ActionEvent e) { vt.hostPrint(1); }
| 5,902
|
public void actionPerformed(ActionEvent e) { sendMeToFile(); }
|
public void actionPerformed(ActionEvent e) { sendMeToFile(); }
| 5,903
|
public void actionPerformed(ActionEvent e) { vt.disconnect(); getFocusForMe(); }
|
public void actionPerformed(ActionEvent e) { vt.disconnect(); getFocusForMe(); }
| 5,904
|
public void actionPerformed(ActionEvent e) { vt.connect(); getFocusForMe(); }
|
public void actionPerformed(ActionEvent e) { vt.connect(); getFocusForMe(); }
| 5,905
|
public void actionPerformed(ActionEvent e) { closeSession(); }
|
public void actionPerformed(ActionEvent e) { closeSession(); }
| 5,906
|
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(); }
| 5,907
|
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(); }
| 5,908
|
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; }
| 5,910
|
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); }
| 5,912
|
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); }
| 5,913
|
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); }
| 5,914
|
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); }
| 5,915
|
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); }
| 5,916
|
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); }
| 5,917
|
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); }
| 5,918
|
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); }
| 5,919
|
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); }
| 5,921
|
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); }
| 5,922
|
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); }
| 5,923
|
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); }
| 5,924
|
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; } }
| 5,925
|
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; }
| 5,927
|
public static InputMap makeInputMap(Object[] keys) { return null; }
|
public static InputMap makeInputMap(Object[] keys) { InputMap retMap = new InputMapUIResource(); loadKeyBindings(retMap, keys); return retMap; }
| 5,928
|
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; }
| 5,929
|
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; }
| 5,930
|
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; }
| 5,931
|
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; }
| 5,932
|
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); 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? return true; } // If we fall out, no matches. return false; }
| 5,933
|
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. 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; }
| 5,934
|
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; }
| 5,935
|
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; }
| 5,936
|
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(); if (newMatch.empty) { numRepeats = min; emptyMatchFound = true; break; } lastIndex = newMatch.index; } Vector positions = new Vector(); while (numRepeats <= max) { if (stopMatchingIfSatisfied && stingy) { REMatch results = matchRest(input, newMatch); if (results != null) { mymatch.assignFrom(results); return true; } } positions.add(newMatch); if (emptyMatchFound) break; doables = findDoables(token, input, newMatch); if (doables == null) break; // 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; if (newMatch.empty) { numRepeats = min; emptyMatchFound = true; break; } lastIndex = newMatch.index; } Vector positions = new Vector(); while (numRepeats <= max) { if (stopMatchingIfSatisfied && stingy) { REMatch results = matchRest(input, newMatch); if (results != null) { mymatch.assignFrom(results); return true; } } positions.add(newMatch); if (emptyMatchFound) break; doables = findDoables(token, input, newMatch); if (doables == null) break; // 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; }
| 5,937
|
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; }
| 5,938
|
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; }
| 5,939
|
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; } } } 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; }
| 5,940
|
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; }
| 5,941
|
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; }
| 5,942
|
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; }
| 5,943
|
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; }
| 5,944
|
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; }
| 5,945
|
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) allResults.addTail(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; }
| 5,946
|
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; }
| 5,947
|
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; }
| 5,948
|
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; }
| 5,949
|
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; }
| 5,950
|
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; }
| 5,951
|
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; }
| 5,952
|
static Frame getOwnerFrame() { if (ownerFrame == null) ownerFrame = new OwnerFrame(); return ownerFrame; }
|
static Frame getOwnerFrame() { if (ownerFrame == null) ownerFrame = new OwnerFrame(); result = ownerFrame; } return result; }
| 5,953
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.