diff --git a/src/main/java/com/metaweb/gridworks/GridworksServlet.java b/src/main/java/com/metaweb/gridworks/GridworksServlet.java index 81b7ee86e..2518b01ad 100644 --- a/src/main/java/com/metaweb/gridworks/GridworksServlet.java +++ b/src/main/java/com/metaweb/gridworks/GridworksServlet.java @@ -159,13 +159,13 @@ public class GridworksServlet extends HttpServlet { final static protected long s_autoSavePeriod = 1000 * 60 * 5; // 5 minutes static protected class AutoSaveTimerTask extends TimerTask { public void run() { - try { - ProjectManager.singleton.save(false); // quick, potentially incomplete save - } finally { - _timer.schedule(new AutoSaveTimerTask(), s_autoSavePeriod); - // we don't use scheduleAtFixedRate because that might result in - // bunched up events when the computer is put in sleep mode - } + try { + ProjectManager.singleton.save(false); // quick, potentially incomplete save + } finally { + _timer.schedule(new AutoSaveTimerTask(), s_autoSavePeriod); + // we don't use scheduleAtFixedRate because that might result in + // bunched up events when the computer is put in sleep mode + } } } @@ -178,7 +178,7 @@ public class GridworksServlet extends HttpServlet { if (_timer == null) { _timer = new Timer("autosave"); - _timer.schedule(new AutoSaveTimerTask(), s_autoSavePeriod); + _timer.schedule(new AutoSaveTimerTask(), s_autoSavePeriod); } logger.trace("< initialize"); diff --git a/src/main/java/com/metaweb/gridworks/ProjectManager.java b/src/main/java/com/metaweb/gridworks/ProjectManager.java index 50e1e5308..a5885b819 100644 --- a/src/main/java/com/metaweb/gridworks/ProjectManager.java +++ b/src/main/java/com/metaweb/gridworks/ProjectManager.java @@ -145,23 +145,23 @@ public class ProjectManager { * APPDATA value to substitute back the original user ID. */ static protected String fixWindowsUnicodePath(String path) { - int q = path.indexOf('?'); - if (q < 0) { - return path; - } - int pathSep = path.indexOf(File.separatorChar, q); - - String goodPath = System.getenv("APPDATA"); - if (goodPath == null || goodPath.length() == 0) { + int q = path.indexOf('?'); + if (q < 0) { + return path; + } + int pathSep = path.indexOf(File.separatorChar, q); + + String goodPath = System.getenv("APPDATA"); + if (goodPath == null || goodPath.length() == 0) { goodPath = System.getenv("USERPROFILE"); if (!goodPath.endsWith(File.separator)) { - goodPath = goodPath + File.separator; + goodPath = goodPath + File.separator; } - } - - int goodPathSep = goodPath.indexOf(File.separatorChar, q); - - return path.substring(0, q) + goodPath.substring(q, goodPathSep) + path.substring(pathSep); + } + + int goodPathSep = goodPath.indexOf(File.separatorChar, q); + + return path.substring(0, q) + goodPath.substring(q, goodPathSep) + path.substring(pathSep); } private ProjectManager(File dir) { @@ -291,13 +291,13 @@ public class ProjectManager { } public void setBusy(boolean busy) { - synchronized (this) { - if (busy) { - _busy++; - } else { - _busy--; - } - } + synchronized (this) { + if (busy) { + _busy++; + } else { + _busy--; + } + } } public void addLatestExpression(String s) { @@ -315,10 +315,10 @@ public class ProjectManager { } public void save(boolean allModified) { - if (allModified || _busy == 0) { - saveProjects(allModified); - saveWorkspace(); - } + if (allModified || _busy == 0) { + saveProjects(allModified); + saveWorkspace(); + } } /** diff --git a/src/main/java/com/metaweb/gridworks/browsing/facets/ScatterplotDrawingRowVisitor.java b/src/main/java/com/metaweb/gridworks/browsing/facets/ScatterplotDrawingRowVisitor.java index b52fffc84..83e485dc5 100644 --- a/src/main/java/com/metaweb/gridworks/browsing/facets/ScatterplotDrawingRowVisitor.java +++ b/src/main/java/com/metaweb/gridworks/browsing/facets/ScatterplotDrawingRowVisitor.java @@ -67,16 +67,16 @@ public class ScatterplotDrawingRowVisitor implements RowVisitor { g2.setPaint(color); if (r != null) { - /* - * Fill in the negative quadrants to give a hint of how the plot has been rotated. - */ - Graphics2D g2r = (Graphics2D) g2.create(); - g2r.transform(r); - - g2r.setPaint(Color.lightGray); - g2r.fillRect(-size, 0, size, size); - g2r.fillRect(0, -size, size, size); - g2r.dispose(); + /* + * Fill in the negative quadrants to give a hint of how the plot has been rotated. + */ + Graphics2D g2r = (Graphics2D) g2.create(); + g2r.transform(r); + + g2r.setPaint(Color.lightGray); + g2r.fillRect(-size, 0, size, size); + g2r.fillRect(0, -size, size, size); + g2r.dispose(); } } @@ -97,7 +97,7 @@ public class ScatterplotDrawingRowVisitor implements RowVisitor { Point2D.Double p = new Point2D.Double(xv,yv); p = ScatterplotFacet.translateCoordinates( - p, min_x, max_x, min_y, max_y, dim_x, dim_y, l, r); + p, min_x, max_x, min_y, max_y, dim_x, dim_y, l, r); g2.fill(new Rectangle2D.Double(p.x - dot / 2, p.y - dot / 2, dot, dot)); } diff --git a/src/main/java/com/metaweb/gridworks/browsing/facets/ScatterplotFacet.java b/src/main/java/com/metaweb/gridworks/browsing/facets/ScatterplotFacet.java index 6ea0d96b8..0ae4d69f8 100644 --- a/src/main/java/com/metaweb/gridworks/browsing/facets/ScatterplotFacet.java +++ b/src/main/java/com/metaweb/gridworks/browsing/facets/ScatterplotFacet.java @@ -175,8 +175,8 @@ public class ScatterplotFacet implements Facet { to_x = o.getDouble(TO_X); selected = true; } else { - from_x = 0; - to_x = 1; + from_x = 0; + to_x = 1; } dim_y = (o.has(DIM_Y)) ? getAxisDim(o.getString(DIM_Y)) : LIN; @@ -185,8 +185,8 @@ public class ScatterplotFacet implements Facet { to_y = o.getDouble(TO_Y); selected = true; } else { - from_y = 0; - to_y = 1; + from_y = 0; + to_y = 1; } rotation = (o.has(ROTATION)) ? getRotation(o.getString(ROTATION)) : NO_ROTATION; @@ -251,13 +251,13 @@ public class ScatterplotFacet implements Facet { eval_y != null && errorMessage_y == null) { return new DualExpressionsNumberComparisonRowFilter( - eval_x, columnName_x, columnIndex_x, eval_y, columnName_y, columnIndex_y) { - - double from_x_pixels = from_x * l; - double to_x_pixels = to_x * l; - double from_y_pixels = from_y * l; - double to_y_pixels = to_y * l; - + eval_x, columnName_x, columnIndex_x, eval_y, columnName_y, columnIndex_y) { + + double from_x_pixels = from_x * l; + double to_x_pixels = to_x * l; + double from_y_pixels = from_y * l; + double to_y_pixels = to_y * l; + protected boolean checkValues(double x, double y) { Point2D.Double p = new Point2D.Double(x,y); p = translateCoordinates(p, min_x, max_x, min_y, max_y, dim_x, dim_y, l, t); @@ -348,25 +348,25 @@ public class ScatterplotFacet implements Facet { public static AffineTransform createRotationMatrix(int rotation, double l) { if (rotation == ScatterplotFacet.ROTATE_CW) { - AffineTransform t = AffineTransform.getTranslateInstance(0, l / 2); - t.scale(s_rotateScale, s_rotateScale); - t.rotate(-Math.PI / 4); - return t; + AffineTransform t = AffineTransform.getTranslateInstance(0, l / 2); + t.scale(s_rotateScale, s_rotateScale); + t.rotate(-Math.PI / 4); + return t; } else if (rotation == ScatterplotFacet.ROTATE_CCW) { - AffineTransform t = AffineTransform.getTranslateInstance(l / 2, 0); - t.scale(s_rotateScale, s_rotateScale); - t.rotate(Math.PI / 4); - return t; + AffineTransform t = AffineTransform.getTranslateInstance(l / 2, 0); + t.scale(s_rotateScale, s_rotateScale); + t.rotate(Math.PI / 4); + return t; } else { - return null; + return null; } } public static Point2D.Double translateCoordinates( - Point2D.Double p, - double min_x, double max_x, double min_y, double max_y, - int dim_x, int dim_y, double l, AffineTransform t) { - + Point2D.Double p, + double min_x, double max_x, double min_y, double max_y, + int dim_x, int dim_y, double l, AffineTransform t) { + double x = p.x; double y = p.y; @@ -389,7 +389,7 @@ public class ScatterplotFacet implements Facet { p.x = x; p.y = y; if (t != null) { - t.transform(p, p); + t.transform(p, p); } return p; diff --git a/src/main/java/com/metaweb/gridworks/commands/edit/CreateProjectCommand.java b/src/main/java/com/metaweb/gridworks/commands/edit/CreateProjectCommand.java index 3eba2b4c6..880a8da83 100644 --- a/src/main/java/com/metaweb/gridworks/commands/edit/CreateProjectCommand.java +++ b/src/main/java/com/metaweb/gridworks/commands/edit/CreateProjectCommand.java @@ -62,7 +62,7 @@ public class CreateProjectCommand extends Command { public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - ProjectManager.singleton.setBusy(true); + ProjectManager.singleton.setBusy(true); try { /* * The uploaded file is in the POST body as a "file part". If @@ -99,7 +99,7 @@ public class CreateProjectCommand extends Command { ); e.printStackTrace(); } finally { - ProjectManager.singleton.setBusy(false); + ProjectManager.singleton.setBusy(false); } } diff --git a/src/main/java/com/metaweb/gridworks/commands/edit/ImportProjectCommand.java b/src/main/java/com/metaweb/gridworks/commands/edit/ImportProjectCommand.java index fb6670687..032b389e3 100644 --- a/src/main/java/com/metaweb/gridworks/commands/edit/ImportProjectCommand.java +++ b/src/main/java/com/metaweb/gridworks/commands/edit/ImportProjectCommand.java @@ -36,7 +36,7 @@ public class ImportProjectCommand extends Command { public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - ProjectManager.singleton.setBusy(true); + ProjectManager.singleton.setBusy(true); try { Properties options = ParsingUtilities.parseUrlParameters(request); @@ -65,7 +65,7 @@ public class ImportProjectCommand extends Command { } catch (Exception e) { e.printStackTrace(); } finally { - ProjectManager.singleton.setBusy(false); + ProjectManager.singleton.setBusy(false); } } diff --git a/src/main/java/com/metaweb/gridworks/commands/edit/UploadDataCommand.java b/src/main/java/com/metaweb/gridworks/commands/edit/UploadDataCommand.java index 53274f78b..d302b3181 100644 --- a/src/main/java/com/metaweb/gridworks/commands/edit/UploadDataCommand.java +++ b/src/main/java/com/metaweb/gridworks/commands/edit/UploadDataCommand.java @@ -24,7 +24,7 @@ public class UploadDataCommand extends Command { public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - ProjectManager.singleton.setBusy(true); + ProjectManager.singleton.setBusy(true); try { Project project = getProject(request); Engine engine = getEngine(request, project); @@ -51,7 +51,7 @@ public class UploadDataCommand extends Command { } catch (Exception e) { respondException(response, e); } finally { - ProjectManager.singleton.setBusy(false); + ProjectManager.singleton.setBusy(false); } } } diff --git a/src/main/java/com/metaweb/gridworks/commands/info/ExportRowsCommand.java b/src/main/java/com/metaweb/gridworks/commands/info/ExportRowsCommand.java index 593329c1c..37b2c82aa 100644 --- a/src/main/java/com/metaweb/gridworks/commands/info/ExportRowsCommand.java +++ b/src/main/java/com/metaweb/gridworks/commands/info/ExportRowsCommand.java @@ -33,7 +33,7 @@ public class ExportRowsCommand extends Command { public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - ProjectManager.singleton.setBusy(true); + ProjectManager.singleton.setBusy(true); try { Project project = getProject(request); Engine engine = getEngine(request, project); @@ -56,7 +56,7 @@ public class ExportRowsCommand extends Command { } catch (Exception e) { respondException(response, e); } finally { - ProjectManager.singleton.setBusy(false); + ProjectManager.singleton.setBusy(false); } } } diff --git a/src/main/java/com/metaweb/gridworks/commands/info/GetScatterplotCommand.java b/src/main/java/com/metaweb/gridworks/commands/info/GetScatterplotCommand.java index deba75b78..726cb40e3 100644 --- a/src/main/java/com/metaweb/gridworks/commands/info/GetScatterplotCommand.java +++ b/src/main/java/com/metaweb/gridworks/commands/info/GetScatterplotCommand.java @@ -151,20 +151,20 @@ public class GetScatterplotCommand extends Command { size, dim_x, dim_y, rotation, dot, color ); - if (base_color != null) { - drawer.setColor(base_color); - + if (base_color != null) { + drawer.setColor(base_color); + FilteredRows filteredRows = engine.getAllRows(); filteredRows.accept(project, drawer); - drawer.setColor(color); - } - - { - FilteredRows filteredRows = engine.getAllFilteredRows(false); - filteredRows.accept(project, drawer); - } - + drawer.setColor(color); + } + + { + FilteredRows filteredRows = engine.getAllFilteredRows(false); + filteredRows.accept(project, drawer); + } + ImageIO.write(drawer.getImage(), "png", output); } else { ImageIO.write(new BufferedImage(1, 1, BufferedImage.TYPE_4BYTE_ABGR), "png", output); diff --git a/src/main/java/com/metaweb/gridworks/importers/parsers/CSVRowParser.java b/src/main/java/com/metaweb/gridworks/importers/parsers/CSVRowParser.java index e3b89b559..e1f5a332b 100644 --- a/src/main/java/com/metaweb/gridworks/importers/parsers/CSVRowParser.java +++ b/src/main/java/com/metaweb/gridworks/importers/parsers/CSVRowParser.java @@ -28,13 +28,13 @@ public class CSVRowParser extends RowParser { if (quote < 0) { sb.append(line.substring(start)); - start = 0; + start = 0; try { - line = lineReader.readLine(); - } catch (IOException e) { - line = ""; - break; - } + line = lineReader.readLine(); + } catch (IOException e) { + line = ""; + break; + } } else { if (quote < line.length() - 1 && line.charAt(quote + 1) == '"') { sb.append(line.substring(start, quote + 1)); // include " as well diff --git a/src/main/java/com/metaweb/gridworks/model/Recon.java b/src/main/java/com/metaweb/gridworks/model/Recon.java index 4ff6752a5..91045410f 100644 --- a/src/main/java/com/metaweb/gridworks/model/Recon.java +++ b/src/main/java/com/metaweb/gridworks/model/Recon.java @@ -141,9 +141,9 @@ public class Recon implements HasFields, Jsonizable { } public Object getField(String name, Properties bindings) { - if ("id".equals(name)) { - return id; - } else if ("best".equals(name)) { + if ("id".equals(name)) { + return id; + } else if ("best".equals(name)) { return candidates != null && candidates.size() > 0 ? candidates.get(0) : null; } else if ("candidates".equals(name)) { return candidates; diff --git a/src/main/java/com/metaweb/gridworks/model/changes/MassChange.java b/src/main/java/com/metaweb/gridworks/model/changes/MassChange.java index f5ab78c2b..f62431c01 100644 --- a/src/main/java/com/metaweb/gridworks/model/changes/MassChange.java +++ b/src/main/java/com/metaweb/gridworks/model/changes/MassChange.java @@ -49,7 +49,7 @@ public class MassChange implements Change { writer.write("updateRowContextDependencies="); writer.write(Boolean.toString(_updateRowContextDependencies)); writer.write('\n'); writer.write("changeCount="); writer.write(Integer.toString(_changes.size())); writer.write('\n'); for (Change c : _changes) { - History.writeOneChange(writer, c, options); + History.writeOneChange(writer, c, options); } writer.write("/ec/\n"); // end of change marker } diff --git a/src/main/java/com/metaweb/gridworks/protograph/Link.java b/src/main/java/com/metaweb/gridworks/protograph/Link.java index d67d2cc46..c775d9580 100644 --- a/src/main/java/com/metaweb/gridworks/protograph/Link.java +++ b/src/main/java/com/metaweb/gridworks/protograph/Link.java @@ -31,7 +31,7 @@ public class Link implements Jsonizable { writer.key("property"); property.write(writer, options); if (target != null) { writer.key("target"); - target.write(writer, options); + target.write(writer, options); } writer.endObject(); } diff --git a/src/main/java/com/metaweb/gridworks/protograph/Protograph.java b/src/main/java/com/metaweb/gridworks/protograph/Protograph.java index 751440dc3..b259aad20 100644 --- a/src/main/java/com/metaweb/gridworks/protograph/Protograph.java +++ b/src/main/java/com/metaweb/gridworks/protograph/Protograph.java @@ -93,7 +93,7 @@ public class Protograph implements Jsonizable { node2.addLink(new Link( reconstructProperty(oLink.getJSONObject("property")), oLink.has("target") && !oLink.isNull("target") ? - reconstructNode(oLink.getJSONObject("target")) : null + reconstructNode(oLink.getJSONObject("target")) : null )); } }