Add classes for visitor traversal
[cql-java-moved-to-github.git] / src / main / java / org / z3950 / zing / cql / CQLGenerator.java
index 416b771..f03235d 100644 (file)
@@ -1,4 +1,3 @@
-// $Id: CQLGenerator.java,v 1.9 2007-07-03 15:41:35 mike Exp $
 
 package org.z3950.zing.cql;
 import java.util.Properties;
@@ -22,13 +21,12 @@ import java.io.FileNotFoundException;
  * this distribution - there is a <TT>generate_<I>x</I>()</TT> method
  * for each grammar element <I>X</I>.
  *
- * @version    $Id: CQLGenerator.java,v 1.9 2007-07-03 15:41:35 mike Exp $
  * @see                <A href="http://zing.z3950.org/cql/index.html"
  *                     >http://zing.z3950.org/cql/index.html</A>
  */
 public class CQLGenerator {
-    Properties params;
-    Random rnd;
+    private Properties params;
+    private Random rnd;
     static private boolean DEBUG = false;
 
     /**
@@ -198,7 +196,7 @@ public class CQLGenerator {
            return generate_numeric_relation();
        } else {
            switch (rnd.nextInt(3)) {
-           case 0: return "exact";
+           case 0: return "within";
            case 1: return "all";
            case 2: return "any";
            }
@@ -301,15 +299,12 @@ public class CQLGenerator {
 
        String configFile = args[0];
        InputStream f = new FileInputStream(configFile);
-       if (f == null)
-           throw new FileNotFoundException(configFile);
-
        Properties params = new Properties();
        params.load(f);
        f.close();
        for (int i = 1; i < args.length; i += 2)
            params.setProperty(args[i], args[i+1]);
-
+        
        CQLGenerator generator = new CQLGenerator(params);
        CQLNode tree = generator.generate();
        System.out.println(tree.toCQL());