00001 00002 // // 00003 // SourceFile.java // 00004 // // 00005 // experiment.source.SourceFile -- interface of all source file classes// 00006 // Last edited: January 29, 2001 at 12:21 // 00007 // // 00008 // (c) Copyright 2002 Rice University. All rights reserved. // 00009 // // 00011 00012 00013 00014 00015 package edu.rice.cs.hpc.data.experiment.source; 00016 00017 00018 import edu.rice.cs.hpc.data.experiment.source.EmptySourceFile; 00019 00020 import java.io.File; 00021 import java.io.InputStream; 00022 00023 00024 00025 00027 // INTERFACE SOURCE-FILE // 00029 00037 public interface SourceFile 00038 { 00039 00041 // PUBLIC CONSTANTS // 00043 00045 public static final SourceFile NONE = new EmptySourceFile(); 00046 00047 00048 00049 00051 // ACCESS TO CONTENTS // 00053 00054 public abstract int getFileID(); 00055 00056 00057 00058 /************************************************************************* 00059 * Returns the source file's user visible name. 00060 ************************************************************************/ 00061 00062 public abstract String getName(); 00063 00064 00065 00066 00067 /************************************************************************* 00068 * Returns the number of lines in the source file. 00069 ************************************************************************/ 00070 00071 public abstract int getLineCount(); 00072 00073 00074 00075 00076 /************************************************************************* 00077 * Returns an open input stream for reading the file's contents. 00078 ************************************************************************/ 00079 00080 public abstract InputStream getStream(); 00081 00082 00083 00084 00086 // AVAILABILITY OF SOURCE FILE CONTENTS // 00088 00089 00090 00091 00092 /************************************************************************* 00093 * Returns whether this source file can be located and read. 00094 ************************************************************************/ 00095 00096 public abstract boolean isAvailable(); 00097 00098 00099 00100 /************************************************************************* 00101 * Returns whether this source file has a line with the given line number. 00102 ************************************************************************/ 00103 00104 public abstract boolean hasLine(int lineNumber); 00105 00106 00107 00108 00109 public abstract File getFilename(); 00110 00111 00112 public abstract boolean isText(); 00113 00114 public abstract void setIsText(boolean bi); 00115 00116 } 00117 00118 00119 00120 00121 00122 00123 00124