📄 program.java
字号:
package AST;
import java.util.HashSet;import java.util.LinkedHashSet;import java.io.FileNotFoundException;import java.io.File;import java.util.*;import beaver.*;import java.util.ArrayList;import java.util.zip.*;import java.io.*;public class Program extends ASTNode<ASTNode> implements Cloneable {
public void flushCache() { super.flushCache(); typeObject_visited = -1; typeObject_computed = false; typeObject_value = null; typeCloneable_visited = -1; typeCloneable_computed = false; typeCloneable_value = null; typeSerializable_visited = -1; typeSerializable_computed = false; typeSerializable_value = null; typeBoolean_visited = -1; typeBoolean_computed = false; typeBoolean_value = null; typeByte_visited = -1; typeByte_computed = false; typeByte_value = null; typeShort_visited = -1; typeShort_computed = false; typeShort_value = null; typeChar_visited = -1; typeChar_computed = false; typeChar_value = null; typeInt_visited = -1; typeInt_computed = false; typeInt_value = null; typeLong_visited = -1; typeLong_computed = false; typeLong_value = null; typeFloat_visited = -1; typeFloat_computed = false; typeFloat_value = null; typeDouble_visited = -1; typeDouble_computed = false; typeDouble_value = null; typeString_visited = -1; typeString_computed = false; typeString_value = null; typeVoid_visited = -1; typeVoid_computed = false; typeVoid_value = null; typeNull_visited = -1; typeNull_computed = false; typeNull_value = null; unknownType_visited = -1; unknownType_computed = false; unknownType_value = null; hasPackage_String_visited = new java.util.HashMap(4); hasPackage_String_values = null; lookupType_String_String_visited = new java.util.HashMap(4); lookupType_String_String_values = null; unknownConstructor_visited = -1; unknownConstructor_computed = false; unknownConstructor_value = null; } @SuppressWarnings({"unchecked", "cast"}) public Program clone() throws CloneNotSupportedException { Program node = (Program)super.clone(); node.typeObject_visited = -1; node.typeObject_computed = false; node.typeObject_value = null; node.typeCloneable_visited = -1; node.typeCloneable_computed = false; node.typeCloneable_value = null; node.typeSerializable_visited = -1; node.typeSerializable_computed = false; node.typeSerializable_value = null; node.typeBoolean_visited = -1; node.typeBoolean_computed = false; node.typeBoolean_value = null; node.typeByte_visited = -1; node.typeByte_computed = false; node.typeByte_value = null; node.typeShort_visited = -1; node.typeShort_computed = false; node.typeShort_value = null; node.typeChar_visited = -1; node.typeChar_computed = false; node.typeChar_value = null; node.typeInt_visited = -1; node.typeInt_computed = false; node.typeInt_value = null; node.typeLong_visited = -1; node.typeLong_computed = false; node.typeLong_value = null; node.typeFloat_visited = -1; node.typeFloat_computed = false; node.typeFloat_value = null; node.typeDouble_visited = -1; node.typeDouble_computed = false; node.typeDouble_value = null; node.typeString_visited = -1; node.typeString_computed = false; node.typeString_value = null; node.typeVoid_visited = -1; node.typeVoid_computed = false; node.typeVoid_value = null; node.typeNull_visited = -1; node.typeNull_computed = false; node.typeNull_value = null; node.unknownType_visited = -1; node.unknownType_computed = false; node.unknownType_value = null; node.hasPackage_String_visited = new java.util.HashMap(4); node.hasPackage_String_values = null; node.lookupType_String_String_visited = new java.util.HashMap(4); node.lookupType_String_String_values = null; node.unknownConstructor_visited = -1; node.unknownConstructor_computed = false; node.unknownConstructor_value = null; node.in$Circle(false); node.is$Final(false); return node; } @SuppressWarnings({"unchecked", "cast"}) public Program copy() { try { Program node = (Program)clone(); if(children != null) node.children = (ASTNode[])children.clone(); return node; } catch (CloneNotSupportedException e) { } System.err.println("Error: Could not clone node of type " + getClass().getName() + "!"); return null; } @SuppressWarnings({"unchecked", "cast"}) public Program fullCopy() { Program res = (Program)copy(); for(int i = 0; i < getNumChildNoTransform(); i++) { ASTNode node = getChildNoTransform(i); if(node != null) node = node.fullCopy(); res.setChild(node, i); } return res; } // Declared in ClassPath.jrag at line 22 protected BytecodeReader bytecodeReader; // Declared in ClassPath.jrag at line 23 public void initBytecodeReader(BytecodeReader r) { bytecodeReader = r; } // Declared in ClassPath.jrag at line 24 protected JavaParser javaParser; // Declared in ClassPath.jrag at line 25 public void initJavaParser(JavaParser p) { javaParser = p; } // Declared in ClassPath.jrag at line 35 // add a filename to the list of source files to process public void addSourceFile(String name) { sourceFiles.addSourceFile(name); } // Declared in ClassPath.jrag at line 41 // iterate over all source files and demand-loaded compilation units public Iterator compilationUnitIterator() { initPaths(); return new Iterator() { int index = 0; public boolean hasNext() { return index < getNumCompilationUnit() || !sourceFiles.isEmpty(); } public Object next() { if(getNumCompilationUnit() == index) { String typename = (String)sourceFiles.keySet().iterator().next(); CompilationUnit u = getCompilationUnit(typename); if(u != null) { addCompilationUnit(u); getCompilationUnit(getNumCompilationUnit()-1); } else throw new Error("File " + typename + " not found"); } return getCompilationUnit(index++); } public void remove() { throw new UnsupportedOperationException(); } }; } // Declared in ClassPath.jrag at line 70 // get the input stream for a compilation unit specified using // a canonical name. This is used by the bytecode reader to load // nested types public InputStream getInputStream(String name) { initPaths(); try { for(Iterator iter = classPath.iterator(); iter.hasNext(); ) { PathPart part = (PathPart)iter.next(); if(part.selectCompilationUnit(name)) return part.is; } } catch(IOException e) { } throw new Error("Could not find nested type " + name); } // Declared in ClassPath.jrag at line 88 // load a compilation unit from disc using the following rules: // 1) specified on the command line // 2) class file not older than source file // 3) source file public CompilationUnit getCompilationUnit(String name) { initPaths(); try { if(sourceFiles.selectCompilationUnit(name)) return sourceFiles.getCompilationUnit(); PathPart sourcePart = null; PathPart classPart = null; for(Iterator iter = sourcePath.iterator(); iter.hasNext() && sourcePart == null; ) { PathPart part = (PathPart)iter.next(); if(part.selectCompilationUnit(name)) sourcePart = part; } for(Iterator iter = classPath.iterator(); iter.hasNext() && classPart == null; ) { PathPart part = (PathPart)iter.next(); if(part.selectCompilationUnit(name)) classPart = part; } if(sourcePart != null && (classPart == null || classPart.age <= sourcePart.age)) { CompilationUnit unit = sourcePart.getCompilationUnit(); int index = name.lastIndexOf('.'); if(index == -1) return unit; String pkgName = name.substring(0, index); if(pkgName.equals(unit.getPackageDecl())) return unit; } if(classPart != null) { CompilationUnit unit = classPart.getCompilationUnit(); int index = name.lastIndexOf('.'); if(index == -1) return unit; String pkgName = name.substring(0, index); if(pkgName.equals(unit.getPackageDecl())) return unit; } return null; } catch(IOException e) { } return null; } // Declared in ClassPath.jrag at line 132 // is there a package named name on the path public boolean isPackage(String name) { if(sourceFiles.hasPackage(name)) return true; for(Iterator iter = classPath.iterator(); iter.hasNext(); ) { PathPart part = (PathPart)iter.next(); if(part.hasPackage(name)) return true; } for(Iterator iter = sourcePath.iterator(); iter.hasNext(); ) { PathPart part = (PathPart)iter.next(); if(part.hasPackage(name)) return true; } return false; } // Declared in ClassPath.jrag at line 162 private boolean pathsInitialized = false; // Declared in ClassPath.jrag at line 163 private java.util.ArrayList classPath; // Declared in ClassPath.jrag at line 164 private java.util.ArrayList sourcePath; // Declared in ClassPath.jrag at line 165 private FileNamesPart sourceFiles = new FileNamesPart(this); // Declared in ClassPath.jrag at line 167 public void pushClassPath(String name) { PathPart part = PathPart.createSourcePath(name, this); if(part != null) { sourcePath.add(part); System.out.println("Pushing source path " + name); } else throw new Error("Could not push source path " + name); part = PathPart.createClassPath(name, this); if(part != null) { classPath.add(part); System.out.println("Pushing class path " + name); } } // Declared in ClassPath.jrag at line 181 public void popClassPath() { if(sourcePath.size() > 0) sourcePath.remove(sourcePath.size()-1); if(classPath.size() > 0) classPath.remove(classPath.size()-1); } // Declared in ClassPath.jrag at line 188 public void initPaths() { if(!pathsInitialized) { pathsInitialized = true; //System.err.println("Initializing class paths"); ArrayList classPaths = new ArrayList(); ArrayList sourcePaths = new ArrayList();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -