[HepData-svn] r1415 - trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Tue Oct 19 20:26:40 BST 2010


Author: whalley
Date: Tue Oct 19 20:26:40 2010
New Revision: 1415

Log:
mods to x values outputs

Modified:
   trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java

Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java
==============================================================================
--- trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java	Fri Oct 15 15:18:27 2010	(r1414)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java	Tue Oct 19 20:26:40 2010	(r1415)
@@ -198,7 +198,8 @@
                     int fwidth = 0;
                     // Format as "<focus> (bin: <low>--<high>)" if showmean is true ==
                     // at least one bin has a focus which significantly differs from the mean
-                    boolean asymmfocus = false;
+                    // ..force it to be true so that we always output the mean
+                    boolean asymmfocus = true;
                     for (Bin b : x.getBins()) {
                         if (b.getLowValue() != null && b.getHighValue() != null && b.getFocus() != null) {
                             double diff = b.getFocus() - (b.getLowValue() + b.getHighValue()) / 2.0;
@@ -229,7 +230,27 @@
                                 low = b.getLowValue();
                                 high = b.getHighValue();
                                 f = b.getFocus();
-                                String f_val = Formats.forms(f, fwidth);
+                                int lsd = 0;
+                                int msd = 0;                             
+                                if(f != null) {  
+                                    SignificantFigures valx = new SignificantFigures(f);
+                                    lsd = valx.getLSD();
+                                    msd = valx.getMSD();
+                                   if(msd == 0) msd = 1;
+                                }
+                                if(b.getFocus().toString().indexOf("9999999") > 0) {
+                                   int pos1 =  b.getFocus().toString().indexOf("999999");
+                                   int pos2 =  b.getFocus().toString().indexOf(".");
+                                   lsd = pos2-pos1+1;
+                                }
+                                else if(b.getFocus().toString().indexOf("0000000") > 0) {
+                                   int pos1 =  b.getFocus().toString().indexOf("0000000");
+                                   int pos2 =  b.getFocus().toString().indexOf(".");
+                                   lsd = pos2-pos1+1;
+                                }
+
+//                                String f_val = Formats.forms(f, fwidth);
+                                String f_val = Formats.forms(f,fwidth, msd,-lsd);
                                 if (low != null && high != null) {
                                     String f_low = Formats.forms(low, lwidth);
                                     String f_high = Formats.forms(high,hwidth);
@@ -301,7 +322,7 @@
                         int msd = val.getMSD();
                         if (msd <= 0) msd = 1;
                         if(allzero == sumzero) lsd = 0;
-                        writer.write(Formats.forms(pt2.getValue(), msd, -lsd));
+                        writer.write(Formats.forms(pt2.getValue(),msd, -lsd));
                         if (pt2.getRelation() == Relation.EQUALS) {
                             for (PointError e : pt2.getErrors()) {
                                 String stype = e.getSourceType().toShortString();


More information about the HepData-svn mailing list