LineScope.java

Go to the documentation of this file.
00001 
00002 //                                                                      //
00003 //  LineScope.java                                                      //
00004 //                                                                      //
00005 //  experiment.scope.LineScope -- a single-line scope in an experiment  //
00006 //  Last edited: May 18, 2001 at 6:19 pm                                //
00007 //                                                                      //
00008 //  (c) Copyright 2001 Rice University. All rights reserved.            //
00009 //                                                                      //
00011 
00012 
00013 
00014 
00015 package edu.rice.cs.hpc.data.experiment.scope;
00016 
00017 import edu.rice.cs.hpc.data.experiment.BaseExperiment;
00018 import edu.rice.cs.hpc.data.experiment.scope.visitors.IScopeVisitor;
00019 import edu.rice.cs.hpc.data.experiment.source.SourceFile;
00020 
00021 
00022 
00023 
00025 //  CLASS LINE-SCOPE                                                    //
00027 
00035 public class LineScope extends Scope
00036 {
00037 
00038 
00039 
00040 
00042 //  INITIALIZATION                                                      //
00044 
00045 
00046 
00047 
00048 /*************************************************************************
00049  *  Creates a LineScope.
00050  ************************************************************************/
00051     
00052 public LineScope(BaseExperiment experiment, SourceFile sourceFile, int lineNumber, int cct_id, int flat_id)
00053 {
00054     super(experiment, sourceFile, lineNumber, lineNumber, cct_id, flat_id);
00055 //  this.id = "LineScope";
00056 }
00057 
00058 /*
00059 public LineScope(Experiment experiment, SourceFile sourceFile, int lineNumber)
00060 {
00061     super(experiment, sourceFile, lineNumber, lineNumber, Scope.idMax++);
00062 //  this.id = "LineScope";
00063 }*/
00064 
00065 
00066 
00068 //  SCOPE DISPLAY                                                       //
00070 
00071 
00072 
00073 
00074 
00075 /*************************************************************************
00076  *  Returns the user visible name for this loop scope.
00077  ************************************************************************/
00078     
00079 public String getName()
00080 {
00081     if (this.sourceFile==null) {
00082         return "unknown file:" + this.lastLineNumber;
00083     }
00084     return this.getSourceCitation();
00085 }
00086 /*
00087 public int hashCode() {
00088     return this.getName().hashCode();
00089 }
00090 */
00091 
00092 /*************************************************************************
00093  *  Returns the short user visible name for this scope.
00094  *
00095  *  This name is only used in tree views where the scope's name appears
00096  *  in context with its containing scope's name.
00097  *
00098  *  Subclasses may override this to implement better short names.
00099  *
00100  ************************************************************************/
00101     
00102 public String getShortName()
00103 {
00104     return this.getLineNumberCitation();
00105 }
00106 
00107 
00108 public boolean isequal(LineScope ls)
00109 {
00110     return ((this.firstLineNumber == ls.firstLineNumber) &&
00111         (this.lastLineNumber == ls.lastLineNumber) &&
00112         (this.sourceFile == ls.sourceFile));
00113 }
00114 
00116 //  ACCESS TO SCOPE                                                     //
00118 
00119 
00120 
00121 
00122 /*************************************************************************
00123  *  Returns the line number of this line scope.
00124  ************************************************************************/
00125     
00126 public int getLineNumber()
00127 {
00128     return this.firstLineNumber;
00129 }
00130 
00131 
00132 /*************************************************************************
00133  *  Return a duplicate of this line scope, 
00134  *  minus the tree information .
00135  ************************************************************************/
00136 
00137 public Scope duplicate() {
00138     LineScope duplicatedScope = 
00139         new LineScope(this.experiment, 
00140                 this.sourceFile, 
00141                 this.firstLineNumber,
00142                 getCCTIndex(), this.flat_node_index);
00143 
00144     return duplicatedScope;
00145 }
00146 
00148 //support for visitors                                                  //
00150 
00151 public void accept(IScopeVisitor visitor, ScopeVisitType vt) {
00152     visitor.visit(this, vt);
00153 }
00154 
00155 }
00156 
00157 
00158 
00159 
00160 
00161 
00162 
00163 

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1