001 package org.extendj.ast; 002 003 import java.util.HashSet; 004 import java.io.File; 005 import java.util.Set; 006 import java.util.Collections; 007 import java.util.Collection; 008 import java.util.ArrayList; 009 import beaver.*; 010 import java.util.*; 011 import java.io.ByteArrayOutputStream; 012 import java.io.PrintStream; 013 import java.lang.reflect.InvocationTargetException; 014 import java.lang.reflect.Method; 015 import org.jastadd.util.*; 016 import java.util.zip.*; 017 import java.io.*; 018 import org.jastadd.util.PrettyPrintable; 019 import org.jastadd.util.PrettyPrinter; 020 import java.io.FileNotFoundException; 021 import java.io.BufferedInputStream; 022 import java.io.DataInputStream; 023 /** 024 * @ast class 025 * @aspect PathPart 026 * @declaredat /home/jesper/git/extendj/java4/frontend/PathPart.jadd:590 027 */ 028 public class SourceFilePath extends PathPart { 029 030 private final String filePath; 031 032 033 034 public SourceFilePath(String path) { 035 super(true); 036 this.filePath = path; 037 } 038 039 040 041 @Override 042 public String getPath() { 043 return filePath; 044 } 045 046 047 048 /** 049 * <b>Use the parsed CompilationUnit to find the package name of the file! 050 */ 051 @Override 052 public boolean hasPackage(String name) { 053 return false; 054 } 055 056 057 058 @Override 059 public ClassSource findSource(String name) { 060 if (filePath.equals(name)) { 061 File file = new File(filePath); 062 if (file.isFile() && file.canRead()) { 063 return new FileClassSource(this, filePath); 064 } 065 } 066 return ClassSource.NONE; 067 } 068 069 070 071 @Override 072 public String toString() { 073 return filePath; 074 } 075 076 077 }