import java.io.*; import java.lang.*; class CheckMany { // Copyleft Harvey Greenberg, UW hgreen@u.washington.edu Feb 5 14:59:45 1997 // This class checks a number of ARC/INFO AAT files, making sure that no // pair of connected arcs have a different value for ELEV. // The results are written to stanard err. // It calls class Arccheck.java // The optinal first argument is the search directory. // The optional second argument is a string with which the coverage name begins // The default values are . and con, i.e. this will check every cover beginning // with the characters "con" in the current directory. // More precisely, it checks every aat.adf subdirectory of every directory // beginning with the specified characters. // Caveats: // Error handling is neither complete nor elegant // This class and class Arccheck assume a unix style "/" separator, which is // probably not portable. // This will recognize AAT files which are not stored as "aat.adf". // Class Arccheck assumes a specific item list for the arcs being checked. // This includes an 8-byte length, i.e. it assumes double precision. // This was compiled and checked under JDK Beta3 under Solaris. public static void main (String args[]) throws IOException { int nfiles; String searchdir,filefilter,filelist[]; String arglist[] = new String[2]; boolean searchstat; File mydir; FilenameFilter myfilter; System.out.println("CheckMany: version 1.0"); if (args.length < 1) searchdir = "."; else searchdir = args[0]; if (args.length < 2) filefilter = "con"; else filefilter = args[1]; mydir = new File(searchdir); myfilter = new StartsWithFilter(filefilter); filelist = mydir.list(myfilter); nfiles = filelist.length; for(int i=0;i < nfiles;i++){ /// System.out.println(filelist[i]); /// THIS DOES NOT WORK Arccheck(filelist[i],"ELEV"); arglist[0] = filelist[i]; arglist[1] = "ELEV"; Arccheck.acheck(arglist); } } // main } // This class is a simple FilenameFilter. It defines the required accept() // method to determine whether a specified file should be listed. A file // will be listed if it starts with the specified string. // This is adapted from part of ORA javanut example FileLister.java // it is a directory. class StartsWithFilter implements FilenameFilter { private String filestart; public StartsWithFilter(String filestart) { this.filestart = filestart; } public boolean accept(File dir, String name) { return ((name.startsWith(filestart)) && new File(dir, name + "/aat.adf").isFile()); } }