AbstractBaseData.java

Go to the documentation of this file.
00001 package edu.rice.cs.hpc.data.experiment.extdata;
00002 
00003 import java.io.IOException;
00004 
00005 public abstract class AbstractBaseData implements IBaseData 
00006 {
00007     protected static final int SIZE_OF_END_OF_FILE_MARKER = 4;
00008     protected IFileDB baseDataFile;
00009     final int headerSize;
00010 
00011     public AbstractBaseData(String filename, int headerSize, int recordSz) throws IOException {
00012         baseDataFile = new FileDB2();
00013         baseDataFile.open(filename, headerSize, recordSz);
00014         this.headerSize = headerSize;
00015     }
00016     
00017     /*
00018      * (non-Javadoc)
00019      * @see edu.rice.cs.hpc.data.experiment.extdata.IBaseData#getOffsets()
00020      */
00021     public long[] getOffsets() {
00022         return baseDataFile.getOffsets();
00023     }
00024 
00025     /***
00026      * retrieve the start location of a rank in a database
00027      * @param rank
00028      * @return
00029      */
00030     public abstract long getMinLoc(int rank);
00031     
00032     /****
00033      * retrieve the end of file location of a rank
00034      * @param rank
00035      * @return
00036      */
00037     public abstract long getMaxLoc(int rank, int recordSize);
00038     
00039 
00040 
00041     /*
00042      * (non-Javadoc)
00043      * @see edu.rice.cs.hpc.data.experiment.extdata.IBaseData#getString(long)
00044      */
00045     public String getString(long position, long length) {
00046         try {
00047             return baseDataFile.getMasterBuffer().getString(position, length);
00048         } catch (IOException e) {
00049             // TODO Auto-generated catch block
00050             e.printStackTrace();
00051         }
00052         return null;
00053     }
00054 
00055     /*
00056      * (non-Javadoc)
00057      * @see edu.rice.cs.hpc.data.experiment.extdata.IBaseData#getLong(long)
00058      */
00059     public long getLong(long position) {
00060         try {
00061             return baseDataFile.getMasterBuffer().getLong(position);
00062         } catch (IOException e) {
00063             // TODO Auto-generated catch block
00064             e.printStackTrace();
00065         }
00066         return -1;
00067     }
00068 
00069     /*
00070      * (non-Javadoc)
00071      * @see edu.rice.cs.hpc.data.experiment.extdata.IBaseData#getInt(long)
00072      */
00073     public int getInt(long position) {
00074         try {
00075             return baseDataFile.getMasterBuffer().getInt(position);
00076         } catch (IOException e) {
00077             // TODO Auto-generated catch block
00078             e.printStackTrace();
00079         }
00080         return -1;
00081     }
00082 
00083     /*
00084      * (non-Javadoc)
00085      * @see edu.rice.cs.hpc.data.experiment.extdata.IBaseData#getDouble(long)
00086      */
00087     public double getDouble(long position) {
00088         try {
00089             return baseDataFile.getMasterBuffer().getDouble(position);
00090         } catch (IOException e) {
00091             // TODO Auto-generated catch block
00092             e.printStackTrace();
00093         }
00094         return -1;
00095     }
00096 
00097     /*
00098      * (non-Javadoc)
00099      * @see edu.rice.cs.hpc.data.experiment.extdata.IBaseData#getHeaderSize()
00100      */
00101     public int getHeaderSize() {
00102         return headerSize;
00103     }
00104 
00105 
00106     @Override
00107     public boolean isHybridRank() {
00108         return baseDataFile.getParallelismLevel() > 1;
00109     }
00110 
00111     /*
00112      * (non-Javadoc)
00113      * @see edu.rice.cs.hpc.data.experiment.extdata.IBaseData#dispose()
00114      */
00115     public void dispose() {
00116         this.baseDataFile.dispose();
00117     }
00118 }

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1