[HepData-svn] r1794 - trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Tue Apr 29 14:07:08 BST 2014


Author: whalley
Date: Tue Apr 29 14:07:08 2014
New Revision: 1794

Log:
adding fixes to deal with non-numerical xfocus

Modified:
   trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/JhepworkFormatter.java

Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/JhepworkFormatter.java
==============================================================================
--- trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/JhepworkFormatter.java	Tue Apr 29 12:12:09 2014	(r1793)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/JhepworkFormatter.java	Tue Apr 29 14:07:08 2014	(r1794)
@@ -115,19 +115,25 @@
             s.append("p1=P1D('" + path.toString() + "')" + "\n");
             for (int r = 1; r <= d.getMaxPointId(); ++r) {
                 StringTemplate row = new StringTemplate();
-                String  template = "p1.add($xfocus$,$yval$,$xup$,$xdn$,$statup$,$statdn$,0.0,0.0,$systup$,$systdn$)";
+                String  template = "p1.add($xfocus$,$yval$,$xup$,$xdn$,$statup$,$statdn$,0.0,0.0,$systup$,$systdn$) $message$";
                 Bin b = x.getBin(r);
                 Point p = y.getPoint(r);
                 if (b != null && p != null) {
                     Double xfocus = null;
-                    Double xup = null;
-                    Double xdn = null;
+                    Double xup = 0.0;
+                    Double xdn = 0.0;
+                    String message = null;
                     if(b.getRelation() == Relation.EQUALS){
                          xfocus = b.getFocus();
                          if(xfocus != null) {
                              xup = b.getHighValue() - xfocus;
                              xdn = xfocus - b.getLowValue(); 
-                         }                  
+                             row.setAttribute("xfocus", xfocus);
+                         }
+                         else{
+                             message = " # NOTE .... xvalue is non-numerical/undefined";
+                             row.setAttribute("xfocus",r);
+                        }                  
                     }
                     else if (b.getRelation() == Relation.GREATER || b.getRelation() == Relation.GREATEREQUALS){
                         xdn = b.getLowValue();
@@ -136,7 +142,7 @@
                         xup = b.getHighValue();
                     } 
                     Double yval = p.getValue();
-		    String ydesc = p.getDescription();
+		            String ydesc = p.getDescription();
                     Double statdn = 0.0;
                     Double statup = 0.0;
                     Double systdn = 0.0;
@@ -172,9 +178,9 @@
                     }
 
                     row.setTemplate(template);
-                    row.setAttribute("xfocus", xfocus);
                     row.setAttribute("xup", xup);
                     row.setAttribute("xdn", xdn);
+                    row.setAttribute("message",message);
 		    if (ydesc != null) {
 			row.setAttribute("yval", ydesc);
 		    }


More information about the HepData-svn mailing list