bugged
stringlengths
6
599k
fixed
stringlengths
6
40.8M
__index_level_0__
int64
0
3.24M
public void onZChange(int z, int t) { resetZSlider(z); abstraction.onPlaneSelected(z, t); }
public void onZChange(int z, int t) { resetZSlider(z); abstraction.onPlaneSelected(z, t); }
3,229,099
public void onZChange(int z, int t) { resetZSlider(z); abstraction.onPlaneSelected(z, t); }
public void onZChange(int z, int t) { resetZSlider(z); abstraction.onPlaneSelected(z, t); }
3,229,100
void removeProgressNotifier() { progressNotifier.dispose(); progressNotifier = null; }
void removeProgressNotifier() { progressNotifier.dispose(); progressNotifier = null; }
3,229,101
public void setMagFactor(double v) { magFactor = v; }
public void setMagFactor(double v) { magFactor = v; }
3,229,102
void setPresentation(ViewerUIF presentation) { this.presentation = presentation; }
void setPresentation(ViewerUIF presentation) { this.presentation = presentation; }
3,229,103
public void showDialog(JDialog dialog) { UIUtilities.centerAndShow(dialog); }
public void showDialog(JDialog dialog) { UIUtilities.centerAndShow(dialog); }
3,229,104
public void showImage3DViewer() { int model = getModel(); Viewer3D v3D = new Viewer3D(this, abstraction.getPixelsDims().sizeZ, model); if (v3D.isVisible()) UIUtilities.centerAndShow(v3D); else { //TODO: tempo around before fix bug #321 abstraction.setModel(model); v3D.dispose(); } }
public void showImage3DViewer() { int model = getModel(); Viewer3D v3D = new Viewer3D(this, abstraction.getPixelsDims().sizeZ, model); if (v3D.isVisible()) UIUtilities.centerAndShow(v3D); else { //TODO: tempo around before fix bug #321 abstraction.setModel(model); v3D.dispose(); } }
3,229,105
public void showImage3DViewer() { int model = getModel(); Viewer3D v3D = new Viewer3D(this, abstraction.getPixelsDims().sizeZ, model); if (v3D.isVisible()) UIUtilities.centerAndShow(v3D); else { //TODO: tempo around before fix bug #321 abstraction.setModel(model); v3D.dispose(); } }
public void showImage3DViewer() { int model = getModel(); Viewer3D v3D = new Viewer3D(this, abstraction.getPixelsDims().sizeZ, model); if (v3D.isVisible()) UIUtilities.centerAndShow(v3D); else { //TODO: tempo around before fix bug #321 abstraction.setModel(model); v3D.dispose(); } }
3,229,106
public void showImage3DViewer() { int model = getModel(); Viewer3D v3D = new Viewer3D(this, abstraction.getPixelsDims().sizeZ, model); if (v3D.isVisible()) UIUtilities.centerAndShow(v3D); else { //TODO: tempo around before fix bug #321 abstraction.setModel(model); v3D.dispose(); } }
public void showImage3DViewer() { int model = getModel(); Viewer3D v3D = new Viewer3D(this, abstraction.getPixelsDims().sizeZ, model); if (v3D.isVisible()) UIUtilities.centerAndShow(v3D); else { //TODO: tempo around before fix bug #321 abstraction.setModel(model); v3D.dispose(); } }
3,229,107
public void showImageSaver() { BufferedImage image = presentation.getDisplayImage(); if (image == null) { UserNotifier un = getRegistry().getUserNotifier(); un.notifyError("Save image", "No current image displayed"); } else new ImageSaver(this, image); }
public void showImageSaver() { BufferedImage image = presentation.getDisplayImage(); if (image == null) { UserNotifier un = getRegistry().getUserNotifier(); un.notifyError("Save image", "No current image displayed"); } else new ImageSaver(this, image); }
3,229,108
public void showImageSaver() { BufferedImage image = presentation.getDisplayImage(); if (image == null) { UserNotifier un = getRegistry().getUserNotifier(); un.notifyError("Save image", "No current image displayed"); } else new ImageSaver(this, image); }
public void showImageSaver() { BufferedImage image = presentation.getDisplayImage(); if (image == null) { UserNotifier un = getRegistry().getUserNotifier(); un.notifyError("Save image", "No current image displayed"); } else new ImageSaver(this, image); }
3,229,109
public void showInspector() { if (imageInspector == null) imageInspector = new ImageInspector(this, presentation.getCanvas(), magFactor); UIUtilities.centerAndShow(imageInspector); }
public void showInspector() { if (imageInspector == null) imageInspector = new ImageInspector(this, presentation.getCanvas(), magFactor); UIUtilities.centerAndShow(imageInspector); }
3,229,110
public void showInspector() { if (imageInspector == null) imageInspector = new ImageInspector(this, presentation.getCanvas(), magFactor); UIUtilities.centerAndShow(imageInspector); }
public void showInspector() { if (imageInspector == null) imageInspector = new ImageInspector(this, presentation.getCanvas(), magFactor); UIUtilities.centerAndShow(imageInspector); }
3,229,111
public void showMovie() { int maxZ = abstraction.getPixelsDims().sizeZ-1; int maxT = abstraction.getPixelsDims().sizeT-1; if (movieSettings == null) initMovieSettings(maxZ, maxT); if (moviePlayer == null) moviePlayer = new Player(this, maxT, maxZ, movieSettings); UIUtilities.centerAndShow(moviePlayer); }
public void showMovie() { int maxZ = abstraction.getPixelsDims().sizeZ-1; int maxT = abstraction.getPixelsDims().sizeT-1; if (movieSettings == null) initMovieSettings(maxZ, maxT); if (moviePlayer == null) moviePlayer = new Player(this, maxT, maxZ, movieSettings); UIUtilities.centerAndShow(moviePlayer); }
3,229,112
public void showMovie() { int maxZ = abstraction.getPixelsDims().sizeZ-1; int maxT = abstraction.getPixelsDims().sizeT-1; if (movieSettings == null) initMovieSettings(maxZ, maxT); if (moviePlayer == null) moviePlayer = new Player(this, maxT, maxZ, movieSettings); UIUtilities.centerAndShow(moviePlayer); }
public void showMovie() { int maxZ = abstraction.getPixelsDims().sizeZ-1; int maxT = abstraction.getPixelsDims().sizeT-1; if (movieSettings == null) initMovieSettings(maxZ, maxT); if (moviePlayer == null) moviePlayer = new Player(this, maxT, maxZ, movieSettings); UIUtilities.centerAndShow(moviePlayer); }
3,229,113
void showProgressNotifier(String imageName) { progressNotifier = new ProgressNotifier(this, imageName); UIUtilities.centerAndShow(progressNotifier); }
void showProgressNotifier(String imageName) { progressNotifier = new ProgressNotifier(this, imageName); UIUtilities.centerAndShow(progressNotifier); }
3,229,114
public void showRendering() { abstraction.showRendering(); }
public void showRendering() { abstraction.showRendering(); }
3,229,115
public void stateChanged(ChangeEvent e) { Object src = e.getSource(); int valT, valZ; valT = tSlider.getValue(); valZ = zSlider.getValue(); ToolBarManager tbm = presentation.getToolBar().getManager(); if (src == tSlider) tbm.onTChange(valT); else tbm.onZChange(valZ); abstraction.onPlaneSelected(valZ, valT); }
public void stateChanged(ChangeEvent e) { Object src = e.getSource(); int valT, valZ; valT = tSlider.getValue(); valZ = zSlider.getValue(); ToolBarManager tbm = presentation.getToolBar().getManager(); if (src == tSlider) tbm.onTChange(valT); else tbm.onZChange(valZ); abstraction.onPlaneSelected(valZ, valT); }
3,229,116
public void synchPlaneSelected(int z, int previousModel) { resetZSlider(z); resetZField(z); abstraction.setModel(previousModel); abstraction.onPlaneSelected(z); }
void synchPlaneSelected(int z, int model) { resetZSlider(z); resetZField(z); abstraction.setModel(previousModel); abstraction.onPlaneSelected(z); }
3,229,117
public void synchPlaneSelected(int z, int previousModel) { resetZSlider(z); resetZField(z); abstraction.setModel(previousModel); abstraction.onPlaneSelected(z); }
public void synchPlaneSelected(int z, int previousModel) { resetZSlider(z); resetZField(z); abstraction.setModel(model); abstraction.onPlaneSelected(z); }
3,229,118
public void onTChange(int t) { curT = t; view.getTField().setText(""+t); }
public void onTChange(int t) { curT = t; view.getTField().setText(""+t); }
3,229,119
public void onZChange(int z) { curZ = z; view.getZField().setText(""+z); }
public void onZChange(int z) { curZ = z; view.getZField().setText(""+z); }
3,229,120
public ImageInspector(ViewerCtrl control) { //super(control.getReferenceFrame(), "Image Inspector"); initFrame(IconManager.getInstance(control.getRegistry())); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); init(control); setJMenuBar(menuBar); buildGUI(); }
public ImageInspector(ViewerCtrl control) { //super(control.getReferenceFrame(), "Image Inspector"); initFrame(IconManager.getInstance(control.getRegistry())); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); init(control); setJMenuBar(menuBar); buildGUI(); }
3,229,121
public RenderingDef retrieveRndSettings(final long pixId) { final Long userId = getSecuritySystem() .getEventContext() .getCurrentUserId(); return (RenderingDef) iQuery.findByQuery( " select rdef from RenderingDef rdef where " + " rdef.pixels.id = :pixid and rdef.details.owner.id = :ownerid", new Parameters().addLong("pixid",pixId).addLong("ownerid",userId)); }
public RenderingDef retrieveRndSettings(final long pixId) { final Long userId = getSecuritySystem() .getEventContext() .getCurrentUserId(); return (RenderingDef) iQuery.findByQuery( " select rdef from RenderingDef rdef where " + " rdef.pixels.id = :pixid and rdef.details.owner.id = :ownerid", new Parameters().addLong("pixid",pixId).addLong("ownerid",userId)); }
3,229,123
void setLensVisible(boolean b) { if (lens==null) lens = new LensComponent(this); if (b==true) { if (model.getMaxX() < lens.getLensUI().getWidth() || model.getMaxY() < lens.getLensUI().getHeight()) return; if (firstTimeLensShown) { firstTimeLensShown = false; int lensX = model.getMaxX()/2-lens.getLensUI().getWidth()/2; int lensY = model.getMaxY()/2-lens.getLensUI().getHeight()/2; if (lensX+lens.getLensUI().getWidth() > model.getMaxX()) lensX = model.getMaxX()-lens.getLensUI().getWidth(); if (lensY+lens.getLensUI().getHeight() > model.getMaxY()) lensY = model.getMaxY()-lens.getLensUI().getHeight(); lens.setImageZoomFactor((float)model.getZoomFactor()); lens.setLensLocation(lensX, lensY); lens.setXYPixelMicron(model.getPixelsSizeX(), model.getPixelsSizeY()); model.getBrowser().addComponent(lens.getLensUI()); lens.setZoomWindowLocation(this.getX()+this.getWidth(), this.getY()); } lens.setImageZoomFactor((float) model.getZoomFactor()); lens.setPlaneImage(model.getRenderedImage()); lens.setLensPreferredColour(); lens.setVisible(b); } else lens.setVisible(b); this.repaint(); }
void setLensVisible(boolean b) { if (lens==null) lens = new LensComponent(this); if (b) { if (model.getMaxX() < lens.getLensUI().getWidth() || model.getMaxY() < lens.getLensUI().getHeight()) return; if (firstTimeLensShown) { firstTimeLensShown = false; int lensX = model.getMaxX()/2-lens.getLensUI().getWidth()/2; int lensY = model.getMaxY()/2-lens.getLensUI().getHeight()/2; if (lensX+lens.getLensUI().getWidth() > model.getMaxX()) lensX = model.getMaxX()-lens.getLensUI().getWidth(); if (lensY+lens.getLensUI().getHeight() > model.getMaxY()) lensY = model.getMaxY()-lens.getLensUI().getHeight(); lens.setImageZoomFactor((float)model.getZoomFactor()); lens.setLensLocation(lensX, lensY); lens.setXYPixelMicron(model.getPixelsSizeX(), model.getPixelsSizeY()); model.getBrowser().addComponent(lens.getLensUI()); lens.setZoomWindowLocation(this.getX()+this.getWidth(), this.getY()); } lens.setImageZoomFactor((float) model.getZoomFactor()); lens.setPlaneImage(model.getRenderedImage()); lens.setLensPreferredColour(); lens.setVisible(b); } else lens.setVisible(b); this.repaint(); }
3,229,124
void setLensVisible(boolean b) { if (lens==null) lens = new LensComponent(this); if (b==true) { if (model.getMaxX() < lens.getLensUI().getWidth() || model.getMaxY() < lens.getLensUI().getHeight()) return; if (firstTimeLensShown) { firstTimeLensShown = false; int lensX = model.getMaxX()/2-lens.getLensUI().getWidth()/2; int lensY = model.getMaxY()/2-lens.getLensUI().getHeight()/2; if (lensX+lens.getLensUI().getWidth() > model.getMaxX()) lensX = model.getMaxX()-lens.getLensUI().getWidth(); if (lensY+lens.getLensUI().getHeight() > model.getMaxY()) lensY = model.getMaxY()-lens.getLensUI().getHeight(); lens.setImageZoomFactor((float)model.getZoomFactor()); lens.setLensLocation(lensX, lensY); lens.setXYPixelMicron(model.getPixelsSizeX(), model.getPixelsSizeY()); model.getBrowser().addComponent(lens.getLensUI()); lens.setZoomWindowLocation(this.getX()+this.getWidth(), this.getY()); } lens.setImageZoomFactor((float) model.getZoomFactor()); lens.setPlaneImage(model.getRenderedImage()); lens.setLensPreferredColour(); lens.setVisible(b); } else lens.setVisible(b); this.repaint(); }
void setLensVisible(boolean b) { if (lens==null) lens = new LensComponent(this); if (b==true) { if (model.getMaxX() < lens.getLensUI().getWidth() || model.getMaxY() < lens.getLensUI().getHeight()) return; if (firstTimeLensShown) { firstTimeLensShown = false; int lensX = model.getMaxX()/2-lens.getLensUI().getWidth()/2; int lensY = model.getMaxY()/2-lens.getLensUI().getHeight()/2; if (lensX+lens.getLensUI().getWidth() > model.getMaxX()) lensX = model.getMaxX()-lens.getLensUI().getWidth(); if (lensY+lens.getLensUI().getHeight() > model.getMaxY()) lensY = model.getMaxY()-lens.getLensUI().getHeight(); lens.setImageZoomFactor((float)model.getZoomFactor()); lens.setLensLocation(lensX, lensY); lens.setXYPixelMicron(model.getPixelsSizeX(), model.getPixelsSizeY()); model.getBrowser().addComponent(lens.getLensUI()); lens.setZoomWindowLocation(this.getX()+this.getWidth(), this.getY()); } lens.setImageZoomFactor((float) model.getZoomFactor()); lens.setPlaneImage(model.getRenderedImage()); lens.setLensPreferredColour(); lens.setVisible(b); } else lens.setVisible(b); this.repaint(); }
3,229,125
void setLensVisible(boolean b) { if (lens==null) lens = new LensComponent(this); if (b==true) { if (model.getMaxX() < lens.getLensUI().getWidth() || model.getMaxY() < lens.getLensUI().getHeight()) return; if (firstTimeLensShown) { firstTimeLensShown = false; int lensX = model.getMaxX()/2-lens.getLensUI().getWidth()/2; int lensY = model.getMaxY()/2-lens.getLensUI().getHeight()/2; if (lensX+lens.getLensUI().getWidth() > model.getMaxX()) lensX = model.getMaxX()-lens.getLensUI().getWidth(); if (lensY+lens.getLensUI().getHeight() > model.getMaxY()) lensY = model.getMaxY()-lens.getLensUI().getHeight(); lens.setImageZoomFactor((float)model.getZoomFactor()); lens.setLensLocation(lensX, lensY); lens.setXYPixelMicron(model.getPixelsSizeX(), model.getPixelsSizeY()); model.getBrowser().addComponent(lens.getLensUI()); lens.setZoomWindowLocation(this.getX()+this.getWidth(), this.getY()); } lens.setImageZoomFactor((float) model.getZoomFactor()); lens.setPlaneImage(model.getRenderedImage()); lens.setLensPreferredColour(); lens.setVisible(b); } else lens.setVisible(b); this.repaint(); }
void setLensVisible(boolean b) { if (lens==null) lens = new LensComponent(this); if (b==true) { if (model.getMaxX() < lens.getLensUI().getWidth() || model.getMaxY() < lens.getLensUI().getHeight()) return; if (firstTimeLensShown) { firstTimeLensShown = false; int lensX = model.getMaxX()/2-lens.getLensUI().getWidth()/2; int lensY = model.getMaxY()/2-lens.getLensUI().getHeight()/2; if (lensX+lens.getLensUI().getWidth() > model.getMaxX()) lensX = model.getMaxX()-lens.getLensUI().getWidth(); if (lensY+lens.getLensUI().getHeight() > model.getMaxY()) lensY = model.getMaxY()-lens.getLensUI().getHeight(); lens.setImageZoomFactor((float)model.getZoomFactor()); lens.setLensLocation(lensX, lensY); lens.setXYPixelMicron(model.getPixelsSizeX(), model.getPixelsSizeY()); model.getBrowser().addComponent(lens.getLensUI()); lens.setZoomWindowLocation(this.getX()+this.getWidth(), this.getY()); } lens.setImageZoomFactor((float) model.getZoomFactor()); lens.setPlaneImage(model.getRenderedImage()); lens.setLensPreferredColour(); lens.setVisible(b); } else lens.setVisible(b); this.repaint(); }
3,229,126
public String getName() { return name; }
public String getName() { return name; }
3,229,127
public LensComponent(JFrame parent) { this(parent, null); }
public LensComponent(JFrame parent) { this(parent, null); }
3,229,130
public LensComponent(JFrame parent) { this(parent, null); }
public LensComponent(JFrame parent) { this(parent, null); }
3,229,131
final private void doRequest( HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { WebContext context = null; if (_problem != null) { init(); if (_problem != null) { try { resp.setContentType("text/html"); FastWriter out = new FastWriter(resp.getOutputStream(), resp.getCharacterEncoding()); out.write("<html><head><title>WebMacro Error</title></head>"); out.write("<body><h1><font color=\"red\">WebMacro Error: "); out.write("</font></h1><pre>"); out.write(_problem); out.write("</pre>"); out.write("Please contat the server administrator"); out.flush(); out.close(); } catch (Exception e) { _log.error(_problem,e); } return; } } try { context = newContext(req,resp); boolean timing = context.isTiming(); if (timing) context.startTiming("WMServlet",req.getRequestURI()); Template t; try { if (timing) context.startTiming("handle"); t = handle(context); } finally { context.stopTiming(); } if (t != null) { execute(t,context); } context.startTiming("WMServlet.destroyContext()"); try { destroyContext(context); } finally { if (timing) context.stopTiming(); } } catch (HandlerException e) { if (context == null) { context = _wcPrototype.newInstance(req,resp); } _log.error("Your handler failed to handle the request:" + this, e); Template tmpl = error(context, "Your handler was unable to process the request successfully " + "for some reason. Here are the details:<p>" + e); execute(tmpl,context); } catch (Exception e) { if (context == null) { context = _wcPrototype.newInstance(req,resp); } _log.error("Your handler failed to handle the request:" + this, e); Template tmpl = error(context, "The handler WebMacro used to handle this request failed for " + "some reason. This is likely a bug in the handler written " + "for this application. Here are the details:<p>" + e); execute(tmpl,_wcPrototype.newInstance(req,resp)); } finally { context.stopTiming(); context.clear(); } }
final private void doRequest( HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { WebContext context = null; if (_problem != null) { init(); if (_problem != null) { try { resp.setContentType("text/html"); FastWriter out = new FastWriter(resp.getOutputStream(), resp.getCharacterEncoding()); out.write("<html><head><title>WebMacro Error</title></head>"); out.write("<body><h1><font color=\"red\">WebMacro Error: "); out.write("</font></h1><pre>"); out.write(_problem); out.write("</pre>"); out.write("Please contat the server administrator"); out.flush(); out.close(); } catch (Exception e) { _log.error(_problem,e); } return; } } try { context = newContext(req,resp); timing = Flags.PROFILE && context.isTiming(); if (timing) context.startTiming("WMServlet",req.getRequestURI()); Template t; try { if (timing) context.startTiming("handle"); t = handle(context); } finally { context.stopTiming(); } if (t != null) { execute(t,context); } context.startTiming("WMServlet.destroyContext()"); try { destroyContext(context); } finally { if (timing) context.stopTiming(); } } catch (HandlerException e) { if (context == null) { context = _wcPrototype.newInstance(req,resp); } _log.error("Your handler failed to handle the request:" + this, e); Template tmpl = error(context, "Your handler was unable to process the request successfully " + "for some reason. Here are the details:<p>" + e); execute(tmpl,context); } catch (Exception e) { if (context == null) { context = _wcPrototype.newInstance(req,resp); } _log.error("Your handler failed to handle the request:" + this, e); Template tmpl = error(context, "The handler WebMacro used to handle this request failed for " + "some reason. This is likely a bug in the handler written " + "for this application. Here are the details:<p>" + e); execute(tmpl,_wcPrototype.newInstance(req,resp)); } finally { context.stopTiming(); context.clear(); } }
3,229,132
final private void doRequest( HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { WebContext context = null; if (_problem != null) { init(); if (_problem != null) { try { resp.setContentType("text/html"); FastWriter out = new FastWriter(resp.getOutputStream(), resp.getCharacterEncoding()); out.write("<html><head><title>WebMacro Error</title></head>"); out.write("<body><h1><font color=\"red\">WebMacro Error: "); out.write("</font></h1><pre>"); out.write(_problem); out.write("</pre>"); out.write("Please contat the server administrator"); out.flush(); out.close(); } catch (Exception e) { _log.error(_problem,e); } return; } } try { context = newContext(req,resp); boolean timing = context.isTiming(); if (timing) context.startTiming("WMServlet",req.getRequestURI()); Template t; try { if (timing) context.startTiming("handle"); t = handle(context); } finally { context.stopTiming(); } if (t != null) { execute(t,context); } context.startTiming("WMServlet.destroyContext()"); try { destroyContext(context); } finally { if (timing) context.stopTiming(); } } catch (HandlerException e) { if (context == null) { context = _wcPrototype.newInstance(req,resp); } _log.error("Your handler failed to handle the request:" + this, e); Template tmpl = error(context, "Your handler was unable to process the request successfully " + "for some reason. Here are the details:<p>" + e); execute(tmpl,context); } catch (Exception e) { if (context == null) { context = _wcPrototype.newInstance(req,resp); } _log.error("Your handler failed to handle the request:" + this, e); Template tmpl = error(context, "The handler WebMacro used to handle this request failed for " + "some reason. This is likely a bug in the handler written " + "for this application. Here are the details:<p>" + e); execute(tmpl,_wcPrototype.newInstance(req,resp)); } finally { context.stopTiming(); context.clear(); } }
final private void doRequest( HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { WebContext context = null; if (_problem != null) { init(); if (_problem != null) { try { resp.setContentType("text/html"); FastWriter out = new FastWriter(resp.getOutputStream(), resp.getCharacterEncoding()); out.write("<html><head><title>WebMacro Error</title></head>"); out.write("<body><h1><font color=\"red\">WebMacro Error: "); out.write("</font></h1><pre>"); out.write(_problem); out.write("</pre>"); out.write("Please contat the server administrator"); out.flush(); out.close(); } catch (Exception e) { _log.error(_problem,e); } return; } } try { context = newContext(req,resp); boolean timing = context.isTiming(); if (timing) context.startTiming("WMServlet",req.getRequestURI()); Template t; try { if (timing) context.startTiming("handle"); t = handle(context); } finally { if (timing) context.stopTiming(); } if (t != null) { execute(t,context); } context.startTiming("WMServlet.destroyContext()"); try { destroyContext(context); } finally { if (timing) if (timing) context.stopTiming(); } } catch (HandlerException e) { if (context == null) { context = _wcPrototype.newInstance(req,resp); } _log.error("Your handler failed to handle the request:" + this, e); Template tmpl = error(context, "Your handler was unable to process the request successfully " + "for some reason. Here are the details:<p>" + e); execute(tmpl,context); } catch (Exception e) { if (context == null) { context = _wcPrototype.newInstance(req,resp); } _log.error("Your handler failed to handle the request:" + this, e); Template tmpl = error(context, "The handler WebMacro used to handle this request failed for " + "some reason. This is likely a bug in the handler written " + "for this application. Here are the details:<p>" + e); execute(tmpl,_wcPrototype.newInstance(req,resp)); } finally { if (timing) context.stopTiming(); context.clear(); } }
3,229,133
final private void doRequest( HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { WebContext context = null; if (_problem != null) { init(); if (_problem != null) { try { resp.setContentType("text/html"); FastWriter out = new FastWriter(resp.getOutputStream(), resp.getCharacterEncoding()); out.write("<html><head><title>WebMacro Error</title></head>"); out.write("<body><h1><font color=\"red\">WebMacro Error: "); out.write("</font></h1><pre>"); out.write(_problem); out.write("</pre>"); out.write("Please contat the server administrator"); out.flush(); out.close(); } catch (Exception e) { _log.error(_problem,e); } return; } } try { context = newContext(req,resp); boolean timing = context.isTiming(); if (timing) context.startTiming("WMServlet",req.getRequestURI()); Template t; try { if (timing) context.startTiming("handle"); t = handle(context); } finally { context.stopTiming(); } if (t != null) { execute(t,context); } context.startTiming("WMServlet.destroyContext()"); try { destroyContext(context); } finally { if (timing) context.stopTiming(); } } catch (HandlerException e) { if (context == null) { context = _wcPrototype.newInstance(req,resp); } _log.error("Your handler failed to handle the request:" + this, e); Template tmpl = error(context, "Your handler was unable to process the request successfully " + "for some reason. Here are the details:<p>" + e); execute(tmpl,context); } catch (Exception e) { if (context == null) { context = _wcPrototype.newInstance(req,resp); } _log.error("Your handler failed to handle the request:" + this, e); Template tmpl = error(context, "The handler WebMacro used to handle this request failed for " + "some reason. This is likely a bug in the handler written " + "for this application. Here are the details:<p>" + e); execute(tmpl,_wcPrototype.newInstance(req,resp)); } finally { context.stopTiming(); context.clear(); } }
final private void doRequest( HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { WebContext context = null; if (_problem != null) { init(); if (_problem != null) { try { resp.setContentType("text/html"); FastWriter out = new FastWriter(resp.getOutputStream(), resp.getCharacterEncoding()); out.write("<html><head><title>WebMacro Error</title></head>"); out.write("<body><h1><font color=\"red\">WebMacro Error: "); out.write("</font></h1><pre>"); out.write(_problem); out.write("</pre>"); out.write("Please contat the server administrator"); out.flush(); out.close(); } catch (Exception e) { _log.error(_problem,e); } return; } } try { context = newContext(req,resp); boolean timing = context.isTiming(); if (timing) context.startTiming("WMServlet",req.getRequestURI()); Template t; try { if (timing) context.startTiming("handle"); t = handle(context); } finally { context.stopTiming(); } if (t != null) { execute(t,context); } if (timing) context.startTiming("WMServlet.destroyContext()"); try { destroyContext(context); } finally { if (timing) context.stopTiming(); } } catch (HandlerException e) { if (context == null) { context = _wcPrototype.newInstance(req,resp); } _log.error("Your handler failed to handle the request:" + this, e); Template tmpl = error(context, "Your handler was unable to process the request successfully " + "for some reason. Here are the details:<p>" + e); execute(tmpl,context); } catch (Exception e) { if (context == null) { context = _wcPrototype.newInstance(req,resp); } _log.error("Your handler failed to handle the request:" + this, e); Template tmpl = error(context, "The handler WebMacro used to handle this request failed for " + "some reason. This is likely a bug in the handler written " + "for this application. Here are the details:<p>" + e); execute(tmpl,_wcPrototype.newInstance(req,resp)); } finally { context.stopTiming(); context.clear(); } }
3,229,134
final private void doRequest( HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { WebContext context = null; if (_problem != null) { init(); if (_problem != null) { try { resp.setContentType("text/html"); FastWriter out = new FastWriter(resp.getOutputStream(), resp.getCharacterEncoding()); out.write("<html><head><title>WebMacro Error</title></head>"); out.write("<body><h1><font color=\"red\">WebMacro Error: "); out.write("</font></h1><pre>"); out.write(_problem); out.write("</pre>"); out.write("Please contat the server administrator"); out.flush(); out.close(); } catch (Exception e) { _log.error(_problem,e); } return; } } try { context = newContext(req,resp); boolean timing = context.isTiming(); if (timing) context.startTiming("WMServlet",req.getRequestURI()); Template t; try { if (timing) context.startTiming("handle"); t = handle(context); } finally { context.stopTiming(); } if (t != null) { execute(t,context); } context.startTiming("WMServlet.destroyContext()"); try { destroyContext(context); } finally { if (timing) context.stopTiming(); } } catch (HandlerException e) { if (context == null) { context = _wcPrototype.newInstance(req,resp); } _log.error("Your handler failed to handle the request:" + this, e); Template tmpl = error(context, "Your handler was unable to process the request successfully " + "for some reason. Here are the details:<p>" + e); execute(tmpl,context); } catch (Exception e) { if (context == null) { context = _wcPrototype.newInstance(req,resp); } _log.error("Your handler failed to handle the request:" + this, e); Template tmpl = error(context, "The handler WebMacro used to handle this request failed for " + "some reason. This is likely a bug in the handler written " + "for this application. Here are the details:<p>" + e); execute(tmpl,_wcPrototype.newInstance(req,resp)); } finally { context.stopTiming(); context.clear(); } }
final private void doRequest( HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { WebContext context = null; if (_problem != null) { init(); if (_problem != null) { try { resp.setContentType("text/html"); FastWriter out = new FastWriter(resp.getOutputStream(), resp.getCharacterEncoding()); out.write("<html><head><title>WebMacro Error</title></head>"); out.write("<body><h1><font color=\"red\">WebMacro Error: "); out.write("</font></h1><pre>"); out.write(_problem); out.write("</pre>"); out.write("Please contat the server administrator"); out.flush(); out.close(); } catch (Exception e) { _log.error(_problem,e); } return; } } try { context = newContext(req,resp); boolean timing = context.isTiming(); if (timing) context.startTiming("WMServlet",req.getRequestURI()); Template t; try { if (timing) context.startTiming("handle"); t = handle(context); } finally { if (timing) context.stopTiming(); } if (t != null) { execute(t,context); } context.startTiming("WMServlet.destroyContext()"); try { destroyContext(context); } finally { if (timing) if (timing) context.stopTiming(); } } catch (HandlerException e) { if (context == null) { context = _wcPrototype.newInstance(req,resp); } _log.error("Your handler failed to handle the request:" + this, e); Template tmpl = error(context, "Your handler was unable to process the request successfully " + "for some reason. Here are the details:<p>" + e); execute(tmpl,context); } catch (Exception e) { if (context == null) { context = _wcPrototype.newInstance(req,resp); } _log.error("Your handler failed to handle the request:" + this, e); Template tmpl = error(context, "The handler WebMacro used to handle this request failed for " + "some reason. This is likely a bug in the handler written " + "for this application. Here are the details:<p>" + e); execute(tmpl,_wcPrototype.newInstance(req,resp)); } finally { if (timing) context.stopTiming(); context.clear(); } }
3,229,135
final protected void execute(Template tmpl, WebContext c) { Writer out = null; try { c.startTiming("Template.write", tmpl); FastWriter fw; try { HttpServletResponse resp= c.getResponse(); fw = FastWriter.getInstance( resp.getOutputStream(), resp.getCharacterEncoding()); tmpl.write(fw, c); } finally { c.stopTiming(); } c.startTiming("FastWriter.close()"); try { fw.close(); } finally { c.stopTiming(); } } catch (IOException e) { // ignore disconnect } catch (Exception e) { String error = "WebMacro encountered an error while executing a template:\n" + ((tmpl != null) ? (tmpl + ": " + e + "\n") : ("The template failed to load; double check the " + "TemplatePath in your webmacro.properties file.")); _log.warning(error,e); try { out.write(error); } catch (Exception ignore) { } } finally { try { if (out != null) { out.flush(); out.close(); } } catch (Exception e3) { // ignore disconnect } } }
final protected void execute(Template tmpl, WebContext c) { Writer out = null; try { if (timing) c.startTiming("Template.write", tmpl); FastWriter fw; try { HttpServletResponse resp= c.getResponse(); fw = FastWriter.getInstance( resp.getOutputStream(), resp.getCharacterEncoding()); tmpl.write(fw, c); } finally { c.stopTiming(); } c.startTiming("FastWriter.close()"); try { fw.close(); } finally { c.stopTiming(); } } catch (IOException e) { // ignore disconnect } catch (Exception e) { String error = "WebMacro encountered an error while executing a template:\n" + ((tmpl != null) ? (tmpl + ": " + e + "\n") : ("The template failed to load; double check the " + "TemplatePath in your webmacro.properties file.")); _log.warning(error,e); try { out.write(error); } catch (Exception ignore) { } } finally { try { if (out != null) { out.flush(); out.close(); } } catch (Exception e3) { // ignore disconnect } } }
3,229,136
final protected void execute(Template tmpl, WebContext c) { Writer out = null; try { c.startTiming("Template.write", tmpl); FastWriter fw; try { HttpServletResponse resp= c.getResponse(); fw = FastWriter.getInstance( resp.getOutputStream(), resp.getCharacterEncoding()); tmpl.write(fw, c); } finally { c.stopTiming(); } c.startTiming("FastWriter.close()"); try { fw.close(); } finally { c.stopTiming(); } } catch (IOException e) { // ignore disconnect } catch (Exception e) { String error = "WebMacro encountered an error while executing a template:\n" + ((tmpl != null) ? (tmpl + ": " + e + "\n") : ("The template failed to load; double check the " + "TemplatePath in your webmacro.properties file.")); _log.warning(error,e); try { out.write(error); } catch (Exception ignore) { } } finally { try { if (out != null) { out.flush(); out.close(); } } catch (Exception e3) { // ignore disconnect } } }
final protected void execute(Template tmpl, WebContext c) { Writer out = null; try { c.startTiming("Template.write", tmpl); FastWriter fw; try { HttpServletResponse resp= c.getResponse(); fw = FastWriter.getInstance( resp.getOutputStream(), resp.getCharacterEncoding()); tmpl.write(fw, c); } finally { if (timing) c.stopTiming(); } c.startTiming("FastWriter.close()"); try { fw.close(); } finally { if (timing) c.stopTiming(); } } catch (IOException e) { // ignore disconnect } catch (Exception e) { String error = "WebMacro encountered an error while executing a template:\n" + ((tmpl != null) ? (tmpl + ": " + e + "\n") : ("The template failed to load; double check the " + "TemplatePath in your webmacro.properties file.")); _log.warning(error,e); try { out.write(error); } catch (Exception ignore) { } } finally { try { if (out != null) { out.flush(); out.close(); } } catch (Exception e3) { // ignore disconnect } } }
3,229,137
final protected void execute(Template tmpl, WebContext c) { Writer out = null; try { c.startTiming("Template.write", tmpl); FastWriter fw; try { HttpServletResponse resp= c.getResponse(); fw = FastWriter.getInstance( resp.getOutputStream(), resp.getCharacterEncoding()); tmpl.write(fw, c); } finally { c.stopTiming(); } c.startTiming("FastWriter.close()"); try { fw.close(); } finally { c.stopTiming(); } } catch (IOException e) { // ignore disconnect } catch (Exception e) { String error = "WebMacro encountered an error while executing a template:\n" + ((tmpl != null) ? (tmpl + ": " + e + "\n") : ("The template failed to load; double check the " + "TemplatePath in your webmacro.properties file.")); _log.warning(error,e); try { out.write(error); } catch (Exception ignore) { } } finally { try { if (out != null) { out.flush(); out.close(); } } catch (Exception e3) { // ignore disconnect } } }
final protected void execute(Template tmpl, WebContext c) { Writer out = null; try { c.startTiming("Template.write", tmpl); FastWriter fw; try { HttpServletResponse resp= c.getResponse(); fw = FastWriter.getInstance( resp.getOutputStream(), resp.getCharacterEncoding()); tmpl.write(fw, c); } finally { c.stopTiming(); } if (timing) c.startTiming("FastWriter.close()"); try { fw.close(); } finally { c.stopTiming(); } } catch (IOException e) { // ignore disconnect } catch (Exception e) { String error = "WebMacro encountered an error while executing a template:\n" + ((tmpl != null) ? (tmpl + ": " + e + "\n") : ("The template failed to load; double check the " + "TemplatePath in your webmacro.properties file.")); _log.warning(error,e); try { out.write(error); } catch (Exception ignore) { } } finally { try { if (out != null) { out.flush(); out.close(); } } catch (Exception e3) { // ignore disconnect } } }
3,229,138
final protected void execute(Template tmpl, WebContext c) { Writer out = null; try { c.startTiming("Template.write", tmpl); FastWriter fw; try { HttpServletResponse resp= c.getResponse(); fw = FastWriter.getInstance( resp.getOutputStream(), resp.getCharacterEncoding()); tmpl.write(fw, c); } finally { c.stopTiming(); } c.startTiming("FastWriter.close()"); try { fw.close(); } finally { c.stopTiming(); } } catch (IOException e) { // ignore disconnect } catch (Exception e) { String error = "WebMacro encountered an error while executing a template:\n" + ((tmpl != null) ? (tmpl + ": " + e + "\n") : ("The template failed to load; double check the " + "TemplatePath in your webmacro.properties file.")); _log.warning(error,e); try { out.write(error); } catch (Exception ignore) { } } finally { try { if (out != null) { out.flush(); out.close(); } } catch (Exception e3) { // ignore disconnect } } }
final protected void execute(Template tmpl, WebContext c) { Writer out = null; try { c.startTiming("Template.write", tmpl); FastWriter fw; try { HttpServletResponse resp= c.getResponse(); fw = FastWriter.getInstance( resp.getOutputStream(), resp.getCharacterEncoding()); tmpl.write(fw, c); } finally { c.stopTiming(); } c.startTiming("FastWriter.close()"); try { fw.close(); } finally { if (timing) c.stopTiming(); } } catch (IOException e) { // ignore disconnect } catch (Exception e) { String error = "WebMacro encountered an error while executing a template:\n" + ((tmpl != null) ? (tmpl + ": " + e + "\n") : ("The template failed to load; double check the " + "TemplatePath in your webmacro.properties file.")); _log.warning(error,e); try { out.write(error); } catch (Exception ignore) { } } finally { try { if (out != null) { out.flush(); out.close(); } } catch (Exception e3) { // ignore disconnect } } }
3,229,139
private void addInstrumentation(File file) { if (file.isDirectory()) { File[] contents = file.listFiles(); for (int i = 0; i < contents.length; i++) addInstrumentation(contents[i]); return; } if (!isClass(file)) { return; } if (logger.isDebugEnabled()) { logger.debug("instrumenting " + file.getAbsolutePath()); } InputStream inputStream = null; OutputStream outputStream = null; try { inputStream = new FileInputStream(file); ClassReader cr = new ClassReader(inputStream); ClassWriter cw = new ClassWriter(true); ClassInstrumenter cv = new ClassInstrumenter(projectData, cw, ignoreRegexp); cr.accept(cv, false); byte[] instrumentedClass = cw.toByteArray(); if (cv.isInstrumented()) { File outputFile = new File(destinationDirectory, cv .getClassName().replace('.', File.separatorChar) + ".class"); outputFile.getParentFile().mkdirs(); outputStream = new FileOutputStream(outputFile); outputStream.write(instrumentedClass); } } catch (IOException e) { logger.warn( "Unable to instrument file " + file.getAbsolutePath(), e); } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { } } if (outputStream != null) { try { outputStream.close(); } catch (IOException e) { } } } }
private void addInstrumentation(File file) { if (file.isDirectory()) { File[] contents = file.listFiles(); for (int i = 0; i < contents.length; i++) addInstrumentation(contents[i]); return; } if (!isClass(file)) { return; } if (logger.isDebugEnabled()) { logger.debug("instrumenting " + file.getAbsolutePath()); } InputStream inputStream = null; OutputStream outputStream = null; try { inputStream = new FileInputStream(file); ClassReader cr = new ClassReader(inputStream); ClassWriter cw = new ClassWriter(true); ClassInstrumenter cv = new ClassInstrumenter(projectData, cw, ignoreRegexp); cr.accept(cv, false); byte[] instrumentedClass = cw.toByteArray(); if (cv.isInstrumented()) { File outputFile = new File(destinationDirectory, cv .getClassName().replace('.', File.separatorChar) + ".class"); outputFile.getParentFile().mkdirs(); outputStream = new FileOutputStream(outputFile); outputStream.write(instrumentedClass); } } catch (IOException e) { logger.warn( "Unable to instrument file " + file.getAbsolutePath(), e); } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { } } if (outputStream != null) { try { outputStream.close(); } catch (IOException e) { } } } }
3,229,140
private Ruby() { nilObject = RubyObject.nilObject(this); trueObject = new RubyBoolean(this, true); falseObject = new RubyBoolean(this, false); javaSupport = new JavaSupport(this); }
private Ruby() { nilObject = new RubyNil(this); trueObject = new RubyBoolean(this, true); falseObject = new RubyBoolean(this, false); javaSupport = new JavaSupport(this); }
3,229,141
public void setSatisfied() { lock.lock(); try { condition.signalAll(); } finally { lock.unlock(); } }
public void setSatisfied() { lock.lock(); try { if (!satisfied) { satisfied = true; condition.signalAll(); } } finally { lock.unlock(); } }
3,229,142
public int getIntegerSetting(String key) { String snum = getSetting(key); try { return Integer.parseInt(key); } catch (Exception e) { return 0; } }
public int getIntegerSetting(String key) { String snum = getSetting(key); try { return Integer.parseInt(snum); } catch (Exception e) { return 0; } }
3,229,143
public PaletteModuleView(ChainModuleData module) { super(module); }
public PaletteModuleView(ChainModuleData module) { super(module); }
3,229,144
private ChainView getChainViewParent() { PNode p = getParent(); while (p != null) { if (p instanceof ChainView) return (ChainView) p; p = p.getParent(); } return null; }
private ChainView getChainViewParent() { PNode p = getParent(); while (p != null) { if (p instanceof ChainView) return (ChainView) p; p = p.getParent(); } return null; }
3,229,145
private ChainView getChainViewParent() { PNode p = getParent(); while (p != null) { if (p instanceof ChainView) return (ChainView) p; p = p.getParent(); } return null; }
private ChainView getChainViewParent() { PNode p = getParent(); while (p != null) { if (p instanceof ChainView) return (ChainView) p; p = p.getParent(); } return null; }
3,229,146
protected LinkTarget getLinkTarget() { LinkTarget link = super.getLinkTarget(); link.setPickable(false); return link; }
protected LinkTarget getLinkTarget() { LinkTarget link = super.getLinkTarget(); link.setPickable(false); return link; }
3,229,147
public void mouseClicked(GenericEventHandler handler) { ((ChainPaletteEventHandler) handler).animateToNode(this); ((ChainPaletteEventHandler) handler).setLastEntered(this); }
public void mouseClicked(GenericEventHandler handler) { ((ChainPaletteEventHandler) handler).animateToNode(this); ((ChainPaletteEventHandler) handler).setLastEntered(this); }
3,229,148
public void mousePopup(GenericEventHandler handler) { ChainView view = getChainViewParent(); ((ChainPaletteEventHandler) handler).animateToNode(view); ((ChainPaletteEventHandler) handler).setLastEntered(view); ((ChainPaletteEventHandler) handler).hideLastChainView(); }
public void mousePopup(GenericEventHandler handler) { ChainView view = getChainViewParent(); ((ChainPaletteEventHandler) handler).animateToNode(view); ((ChainPaletteEventHandler) handler).setLastEntered(view); ((ChainPaletteEventHandler) handler).hideLastChainView(); }
3,229,149
public void mousePopup(GenericEventHandler handler) { ChainView view = getChainViewParent(); ((ChainPaletteEventHandler) handler).animateToNode(view); ((ChainPaletteEventHandler) handler).setLastEntered(view); ((ChainPaletteEventHandler) handler).hideLastChainView(); }
public void mousePopup(GenericEventHandler handler) { ChainView view = getChainViewParent(); ((ChainPaletteEventHandler) handler).animateToNode(view); ((ChainPaletteEventHandler) handler).setLastEntered(view); ((ChainPaletteEventHandler) handler).hideLastChainView(); }
3,229,150
protected String[] getConfigLocations() { return new String[] { "WEB-INF/dao.xml", "WEB-INF/data.xml", "WEB-INF/config-test.xml" }; }
protected String[] getConfigLocations() { return new String[] { "WEB-INF/services.xml", "WEB-INF/dao.xml", "WEB-INF/data.xml", "WEB-INF/config-test.xml" }; }
3,229,151
public void testImageThumbnailExplodsOnHessianSerialization() { HierarchyBrowsingImpl hbv = new HierarchyBrowsingImpl(); SessionFactory sessions = (SessionFactory) this.applicationContext .getBean("sessionFactory"); // Mock Dao Mock containerDao = new Mock(ContainerDao.class); hbv.setContainerDao((ContainerDao) containerDao.proxy()); HibernateTemplate ht = new HibernateTemplate(sessions); // Arguments Set ids = new HashSet(); ids.add(new Integer(1)); // Result Image img = (Image) ht.execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { Query q = session.createQuery("from Image as i join fetch i.datasets as ds join fetch ds.projects as prj "); return q.setMaxResults(1).uniqueResult(); } }); List result = new ArrayList(); result.add(img); // Run containerDao.expects(new InvokeOnceMatcher()).method("findPDIHierarchies").with(new IsSame(ids)).will(new ReturnStub(result)); Set set = hbv.findPDIHierarchies(ids ); containerDao.verify(); containerDao.reset(); Utils.structureSize(set); }
public void testImageThumbnailExplodsOnHessianSerialization() { HierarchyBrowsingImpl hbv = new HierarchyBrowsingImpl(); SessionFactory sessions = (SessionFactory) this.applicationContext .getBean("sessionFactory"); // Mock Dao Mock containerDao = new Mock(ContainerDao.class); hbv.setContainerDao((ContainerDao) containerDao.proxy()); HibernateTemplate ht = new HibernateTemplate(sessions); // Arguments Set ids = new HashSet(); ids.add(new Integer(1)); // Result Image img = (Image) ht.execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { Query q = session .createQuery("from Image as i join fetch i.datasets as ds join fetch ds.projects as prj "); return q.setMaxResults(1).uniqueResult(); } }); List result = new ArrayList(); result.add(img); // Run containerDao.expects(new InvokeOnceMatcher()).method("findPDIHierarchies").with(new IsSame(ids)).will(new ReturnStub(result)); Set set = hbv.findPDIHierarchies(ids ); containerDao.verify(); containerDao.reset(); Utils.structureSize(set); }
3,229,152
public void testImageThumbnailExplodsOnHessianSerialization() { HierarchyBrowsingImpl hbv = new HierarchyBrowsingImpl(); SessionFactory sessions = (SessionFactory) this.applicationContext .getBean("sessionFactory"); // Mock Dao Mock containerDao = new Mock(ContainerDao.class); hbv.setContainerDao((ContainerDao) containerDao.proxy()); HibernateTemplate ht = new HibernateTemplate(sessions); // Arguments Set ids = new HashSet(); ids.add(new Integer(1)); // Result Image img = (Image) ht.execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { Query q = session.createQuery("from Image as i join fetch i.datasets as ds join fetch ds.projects as prj "); return q.setMaxResults(1).uniqueResult(); } }); List result = new ArrayList(); result.add(img); // Run containerDao.expects(new InvokeOnceMatcher()).method("findPDIHierarchies").with(new IsSame(ids)).will(new ReturnStub(result)); Set set = hbv.findPDIHierarchies(ids ); containerDao.verify(); containerDao.reset(); Utils.structureSize(set); }
public void testImageThumbnailExplodsOnHessianSerialization() { HierarchyBrowsingImpl hbv = new HierarchyBrowsingImpl(); SessionFactory sessions = (SessionFactory) this.applicationContext .getBean("sessionFactory"); // Mock Dao Mock containerDao = new Mock(ContainerDao.class); hbv.setContainerDao((ContainerDao) containerDao.proxy()); HibernateTemplate ht = new HibernateTemplate(sessions); // Arguments Set ids = new HashSet(); ids.add(new Integer(1)); // Result Image img = (Image) ht.execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { Query q = session.createQuery("from Image as i join fetch i.datasets as ds join fetch ds.projects as prj "); return q.setMaxResults(1).uniqueResult(); } }); List result = new ArrayList(); result.add(img); // Run containerDao.expects(new InvokeOnceMatcher()).method("findPDIHierarchies").with(new IsSame(ids)).will(new ReturnStub(result)); Set set = hbv.findPDIHierarchies(ids ); containerDao.verify(); containerDao.reset(); Utils.structureSize(set); }
3,229,153
public void testImageThumbnailExplodsOnHessianSerialization() { HierarchyBrowsingImpl hbv = new HierarchyBrowsingImpl(); SessionFactory sessions = (SessionFactory) this.applicationContext .getBean("sessionFactory"); // Mock Dao Mock containerDao = new Mock(ContainerDao.class); hbv.setContainerDao((ContainerDao) containerDao.proxy()); HibernateTemplate ht = new HibernateTemplate(sessions); // Arguments Set ids = new HashSet(); ids.add(new Integer(1)); // Result Image img = (Image) ht.execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { Query q = session.createQuery("from Image as i join fetch i.datasets as ds join fetch ds.projects as prj "); return q.setMaxResults(1).uniqueResult(); } }); List result = new ArrayList(); result.add(img); // Run containerDao.expects(new InvokeOnceMatcher()).method("findPDIHierarchies").with(new IsSame(ids)).will(new ReturnStub(result)); Set set = hbv.findPDIHierarchies(ids ); containerDao.verify(); containerDao.reset(); Utils.structureSize(set); }
public void testImageThumbnailExplodsOnHessianSerialization() { HierarchyBrowsingImpl hbv = new HierarchyBrowsingImpl(); SessionFactory sessions = (SessionFactory) this.applicationContext .getBean("sessionFactory"); // Mock Dao Mock containerDao = new Mock(ContainerDao.class); hbv.setContainerDao((ContainerDao) containerDao.proxy()); HibernateTemplate ht = new HibernateTemplate(sessions); // Arguments Set ids = new HashSet(); ids.add(new Integer(1)); // Result Image img = (Image) ht.execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { Query q = session.createQuery("from Image as i join fetch i.datasets as ds join fetch ds.projects as prj "); return q.setMaxResults(1).uniqueResult(); } }); List result = new ArrayList(); result.add(img); // Run containerDao.expects(new InvokeOnceMatcher()).method("findPDIHierarchies").with(new IsSame(ids)).will(new ReturnStub(result)); Set set = hbv.findPDIHierarchies(ids ); containerDao.verify(); containerDao.reset(); Utils.structureSize(set); }
3,229,154
public Object doInHibernate(Session session) throws HibernateException { Query q = session.createQuery("from Image as i join fetch i.datasets as ds join fetch ds.projects as prj "); return q.setMaxResults(1).uniqueResult(); }
public Object doInHibernate(Session session) throws HibernateException { Query q = session .createQuery("from Image as i join fetch i.datasets as ds join fetch ds.projects as prj "); return q.setMaxResults(1).uniqueResult(); }
3,229,155
public Object build(DirectiveBuilder builder, BuildContext bc) throws BuildException { Object c = builder.getArg(IF_COND, bc); boolean cMacro = (c instanceof Macro); int elseifCount; DirectiveArgs elseArgs; DirectiveArgs[] elseifArgs = null; // If condition is static and true -- just return the block if (!cMacro && Expression.isTrue(c)) { return (Block) builder.getArg(IF_BLOCK, bc); } elseArgs = builder.getSubdirective(IF_ELSE); elseifArgs = builder.getRepeatingSubdirective(IF_ELSEIF); elseifCount = (elseifArgs == null) ? 0 : elseifArgs.length; // OK, how about no else-if subdirectives? if (elseifCount == 0) { // If condition is static and false -- just return the else block if (!cMacro) { return (elseArgs != null) ? elseArgs.getArg(ELSE_BLOCK, bc) : ""; } else { // Just one condition -- the IF condition, and maybe an ELSE block nConditions = 1; conditions = new Macro[1]; blocks = new Block[1]; conditions[0] = (Macro) c; blocks[0] = (Block) builder.getArg(IF_BLOCK, bc); if (elseArgs != null) elseBlock = (Block) elseArgs.getArg(ELSE_BLOCK, bc); return this; } } else { // This is the ugly case -- we have to guess at how many conditions // we'll have. We start with 1 + count(#elseof), and if any can be // folded out at compile time, we just won't use the whole thing int i=0; nConditions=elseifCount + (cMacro? 1 : 0); conditions = new Macro[nConditions]; blocks = new Block[nConditions]; if (cMacro) { conditions[0] = (Macro) c; blocks[0] = (Block) builder.getArg(IF_BLOCK, bc); ++i; } for (int j=0; j < elseifCount; j++) { c = elseifArgs[j].getArg(ELSEIF_COND, bc); if (c instanceof Macro) { conditions[i] = (Macro) c; blocks[i] = (Block) elseifArgs[j].getArg(ELSEIF_BLOCK, bc); ++i; } else if (Expression.isTrue(c)) { elseBlock = (Block) elseifArgs[j].getArg(ELSEIF_BLOCK, bc); // If all the previous got folded out as false, then just return the // block from this condition, otherwise stash it in the elseBlock // and we're done with #elseif directives if (i == 0) return elseBlock; else break; } else { // Just skip this #elseif directive } } // If we didn't promote one of the elseif blocks to else, get the else if (elseBlock == null && elseArgs != null) { elseBlock = (Block) elseArgs.getArg(ELSE_BLOCK, bc); // If there are no valid conditions, just return the else block if (i == 0) return elseBlock; } if (i < nConditions) { // If we folded out some cases, we would want to resize the arrays, // but since the space doesn't really matter, we'll save time by // just remembering how big they really are. nConditions = i; } } return this; }
public Object build(DirectiveBuilder builder, BuildContext bc) throws BuildException { Object c = builder.getArg(IF_COND, bc); boolean cMacro = (c instanceof Macro); int elseifCount; DirectiveArgs elseArgs; DirectiveArgs[] elseifArgs = null; // If condition is static and true -- just return the block if (!cMacro && Expression.isTrue(c)) { return (Block) builder.getArg(IF_BLOCK, bc); } elseArgs = builder.getSubdirective(IF_ELSE); elseifArgs = builder.getRepeatingSubdirective(IF_ELSEIF); elseifCount = (elseifArgs == null) ? 0 : elseifArgs.length; // OK, how about no else-if subdirectives? if (elseifCount == 0) { // If condition is static and false -- just return the else block if (!cMacro) { return (elseArgs != null) ? elseArgs.getArg(ELSE_BLOCK, bc) : ""; } else { // Just one condition -- the IF condition, and maybe an ELSE block nConditions = 1; conditions = new Macro[1]; blocks = new Block[1]; conditions[0] = (Macro) c; blocks[0] = (Block) builder.getArg(IF_BLOCK, bc); if (elseArgs != null) elseBlock = (Block) elseArgs.getArg(ELSE_BLOCK, bc); return this; } } else { // This is the ugly case -- we have to guess at how many conditions // we'll have. We start with 1 + count(#elseof), and if any can be // folded out at compile time, we just won't use the whole thing int i=0; nConditions=elseifCount + (cMacro? 1 : 0); conditions = new Macro[nConditions]; blocks = new Block[nConditions]; if (cMacro) { conditions[0] = (Macro) c; blocks[0] = (Block) builder.getArg(IF_BLOCK, bc); ++i; } for (int j=0; j < elseifCount; j++) { c = elseifArgs[j].getArg(ELSEIF_COND, bc); if (c instanceof Macro) { conditions[i] = (Macro) c; blocks[i] = (Block) elseifArgs[j].getArg(ELSEIF_BLOCK, bc); ++i; } else if (Expression.isTrue(c)) { elseBlock = (Block) elseifArgs[j].getArg(ELSEIF_BLOCK, bc); // If all the previous got folded out as false, then just return the // block from this condition, otherwise stash it in the elseBlock // and we're done with #elseif directives if (i == 0) return elseBlock; else break; } else { // Just skip this #elseif directive } } // If we didn't promote one of the elseif blocks to else, get the else if (elseBlock == null && elseArgs != null) { elseBlock = (Block) elseArgs.getArg(ELSE_BLOCK, bc); // If there are no valid conditions, just return the else block if (i == 0) return elseBlock; } if (i < nConditions) { // If we folded out some cases, we would want to resize the arrays, // but since the space doesn't really matter, we'll save time by // just remembering how big they really are. nConditions = i; } } return this; }
3,229,156
public Object build(DirectiveBuilder builder, BuildContext bc) throws BuildException { Object c = builder.getArg(IF_COND, bc); boolean cMacro = (c instanceof Macro); int elseifCount; DirectiveArgs elseArgs; DirectiveArgs[] elseifArgs = null; // If condition is static and true -- just return the block if (!cMacro && Expression.isTrue(c)) { return (Block) builder.getArg(IF_BLOCK, bc); } elseArgs = builder.getSubdirective(IF_ELSE); elseifArgs = builder.getRepeatingSubdirective(IF_ELSEIF); elseifCount = (elseifArgs == null) ? 0 : elseifArgs.length; // OK, how about no else-if subdirectives? if (elseifCount == 0) { // If condition is static and false -- just return the else block if (!cMacro) { return (elseArgs != null) ? elseArgs.getArg(ELSE_BLOCK, bc) : ""; } else { // Just one condition -- the IF condition, and maybe an ELSE block nConditions = 1; conditions = new Macro[1]; blocks = new Block[1]; conditions[0] = (Macro) c; blocks[0] = (Block) builder.getArg(IF_BLOCK, bc); if (elseArgs != null) elseBlock = (Block) elseArgs.getArg(ELSE_BLOCK, bc); return this; } } else { // This is the ugly case -- we have to guess at how many conditions // we'll have. We start with 1 + count(#elseof), and if any can be // folded out at compile time, we just won't use the whole thing int i=0; nConditions=elseifCount + (cMacro? 1 : 0); conditions = new Macro[nConditions]; blocks = new Block[nConditions]; if (cMacro) { conditions[0] = (Macro) c; blocks[0] = (Block) builder.getArg(IF_BLOCK, bc); ++i; } for (int j=0; j < elseifCount; j++) { c = elseifArgs[j].getArg(ELSEIF_COND, bc); if (c instanceof Macro) { conditions[i] = (Macro) c; blocks[i] = (Block) elseifArgs[j].getArg(ELSEIF_BLOCK, bc); ++i; } else if (Expression.isTrue(c)) { elseBlock = (Block) elseifArgs[j].getArg(ELSEIF_BLOCK, bc); // If all the previous got folded out as false, then just return the // block from this condition, otherwise stash it in the elseBlock // and we're done with #elseif directives if (i == 0) return elseBlock; else break; } else { // Just skip this #elseif directive } } // If we didn't promote one of the elseif blocks to else, get the else if (elseBlock == null && elseArgs != null) { elseBlock = (Block) elseArgs.getArg(ELSE_BLOCK, bc); // If there are no valid conditions, just return the else block if (i == 0) return elseBlock; } if (i < nConditions) { // If we folded out some cases, we would want to resize the arrays, // but since the space doesn't really matter, we'll save time by // just remembering how big they really are. nConditions = i; } } return this; }
public Object build(DirectiveBuilder builder, BuildContext bc) throws BuildException { Object c = builder.getArg(IF_COND, bc); boolean cMacro = (c instanceof Macro); int elseifCount; DirectiveArgs elseArgs; DirectiveArgs[] elseifArgs = null; // If condition is static and true -- just return the block if (!cMacro && Expression.isTrue(c)) { return (Block) builder.getArg(IF_BLOCK, bc); } elseArgs = builder.getSubdirective(IF_ELSE); elseifArgs = builder.getRepeatingSubdirective(IF_ELSEIF); elseifCount = (elseifArgs == null) ? 0 : elseifArgs.length; // OK, how about no else-if subdirectives? if (elseifCount == 0) { // If condition is static and false -- just return the else block if (!cMacro) { return (elseArgs != null) ? elseArgs.getArg(ELSE_BLOCK) : ""; } else { // Just one condition -- the IF condition, and maybe an ELSE block nConditions = 1; conditions = new Macro[1]; blocks = new Block[1]; conditions[0] = (Macro) c; blocks[0] = (Block) builder.getArg(IF_BLOCK, bc); if (elseArgs != null) elseBlock = (Block) elseArgs.getArg(ELSE_BLOCK, bc); return this; } } else { // This is the ugly case -- we have to guess at how many conditions // we'll have. We start with 1 + count(#elseof), and if any can be // folded out at compile time, we just won't use the whole thing int i=0; nConditions=elseifCount + (cMacro? 1 : 0); conditions = new Macro[nConditions]; blocks = new Block[nConditions]; if (cMacro) { conditions[0] = (Macro) c; blocks[0] = (Block) builder.getArg(IF_BLOCK, bc); ++i; } for (int j=0; j < elseifCount; j++) { c = elseifArgs[j].getArg(ELSEIF_COND, bc); if (c instanceof Macro) { conditions[i] = (Macro) c; blocks[i] = (Block) elseifArgs[j].getArg(ELSEIF_BLOCK, bc); ++i; } else if (Expression.isTrue(c)) { elseBlock = (Block) elseifArgs[j].getArg(ELSEIF_BLOCK, bc); // If all the previous got folded out as false, then just return the // block from this condition, otherwise stash it in the elseBlock // and we're done with #elseif directives if (i == 0) return elseBlock; else break; } else { // Just skip this #elseif directive } } // If we didn't promote one of the elseif blocks to else, get the else if (elseBlock == null && elseArgs != null) { elseBlock = (Block) elseArgs.getArg(ELSE_BLOCK, bc); // If there are no valid conditions, just return the else block if (i == 0) return elseBlock; } if (i < nConditions) { // If we folded out some cases, we would want to resize the arrays, // but since the space doesn't really matter, we'll save time by // just remembering how big they really are. nConditions = i; } } return this; }
3,229,157
public Object build(DirectiveBuilder builder, BuildContext bc) throws BuildException { Object c = builder.getArg(IF_COND, bc); boolean cMacro = (c instanceof Macro); int elseifCount; DirectiveArgs elseArgs; DirectiveArgs[] elseifArgs = null; // If condition is static and true -- just return the block if (!cMacro && Expression.isTrue(c)) { return (Block) builder.getArg(IF_BLOCK, bc); } elseArgs = builder.getSubdirective(IF_ELSE); elseifArgs = builder.getRepeatingSubdirective(IF_ELSEIF); elseifCount = (elseifArgs == null) ? 0 : elseifArgs.length; // OK, how about no else-if subdirectives? if (elseifCount == 0) { // If condition is static and false -- just return the else block if (!cMacro) { return (elseArgs != null) ? elseArgs.getArg(ELSE_BLOCK, bc) : ""; } else { // Just one condition -- the IF condition, and maybe an ELSE block nConditions = 1; conditions = new Macro[1]; blocks = new Block[1]; conditions[0] = (Macro) c; blocks[0] = (Block) builder.getArg(IF_BLOCK, bc); if (elseArgs != null) elseBlock = (Block) elseArgs.getArg(ELSE_BLOCK, bc); return this; } } else { // This is the ugly case -- we have to guess at how many conditions // we'll have. We start with 1 + count(#elseof), and if any can be // folded out at compile time, we just won't use the whole thing int i=0; nConditions=elseifCount + (cMacro? 1 : 0); conditions = new Macro[nConditions]; blocks = new Block[nConditions]; if (cMacro) { conditions[0] = (Macro) c; blocks[0] = (Block) builder.getArg(IF_BLOCK, bc); ++i; } for (int j=0; j < elseifCount; j++) { c = elseifArgs[j].getArg(ELSEIF_COND, bc); if (c instanceof Macro) { conditions[i] = (Macro) c; blocks[i] = (Block) elseifArgs[j].getArg(ELSEIF_BLOCK, bc); ++i; } else if (Expression.isTrue(c)) { elseBlock = (Block) elseifArgs[j].getArg(ELSEIF_BLOCK, bc); // If all the previous got folded out as false, then just return the // block from this condition, otherwise stash it in the elseBlock // and we're done with #elseif directives if (i == 0) return elseBlock; else break; } else { // Just skip this #elseif directive } } // If we didn't promote one of the elseif blocks to else, get the else if (elseBlock == null && elseArgs != null) { elseBlock = (Block) elseArgs.getArg(ELSE_BLOCK, bc); // If there are no valid conditions, just return the else block if (i == 0) return elseBlock; } if (i < nConditions) { // If we folded out some cases, we would want to resize the arrays, // but since the space doesn't really matter, we'll save time by // just remembering how big they really are. nConditions = i; } } return this; }
public Object build(DirectiveBuilder builder, BuildContext bc) throws BuildException { Object c = builder.getArg(IF_COND, bc); boolean cMacro = (c instanceof Macro); int elseifCount; DirectiveArgs elseArgs; DirectiveArgs[] elseifArgs = null; // If condition is static and true -- just return the block if (!cMacro && Expression.isTrue(c)) { return (Block) builder.getArg(IF_BLOCK, bc); } elseArgs = builder.getSubdirective(IF_ELSE); elseifArgs = builder.getRepeatingSubdirective(IF_ELSEIF); elseifCount = (elseifArgs == null) ? 0 : elseifArgs.length; // OK, how about no else-if subdirectives? if (elseifCount == 0) { // If condition is static and false -- just return the else block if (!cMacro) { return (elseArgs != null) ? elseArgs.getArg(ELSE_BLOCK, bc) : ""; } else { // Just one condition -- the IF condition, and maybe an ELSE block nConditions = 1; conditions = new Macro[1]; blocks = new Block[1]; conditions[0] = (Macro) c; blocks[0] = (Block) builder.getArg(IF_BLOCK, bc); if (elseArgs != null) elseBlock = (Block) elseArgs.getArg(ELSE_BLOCK, bc); return this; } } else { // This is the ugly case -- we have to guess at how many conditions // we'll have. We start with 1 + count(#elseof), and if any can be // folded out at compile time, we just won't use the whole thing int i=0; nConditions=elseifCount + (cMacro? 1 : 0); conditions = new Macro[nConditions]; blocks = new Block[nConditions]; if (cMacro) { conditions[0] = (Macro) c; blocks[0] = (Block) builder.getArg(IF_BLOCK, bc); ++i; } for (int j=0; j < elseifCount; j++) { c = elseifArgs[j].getArg(ELSEIF_COND, bc); if (c instanceof Macro) { conditions[i] = (Macro) c; blocks[i] = (Block) elseifArgs[j].getArg(ELSEIF_BLOCK, bc); ++i; } else if (Expression.isTrue(c)) { // If all the previous got folded out as false, then just return the // block from this condition, otherwise stash it in the elseBlock // and we're done with #elseif directives if (i == 0) return elseBlock; else break; } else { // Just skip this #elseif directive } } // If we didn't promote one of the elseif blocks to else, get the else if (elseBlock == null && elseArgs != null) { elseBlock = (Block) elseArgs.getArg(ELSE_BLOCK, bc); // If there are no valid conditions, just return the else block if (i == 0) return elseBlock; } if (i < nConditions) { // If we folded out some cases, we would want to resize the arrays, // but since the space doesn't really matter, we'll save time by // just remembering how big they really are. nConditions = i; } } return this; }
3,229,158
public Object build(DirectiveBuilder builder, BuildContext bc) throws BuildException { Object c = builder.getArg(IF_COND, bc); boolean cMacro = (c instanceof Macro); int elseifCount; DirectiveArgs elseArgs; DirectiveArgs[] elseifArgs = null; // If condition is static and true -- just return the block if (!cMacro && Expression.isTrue(c)) { return (Block) builder.getArg(IF_BLOCK, bc); } elseArgs = builder.getSubdirective(IF_ELSE); elseifArgs = builder.getRepeatingSubdirective(IF_ELSEIF); elseifCount = (elseifArgs == null) ? 0 : elseifArgs.length; // OK, how about no else-if subdirectives? if (elseifCount == 0) { // If condition is static and false -- just return the else block if (!cMacro) { return (elseArgs != null) ? elseArgs.getArg(ELSE_BLOCK, bc) : ""; } else { // Just one condition -- the IF condition, and maybe an ELSE block nConditions = 1; conditions = new Macro[1]; blocks = new Block[1]; conditions[0] = (Macro) c; blocks[0] = (Block) builder.getArg(IF_BLOCK, bc); if (elseArgs != null) elseBlock = (Block) elseArgs.getArg(ELSE_BLOCK, bc); return this; } } else { // This is the ugly case -- we have to guess at how many conditions // we'll have. We start with 1 + count(#elseof), and if any can be // folded out at compile time, we just won't use the whole thing int i=0; nConditions=elseifCount + (cMacro? 1 : 0); conditions = new Macro[nConditions]; blocks = new Block[nConditions]; if (cMacro) { conditions[0] = (Macro) c; blocks[0] = (Block) builder.getArg(IF_BLOCK, bc); ++i; } for (int j=0; j < elseifCount; j++) { c = elseifArgs[j].getArg(ELSEIF_COND, bc); if (c instanceof Macro) { conditions[i] = (Macro) c; blocks[i] = (Block) elseifArgs[j].getArg(ELSEIF_BLOCK, bc); ++i; } else if (Expression.isTrue(c)) { elseBlock = (Block) elseifArgs[j].getArg(ELSEIF_BLOCK, bc); // If all the previous got folded out as false, then just return the // block from this condition, otherwise stash it in the elseBlock // and we're done with #elseif directives if (i == 0) return elseBlock; else break; } else { // Just skip this #elseif directive } } // If we didn't promote one of the elseif blocks to else, get the else if (elseBlock == null && elseArgs != null) { elseBlock = (Block) elseArgs.getArg(ELSE_BLOCK, bc); // If there are no valid conditions, just return the else block if (i == 0) return elseBlock; } if (i < nConditions) { // If we folded out some cases, we would want to resize the arrays, // but since the space doesn't really matter, we'll save time by // just remembering how big they really are. nConditions = i; } } return this; }
public Object build(DirectiveBuilder builder, BuildContext bc) throws BuildException { Object c = builder.getArg(IF_COND, bc); boolean cMacro = (c instanceof Macro); int elseifCount; DirectiveArgs elseArgs; DirectiveArgs[] elseifArgs = null; // If condition is static and true -- just return the block if (!cMacro && Expression.isTrue(c)) { return (Block) builder.getArg(IF_BLOCK, bc); } elseArgs = builder.getSubdirective(IF_ELSE); elseifArgs = builder.getRepeatingSubdirective(IF_ELSEIF); elseifCount = (elseifArgs == null) ? 0 : elseifArgs.length; // OK, how about no else-if subdirectives? if (elseifCount == 0) { // If condition is static and false -- just return the else block if (!cMacro) { return (elseArgs != null) ? elseArgs.getArg(ELSE_BLOCK, bc) : ""; } else { // Just one condition -- the IF condition, and maybe an ELSE block nConditions = 1; conditions = new Macro[1]; blocks = new Block[1]; conditions[0] = (Macro) c; blocks[0] = (Block) builder.getArg(IF_BLOCK, bc); if (elseArgs != null) elseBlock = (Block) elseArgs.getArg(ELSE_BLOCK, bc); return this; } } else { // This is the ugly case -- we have to guess at how many conditions // we'll have. We start with 1 + count(#elseof), and if any can be // folded out at compile time, we just won't use the whole thing int i=0; nConditions=elseifCount + (cMacro? 1 : 0); conditions = new Macro[nConditions]; blocks = new Block[nConditions]; if (cMacro) { conditions[0] = (Macro) c; blocks[0] = (Block) builder.getArg(IF_BLOCK, bc); ++i; } for (int j=0; j < elseifCount; j++) { c = elseifArgs[j].getArg(ELSEIF_COND, bc); if (c instanceof Macro) { conditions[i] = (Macro) c; blocks[i] = (Block) elseifArgs[j].getArg(ELSEIF_BLOCK, bc); ++i; } else if (Expression.isTrue(c)) { elseBlock = (Block) elseifArgs[j].getArg(ELSEIF_BLOCK, bc); // If all the previous got folded out as false, then just return the // block from this condition, otherwise stash it in the elseBlock // and we're done with #elseif directives if (i == 0) return elseBlock; else break; } else { // Just skip this #elseif directive } } // If we didn't promote one of the elseif blocks to else, get the else if (elseBlock == null && elseArgs != null) { elseBlock = (Block) elseArgs.getArg(ELSE_BLOCK, bc); // If there are no valid conditions, just return the else block if (i == 0) return elseBlock; } if (i < nConditions) { // If we folded out some cases, we would want to resize the arrays, // but since the space doesn't really matter, we'll save time by // just remembering how big they really are. nConditions = i; } } return this; }
3,229,159
public Object build(DirectiveBuilder builder, BuildContext bc) throws BuildException { Object c = builder.getArg(IF_COND, bc); boolean cMacro = (c instanceof Macro); int elseifCount; DirectiveArgs elseArgs; DirectiveArgs[] elseifArgs = null; // If condition is static and true -- just return the block if (!cMacro && Expression.isTrue(c)) { return (Block) builder.getArg(IF_BLOCK, bc); } elseArgs = builder.getSubdirective(IF_ELSE); elseifArgs = builder.getRepeatingSubdirective(IF_ELSEIF); elseifCount = (elseifArgs == null) ? 0 : elseifArgs.length; // OK, how about no else-if subdirectives? if (elseifCount == 0) { // If condition is static and false -- just return the else block if (!cMacro) { return (elseArgs != null) ? elseArgs.getArg(ELSE_BLOCK, bc) : ""; } else { // Just one condition -- the IF condition, and maybe an ELSE block nConditions = 1; conditions = new Macro[1]; blocks = new Block[1]; conditions[0] = (Macro) c; blocks[0] = (Block) builder.getArg(IF_BLOCK, bc); if (elseArgs != null) elseBlock = (Block) elseArgs.getArg(ELSE_BLOCK, bc); return this; } } else { // This is the ugly case -- we have to guess at how many conditions // we'll have. We start with 1 + count(#elseof), and if any can be // folded out at compile time, we just won't use the whole thing int i=0; nConditions=elseifCount + (cMacro? 1 : 0); conditions = new Macro[nConditions]; blocks = new Block[nConditions]; if (cMacro) { conditions[0] = (Macro) c; blocks[0] = (Block) builder.getArg(IF_BLOCK, bc); ++i; } for (int j=0; j < elseifCount; j++) { c = elseifArgs[j].getArg(ELSEIF_COND, bc); if (c instanceof Macro) { conditions[i] = (Macro) c; blocks[i] = (Block) elseifArgs[j].getArg(ELSEIF_BLOCK, bc); ++i; } else if (Expression.isTrue(c)) { elseBlock = (Block) elseifArgs[j].getArg(ELSEIF_BLOCK, bc); // If all the previous got folded out as false, then just return the // block from this condition, otherwise stash it in the elseBlock // and we're done with #elseif directives if (i == 0) return elseBlock; else break; } else { // Just skip this #elseif directive } } // If we didn't promote one of the elseif blocks to else, get the else if (elseBlock == null && elseArgs != null) { elseBlock = (Block) elseArgs.getArg(ELSE_BLOCK, bc); // If there are no valid conditions, just return the else block if (i == 0) return elseBlock; } if (i < nConditions) { // If we folded out some cases, we would want to resize the arrays, // but since the space doesn't really matter, we'll save time by // just remembering how big they really are. nConditions = i; } } return this; }
public Object build(DirectiveBuilder builder, BuildContext bc) throws BuildException { Object c = builder.getArg(IF_COND, bc); boolean cMacro = (c instanceof Macro); int elseifCount; DirectiveArgs elseArgs; DirectiveArgs[] elseifArgs = null; // If condition is static and true -- just return the block if (!cMacro && Expression.isTrue(c)) { return (Block) builder.getArg(IF_BLOCK, bc); } elseArgs = builder.getSubdirective(IF_ELSE); elseifArgs = builder.getRepeatingSubdirective(IF_ELSEIF); elseifCount = (elseifArgs == null) ? 0 : elseifArgs.length; // OK, how about no else-if subdirectives? if (elseifCount == 0) { // If condition is static and false -- just return the else block if (!cMacro) { return (elseArgs != null) ? elseArgs.getArg(ELSE_BLOCK, bc) : ""; } else { // Just one condition -- the IF condition, and maybe an ELSE block nConditions = 1; conditions = new Macro[1]; blocks = new Block[1]; conditions[0] = (Macro) c; blocks[0] = (Block) builder.getArg(IF_BLOCK, bc); if (elseArgs != null) return this; } } else { // This is the ugly case -- we have to guess at how many conditions // we'll have. We start with 1 + count(#elseof), and if any can be // folded out at compile time, we just won't use the whole thing int i=0; nConditions=elseifCount + (cMacro? 1 : 0); conditions = new Macro[nConditions]; blocks = new Block[nConditions]; if (cMacro) { conditions[0] = (Macro) c; blocks[0] = (Block) builder.getArg(IF_BLOCK, bc); ++i; } for (int j=0; j < elseifCount; j++) { c = elseifArgs[j].getArg(ELSEIF_COND, bc); if (c instanceof Macro) { conditions[i] = (Macro) c; blocks[i] = (Block) elseifArgs[j].getArg(ELSEIF_BLOCK, bc); ++i; } else if (Expression.isTrue(c)) { elseBlock = (Block) elseifArgs[j].getArg(ELSEIF_BLOCK, bc); // If all the previous got folded out as false, then just return the // block from this condition, otherwise stash it in the elseBlock // and we're done with #elseif directives if (i == 0) return elseBlock; else break; } else { // Just skip this #elseif directive } } // If we didn't promote one of the elseif blocks to else, get the else if (elseBlock == null && elseArgs != null) { // If there are no valid conditions, just return the else block if (i == 0) return elseBlock; } if (i < nConditions) { // If we folded out some cases, we would want to resize the arrays, // but since the space doesn't really matter, we'll save time by // just remembering how big they really are. nConditions = i; } } return this; }
3,229,160
public Object build(DirectiveBuilder builder, BuildContext bc) throws BuildException { Object c = builder.getArg(IF_COND, bc); boolean cMacro = (c instanceof Macro); int elseifCount; DirectiveArgs elseArgs; DirectiveArgs[] elseifArgs = null; // If condition is static and true -- just return the block if (!cMacro && Expression.isTrue(c)) { return (Block) builder.getArg(IF_BLOCK, bc); } elseArgs = builder.getSubdirective(IF_ELSE); elseifArgs = builder.getRepeatingSubdirective(IF_ELSEIF); elseifCount = (elseifArgs == null) ? 0 : elseifArgs.length; // OK, how about no else-if subdirectives? if (elseifCount == 0) { // If condition is static and false -- just return the else block if (!cMacro) { return (elseArgs != null) ? elseArgs.getArg(ELSE_BLOCK, bc) : ""; } else { // Just one condition -- the IF condition, and maybe an ELSE block nConditions = 1; conditions = new Macro[1]; blocks = new Block[1]; conditions[0] = (Macro) c; blocks[0] = (Block) builder.getArg(IF_BLOCK, bc); if (elseArgs != null) elseBlock = (Block) elseArgs.getArg(ELSE_BLOCK, bc); return this; } } else { // This is the ugly case -- we have to guess at how many conditions // we'll have. We start with 1 + count(#elseof), and if any can be // folded out at compile time, we just won't use the whole thing int i=0; nConditions=elseifCount + (cMacro? 1 : 0); conditions = new Macro[nConditions]; blocks = new Block[nConditions]; if (cMacro) { conditions[0] = (Macro) c; blocks[0] = (Block) builder.getArg(IF_BLOCK, bc); ++i; } for (int j=0; j < elseifCount; j++) { c = elseifArgs[j].getArg(ELSEIF_COND, bc); if (c instanceof Macro) { conditions[i] = (Macro) c; blocks[i] = (Block) elseifArgs[j].getArg(ELSEIF_BLOCK, bc); ++i; } else if (Expression.isTrue(c)) { elseBlock = (Block) elseifArgs[j].getArg(ELSEIF_BLOCK, bc); // If all the previous got folded out as false, then just return the // block from this condition, otherwise stash it in the elseBlock // and we're done with #elseif directives if (i == 0) return elseBlock; else break; } else { // Just skip this #elseif directive } } // If we didn't promote one of the elseif blocks to else, get the else if (elseBlock == null && elseArgs != null) { elseBlock = (Block) elseArgs.getArg(ELSE_BLOCK, bc); // If there are no valid conditions, just return the else block if (i == 0) return elseBlock; } if (i < nConditions) { // If we folded out some cases, we would want to resize the arrays, // but since the space doesn't really matter, we'll save time by // just remembering how big they really are. nConditions = i; } } return this; }
public Object build(DirectiveBuilder builder, BuildContext bc) throws BuildException { Object c = builder.getArg(IF_COND, bc); boolean cMacro = (c instanceof Macro); int elseifCount; DirectiveArgs elseArgs; DirectiveArgs[] elseifArgs = null; // If condition is static and true -- just return the block if (!cMacro && Expression.isTrue(c)) { return (Block) builder.getArg(IF_BLOCK, bc); } elseArgs = builder.getSubdirective(IF_ELSE); elseifArgs = builder.getRepeatingSubdirective(IF_ELSEIF); elseifCount = (elseifArgs == null) ? 0 : elseifArgs.length; // OK, how about no else-if subdirectives? if (elseifCount == 0) { // If condition is static and false -- just return the else block if (!cMacro) { return (elseArgs != null) ? elseArgs.getArg(ELSE_BLOCK, bc) : ""; } else { // Just one condition -- the IF condition, and maybe an ELSE block nConditions = 1; conditions = new Macro[1]; blocks = new Block[1]; conditions[0] = (Macro) c; blocks[0] = (Block) builder.getArg(IF_BLOCK, bc); if (elseArgs != null) elseBlock = (Block) elseArgs.getArg(ELSE_BLOCK, bc); return this; } } else { // This is the ugly case -- we have to guess at how many conditions // we'll have. We start with 1 + count(#elseof), and if any can be // folded out at compile time, we just won't use the whole thing int i=0; nConditions=elseifCount + (cMacro? 1 : 0); conditions = new Macro[nConditions]; blocks = new Block[nConditions]; if (cMacro) { conditions[0] = (Macro) c; blocks[0] = (Block) builder.getArg(IF_BLOCK, bc); ++i; } for (int j=0; j < elseifCount; j++) { c = elseifArgs[j].getArg(ELSEIF_COND, bc); if (c instanceof Macro) { conditions[i] = (Macro) c; blocks[i] = (Block) elseifArgs[j].getArg(ELSEIF_BLOCK, bc); ++i; } else if (Expression.isTrue(c)) { elseBlock = (Block) elseifArgs[j].getArg(ELSEIF_BLOCK, bc); // If all the previous got folded out as false, then just return the // block from this condition, otherwise stash it in the elseBlock // and we're done with #elseif directives if (i == 0) return elseArgs.getArg(ELSE_BLOCK); else elseBlock = (Block) elseArgs.getArg(ELSE_BLOCK, bc); else break; } else { // Just skip this #elseif directive } } // If we didn't promote one of the elseif blocks to else, get the else if (elseBlock == null && elseArgs != null) { elseBlock = (Block) elseArgs.getArg(ELSE_BLOCK, bc); // If there are no valid conditions, just return the else block if (i == 0) return elseArgs.getArg(ELSE_BLOCK); else elseBlock = (Block) elseArgs.getArg(ELSE_BLOCK, bc); } if (i < nConditions) { // If we folded out some cases, we would want to resize the arrays, // but since the space doesn't really matter, we'll save time by // just remembering how big they really are. nConditions = i; } } return this; }
3,229,161
int yPositionForValue(int value) { /* int min = model.getMinimum(); int max = model.getMaximum(); int trackLength = trackRect.height; double valueRange = (double)max -(double)min; double pixelsPerValue = trackLength/valueRange; int trackTop = trackRect.y; int trackBottom = trackRect.y+trackRect.height-1; int yPosition = trackTop; yPosition += Math.round(pixelsPerValue*((double) max - value)); yPosition = Math.max(trackTop, yPosition); yPosition = Math.min(trackBottom, yPosition); return yPosition; */ int min = model.getMinimum(); int max = model.getMaximum(); int trackLength = trackRect.height; double valueRange = (double) max-(double) min; double pixelsPerValue = trackLength/valueRange; int trackTop = trackRect.y; int trackBottom = trackRect.y+trackRect.height-1; int yPosition= trackTop; yPosition += Math.round(pixelsPerValue*((double) max-value)); yPosition = Math.max(trackTop, yPosition); yPosition = Math.min(trackBottom, yPosition); return yPosition; }
int yPositionForValue(int value) { /* int min = model.getMinimum(); int max = model.getMaximum(); int trackLength = trackRect.height; double valueRange = (double)max -(double)min; double pixelsPerValue = trackLength/valueRange; int trackTop = trackRect.y; int trackBottom = trackRect.y+trackRect.height-1; int yPosition = trackTop; yPosition += Math.round(pixelsPerValue*((double) max - value)); yPosition = Math.max(trackTop, yPosition); yPosition = Math.min(trackBottom, yPosition); return yPosition; */ int min = model.getMinimum(); int max = model.getMaximum(); int trackLength = trackRect.height; double valueRange = (double) max-(double) min; double pixelsPerValue = trackLength/valueRange; int trackTop = trackRect.y; int trackBottom = trackRect.y+trackRect.height-1; int yPosition= trackTop; yPosition += Math.round(pixelsPerValue*((double) max-value)); yPosition = Math.max(trackTop, yPosition); yPosition = Math.min(trackBottom, yPosition); return yPosition; }
3,229,162
int yValueForPosition(int yPosition) { /* int value; int minValue = model.getMinimum(); int maxValue = model.getMaximum(); int trackLength = trackRect.height; int trackTop = trackRect.y; int trackBottom = trackRect.y+trackRect.height; if (yPosition <= trackTop ) value = maxValue; else if (yPosition >= trackBottom) value = minValue; else { double valueRange = (double) maxValue-(double) minValue; double valuePerPixel = valueRange/trackLength; value = maxValue-(int) Math.round( (yPosition-trackTop)*valuePerPixel); } return value; */ int value; int minValue = model.getMinimum(); int maxValue = model.getMaximum(); int trackLength = trackRect.height; int trackTop = trackRect.y; int trackBottom = trackRect.y+trackRect.height-1; if (yPosition <= trackTop) value = maxValue; else if (yPosition >= trackBottom) value = minValue; else { int distanceFromTrackTop = yPosition-trackTop; double valueRange = (double) maxValue-(double) minValue; double valuePerPixel = valueRange/trackLength; int valueFromTrackTop = (int)Math.round(distanceFromTrackTop*valuePerPixel); value = maxValue-valueFromTrackTop; } return value; }
int yValueForPosition(int yPosition) { /* int value; int minValue = model.getMinimum(); int maxValue = model.getMaximum(); int trackLength = trackRect.height; int trackTop = trackRect.y; int trackBottom = trackRect.y+trackRect.height; if (yPosition <= trackTop ) value = maxValue; else if (yPosition >= trackBottom) value = minValue; else { double valueRange = (double) maxValue-(double) minValue; double valuePerPixel = valueRange/trackLength; value = maxValue-(int) Math.round( (yPosition-trackTop)*valuePerPixel); } return value; */ int value; int minValue = model.getMinimum(); int maxValue = model.getMaximum(); int trackLength = trackRect.height; int trackTop = trackRect.y; int trackBottom = trackRect.y+trackRect.height-1; if (yPosition <= trackTop) value = maxValue; else if (yPosition >= trackBottom) value = minValue; else { int distanceFromTrackTop = yPosition-trackTop; double valueRange = (double) maxValue-(double) minValue; double valuePerPixel = valueRange/trackLength; int valueFromTrackTop = (int)Math.round(distanceFromTrackTop*valuePerPixel); value = maxValue-valueFromTrackTop; } return value; }
3,229,163
public static IRubyObject backquote(IRubyObject recv, IRubyObject aString) { StringBuffer output = new StringBuffer(); IRuby runtime = recv.getRuntime(); runtime.getGlobalVariables().set("$?", runtime.newFixnum( runInShell(runtime, aString.toString(), output))); return recv.getRuntime().newString(output.toString()); }
public static IRubyObject backquote(IRubyObject recv, IRubyObject aString) { IRuby runtime = recv.getRuntime(); runtime.getGlobalVariables().set("$?", runtime.newFixnum( runInShell(runtime, aString.toString(), output))); return recv.getRuntime().newString(output.toString()); }
3,229,164
public static IRubyObject backquote(IRubyObject recv, IRubyObject aString) { StringBuffer output = new StringBuffer(); IRuby runtime = recv.getRuntime(); runtime.getGlobalVariables().set("$?", runtime.newFixnum( runInShell(runtime, aString.toString(), output))); return recv.getRuntime().newString(output.toString()); }
public static IRubyObject backquote(IRubyObject recv, IRubyObject aString) { StringBuffer output = new StringBuffer(); IRuby runtime = recv.getRuntime(); runtime.getGlobalVariables().set("$?", runtime.newFixnum( runInShell(runtime, aString.toString(), output))); return recv.getRuntime().newString(output.toString()); }
3,229,165
private static String repairDirSeps(String command) { // TODO: This could be improved and optimized StringTokenizer toker = new StringTokenizer(command, " "); StringBuffer executable = new StringBuffer(); boolean insideQuotes = false; char quoteChar = 0; loop: while (true) { String token = toker.nextToken(); if (!insideQuotes) { char first = token.charAt(0); switch (first) { case '"': case '\'': insideQuotes = true; quoteChar = first; executable.append(token + " "); break; default: executable.append(token); break loop; } } else { char last = token.charAt(token.length() - 1); executable.append(token); if (last == quoteChar) { insideQuotes = false; break loop; } else { executable.append(" "); } } } String remainder = command.substring(executable.length()); // Matcher.replaceAll treats backslashes in the replacement string as escaped characters String replacement = File.separator; if (File.separatorChar == '\\') replacement = "\\\\"; return PATH_SEPARATORS.matcher(executable).replaceAll(replacement) + remainder; }
private static String repairDirSeps(String command) { // TODO: This could be improved and optimized StringTokenizer toker = new StringTokenizer(command, " "); StringBuffer executable = new StringBuffer(); boolean insideQuotes = false; char quoteChar = 0; loop: while (true) { String token = toker.nextToken(); if (!insideQuotes) { char first = token.charAt(0); switch (first) { case '"': case '\'': insideQuotes = true; quoteChar = first; executable.append(token + " "); break; default: executable.append(token); break loop; } } else { char last = token.charAt(token.length() - 1); executable.append(token); if (last == quoteChar) { insideQuotes = false; break loop; } else { executable.append(" "); } } } String remainder = command.substring(executable.length()); // Matcher.replaceAll treats backslashes in the replacement string as escaped characters String replacement = File.separator; if (File.separatorChar == '\\') replacement = "\\\\"; return PATH_SEPARATORS.matcher(executable).replaceAll(replacement) + remainder; }
3,229,166
private static String repairDirSeps(String command) { // TODO: This could be improved and optimized StringTokenizer toker = new StringTokenizer(command, " "); StringBuffer executable = new StringBuffer(); boolean insideQuotes = false; char quoteChar = 0; loop: while (true) { String token = toker.nextToken(); if (!insideQuotes) { char first = token.charAt(0); switch (first) { case '"': case '\'': insideQuotes = true; quoteChar = first; executable.append(token + " "); break; default: executable.append(token); break loop; } } else { char last = token.charAt(token.length() - 1); executable.append(token); if (last == quoteChar) { insideQuotes = false; break loop; } else { executable.append(" "); } } } String remainder = command.substring(executable.length()); // Matcher.replaceAll treats backslashes in the replacement string as escaped characters String replacement = File.separator; if (File.separatorChar == '\\') replacement = "\\\\"; return PATH_SEPARATORS.matcher(executable).replaceAll(replacement) + remainder; }
private static String repairDirSeps(String command) { // TODO: This could be improved and optimized StringTokenizer toker = new StringTokenizer(command, " "); StringBuffer executable = new StringBuffer(); boolean insideQuotes = false; char quoteChar = 0; loop: while (true) { String token = toker.nextToken(); if (!insideQuotes) { char first = token.charAt(0); switch (first) { case '"': case '\'': insideQuotes = true; quoteChar = first; executable.append(token + " "); break; default: executable.append(token); break loop; } } else { char last = token.charAt(token.length() - 1); executable.append(token); if (last == quoteChar) { insideQuotes = false; break loop; } else { executable.append(" "); } } } // Matcher.replaceAll treats backslashes in the replacement string as escaped characters String replacement = File.separator; if (File.separatorChar == '\\') replacement = "\\\\"; return PATH_SEPARATORS.matcher(executable).replaceAll(replacement) + remainder; }
3,229,167
private static String repairDirSeps(String command) { // TODO: This could be improved and optimized StringTokenizer toker = new StringTokenizer(command, " "); StringBuffer executable = new StringBuffer(); boolean insideQuotes = false; char quoteChar = 0; loop: while (true) { String token = toker.nextToken(); if (!insideQuotes) { char first = token.charAt(0); switch (first) { case '"': case '\'': insideQuotes = true; quoteChar = first; executable.append(token + " "); break; default: executable.append(token); break loop; } } else { char last = token.charAt(token.length() - 1); executable.append(token); if (last == quoteChar) { insideQuotes = false; break loop; } else { executable.append(" "); } } } String remainder = command.substring(executable.length()); // Matcher.replaceAll treats backslashes in the replacement string as escaped characters String replacement = File.separator; if (File.separatorChar == '\\') replacement = "\\\\"; return PATH_SEPARATORS.matcher(executable).replaceAll(replacement) + remainder; }
private static String repairDirSeps(String command) { // TODO: This could be improved and optimized StringTokenizer toker = new StringTokenizer(command, " "); StringBuffer executable = new StringBuffer(); boolean insideQuotes = false; char quoteChar = 0; loop: while (true) { String token = toker.nextToken(); if (!insideQuotes) { char first = token.charAt(0); switch (first) { case '"': case '\'': insideQuotes = true; quoteChar = first; executable.append(token + " "); break; default: executable.append(token); break loop; } } else { char last = token.charAt(token.length() - 1); executable.append(token); if (last == quoteChar) { insideQuotes = false; break loop; } else { executable.append(" "); } } } String remainder = command.substring(executable.length()); // Matcher.replaceAll treats backslashes in the replacement string as escaped characters String replacement = File.separator; if (File.separatorChar == '\\') replacement = "\\\\"; return PATH_SEPARATORS.matcher(executable).replaceAll(replacement) + remainder; }
3,229,168
private static String repairDirSeps(String command) { // TODO: This could be improved and optimized StringTokenizer toker = new StringTokenizer(command, " "); StringBuffer executable = new StringBuffer(); boolean insideQuotes = false; char quoteChar = 0; loop: while (true) { String token = toker.nextToken(); if (!insideQuotes) { char first = token.charAt(0); switch (first) { case '"': case '\'': insideQuotes = true; quoteChar = first; executable.append(token + " "); break; default: executable.append(token); break loop; } } else { char last = token.charAt(token.length() - 1); executable.append(token); if (last == quoteChar) { insideQuotes = false; break loop; } else { executable.append(" "); } } } String remainder = command.substring(executable.length()); // Matcher.replaceAll treats backslashes in the replacement string as escaped characters String replacement = File.separator; if (File.separatorChar == '\\') replacement = "\\\\"; return PATH_SEPARATORS.matcher(executable).replaceAll(replacement) + remainder; }
private static String repairDirSeps(String command) { // TODO: This could be improved and optimized StringTokenizer toker = new StringTokenizer(command, " "); StringBuffer executable = new StringBuffer(); boolean insideQuotes = false; char quoteChar = 0; loop: while (true) { String token = toker.nextToken(); if (!insideQuotes) { char first = token.charAt(0); switch (first) { case '"': case '\'': insideQuotes = true; quoteChar = first; executable.append(token + " "); break; default: executable.append(token); break loop; } } else { char last = token.charAt(token.length() - 1); executable.append(token); if (last == quoteChar) { insideQuotes = false; break loop; } else { executable.append(" "); } } } String remainder = command.substring(executable.length()); // Matcher.replaceAll treats backslashes in the replacement string as escaped characters String replacement = File.separator; if (File.separatorChar == '\\') replacement = "\\\\"; return PATH_SEPARATORS.matcher(executable).replaceAll(replacement) + remainder; }
3,229,169
private static int runInShell(IRuby runtime, String command, StringBuffer output) { try { String shell = System.getProperty("jruby.shell"); Process aProcess; String shellSwitch = "-c"; command = repairDirSeps(command); if (shell != null) { if (!shell.endsWith("sh")) { shellSwitch = "/c"; } aProcess = Runtime.getRuntime().exec(new String[] { shell, shellSwitch, command }); } else { aProcess = Runtime.getRuntime().exec(command); } final BufferedReader reader = new BufferedReader(new InputStreamReader(aProcess.getInputStream())); // Fairly innefficient impl, but readLine is unable to tell // whether the last line in a process ended with a newline or not. int c; boolean crSeen = false; while ((c = reader.read()) != -1) { if (c == '\r') { crSeen = true; } else { if (crSeen) { if (c != '\n') { output.append('\r'); } crSeen = false; } output.append((char)c); } } if (crSeen) { output.append('\r'); } aProcess.getErrorStream().close(); aProcess.getOutputStream().close(); reader.close(); return aProcess.waitFor(); } catch (IOException e) { throw runtime.newIOErrorFromException(e); } catch (InterruptedException e) { throw runtime.newThreadError("unexpected interrupt"); } }
private static int runInShell(IRuby runtime, IRubyObject[] rawArgs, OutputStream output) { try { String shell = System.getProperty("jruby.shell"); Process aProcess; String shellSwitch = "-c"; command = repairDirSeps(command); if (shell != null) { if (!shell.endsWith("sh")) { shellSwitch = "/c"; } aProcess = Runtime.getRuntime().exec(new String[] { shell, shellSwitch, command }); } else { aProcess = Runtime.getRuntime().exec(command); } final BufferedReader reader = new BufferedReader(new InputStreamReader(aProcess.getInputStream())); // Fairly innefficient impl, but readLine is unable to tell // whether the last line in a process ended with a newline or not. int c; boolean crSeen = false; while ((c = reader.read()) != -1) { if (c == '\r') { crSeen = true; } else { if (crSeen) { if (c != '\n') { output.append('\r'); } crSeen = false; } output.append((char)c); } } if (crSeen) { output.append('\r'); } aProcess.getErrorStream().close(); aProcess.getOutputStream().close(); reader.close(); return aProcess.waitFor(); } catch (IOException e) { throw runtime.newIOErrorFromException(e); } catch (InterruptedException e) { throw runtime.newThreadError("unexpected interrupt"); } }
3,229,170
private static int runInShell(IRuby runtime, String command, StringBuffer output) { try { String shell = System.getProperty("jruby.shell"); Process aProcess; String shellSwitch = "-c"; command = repairDirSeps(command); if (shell != null) { if (!shell.endsWith("sh")) { shellSwitch = "/c"; } aProcess = Runtime.getRuntime().exec(new String[] { shell, shellSwitch, command }); } else { aProcess = Runtime.getRuntime().exec(command); } final BufferedReader reader = new BufferedReader(new InputStreamReader(aProcess.getInputStream())); // Fairly innefficient impl, but readLine is unable to tell // whether the last line in a process ended with a newline or not. int c; boolean crSeen = false; while ((c = reader.read()) != -1) { if (c == '\r') { crSeen = true; } else { if (crSeen) { if (c != '\n') { output.append('\r'); } crSeen = false; } output.append((char)c); } } if (crSeen) { output.append('\r'); } aProcess.getErrorStream().close(); aProcess.getOutputStream().close(); reader.close(); return aProcess.waitFor(); } catch (IOException e) { throw runtime.newIOErrorFromException(e); } catch (InterruptedException e) { throw runtime.newThreadError("unexpected interrupt"); } }
private static int runInShell(IRuby runtime, String command, StringBuffer output) { try { String shell = System.getProperty("jruby.shell"); Process aProcess; String shellSwitch = "-c"; command = repairDirSeps(command); if (shell != null) { if (!shell.endsWith("sh")) { shellSwitch = "/c"; } aProcess = Runtime.getRuntime().exec(new String[] { shell, shellSwitch, command }); } else { aProcess = Runtime.getRuntime().exec(command); } final BufferedReader reader = new BufferedReader(new InputStreamReader(aProcess.getInputStream())); // Fairly innefficient impl, but readLine is unable to tell // whether the last line in a process ended with a newline or not. int c; boolean crSeen = false; while ((c = reader.read()) != -1) { if (c == '\r') { crSeen = true; } else { if (crSeen) { if (c != '\n') { output.append('\r'); } crSeen = false; } output.append((char)c); } } if (crSeen) { output.append('\r'); } aProcess.getErrorStream().close(); aProcess.getOutputStream().close(); reader.close(); return aProcess.waitFor(); } catch (IOException e) { throw runtime.newIOErrorFromException(e); } catch (InterruptedException e) { throw runtime.newThreadError("unexpected interrupt"); } }
3,229,171
private static int runInShell(IRuby runtime, String command, StringBuffer output) { try { String shell = System.getProperty("jruby.shell"); Process aProcess; String shellSwitch = "-c"; command = repairDirSeps(command); if (shell != null) { if (!shell.endsWith("sh")) { shellSwitch = "/c"; } aProcess = Runtime.getRuntime().exec(new String[] { shell, shellSwitch, command }); } else { aProcess = Runtime.getRuntime().exec(command); } final BufferedReader reader = new BufferedReader(new InputStreamReader(aProcess.getInputStream())); // Fairly innefficient impl, but readLine is unable to tell // whether the last line in a process ended with a newline or not. int c; boolean crSeen = false; while ((c = reader.read()) != -1) { if (c == '\r') { crSeen = true; } else { if (crSeen) { if (c != '\n') { output.append('\r'); } crSeen = false; } output.append((char)c); } } if (crSeen) { output.append('\r'); } aProcess.getErrorStream().close(); aProcess.getOutputStream().close(); reader.close(); return aProcess.waitFor(); } catch (IOException e) { throw runtime.newIOErrorFromException(e); } catch (InterruptedException e) { throw runtime.newThreadError("unexpected interrupt"); } }
private static int runInShell(IRuby runtime, String command, StringBuffer output) { try { String shell = System.getProperty("jruby.shell"); Process aProcess; String shellSwitch = "-c"; if (isRubyCommand(rawArgs[0].toString())) { List args = parseCommandLine(rawArgs); PrintStream redirect = new PrintStream(output); String command = (String)args.get(0); String[] argArray = new String[args.size()-1]; int startIndex = command.endsWith(".rb") ? 0 : 1; args.subList(startIndex,args.size()).toArray(argArray); ipScript = new InProcessScript(argArray, System.in, redirect, redirect); ipScript.start(); ipScript.join(); } else if (shell != null && rawArgs.length == 1) { String shellSwitch = shell.endsWith("sh") ? "-c" : "/c"; String[] argArray = new String[3]; argArray[0] = shell; argArray[1] = shellSwitch; argArray[2] = rawArgs[0].toString(); aProcess = Runtime.getRuntime().exec(argArray); } else { if (rawArgs.length > 1) { String[] argArray = new String[rawArgs.length]; for (int i=0;i<rawArgs.length;i++) { argArray[i] = rawArgs[i].toString(); } aProcess = Runtime.getRuntime().exec(argArray); } else { aProcess = Runtime.getRuntime().exec(rawArgs[0].toString()); } } if (shell != null) { if (!shell.endsWith("sh")) { shellSwitch = "/c"; } aProcess = Runtime.getRuntime().exec(new String[] { shell, shellSwitch, command }); } else { aProcess = Runtime.getRuntime().exec(command); } final BufferedReader reader = new BufferedReader(new InputStreamReader(aProcess.getInputStream())); // Fairly innefficient impl, but readLine is unable to tell // whether the last line in a process ended with a newline or not. int c; boolean crSeen = false; while ((c = reader.read()) != -1) { if (c == '\r') { crSeen = true; } else { if (crSeen) { if (c != '\n') { output.append('\r'); } crSeen = false; } output.append((char)c); } } if (crSeen) { output.append('\r'); } aProcess.getErrorStream().close(); aProcess.getOutputStream().close(); reader.close(); return aProcess.waitFor(); } catch (IOException e) { throw runtime.newIOErrorFromException(e); } catch (InterruptedException e) { throw runtime.newThreadError("unexpected interrupt"); } }
3,229,172
private static int runInShell(IRuby runtime, String command, StringBuffer output) { try { String shell = System.getProperty("jruby.shell"); Process aProcess; String shellSwitch = "-c"; command = repairDirSeps(command); if (shell != null) { if (!shell.endsWith("sh")) { shellSwitch = "/c"; } aProcess = Runtime.getRuntime().exec(new String[] { shell, shellSwitch, command }); } else { aProcess = Runtime.getRuntime().exec(command); } final BufferedReader reader = new BufferedReader(new InputStreamReader(aProcess.getInputStream())); // Fairly innefficient impl, but readLine is unable to tell // whether the last line in a process ended with a newline or not. int c; boolean crSeen = false; while ((c = reader.read()) != -1) { if (c == '\r') { crSeen = true; } else { if (crSeen) { if (c != '\n') { output.append('\r'); } crSeen = false; } output.append((char)c); } } if (crSeen) { output.append('\r'); } aProcess.getErrorStream().close(); aProcess.getOutputStream().close(); reader.close(); return aProcess.waitFor(); } catch (IOException e) { throw runtime.newIOErrorFromException(e); } catch (InterruptedException e) { throw runtime.newThreadError("unexpected interrupt"); } }
private static int runInShell(IRuby runtime, String command, StringBuffer output) { try { String shell = System.getProperty("jruby.shell"); Process aProcess; String shellSwitch = "-c"; command = repairDirSeps(command); if (shell != null) { if (!shell.endsWith("sh")) { shellSwitch = "/c"; } aProcess = Runtime.getRuntime().exec(new String[] { shell, shellSwitch, command }); } else { aProcess = Runtime.getRuntime().exec(command); } final BufferedReader reader = new BufferedReader(new InputStreamReader(aProcess.getInputStream())); // Fairly innefficient impl, but readLine is unable to tell // whether the last line in a process ended with a newline or not. int c; boolean crSeen = false; while ((c = reader.read()) != -1) { if (c == '\r') { crSeen = true; } else { if (crSeen) { if (c != '\n') { output.append('\r'); } crSeen = false; } output.append((char)c); } } if (crSeen) { output.append('\r'); } aProcess.getErrorStream().close(); aProcess.getOutputStream().close(); reader.close(); return aProcess.waitFor(); } catch (IOException e) { throw runtime.newIOErrorFromException(e); } catch (InterruptedException e) { throw runtime.newThreadError("unexpected interrupt"); } }
3,229,173
private static int runInShell(IRuby runtime, String command, StringBuffer output) { try { String shell = System.getProperty("jruby.shell"); Process aProcess; String shellSwitch = "-c"; command = repairDirSeps(command); if (shell != null) { if (!shell.endsWith("sh")) { shellSwitch = "/c"; } aProcess = Runtime.getRuntime().exec(new String[] { shell, shellSwitch, command }); } else { aProcess = Runtime.getRuntime().exec(command); } final BufferedReader reader = new BufferedReader(new InputStreamReader(aProcess.getInputStream())); // Fairly innefficient impl, but readLine is unable to tell // whether the last line in a process ended with a newline or not. int c; boolean crSeen = false; while ((c = reader.read()) != -1) { if (c == '\r') { crSeen = true; } else { if (crSeen) { if (c != '\n') { output.append('\r'); } crSeen = false; } output.append((char)c); } } if (crSeen) { output.append('\r'); } aProcess.getErrorStream().close(); aProcess.getOutputStream().close(); reader.close(); return aProcess.waitFor(); } catch (IOException e) { throw runtime.newIOErrorFromException(e); } catch (InterruptedException e) { throw runtime.newThreadError("unexpected interrupt"); } }
private static int runInShell(IRuby runtime, String command, StringBuffer output) { try { String shell = System.getProperty("jruby.shell"); Process aProcess; String shellSwitch = "-c"; command = repairDirSeps(command); if (shell != null) { if (!shell.endsWith("sh")) { shellSwitch = "/c"; } if (crSeen) { output.write('\r'); } aProcess.getErrorStream().close(); aProcess.getOutputStream().close(); processOutput.close(); return aProcess.waitFor(); } else if (ipScript != null) { return ipScript.getResult(); } else { aProcess = Runtime.getRuntime().exec(command); } final BufferedReader reader = new BufferedReader(new InputStreamReader(aProcess.getInputStream())); // Fairly innefficient impl, but readLine is unable to tell // whether the last line in a process ended with a newline or not. int c; boolean crSeen = false; while ((c = reader.read()) != -1) { if (c == '\r') { crSeen = true; } else { if (crSeen) { if (c != '\n') { output.append('\r'); } crSeen = false; } output.append((char)c); } } if (crSeen) { output.append('\r'); } aProcess.getErrorStream().close(); aProcess.getOutputStream().close(); reader.close(); return aProcess.waitFor(); } catch (IOException e) { throw runtime.newIOErrorFromException(e); } catch (InterruptedException e) { throw runtime.newThreadError("unexpected interrupt"); } }
3,229,174
private static int runInShell(IRuby runtime, String command, StringBuffer output) { try { String shell = System.getProperty("jruby.shell"); Process aProcess; String shellSwitch = "-c"; command = repairDirSeps(command); if (shell != null) { if (!shell.endsWith("sh")) { shellSwitch = "/c"; } aProcess = Runtime.getRuntime().exec(new String[] { shell, shellSwitch, command }); } else { aProcess = Runtime.getRuntime().exec(command); } final BufferedReader reader = new BufferedReader(new InputStreamReader(aProcess.getInputStream())); // Fairly innefficient impl, but readLine is unable to tell // whether the last line in a process ended with a newline or not. int c; boolean crSeen = false; while ((c = reader.read()) != -1) { if (c == '\r') { crSeen = true; } else { if (crSeen) { if (c != '\n') { output.append('\r'); } crSeen = false; } output.append((char)c); } } if (crSeen) { output.append('\r'); } aProcess.getErrorStream().close(); aProcess.getOutputStream().close(); reader.close(); return aProcess.waitFor(); } catch (IOException e) { throw runtime.newIOErrorFromException(e); } catch (InterruptedException e) { throw runtime.newThreadError("unexpected interrupt"); } }
private static int runInShell(IRuby runtime, String command, StringBuffer output) { try { String shell = System.getProperty("jruby.shell"); Process aProcess; String shellSwitch = "-c"; command = repairDirSeps(command); if (shell != null) { if (!shell.endsWith("sh")) { shellSwitch = "/c"; } aProcess = Runtime.getRuntime().exec(new String[] { shell, shellSwitch, command }); } else { return 0; } final BufferedReader reader = new BufferedReader(new InputStreamReader(aProcess.getInputStream())); // Fairly innefficient impl, but readLine is unable to tell // whether the last line in a process ended with a newline or not. int c; boolean crSeen = false; while ((c = reader.read()) != -1) { if (c == '\r') { crSeen = true; } else { if (crSeen) { if (c != '\n') { output.append('\r'); } crSeen = false; } output.append((char)c); } } if (crSeen) { output.append('\r'); } aProcess.getErrorStream().close(); aProcess.getOutputStream().close(); reader.close(); return aProcess.waitFor(); } catch (IOException e) { throw runtime.newIOErrorFromException(e); } catch (InterruptedException e) { throw runtime.newThreadError("unexpected interrupt"); } }
3,229,175
private static int runInShell(IRuby runtime, String command, StringBuffer output) { try { String shell = System.getProperty("jruby.shell"); Process aProcess; String shellSwitch = "-c"; command = repairDirSeps(command); if (shell != null) { if (!shell.endsWith("sh")) { shellSwitch = "/c"; } aProcess = Runtime.getRuntime().exec(new String[] { shell, shellSwitch, command }); } else { aProcess = Runtime.getRuntime().exec(command); } final BufferedReader reader = new BufferedReader(new InputStreamReader(aProcess.getInputStream())); // Fairly innefficient impl, but readLine is unable to tell // whether the last line in a process ended with a newline or not. int c; boolean crSeen = false; while ((c = reader.read()) != -1) { if (c == '\r') { crSeen = true; } else { if (crSeen) { if (c != '\n') { output.append('\r'); } crSeen = false; } output.append((char)c); } } if (crSeen) { output.append('\r'); } aProcess.getErrorStream().close(); aProcess.getOutputStream().close(); reader.close(); return aProcess.waitFor(); } catch (IOException e) { throw runtime.newIOErrorFromException(e); } catch (InterruptedException e) { throw runtime.newThreadError("unexpected interrupt"); } }
private static int runInShell(IRuby runtime, String command, StringBuffer output) { try { String shell = System.getProperty("jruby.shell"); Process aProcess; String shellSwitch = "-c"; command = repairDirSeps(command); if (shell != null) { if (!shell.endsWith("sh")) { shellSwitch = "/c"; } aProcess = Runtime.getRuntime().exec(new String[] { shell, shellSwitch, command }); } else { aProcess = Runtime.getRuntime().exec(command); } final BufferedReader reader = new BufferedReader(new InputStreamReader(aProcess.getInputStream())); // Fairly innefficient impl, but readLine is unable to tell // whether the last line in a process ended with a newline or not. int c; boolean crSeen = false; while ((c = reader.read()) != -1) { if (c == '\r') { crSeen = true; } else { if (crSeen) { if (c != '\n') { output.append('\r'); } crSeen = false; } output.append((char)c); } } if (crSeen) { output.append('\r'); } aProcess.getErrorStream().close(); aProcess.getOutputStream().close(); reader.close(); return aProcess.waitFor(); } catch (IOException e) { throw runtime.newIOErrorFromException(e); } catch (InterruptedException e) { throw runtime.newThreadError("unexpected interrupt"); } }
3,229,176
public static RubyBoolean system(IRubyObject recv, IRubyObject[] args) { IRuby runtime = recv.getRuntime(); if (args.length > 1) { throw runtime.newArgumentError("more arguments not yet supported"); } StringBuffer output = new StringBuffer(); int resultCode = runInShell(runtime, args[0].toString(), output); recv.getRuntime().getGlobalVariables().set("$?", runtime.newFixnum(resultCode)); return runtime.newBoolean(resultCode == 0); }
public static RubyBoolean system(IRubyObject recv, IRubyObject[] args) { IRuby runtime = recv.getRuntime(); if (args.length > 1) { throw runtime.newArgumentError("more arguments not yet supported"); } StringBuffer output = new StringBuffer(); int resultCode = runInShell(runtime, args[0].toString(), output); recv.getRuntime().getGlobalVariables().set("$?", runtime.newFixnum(resultCode)); return runtime.newBoolean(resultCode == 0); }
3,229,177
private RubyRegexp getPattern(IRubyObject[] args) { if (args.length == 0) { return RubyRegexp.newRegexp(runtime, "\\s+", 0); } if (args[0] instanceof RubyRegexp) { return RubyRegexp.regexpValue(args[0]); } else { RubyString stringPattern = RubyString.stringValue(args[0]); if (stringPattern.getValue().equals(" ")) { return RubyRegexp.newRegexp(runtime, "\\s+", 0); } else { return RubyRegexp.newRegexp(stringPattern, 0); } } }
private RubyRegexp getPattern(IRubyObject[] args) { if (args.length == 0) { return RubyRegexp.newRegexp(runtime, "\\s+", 0); } if (args[0] instanceof RubyRegexp) { return RubyRegexp.regexpValue(args[0]); } else { RubyString stringPattern = RubyString.stringValue(args[0]); if (stringPattern.getValue().equals(" ")) { return RubyRegexp.newRegexp(runtime, "\\s+", 0); } else { return RubyRegexp.newRegexp(stringPattern, 0); } } }
3,229,178
private RubyRegexp getPattern(IRubyObject[] args) { if (args.length == 0) { return RubyRegexp.newRegexp(runtime, "\\s+", 0); } if (args[0] instanceof RubyRegexp) { return RubyRegexp.regexpValue(args[0]); } else { RubyString stringPattern = RubyString.stringValue(args[0]); if (stringPattern.getValue().equals(" ")) { return RubyRegexp.newRegexp(runtime, "\\s+", 0); } else { return RubyRegexp.newRegexp(stringPattern, 0); } } }
private RubyRegexp getPattern(IRubyObject[] args) { if (args.length == 0) { return RubyRegexp.newRegexp(runtime, "\\s+", 0); } if (args[0] instanceof RubyRegexp) { return RubyRegexp.regexpValue(args[0]); } else { RubyString stringPattern = RubyString.stringValue(args[0]); if (stringPattern.getValue().equals(" ")) { return RubyRegexp.newRegexp(runtime, "\\s+", 0); } else { return RubyRegexp.newRegexp(runtime, unescapeString(stringPattern), 0); } } }
3,229,179
private void process() { if (limit == 1) { result.add(splitee); return; } int pos = 0; int beg = 0; int hits = 0; int len = splitee.length(); RubyString rubySplitee = RubyString.newString(runtime, splitee); while ((beg = pattern.search(rubySplitee, pos)) > -1) { hits++; RubyMatchData matchData = (RubyMatchData) runtime.getBackref(); int end = matchData.matchEndPosition(); addResult(substring(splitee, pos, (beg == pos && end == beg) ? 1 : beg - pos)); // Add to list any /(.)/ matched. long extraPatterns = matchData.getSize(); for (int i = 1; i < extraPatterns; i++) { addResult(((RubyString) matchData.group(i)).getValue()); } pos = (end == beg) ? beg + 1 : end; if (hits + 1 == limit) { break; } } if (hits == 0) { addResult(splitee); } else if (pos <= len) { addResult(substring(splitee, pos, len - pos)); } if (limit == 0) { while (((String) result.get(result.size() - 1)).length() == 0) { result.remove(result.size() - 1); } } }
private void process() { if (limit == 1) { result.add(splitee); return; } int pos = 0; int beg = 0; int hits = 0; int len = splitee.length(); RubyString rubySplitee = RubyString.newString(runtime, splitee); while ((beg = pattern.search(rubySplitee, pos)) > -1) { hits++; RubyMatchData matchData = (RubyMatchData) runtime.getBackref(); int end = matchData.matchEndPosition(); addResult(substring(splitee, pos, (beg == pos && end == beg) ? 1 : beg - pos)); // Add to list any /(.)/ matched. long extraPatterns = matchData.getSize(); for (int i = 1; i < extraPatterns; i++) { addResult(((RubyString) matchData.group(i)).getValue()); } pos = (end == beg) ? beg + 1 : end; if (hits + 1 == limit) { break; } } if (hits == 0) { addResult(splitee); } else if (pos <= len) { addResult(substring(splitee, pos, len - pos)); } if (limit == 0) { while (((String) result.get(result.size() - 1)).length() == 0) { result.remove(result.size() - 1); } } }
3,229,180
public Clazz(String longName) { if (longName == null) { throw new IllegalArgumentException("Class name can not be null."); } lines = new TreeMap(); packageName = ClassHelper.getPackageName(longName); name = ClassHelper.getBaseName(longName); numberOfBranches = 0; numberOfCoveredBranches = 0; numberOfCoveredLines = 0; numberOfLines = 0; }
public Clazz(String longName) { if (longName == null) { throw new IllegalArgumentException("Class name can not be null."); } lines = new TreeMap(); packageName = ClassHelper.getPackageName(longName); name = ClassHelper.getBaseName(longName); numberOfBranches = 0; numberOfCoveredBranches = 0; numberOfCoveredLines = 0; numberOfLines = 0; }
3,229,181
public Clazz(String longName) { if (longName == null) { throw new IllegalArgumentException("Class name can not be null."); } lines = new TreeMap(); packageName = ClassHelper.getPackageName(longName); name = ClassHelper.getBaseName(longName); numberOfBranches = 0; numberOfCoveredBranches = 0; numberOfCoveredLines = 0; numberOfLines = 0; }
public Clazz(String longName) { if (longName == null) { throw new IllegalArgumentException("Class name can not be null."); } lines = new TreeMap(); packageName = ClassHelper.getPackageName(longName); name = ClassHelper.getBaseName(longName); numberOfBranches = 0; numberOfCoveredBranches = 0; numberOfCoveredLines = 0; numberOfLines = 0; }
3,229,182
public int getNumberOfBranches() { return numberOfBranches; }
public int getNumberOfBranches() { return numberOfBranches; }
3,229,183
public int getNumberOfCoveredBranches() { return numberOfCoveredBranches; }
public int getNumberOfCoveredBranches() { return numberOfCoveredBranches; }
3,229,184
public int getNumberOfCoveredLines() { return numberOfCoveredLines; }
public int getNumberOfCoveredLines() { return numberOfCoveredLines; }
3,229,185
public int getNumberOfLines() { return numberOfLines; }
public int getNumberOfLines() { return numberOfLines; }
3,229,186
public final void setRawCoverageData(CoverageData rawCoverageData) { this.rawCoverageData = rawCoverageData; }
public final void setRawCoverageData(CoverageData rawCoverageData) { this.rawCoverageData = rawCoverageData; }
3,229,187
public static RubyClass createSymbolClass(Ruby ruby) { RubyClass symbolClass = ruby.defineClass("Symbol", ruby.getClasses().getObjectClass()); symbolClass.getRubyClass().undefMethod("new"); symbolClass.defineMethod("id", CallbackFactory.getMethod(RubySymbol.class, "id")); symbolClass.defineMethod("to_i", CallbackFactory.getMethod(RubySymbol.class, "to_i")); symbolClass.defineMethod("to_int", CallbackFactory.getMethod(RubySymbol.class, "to_i")); symbolClass.defineMethod("id2name", CallbackFactory.getMethod(RubySymbol.class, "to_s")); symbolClass.defineMethod("to_s", CallbackFactory.getMethod(RubySymbol.class, "to_s")); symbolClass.defineMethod("==", CallbackFactory.getMethod(RubySymbol.class, "equal", RubyObject.class)); symbolClass.defineMethod("inspect", CallbackFactory.getMethod(RubySymbol.class, "inspect")); symbolClass.defineMethod("hash", CallbackFactory.getMethod(RubySymbol.class, "hash")); symbolClass.defineMethod("dup", CallbackFactory.getMethod(RubySymbol.class, "rbClone")); symbolClass.defineMethod("clone", CallbackFactory.getMethod(RubySymbol.class, "rbClone")); symbolClass.defineMethod("freeze", CallbackFactory.getSelfMethod()); symbolClass.defineMethod("taint", CallbackFactory.getSelfMethod()); return symbolClass; }
public static RubyClass createSymbolClass(Ruby ruby) { RubyClass symbolClass = ruby.defineClass("Symbol", ruby.getClasses().getObjectClass()); symbolClass.getRubyClass().undefMethod("new"); symbolClass.defineMethod("id", CallbackFactory.getMethod(RubySymbol.class, "id")); symbolClass.defineMethod("to_i", CallbackFactory.getMethod(RubySymbol.class, "to_i")); symbolClass.defineMethod("to_int", CallbackFactory.getMethod(RubySymbol.class, "to_i")); symbolClass.defineMethod("id2name", CallbackFactory.getMethod(RubySymbol.class, "to_s")); symbolClass.defineMethod("to_s", CallbackFactory.getMethod(RubySymbol.class, "to_s")); symbolClass.defineMethod("==", CallbackFactory.getMethod(RubySymbol.class, "equal", RubyObject.class)); symbolClass.defineMethod("inspect", CallbackFactory.getMethod(RubySymbol.class, "inspect")); symbolClass.defineMethod("hash", CallbackFactory.getMethod(RubySymbol.class, "hash")); symbolClass.defineMethod("dup", CallbackFactory.getMethod(RubySymbol.class, "rbClone")); symbolClass.defineMethod("clone", CallbackFactory.getMethod(RubySymbol.class, "rbClone")); symbolClass.defineMethod("freeze", CallbackFactory.getSelfMethod()); symbolClass.defineMethod("taint", CallbackFactory.getSelfMethod()); return symbolClass; }
3,229,188
public LoadError(Ruby ruby, String msg) { super(ruby, ruby.getExceptions().getTypeError(), msg); }
public LoadError(Ruby ruby, String msg) { super(ruby, ruby.getExceptions().getLoadError(), msg); }
3,229,189
public int getEndT() { return Integer.parseInt(view.getMPane().getMovieEndT().getText()); }
public int getEndT() { return Integer.parseInt(view.mPane.movieEndT.getText()); }
3,229,190
public int getEndZ() { return Integer.parseInt(view.getMPane().getMovieEndZ().getText()); }
public int getEndZ() { return Integer.parseInt(view.mPane.movieEndZ.getText()); }
3,229,191
public int getStartT() { return Integer.parseInt(view.getMPane().getMovieStartT().getText()); }
public int getStartT() { return Integer.parseInt(view.mPane.movieStartT.getText()); }
3,229,192
public int getStartZ() { return Integer.parseInt(view.getMPane().getMovieStartZ().getText()); }
public int getStartZ() { return Integer.parseInt(view.mPane.movieStartZ.getText()); }
3,229,193
public void setBorderPlay(boolean b) { view.getCPane().getPlay().setBorderPainted(b); }
public void setBorderPlay(boolean b) { view.cPane.play.setBorderPainted(b); }
3,229,194
void setMovieType(int type) { if (!playerManager.isPlaying()) playerManager.setMovieType(type); }
void setMovieType(int type) { stop(); setBorderPlay(false); playerManager.setMovieType(type); }
3,229,195
void setTimerDelay(int rate) { if (!playerManager.isPlaying()) playerManager.setTimerDelay(rate); }
void setTimerDelay(int rate) { stop(); setBorderPlay(false); playerManager.setTimerDelay(rate); }
3,229,196
private void buildTable(List toSelect, String name) { table = new TableComponent(toSelect.size(), 3); JPanel p; ColoredButton button; int w = table.getColumnModel().getColumn(2).getPreferredWidth(); int h = table.getRowHeight(); Dimension d = new Dimension(Math.min(w, h)-3, Math.min(w, h)-3); Iterator i = toSelect.iterator(); int j, k; k = 0; Integer l; while (i.hasNext()) { l = (Integer) i.next(); table.setValueAt(l, k, ContextPane.NAME); table.setValueAt(Boolean.FALSE, k, ContextPane.BOOLEAN); j = k%MODULO; button = getButton(defaultColors[j]); manager.attachButtonListener(button, k); p = buildComponentPanel(button, d); table.setValueAt(p, k, ContextPane.BUTTON); k++; } TableSorter sorter = new TableSorter(table.getModel()); table.setModel(sorter); sorter.addMouseListenerToHeaderInTable(table); sorter.sortByColumn(0); setTableHeader(name); }
private void buildTable(List toSelect, String name) { table = new TableComponent(toSelect.size(), 3); JPanel p; ColoredButton button; int w = table.getColumnModel().getColumn(2).getPreferredWidth(); int h = table.getRowHeight(); Dimension d = new Dimension(Math.min(w, h)-3, Math.min(w, h)-3); Iterator i = toSelect.iterator(); int j, k; k = 0; Integer l; while (i.hasNext()) { l = (Integer) i.next(); table.setValueAt(l, k, ContextPane.NAME); table.setValueAt(Boolean.FALSE, k, ContextPane.BOOLEAN); j = k%MODULO; button = getButton(defaultColors[j]); manager.attachButtonListener(button, k); p = buildComponentPanel(button, d); table.setValueAt(p, k, ContextPane.BUTTON); k++; } TableSorter sorter = new TableSorter(table.getModel()); table.setModel(sorter); sorter.addMouseListenerToHeaderInTable(table); sorter.sortByColumn(0); setTableHeader(name); }
3,229,197
private void buildTable(List toSelect, String name) { table = new TableComponent(toSelect.size(), 3); JPanel p; ColoredButton button; int w = table.getColumnModel().getColumn(2).getPreferredWidth(); int h = table.getRowHeight(); Dimension d = new Dimension(Math.min(w, h)-3, Math.min(w, h)-3); Iterator i = toSelect.iterator(); int j, k; k = 0; Integer l; while (i.hasNext()) { l = (Integer) i.next(); table.setValueAt(l, k, ContextPane.NAME); table.setValueAt(Boolean.FALSE, k, ContextPane.BOOLEAN); j = k%MODULO; button = getButton(defaultColors[j]); manager.attachButtonListener(button, k); p = buildComponentPanel(button, d); table.setValueAt(p, k, ContextPane.BUTTON); k++; } TableSorter sorter = new TableSorter(table.getModel()); table.setModel(sorter); sorter.addMouseListenerToHeaderInTable(table); sorter.sortByColumn(0); setTableHeader(name); }
private void buildTable(List toSelect, String name) { table = new TableComponent(toSelect.size(), 3); JPanel p; ColoredButton button; int w = table.getColumnModel().getColumn(2).getPreferredWidth(); int h = table.getRowHeight(); Dimension d = new Dimension(Math.min(w, h)-3, Math.min(w, h)-3); Iterator i = toSelect.iterator(); int j, k; k = 0; Integer l; while (i.hasNext()) { l = (Integer) i.next(); table.setValueAt(l, k, ContextPane.NAME); table.setValueAt(Boolean.FALSE, k, ContextPane.BOOLEAN); j = k%MODULO; button = getButton(defaultColors[j]); manager.attachButtonListener(button, k); p = buildComponentPanel(button, d); table.setValueAt(p, k, ContextDialog.BUTTON); k++; } TableSorter sorter = new TableSorter(table.getModel()); table.setModel(sorter); sorter.addMouseListenerToHeaderInTable(table); sorter.sortByColumn(0); setTableHeader(name); }
3,229,198
private void setTableHeader(String s) { IconManager im = IconManager.getInstance(getRegistry()); TableIconRenderer rnd = new TableIconRenderer(); TableColumnModel tcm = table.getTableHeader().getColumnModel(); Icon up = im.getIcon(IconManager.UP), down = im.getIcon(IconManager.DOWN); setTableColumnHeader(tcm.getColumn(ContextPane.NAME), rnd, up, down, s); setTableColumnHeader(tcm.getColumn(ContextPane.BOOLEAN), rnd, up, down, ""); setTableColumnHeader(tcm.getColumn(ContextPane.BUTTON), rnd, null, null, ""); table.setDefaultRenderer(JComponent.class, new TableComponentCellRenderer()); table.setDefaultEditor(JComponent.class, new TableComponentCellEditor()); }
private void setTableHeader(String s) { IconManager im = IconManager.getInstance(getRegistry()); TableIconRenderer rnd = new TableIconRenderer(); TableColumnModel tcm = table.getTableHeader().getColumnModel(); Icon up = im.getIcon(IconManager.UP), down = im.getIcon(IconManager.DOWN); setTableColumnHeader(tcm.getColumn(ContextPane.NAME), rnd, up, down, s); setTableColumnHeader(tcm.getColumn(ContextPane.BOOLEAN), rnd, up, down, ""); setTableColumnHeader(tcm.getColumn(ContextPane.BUTTON), rnd, null, null, ""); table.setDefaultRenderer(JComponent.class, new TableComponentCellRenderer()); table.setDefaultEditor(JComponent.class, new TableComponentCellEditor()); }
3,229,199
private void setTableHeader(String s) { IconManager im = IconManager.getInstance(getRegistry()); TableIconRenderer rnd = new TableIconRenderer(); TableColumnModel tcm = table.getTableHeader().getColumnModel(); Icon up = im.getIcon(IconManager.UP), down = im.getIcon(IconManager.DOWN); setTableColumnHeader(tcm.getColumn(ContextPane.NAME), rnd, up, down, s); setTableColumnHeader(tcm.getColumn(ContextPane.BOOLEAN), rnd, up, down, ""); setTableColumnHeader(tcm.getColumn(ContextPane.BUTTON), rnd, null, null, ""); table.setDefaultRenderer(JComponent.class, new TableComponentCellRenderer()); table.setDefaultEditor(JComponent.class, new TableComponentCellEditor()); }
private void setTableHeader(String s) { IconManager im = IconManager.getInstance(getRegistry()); TableIconRenderer rnd = new TableIconRenderer(); TableColumnModel tcm = table.getTableHeader().getColumnModel(); Icon up = im.getIcon(IconManager.UP), down = im.getIcon(IconManager.DOWN); setTableColumnHeader(tcm.getColumn(ContextPane.NAME), rnd, up, down, s); setTableColumnHeader(tcm.getColumn(ContextPane.BOOLEAN), rnd, up, down, ""); setTableColumnHeader(tcm.getColumn(ContextDialog.BUTTON), rnd, null, null, ""); table.setDefaultRenderer(JComponent.class, new TableComponentCellRenderer()); table.setDefaultEditor(JComponent.class, new TableComponentCellEditor()); }
3,229,200
private void createWindowsMenuItems(JMenu menu) { Set viewers = ImViewerFactory.getViewers(); Iterator i = viewers.iterator(); menu.removeAll(); while (i.hasNext()) menu.add(new JMenuItem(new ActivationAction((ImViewer) i.next()))); }
privatevoidcreateWindowsMenuItems(JMenumenu){Setviewers=ImViewerFactory.getViewers();Iteratori=viewers.iterator();menu.removeAll();while(i.hasNext())menu.add(newJMenuItem(newActivationAction((ImViewer)i.next())));}
3,229,201