ImageTraceAttributes.java

Go to the documentation of this file.
00001 package edu.rice.cs.hpc.traceviewer.painter;
00002 
00003 import edu.rice.cs.hpc.traceviewer.spaceTimeData.Frame;
00004 import edu.rice.cs.hpc.traceviewer.spaceTimeData.Position;
00005 
00006 /***********
00007  * Struct class to store attributes of a trace view
00008  * 
00009  *
00010  */
00011 public class ImageTraceAttributes {
00012     
00013     private Frame frame;
00014     
00015     public int numPixelsH, numPixelsV;
00016     public int numPixelsDepthV;
00017 
00018     public ImageTraceAttributes()
00019     {
00020         frame = new Frame();
00021     }
00022     
00023     
00024     /*************************************************************************
00025      * Asserts the process bounds to make sure they're within the actual
00026      * bounds of the database, are integers, and adjusts the process zoom 
00027      * button accordingly.
00028      *************************************************************************/
00029     public void assertProcessBounds(int maxProcesses)
00030     {
00031         if (frame.begProcess < 0)
00032             frame.begProcess = 0;
00033         if (frame.endProcess > maxProcesses)
00034             frame.endProcess = maxProcesses;
00035     }
00036     
00037     /**************************************************************************
00038      * Asserts the time bounds to make sure they're within the actual
00039      * bounds of the database and adjusts the time zoom button accordingly.
00040      *************************************************************************/
00041     public void assertTimeBounds(long maxTime)
00042     {
00043         if (frame.begTime < 0)
00044             frame.begTime = 0;
00045         if (frame.endTime > maxTime)
00046             frame.endTime = maxTime;
00047     }
00048     
00049     
00050     public void setFrame(Frame frame)
00051     {
00052         this.frame = frame;
00053     }
00054     
00055     public Frame getFrame()
00056     {
00057         return frame;
00058     }
00059     
00060     public void setProcess(int p1, int p2)
00061     {
00062         frame.begProcess = p1;
00063         frame.endProcess = p2;
00064         
00065         frame.fixPosition();
00066     }
00067     
00068     public int getProcessBegin()
00069     {
00070         return frame.begProcess;
00071     }
00072     
00073     public int getProcessEnd()
00074     {
00075         return frame.endProcess;
00076     }
00077 
00078     public int getProcessInterval()
00079     {
00080         return (frame.endProcess - frame.begProcess);
00081     }
00082     
00083     public void setTime(long t1, long t2)
00084     {
00085         frame.begTime = t1;
00086         frame.endTime = t2;
00087     }
00088     
00089     public long getTimeBegin()
00090     {
00091         return frame.begTime;
00092     }
00093     
00094     public long getTimeEnd()
00095     {
00096         return frame.endTime;
00097     }
00098     
00099     public long getTimeInterval()
00100     {
00101         long dt = frame.endTime - frame.begTime;
00102         // make sure we have positive time interval, even if users selects 0 time
00103         if (dt>0)
00104             return (frame.endTime - frame.begTime);
00105         else
00106             return 1;
00107     }
00108     
00109     public boolean sameTrace(ImageTraceAttributes other)
00110     {
00111         return ( frame.begTime==other.frame.begTime && frame.endTime==other.frame.endTime &&
00112                 frame.begProcess==other.frame.begProcess && frame.endProcess==other.frame.endProcess &&
00113                  numPixelsH==other.numPixelsH && numPixelsV==other.numPixelsV);
00114     }
00115     
00116     public void setDepth(int depth)
00117     {
00118         frame.depth = depth;
00119     }
00120     
00121     public int getDepth()
00122     {
00123         return frame.depth;
00124     }
00125     
00126     public void setPosition(Position p)
00127     {
00128         frame.position = p;
00129     }
00130     
00131     public Position getPosition()
00132     {
00133         return frame.position;
00134     }
00135     
00136     /***
00137      * Check if two attribute instances have the same depth attribute
00138      * 
00139      * @param other
00140      * @return
00141      */
00142     public boolean sameDepth(ImageTraceAttributes other)
00143     {
00144         return ( frame.begTime==other.frame.begTime && frame.endTime==other.frame.endTime &&
00145                  numPixelsH==other.numPixelsH && numPixelsDepthV==other.numPixelsDepthV);
00146     }
00147     
00148     /***
00149      * Copy from another attribute
00150      * @param other
00151      */
00152     public void copy(ImageTraceAttributes other)
00153     {
00154         frame.begTime = other.frame.begTime;
00155         frame.endTime = other.frame.endTime;
00156         frame.begProcess = other.frame.begProcess;
00157         frame.endProcess = other.frame.endProcess;
00158         numPixelsH = other.numPixelsH;
00159         numPixelsV = other.numPixelsV;
00160         numPixelsDepthV = other.numPixelsDepthV;
00161     }
00162     
00163     public String toString()
00164     {
00165         return ("T [ " + frame.begTime + ","  + frame.endTime+ " ]" +
00166                 "P [ " + frame.begProcess + "," + frame.endProcess + " ]" + 
00167                 " PH: " + numPixelsH + " , PV: " + numPixelsV );
00168     }
00169 }

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1