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

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Wed Jan 19 12:02:54 GMT 2011


Author: whalley
Date: Wed Jan 19 12:02:53 2011
New Revision: 1429

Log:
adding ValueLength to define display decimal length

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	Thu Jan 13 09:55:19 2011	(r1428)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java	Wed Jan 19 12:02:53 2011	(r1429)
@@ -341,6 +341,7 @@
                         if (pt2.getRelation() != Relation.EQUALS) {
                             writer.write(pt2.getRelation().toString());
                         }
+
                         SignificantFigures val = new SignificantFigures(pt2.getValue());
                         int lsd = val.getLSD();
                         allzero += 1;
@@ -349,6 +350,10 @@
                             lsd += 1;
                         }
 
+                      if(pt2.getValueLength() != null && pt2.getValueLength() > 0) {
+                          lsd = -pt2.getValueLength();
+                      } 
+                      else{                        
                         if (pt2.getRelation() == Relation.EQUALS) {
                             for (PointError e : pt2.getErrors()) {
                                 int lsd1 = 0;
@@ -357,22 +362,25 @@
                                     SignificantFigures vale1 = new SignificantFigures(e.getPlus());
                                     lsd1 =  vale1.getLSD();
                                     if(!e.getPlus().toString().endsWith("0") && e.getPlus().toString().indexOf("0E") <= 0){
-//                                    if(e.getPlus().toString().indexOf("0E") <= 0){
+//                                    if(e.getPlus().toString().indexOf("0E") > 0){ lsd1 -= 1; }
                                        lsd = Math.min(lsd, lsd1); 
                                     }
                                     SignificantFigures vale2 = new SignificantFigures(e.getMinus());
                                     lsd2 =  vale2.getLSD();
                                     if(!e.getMinus().toString().endsWith("0") && e.getMinus().toString().indexOf("0E") <= 0){
-//                                    if(e.getMinus().toString().indexOf("0E") <= 0){
+//                                    if(e.getMinus().toString().indexOf("0E") > 0){ lsd2 -= 1; }
                                         lsd = Math.min(lsd, lsd2); 
                                     }
                                 }
                             }
                         }
+                      }
                         int msd = val.getMSD();
                         if (msd <= 0) msd = 1;
                         if(allzero == sumzero) lsd = 0;
                         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