[HepData-svn] r1597 - trunk/hepdata-model/src/main/java/cedar/hepdata/model

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Tue Nov 6 16:03:20 GMT 2012


Author: whalley
Date: Tue Nov  6 16:03:14 2012
New Revision: 1597

Log:
code to add published figures to dataset outputs

Modified:
   trunk/hepdata-model/src/main/java/cedar/hepdata/model/Dataset.java

Modified: trunk/hepdata-model/src/main/java/cedar/hepdata/model/Dataset.java
==============================================================================
--- trunk/hepdata-model/src/main/java/cedar/hepdata/model/Dataset.java	Fri Nov  2 14:12:35 2012	(r1596)
+++ trunk/hepdata-model/src/main/java/cedar/hepdata/model/Dataset.java	Tue Nov  6 16:03:14 2012	(r1597)
@@ -4,6 +4,7 @@
 import org.apache.log4j.*;
 
 import javax.persistence.*;
+import java.io.File;
 
 /**
 * A single result set within a {@link Paper}
@@ -92,6 +93,11 @@
 
     ////////////////////////////////////////////////////////
 
+    public boolean getHaveFigure() {
+        
+        File testfile = new File("/home/whalley/resource/" + getPaper().getSpiresId() + "/fig" + getFigureString() + ".png");
+        return testfile.exists();
+    }
 
 
     /** Default constructor. */
@@ -159,6 +165,18 @@
 	    }
 	    return tfpstring;
     }
+    public String getFigureString(){
+        StringBuffer s = new StringBuffer();
+        String figstring = null;
+	    for(String cr : getComments()){
+	        if(cr.startsWith("Location")){
+	           s.append(cr.substring(10).replaceAll(" ","")); 
+	           figstring = s.toString();
+		       break;
+	        }
+	    }
+	    return figstring;
+    }
 
 
     public String getDsReactionString(int n){


More information about the HepData-svn mailing list