Main Page | Packages | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

PaperBank Class Reference

List of all members.

Detailed Description

A container for lots of papers and plots.

Author:
J.Butterworth
Version:
Date
2007-01-12 18:57:03 +0000 (Fri, 12 Jan 2007)
Revision
1339

Definition at line 39 of file PaperBank.java.


Static Public Member Functions

Collection< PapergetPapers (String accelerator)
Collection< PapergetPapers (MCProcessType proc) throws JetWebException
Collection< PapergetPapers (Collision coll) throws JetWebException
Paper getPaper (DataPlot plot) throws JetWebException
Collection< PapergetPapers ()
Collection< RealPapergetRealPapers ()
int getNPapers ()
Collection< RealPlotgetAllPlots ()
Collection< RealPlotgetPlots (Collision coll) throws JetWebException
Collection< RealPlotgetPlots (MCProcessType proc) throws JetWebException
void getConfig () throws JetWebException
void mkdirs (File xmldir)
void rmdirs (File dir)
Paper getPaper (int id)
RealPlot getPlot (int plotId)

Static Private Attributes

Hashtable< Integer, Paperpapers
Hashtable< Integer, RealPaperrealPapers_
Hashtable< Integer, RealPlotplots = new Hashtable<IntegerRealPlot>()

Member Function Documentation

Collection<RealPlot> getAllPlots  )  [static]
 

Return a Collection containing all the plots of all the papers. Probably should use a Collection?

Returns:
Collection of RealPlot objects

Definition at line 118 of file PaperBank.java.

References PaperBank.plots.

00118                                                     {
00119     return plots.values();
00120     }

void getConfig  )  throws JetWebException [static]
 

Initialise the PaperBank database.

Exceptions:
JetWebException 

Definition at line 157 of file PaperBank.java.

References PaperBank.papers, PaperBank.plots, and PaperBank.realPapers_.

00157                                                           {
00158     if (papers.size()>0) {
00159         System.out.println("Already initialised paperBank");
00160         return;
00161     }
00162 
00163     for (Paper paper : DBPlotManager.getPapers()){
00164         papers.put(paper.getId(),paper);
00165         // Now fill the Hashtable of plots.
00166         for (DataPlot plot : paper.getPlots()){
00167         plots.put(new Integer(plot.getId()),(RealPlot)plot);
00168         }
00169     }
00170 
00171     for(RealPaper paper: DBPlotManager.getRealPapers()){
00172         realPapers_.put(paper.getId(), paper);
00173         for(RealPlot plot: paper.getPlots()){
00174         plots.put(new Integer(plot.getId()), plot);
00175         }
00176     }
00177 
00178     }

int getNPapers  )  [static]
 

Return the number of papers

Definition at line 109 of file PaperBank.java.

References PaperBank.papers.

00109                                   {
00110     return papers.size();
00111     }

Paper getPaper int  id  )  [static]
 

Return the Data Paper which matches any Paper sent (with Real or MC data).

Parameters:
paper to match
Returns:
matching real data paper

Definition at line 217 of file PaperBank.java.

References PaperBank.papers.

00217                                         {
00218     return papers.get(id);
00219     }

Paper getPaper DataPlot  plot  )  throws JetWebException [static]
 

Get the paper to which the plot belongs

Definition at line 85 of file PaperBank.java.

References PaperBank.papers.

00085                                                                        {
00086     for (Paper paper : papers.values()){
00087         if (paper.getPlots().contains(plot)) {
00088         return paper;       
00089         }
00090     }
00091     throw new JetWebException("PaperBank: no paper found for plot",plot.toString());
00092     }

Collection<Paper> getPapers  )  [static]
 

Return a Collection containing all the Papers.

Returns:
Collection of Paper objects

Definition at line 98 of file PaperBank.java.

References PaperBank.papers.

00098                                                {
00099     return papers.values();
00100     }

Collection<Paper> getPapers Collision  coll  )  throws JetWebException [static]
 

Get papers for a given collision

Definition at line 73 of file PaperBank.java.

References PaperBank.papers.

00073                                                                                      {
00074     Collection<Paper> cPapers = new Vector<Paper>();
00075     for (Paper paper : papers.values()){
00076         if (paper.containsDataFor(coll)) {
00077         cPapers.add(paper);
00078         }
00079     }
00080     return cPapers;
00081     }

Collection<Paper> getPapers MCProcessType  proc  )  throws JetWebException [static]
 

Get papers for a given processType

Definition at line 62 of file PaperBank.java.

References PaperBank.papers.

00062                                                                                          {
00063     Collection<Paper> procPapers = new Vector<Paper>();
00064     for (Paper paper : papers.values()){
00065         if (paper.containsDataFor(proc)) {
00066         procPapers.add(paper);
00067         }
00068     }
00069     return procPapers;
00070     }

Collection<Paper> getPapers String  accelerator  )  [static]
 

Get papers for a given accelerator

Definition at line 51 of file PaperBank.java.

References PaperBank.papers.

00051                                                                  {
00052     Collection<Paper> accPapers = new Vector<Paper>();
00053     for (Paper paper : papers.values()){
00054         if (paper.getAccelerator().equalsIgnoreCase(accelerator)) {
00055         accPapers.add(paper);
00056         }
00057     }
00058     return accPapers;
00059     }

RealPlot getPlot int  plotId  )  [static]
 

Return the RealPlot with the given Id.

Definition at line 224 of file PaperBank.java.

References PaperBank.plots.

00224                                               {
00225     return plots.get(plotId);
00226     }

Collection<RealPlot> getPlots MCProcessType  proc  )  throws JetWebException [static]
 

Return a Collection containing all the plots of all the papers which are relevant to proc.

Returns:
Collection of RealPlot objects

Definition at line 141 of file PaperBank.java.

References Paper.add(), and PaperBank.plots.

00141                                                                                            {
00142     Collection<RealPlot> list = new Vector<RealPlot>();
00143     for (RealPlot plot : plots.values()){
00144         if (plot.getMCProcessType().getId()==proc.getId()){
00145         list.add(plot);
00146         }
00147     }
00148     return list;
00149     }

Collection<RealPlot> getPlots Collision  coll  )  throws JetWebException [static]
 

Return a Collection containing all the plots of all the papers relevant to coll.

Returns:
Collection of RealPlot objects

Definition at line 126 of file PaperBank.java.

References Paper.add(), and PaperBank.plots.

00126                                                                                        {
00127     
00128     Collection<RealPlot> list = new Vector<RealPlot>();
00129     for (RealPlot plot : plots.values()){
00130         if (plot.getMCProcessType().getCollision().getId()==coll.getId()){
00131         list.add(plot);
00132         }
00133     }
00134     return list;
00135     }

Collection<RealPaper> getRealPapers  )  [static]
 

Definition at line 102 of file PaperBank.java.

References PaperBank.realPapers_.

00102                                                        {
00103     return realPapers_.values();
00104     }

void mkdirs File  xmldir  )  [static]
 

Make subdirectories for all papers in the directory specified

Parameters:
xmldir paper top directory

Definition at line 186 of file PaperBank.java.

References Paper.getDirName(), and PaperBank.papers.

00186                                           {
00187 
00188     if (!xmldir.isDirectory()) { return; }
00189     
00190     for (Paper p : papers.values()){
00191         String name = p.getDirName();       
00192         File dir = new File(xmldir.getPath()+"/"+name);     
00193         dir.mkdir();        
00194     }   
00195     }

void rmdirs File  dir  )  [static]
 

Delete subdirectories and contents of specified directory

Parameters:
xmldir directory

Definition at line 201 of file PaperBank.java.

00201                                        {
00202     try {
00203         FileUtils.deleteDirectory(dir);
00204     } catch (IOException e) {
00205         System.out.println(e);
00206     }
00207     }


Member Data Documentation

Hashtable<Integer,Paper> papers [static, private]
 

Initial value:

 
    new Hashtable<IntegerPaper>()

Definition at line 41 of file PaperBank.java.

Referenced by PaperBank.getConfig(), PaperBank.getNPapers(), PaperBank.getPaper(), PaperBank.getPapers(), and PaperBank.mkdirs().

Hashtable<Integer,RealPlot> plots = new Hashtable<IntegerRealPlot>() [static, private]
 

Definition at line 47 of file PaperBank.java.

Referenced by PaperBank.getAllPlots(), PaperBank.getConfig(), PaperBank.getPlot(), and PaperBank.getPlots().

Hashtable<Integer, RealPaper> realPapers_ [static, private]
 

Initial value:

 
    new Hashtable<Integer RealPaper>()

Definition at line 44 of file PaperBank.java.

Referenced by PaperBank.getConfig(), and PaperBank.getRealPapers().


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

Generated Wed Jan 17 09:14:27 GMT 2007