|
[HepData-svn] r1358 - trunk/hepdata-webapp/src/main/java/cedar/hepdata/formatsblackhole at projects.hepforge.org blackhole at projects.hepforge.orgMon Jun 7 17:44:01 BST 2010
Author: buckley Date: Mon Jun 7 17:44:03 2010 New Revision: 1358 Log: Fixing loops to start with 1, and to only init comma separator *after* a valid point has been seen. Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/PlainFormatter.java trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/PyRootFormatter.java trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/RootFormatter.java Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/PlainFormatter.java ============================================================================== --- trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/PlainFormatter.java Mon Jun 7 16:25:08 2010 (r1357) +++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/PlainFormatter.java Mon Jun 7 17:44:03 2010 (r1358) @@ -108,7 +108,7 @@ } s.append("\n"); - for (int r = 0; r <= d.getMaxPointId(); ++r) { + for (int r = 1; r <= d.getMaxPointId(); ++r) { StringTemplate row = new StringTemplate("$xlow$\t$xhigh$\t$yval$"); Bin b = x.getBin(r); Point p = y.getPoint(r); Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/PyRootFormatter.java ============================================================================== --- trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/PyRootFormatter.java Mon Jun 7 16:25:08 2010 (r1357) +++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/PyRootFormatter.java Mon Jun 7 17:44:03 2010 (r1358) @@ -64,9 +64,8 @@ StringBuffer yv = new StringBuffer("yval = array(\"f\", ["); StringBuffer yem = new StringBuffer("yerrminus = array(\"f\", ["); StringBuffer yep = new StringBuffer("yerrplus = array(\"f\", ["); - for (int r = 0; r <= d.getMaxPointId(); ++r) { - String sep = ", "; - if (r == 0) sep = ""; + String sep = ""; + for (int r = 1; r <= d.getMaxPointId(); ++r) { Bin b = x.getBin(r); Point p = y.getPoint(r); if (b != null && p != null) { @@ -82,6 +81,8 @@ yem.append(sep + dyminus.toString()); Double dyplus = p.getQuadCombinedPlusError(); yep.append(sep + dyplus.toString()); + // Once we've seen a valid point, init the comma separator + sep = ", "; } } Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/RootFormatter.java ============================================================================== --- trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/RootFormatter.java Mon Jun 7 16:25:08 2010 (r1357) +++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/RootFormatter.java Mon Jun 7 17:44:03 2010 (r1358) @@ -40,7 +40,7 @@ path.setAttribute("xid", x.getId()); path.setAttribute("yid", y.getId()); s.append("BEGIN SCATTER " + path.toString()); - for (int r = 0; r < d.getMaxPointId(); ++r) { + for (int r = 1; r < d.getMaxPointId(); ++r) { StringTemplate row = new StringTemplate("$xlow$\t$xhigh$\t$yval$\t$yerr$"); Bin b = x.getBin(r); if (b != null) {
More information about the HepData-svn mailing list |