Hepreac Class Reference

Collaboration diagram for Hepreac:

Collaboration graph
[legend]

List of all members.


Public Member Functions

String getPath ()
String getContextPath ()
String getTestPath ()
String getQueryParam (String param)
Paper getPaper ()
void setPaper (Paper p)
List< Paper > getPapers ()
Dataset getDataset ()
void setDataset (Dataset d)
SortedSet< Dataset > getDatasets ()
YAxis getYAxis ()
void setYAxis (YAxis y)
SortedSet< YAxis > getYAxes ()
String getFirstAuthorName ()
String getFirstExperimentName ()
String getFirstInformalName ()
String getFirstPublished ()
String getFirstPreprint ()
String getTitle ()
boolean isCkbx ()
void setCkbx (boolean ckbx)
Link getChart3 ()
XYIntervalSeries getDataSeries (YAxis yaxis)
StreamResponse onChart (final int width, final int height, final int numberRun, int number)

Detailed Description

Definition at line 50 of file Hepreac.java.


Member Function Documentation

String getPath (  ) 

Definition at line 59 of file Hepreac.java.

Referenced by Hepreac.getTestPath().

00059                            {
00060        return _reqGlobals.getRequest().getPath();
00061     }

String getContextPath (  ) 

Definition at line 62 of file Hepreac.java.

00062                                   {
00063        return _reqGlobals.getRequest().getContextPath();
00064     }

String getTestPath (  ) 

Definition at line 66 of file Hepreac.java.

References Hepreac.getPath().

00066                                {
00067         return getPath().substring(getPath().lastIndexOf("/")+1); 
00068     }    

String getQueryParam ( String  param  ) 

Definition at line 70 of file Hepreac.java.

00070                                              {
00071        return _reqGlobals.getRequest().getParameter(param);
00072     }

Paper getPaper (  ) 

Definition at line 77 of file Hepreac.java.

00077 { return _paper; }

void setPaper ( Paper  p  ) 

Definition at line 78 of file Hepreac.java.

00078 { _paper = p; }

List<Paper> getPapers (  ) 

Definition at line 80 of file Hepreac.java.

00080                                    {
00081         Query q = constructQuery();
00082         // execute the query and return the list of results
00083         return q.list();   
00084     }

Dataset getDataset (  ) 

Definition at line 88 of file Hepreac.java.

00088 { return _dataset; }

void setDataset ( Dataset  d  ) 

Definition at line 89 of file Hepreac.java.

00089 { _dataset = d; }

SortedSet<Dataset> getDatasets (  ) 

Definition at line 90 of file Hepreac.java.

00090                                             {
00091         return _paper.getDatasets();
00092     }

YAxis getYAxis (  ) 

Definition at line 96 of file Hepreac.java.

00096 { return _yaxis; }

void setYAxis ( YAxis  y  ) 

Definition at line 97 of file Hepreac.java.

00097 { _yaxis = y; }

SortedSet<YAxis> getYAxes (  ) 

Definition at line 98 of file Hepreac.java.

00098                                        {
00099         return _dataset.getYAxes();
00100     }

String getFirstAuthorName (  ) 

Definition at line 132 of file Hepreac.java.

00132                                      {
00133        ckbxs.put(0,false);
00134        int n = 0;
00135        String _firstauthor = "";
00136        for (String author : _paper.getAuthors()){
00137          n += 1;
00138          if(n == 1) {_firstauthor = author;}
00139        }
00140        String _refdate = "xx";
00141        for (Reference reference : _paper.getReferences()){
00142           _refdate = reference.getDate();
00143        }
00144         int _lref = _refdate.length();
00145        _firstauthor = _firstauthor + " " + _refdate.substring(_lref-2,_lref);
00146        return _firstauthor;
00147    }

String getFirstExperimentName (  ) 

Definition at line 149 of file Hepreac.java.

00149                                          {
00150        int n = 0;
00151        String _firstexperiment = "";
00152        for (Experiment experiment : _paper.getExperiments()){
00153            n += 1;
00154            if(n == 1) { _firstexperiment = experiment.getName();}
00155        }
00156        return _firstexperiment;
00157    }

String getFirstInformalName (  ) 

Definition at line 159 of file Hepreac.java.

00159                                       {
00160        int n = 0;
00161        String _firstinformal = "";
00162        for (Experiment experiment : _paper.getExperiments()){
00163            n += 1;
00164            if(n == 1) { _firstinformal = experiment.getInformalName();}
00165        }
00166        return _firstinformal;
00167    }

String getFirstPublished (  ) 

Definition at line 169 of file Hepreac.java.

00169                                     {
00170        int n = 0;
00171        String _firstpublished = "Not Published";
00172        for (Reference ref : _paper.getReferences()){
00173            String refdesc = ref.getDescription();
00174            if(ref.getType().equals("JOUR")){
00175                  n += 1;
00176                  if(n == 1) { _firstpublished = refdesc;}
00177            }
00178        }
00179        return _firstpublished;
00180    }

String getFirstPreprint (  ) 

Definition at line 182 of file Hepreac.java.

00182                                    {
00183        int n = 0;
00184        String _firstpreprint= "Not Known";
00185        System.out.println("number of references:" + _paper.getReferences().size());
00186        for (Reference ref : _paper.getReferences()){
00187            String refdesc = ref.getDescription();
00188            if(!ref.getType().equals("JOUR")){
00189                  n += 1;
00190                  if(n == 1) { _firstpreprint = refdesc;}
00191              
00192            }
00193        }
00194        return _firstpreprint;
00195    }

String getTitle (  ) 

Definition at line 198 of file Hepreac.java.

00198                           {
00199        return _paper.getTitle();
00200    }    

boolean isCkbx (  ) 

Definition at line 207 of file Hepreac.java.

00207                           { 
00208        _nloop += 1;
00209        if(_nloop > _maxmap){ _nloop=0;} 
00210        System.out.println("calling isCkbx" + _nloop); 
00211        return ckbxs.get(_nloop); 
00212     }

void setCkbx ( boolean  ckbx  ) 

Definition at line 213 of file Hepreac.java.

00213                                      {
00214        _nloop += 1;
00215        if(_nloop > _maxmap){ _nloop=0;} 
00216        ckbxs.put(_nloop,ckbx); 
00217        System.out.println("calling setCkbx" + _nloop); 
00218     }   

Link getChart3 (  ) 

Definition at line 232 of file Hepreac.java.

References Hepreac.getDataSeries().

00232                            {          
00233         if (numberRun > 10000) {
00234             numberRun=0;
00235         }
00236         numberRun +=1;
00237         XYIntervalSeries series1 = getDataSeries(_yaxis);
00238         seriesMap.put(numberRun,series1);
00239         xLabelMap.put(numberRun,_yaxis.getDataset().getXAxis(1).getHeader());
00240         yLabelMap.put(numberRun,_yaxis.getHeader());
00241        return _resources.createActionLink("chart", false, new Object[]{"400","400",numberRun,"1"});
00242     }

XYIntervalSeries getDataSeries ( YAxis  yaxis  ) 

Definition at line 245 of file Hepreac.java.

Referenced by Hepreac.getChart3().

00245                                                       {
00246         XAxis _xaxis =  yaxis.getDataset().getXAxis(1);
00247 //      System.out.println(_xaxis.toString());
00248         for (String comment : yaxis.getDataset().getComments()){
00249             System.out.println(comment);
00250             titlestring = comment;
00251         }
00252         XYIntervalSeries series = new  XYIntervalSeries("data1");
00253         for (int ip=1; ip<=yaxis.getPoints().size(); ip++){
00254             try{
00255             double y = yaxis.getPoint(ip).getValue();
00256             double eplus = 0.0;
00257             double eminus = 0.0;
00258             for (Uncertainty e : yaxis.getPoint(ip).getErrors()){
00259                if(e.getNormType() == ErrorNorm.PCT){
00260                  eplus = eplus + (y*e.getPlus()/100.0)*(y*e.getPlus()/100.0);
00261                  eminus = eminus + (y*e.getMinus()/100.0)*(y*e.getMinus()/100.0);
00262                } 
00263                else{
00264                  eplus = eplus + e.getPlus()*e.getPlus(); 
00265                  eminus = eminus - e.getMinus()*e.getMinus();
00266                }
00267             }
00268             eplus = Math.sqrt(eplus);
00269             eminus = Math.sqrt(eminus);
00270             double yhigh = y + eplus;
00271             double ylow = y - eplus;
00272             double x;
00273             double xhigh;
00274             double xlow;
00275             if(_xaxis.getBin(ip).getLowValue() != null  && _xaxis.getBin(ip).getHighValue() != null){
00276                 x = (_xaxis.getBin(ip).getLowValue()+_xaxis.getBin(ip).getHighValue())/2;
00277                 xlow =  _xaxis.getBin(ip).getLowValue();
00278                 xhigh =  _xaxis.getBin(ip).getHighValue();
00279             }
00280             else{
00281                 x = _xaxis.getBin(ip).getFocus();
00282                 xhigh = _xaxis.getBin(ip).getFocus();
00283                 xlow = _xaxis.getBin(ip).getFocus();
00284             }
00285             series.add(x,xlow,xhigh,y,ylow,yhigh);
00286             } catch(Exception e){}
00287         }
00288         return series;
00289     }

StreamResponse onChart ( final int  width,
final int  height,
final int  numberRun,
int  number 
)

Definition at line 292 of file Hepreac.java.

00292                                                                                                      {
00293  
00294         final XYIntervalSeriesCollection collection = new XYIntervalSeriesCollection();
00295         double xlow = 1000000.0;
00296         double xhigh = -1000000.0;
00297         double ylow = 1000000.0;
00298         double yhigh = -1000000.0;
00299         for (int n=0; n<number; n++){
00300             
00301             XYIntervalSeries series = (XYIntervalSeries) seriesMap.get(numberRun+n);
00302             int nitems = series.getItemCount();
00303             for (int nn=0; nn<nitems; nn++){
00304               if(series.getXLowValue(nn) < xlow){ xlow = series.getXLowValue(nn);};     
00305               if(series.getXHighValue(nn) > xhigh){ xhigh = series.getXHighValue(nn);};     
00306               if(series.getYLowValue(nn) < ylow){ ylow = series.getYLowValue(nn);};     
00307               if(series.getYHighValue(nn) > yhigh){ yhigh = series.getYHighValue(nn);};     
00308             }
00309             seriesMap.remove(numberRun+n);
00310             collection.addSeries(series);
00311         }
00312         xlow = xlow - 0.05*(xhigh-xlow);
00313         xhigh = xhigh + 0.05*(xhigh-xlow);
00314         ylow = ylow - 0.05*(yhigh-ylow);
00315         yhigh = yhigh + 0.05*(yhigh-ylow);
00316         if(xlow == xhigh){
00317               xlow = 0.90*xlow;
00318               xhigh= 1.10*xhigh;
00319         }
00320         IntervalXYDataset data1 = collection;
00321  
00322         final XYItemRenderer renderer1 = new XYErrorRenderer();
00323         final Range rangex = new Range(xlow,xhigh);
00324         final Range rangey = new Range(ylow,yhigh);
00325         final NumberAxis rangeAxisX = new NumberAxis();
00326         try {
00327               String xlabel = (String) xLabelMap.get(numberRun);
00328               rangeAxisX.setLabel(xlabel);
00329         } 
00330         catch(Exception e){          
00331            rangeAxisX.setLabel("xaxis label ?");
00332         }
00333         rangeAxisX.setRange(rangex);
00334 //        rangeAxisX.setAutoRangeIncludesZero(false);
00335         final NumberAxis rangeAxisY = new NumberAxis();
00336         try{
00337             String ylabel = (String) yLabelMap.get(numberRun);
00338             rangeAxisY.setLabel(ylabel);
00339         }
00340         catch (Exception e){
00341              rangeAxisY.setLabel("yaxis label ?");
00342        }
00343         rangeAxisY.setRange(rangey);
00344 //        final LogarithmicAxis rangeAxisY = new LogarithmicAxis(_yaxis.getHeader());
00345 //        rangeAxisY.setAllowNegativesFlag(true);
00346 //        rangeAxisY.setStrictValuesFlag(false);
00347 //        rangeAxisY.setAutoRangeNextLogFlag(true);
00348         final XYPlot subplot1 = new XYPlot(data1, rangeAxisX, rangeAxisY, renderer1);
00349         final TextTitle title = new TextTitle(titlestring);
00350         final JFreeChart chart = new JFreeChart(subplot1);
00351         chart.addSubtitle(title);
00352         return new StreamResponse(){
00353             public String getContentType(){
00354                 return "image/jpeg";
00355             }
00356             public InputStream getStream() throws IOException {
00357                 BufferedImage image  = chart.createBufferedImage(width, height);
00358                 ByteArrayOutputStream byteArray = new ByteArrayOutputStream() ;
00359                 ChartUtilities.writeBufferedImageAsJPEG(byteArray, image) ;
00360                 return new ByteArrayInputStream(byteArray.toByteArray());
00361             }
00362             public void prepareResponse(Response response){}
00363         };
00364     }


The documentation for this class was generated from the following file:


Generated on Tue Apr 21 15:55:05 2009 for HepData Web servlets by  doxygen 1.5.5