webwork/src/main/webwork/util SimpleTest.java,1.1,1.2

[email protected] Mon, 17 Nov 2003 16:20:52 -0800
Newsgroups gmane.comp.java.open-symphony.cvs
Message-ID <[email protected]>
Update of /cvsroot/opensymphony/webwork/src/main/webwork/util
In directory sc8-pr-cvs1:/tmp/cvs-serv15582/src/main/webwork/util

Modified Files:
	SimpleTest.java 
Log Message:
Fixed javadoc

Index: SimpleTest.java
===================================================================
RCS file: /cvsroot/opensymphony/webwork/src/main/webwork/util/SimpleTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- SimpleTest.java	16 Nov 2003 23:40:31 -0000	1.1
+++ SimpleTest.java	18 Nov 2003 00:20:50 -0000	1.2
@@ -29,7 +29,7 @@
  */
 public class SimpleTest
 {
-   private static Log log = LogFactory.getLog(SimpleTest.class);
+   private static final Log log = LogFactory.getLog(SimpleTest.class);
 
 	private static Map simpleTestMap = new ConcurrentReaderHashMap();
 
@@ -39,7 +39,7 @@
 	* this class to handle
 	*/
 	private static final SimpleTest COMPLEX_TEST = new SimpleTest();
-	
+
 	private static final Object NO_CONSTANT = new Object();
 
 	// The possible values for the operator
@@ -55,7 +55,7 @@
 	protected static final char NOT_CHAR = '!';
 	protected static final char GREATER_CHAR = '>';
 	protected static final char LESS_CHAR = '<';
-	
+
 	// The possible values for the condition
 	protected static final int CHECK_NULL = 0;
 	protected static final int EQUAL = 1;
@@ -64,9 +64,9 @@
 	protected static final int GREATER_EQUAL = 4;
 	protected static final int LESS = 5;
 	protected static final int LESS_EQUAL = 6;
-	
+
 	protected int condition;
-	
+
 	protected boolean neg1;
 	protected boolean neg2;
 	protected Query q1;
@@ -79,7 +79,7 @@
 	protected int operator = NONE;
 	protected int sameVal1;
 	protected int sameVal2;
-	
+
 	/**
 	* Get a SimpleTest object for the expression.
 	* If the expression is too complex then null is returned
@@ -122,13 +122,13 @@
 			simpleTestMap.put(expression, COMPLEX_TEST);
 			// Return null to show that no SimpleTest could be created
 			return null;
-		}		
+		}
 */
 	}
-	
+
 	public SimpleTest()
 	{}
-	
+
 	/**
 	* Create a SimpleTest for the expression exp, and make use of the values
 	* found in the previously evaluated expression prevText if possible
@@ -137,7 +137,7 @@
 	{
 		// First evaluate the expression exp
 		this(exp);
-		
+
 		// If the first expression is not a constant then
 		// check if it already exists in the previous test
 		if (value1 == NO_CONSTANT)
@@ -147,28 +147,28 @@
 			else if (exp1.equals(prevTest.exp2))
 				sameVal1 = 2;
 		}
-		
+
 		// If we have a second non constant expression check if it exists in the previous test
 		if (exp2 != null && value2 == NO_CONSTANT)
 		{
 			if (exp2.equals(prevTest.exp1))
 				sameVal2 = 1;
 			else if (exp2.equals(prevTest.exp2))
-				sameVal2 = 2;			
+				sameVal2 = 2;
 		}
 	}
-	
+
 	public SimpleTest(String exp) throws ComplexException
 	{
 		exp = exp.trim();
-		
+
 		String nextExp = null;
 
 		// Get the index of any && or || operators
 		// The method also check for conditions like == and != and
 		// if found, sets the exp1 and exp2 variables
 		int opIndex = checkOperator(exp);
-		
+
 		// If there is an operator it means that the expression consists of
 		// several expressions. Get the index of the next one
 		if (operator != NONE)
@@ -176,7 +176,7 @@
 			nextExp = exp.substring(opIndex+2).trim();
 			exp = exp.substring(0, opIndex).trim();
 		}
-		
+
 		if (condition == CHECK_NULL)
 		{
 			// The expression is only to check for null value
@@ -199,7 +199,7 @@
 	      // illegal expression
 		   if (exp1.charAt(0)=='!' || exp2.charAt(0)=='!')
 		   	throw new IllegalArgumentException("Invalid expression, misplaced \'!\' : " + exp);
-		      
+
 			// Check that expression does not start with (
 			if (exp1.charAt(0) == '(' || exp2.charAt(0) == '(')
 				throw new ComplexException("Expression too complex because it starts with ( : " + exp);
@@ -211,11 +211,11 @@
 			q1 = Query.getQuery(exp1);
 		if (condition != CHECK_NULL && value2 == NO_CONSTANT)
 			q2 = Query.getQuery(exp2);
-			
+
 		if (nextExp != null)
 			nextTest = new SimpleTest(this, nextExp);
 	}
-	
+
 	/**
 	* Look through the expression to find any operators like && or ||, <, > etc.
 	* If found then the operator variable is updated.
@@ -327,7 +327,7 @@
 			exp2 = exp2.trim();
 		return -1;
 	}
-	
+
 	/**
 	* This method checks if the expression is a constant value.
 	* If it is not a constant then the method returns the object NO_CONSTANT
@@ -338,7 +338,7 @@
 		Query q = Query.getQuery(exp);
 		QuerySegment[] segments = q.getSegments();
 		QuerySegment segment = segments[0];
-						
+
       switch (segment.getType())
       {
          case QuerySegment.STRING:
@@ -355,21 +355,21 @@
             // the reserved keyword "false"
          case QuerySegment.FALSE:
             return Boolean.FALSE;
-            
+
             // the reserved keyword "null"
          case QuerySegment.NULL:
          	return null;
-            
+
          default:
          	return NO_CONSTANT;
 		}
-	}		
+	}
 
 	public boolean test(ValueStack stack)
 	{
 		return test(stack, null, null);
 	}
-	
+
 	/**
 	* The values in prevVal1 and prevVal2 will always be sent in. They can be null
 	* because they are not used or because the value found was null. This does not matter.
@@ -380,7 +380,7 @@
 	{
 	   Object val1;
 	   Object val2 = null;
-		boolean result = false;	      	
+		boolean result = false;
 
 		// Check if the first expression is not a constant
 	   if (value1 == NO_CONSTANT)
@@ -399,13 +399,13 @@
 	   {
 	   	val1 = value1;
 	   }
-	      	
+
 	   if (condition == CHECK_NULL)
 	   {
 	      // No equals expression. Just check if the value is null or not
 	      result = (val1 == null ? false : true);
 	      if (neg1)
-	      	result = !result;	      	
+	      	result = !result;
 	   }
 	   // The expression contains a condition like == or !=
 	   else
@@ -432,13 +432,13 @@
             }
             else if (val2 == null) // greater than
             	comparison = 1;
-            
+
          }
          else if ( val1 instanceof Number && val2 instanceof Number )
          {
             double number1 = ((Number)val1).doubleValue();
             double number2 = ((Number)val2).doubleValue();
-				
+
 				if (number1 > number2)
 					comparison = 1;		// greater than
             else if ( number1 == number2 )
@@ -483,7 +483,7 @@
 					return nextTest.test(stack, val1, val2);
 			default:
 				return false;
-		}		
+		}
 	}
 
    /**
@@ -491,7 +491,7 @@
     * with the operator.
     *
     * @param   comp  the comparison result
-    * @param   operatr  the operator
+    * @param   condition  the condition
     * @return     the boolean result
     *
     */
@@ -527,7 +527,7 @@
          case NOT_EQUAL:
             return true;
       }
-      
+
       return false;
    }
 }




-------------------------------------------------------
This SF. Net email is sponsored by: GoToMyPC
GoToMyPC is the fast, easy and secure way to access your computer from
any Web browser or wireless device. Click here to Try it Free!
https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tmpl