commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r604783 [2/3] - in /commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath: ./ functions/ ri/ ri/axes/ ri/compiler/ ri/model/ ri/model/beans/ ri/model/container/ ri/model/dom/ ri/model/dynamic/ ri/model/jdom/ ri/parser/ servlet/ uti...
Date Mon, 17 Dec 2007 07:29:46 GMT
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreFunction.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreFunction.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreFunction.java Sun Dec 16 23:29:28 2007
@@ -50,7 +50,7 @@
      * @param functionCode int function code
      * @param args argument Expressions
      */
-    public CoreFunction(int functionCode, Expression args[]) {
+    public CoreFunction(int functionCode, Expression[] args) {
         super(args);
         this.functionCode = functionCode;
     }
@@ -127,8 +127,9 @@
                 return "key";
             case Compiler.FUNCTION_FORMAT_NUMBER:
                 return "format-number";
+            default:
+                return "unknownFunction" + functionCode + "()";
         }
-        return "unknownFunction" + functionCode + "()";
     }
 
     /**
@@ -170,6 +171,7 @@
      * Returns true if any argument is context dependent or if
      * the function is last(), position(), boolean(), local-name(),
      * name(), string(), lang(), number().
+     * @return boolean
      */
     public boolean computeContextDependent() {
         if (super.computeContextDependent()) {
@@ -209,12 +211,12 @@
             case Compiler.FUNCTION_CEILING:
             case Compiler.FUNCTION_ROUND:
                 return false;
-                
+
             case Compiler.FUNCTION_FORMAT_NUMBER:
-                return args != null && args.length == 2;                             
+                return args != null && args.length == 2;
+            default:
+                return false;
         }
-
-        return false;
     }
 
     /**
@@ -224,7 +226,7 @@
         StringBuffer buffer = new StringBuffer();
         buffer.append(getFunctionName());
         buffer.append('(');
-        Expression args[] = getArguments();
+        Expression[] args = getArguments();
         if (args != null) {
             for (int i = 0; i < args.length; i++) {
                 if (i > 0) {
@@ -309,8 +311,9 @@
                 return functionKey(context);
             case Compiler.FUNCTION_FORMAT_NUMBER :
                 return functionFormatNumber(context);
+            default:
+                return null;
         }
-        return null;
     }
 
     /**
@@ -420,7 +423,8 @@
             ec = (EvalContext) value;
             if (ec.hasNext()) {
                 value = ((NodePointer) ec.next()).getValue();
-            } else { // empty context -> empty results
+            }
+            else { // empty context -> empty results
                 return new NodeSetContext(context, new BasicNodeSet());
             }
         }
@@ -529,7 +533,7 @@
             assertArgCount(2);
         }
         StringBuffer buffer = new StringBuffer();
-        Expression args[] = getArguments();
+        Expression[] args = getArguments();
         for (int i = 0; i < args.length; i++) {
             buffer.append(InfoSetUtil.stringValue(args[i].compute(context)));
         }
@@ -669,19 +673,16 @@
     protected Object functionNormalizeSpace(EvalContext context) {
         assertArgCount(1);
         String s = InfoSetUtil.stringValue(getArg1().computeValue(context));
-        char chars[] = s.toCharArray();
+        char[] chars = s.toCharArray();
         int out = 0;
         int phase = 0;
         for (int in = 0; in < chars.length; in++) {
-            switch(chars[in]) {
-                case 0x20:
-                case 0x9:
-                case 0xD:
-                case 0xA:
-                    if (phase == 0) {      // beginning
-                        ;
-                    }
-                    else if (phase == 1) { // non-space
+            switch (chars[in]) {
+                case ' ':
+                case '\t':
+                case '\r':
+                case '\n':
+                    if (phase == 1) { // non-space
                         phase = 2;
                         chars[out++] = ' ';
                     }
@@ -707,7 +708,7 @@
         String s1 = InfoSetUtil.stringValue(getArg1().computeValue(context));
         String s2 = InfoSetUtil.stringValue(getArg2().computeValue(context));
         String s3 = InfoSetUtil.stringValue(getArg3().computeValue(context));
-        char chars[] = s1.toCharArray();
+        char[] chars = s1.toCharArray();
         int out = 0;
         for (int in = 0; in < chars.length; in++) {
             char c = chars[in];
@@ -891,7 +892,7 @@
             }
             symbols = new DecimalFormatSymbols(locale);
         }
-        
+
         DecimalFormat format = (DecimalFormat) NumberFormat.getInstance();
         format.setDecimalFormatSymbols(symbols);
         format.applyLocalizedPattern(pattern);

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperation.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperation.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperation.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperation.java Sun Dec 16 23:29:28 2007
@@ -26,7 +26,7 @@
  * @version $Revision$ $Date$
  */
 public abstract class CoreOperation extends Operation {
-        
+
     public CoreOperation(Expression args[]) {
         super(args);
     }
@@ -36,23 +36,23 @@
     }
 
     public abstract Object computeValue(EvalContext context);
-    
+
     /**
      * Returns the XPath symbol for this operation, e.g. "+", "div", etc.
      */
     public abstract String getSymbol();
-    
+
     /**
      * Returns true if the operation is not sensitive to the order of arguments,
      * e.g. "=", "and" etc, and false if it is, e.g. "&lt;=", "div".
      */
     protected abstract boolean isSymmetric();
-    
+
     /**
      * Computes the precedence of the operation.
      */
     protected abstract int getPrecedence();
-    
+
     public String toString() {
         if (args.length == 1) {
             return getSymbol() + parenthesize(args[0], false);
@@ -68,7 +68,7 @@
         }
         return buffer.toString();
     }
-    
+
     private String parenthesize(Expression expression, boolean left) {
         String s = expression.toString();
         if (!(expression instanceof CoreOperation)) {
@@ -83,5 +83,5 @@
             return s;
         }
         return '(' + s + ')';
-    }    
+    }
 }

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationAnd.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationAnd.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationAnd.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationAnd.java Sun Dec 16 23:29:28 2007
@@ -39,7 +39,7 @@
         }
         return Boolean.TRUE;
     }
-    
+
     protected int getPrecedence() {
         return 1;
     }
@@ -47,7 +47,7 @@
     protected boolean isSymmetric() {
         return true;
     }
-    
+
     public String getSymbol() {
         return "and";
     }

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationCompare.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationCompare.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationCompare.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationCompare.java Sun Dec 16 23:29:28 2007
@@ -63,7 +63,7 @@
     protected boolean equal(
         EvalContext context,
         Expression left,
-        Expression right) 
+        Expression right)
     {
         Object l = left.compute(context);
         Object r = right.compute(context);

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationDivide.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationDivide.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationDivide.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationDivide.java Sun Dec 16 23:29:28 2007
@@ -27,24 +27,41 @@
  */
 public class CoreOperationDivide extends CoreOperation {
 
+    /**
+     * Create a new CoreOperationDivide.
+     * @param arg1 dividend
+     * @param arg2 divisor
+     */
     public CoreOperationDivide(Expression arg1, Expression arg2) {
         super(new Expression[] { arg1, arg2 });
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public Object computeValue(EvalContext context) {
         double l = InfoSetUtil.doubleValue(args[0].computeValue(context));
         double r = InfoSetUtil.doubleValue(args[1].computeValue(context));
         return new Double(l / r);
     }
-    
+
+    /**
+     * {@inheritDoc}
+     */
     protected int getPrecedence() {
         return 5;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     protected boolean isSymmetric() {
         return false;
     }
-    
+
+    /**
+     * {@inheritDoc}
+     */
     public String getSymbol() {
         return "div";
     }

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationMod.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationMod.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationMod.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationMod.java Sun Dec 16 23:29:28 2007
@@ -27,24 +27,41 @@
  */
 public class CoreOperationMod extends CoreOperation {
 
+    /**
+     * Create a new CoreOperationMod.
+     * @param arg1 dividend
+     * @param arg2 divisor
+     */
     public CoreOperationMod(Expression arg1, Expression arg2) {
         super(new Expression[] { arg1, arg2 });
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public Object computeValue(EvalContext context) {
         long l = (long) InfoSetUtil.doubleValue(args[0].computeValue(context));
         long r = (long) InfoSetUtil.doubleValue(args[1].computeValue(context));
         return new Double(l % r);
     }
-    
+
+    /**
+     * {@inheritDoc}
+     */
     protected int getPrecedence() {
         return 5;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     protected boolean isSymmetric() {
         return false;
     }
-    
+
+    /**
+     * {@inheritDoc}
+     */
     public String getSymbol() {
         return "mod";
     }

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationMultiply.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationMultiply.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationMultiply.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationMultiply.java Sun Dec 16 23:29:28 2007
@@ -36,7 +36,7 @@
         double r = InfoSetUtil.doubleValue(args[1].computeValue(context));
         return new Double(l * r);
     }
-    
+
     protected int getPrecedence() {
         return 5;
     }
@@ -44,7 +44,7 @@
     protected boolean isSymmetric() {
         return true;
     }
-    
+
     public String getSymbol() {
         return "*";
     }

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationNegate.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationNegate.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationNegate.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationNegate.java Sun Dec 16 23:29:28 2007
@@ -27,23 +27,39 @@
  */
 public class CoreOperationNegate extends CoreOperation {
 
+    /**
+     * Create a new CoreOperationNegate.
+     * @param arg the Expression to negate
+     */
     public CoreOperationNegate(Expression arg) {
         super(new Expression[] { arg });
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public Object computeValue(EvalContext context) {
         double a = InfoSetUtil.doubleValue(args[0].computeValue(context));
         return new Double(-a);
     }
-    
+
+    /**
+     * {@inheritDoc}
+     */
     protected int getPrecedence() {
         return 6;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     protected boolean isSymmetric() {
         return false;
     }
-    
+
+    /**
+     * {@inheritDoc}
+     */
     public String getSymbol() {
         return "-";
     }

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationOr.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationOr.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationOr.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationOr.java Sun Dec 16 23:29:28 2007
@@ -27,10 +27,17 @@
  */
 public class CoreOperationOr extends CoreOperation {
 
+    /**
+     * Create a new CoreOperationOr.
+     * @param args or'd Expression components
+     */
     public CoreOperationOr(Expression[] args) {
         super(args);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public Object computeValue(EvalContext context) {
         for (int i = 0; i < args.length; i++) {
             if (InfoSetUtil.booleanValue(args[i].computeValue(context))) {
@@ -39,15 +46,24 @@
         }
         return Boolean.FALSE;
     }
-    
+
+    /**
+     * {@inheritDoc}
+     */
     protected int getPrecedence() {
         return 0;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     protected boolean isSymmetric() {
         return true;
     }
-    
+
+    /**
+     * {@inheritDoc}
+     */
     public String getSymbol() {
         return "or";
     }

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationSubtract.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationSubtract.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationSubtract.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationSubtract.java Sun Dec 16 23:29:28 2007
@@ -36,7 +36,7 @@
         double r = InfoSetUtil.doubleValue(args[1].computeValue(context));
         return new Double(l - r);
     }
-    
+
     protected int getPrecedence() {
         return 4;
     }
@@ -44,7 +44,7 @@
     protected boolean isSymmetric() {
         return false;
     }
-    
+
     public String getSymbol() {
         return "-";
     }

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationUnion.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationUnion.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationUnion.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationUnion.java Sun Dec 16 23:29:28 2007
@@ -44,7 +44,7 @@
         }
         return new UnionContext(context.getRootContext(), argCtxs);
     }
-    
+
     protected int getPrecedence() {
         return 7;
     }
@@ -52,7 +52,7 @@
     protected boolean isSymmetric() {
         return true;
     }
-    
+
     public String getSymbol() {
         return "|";
     }

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/Expression.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/Expression.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/Expression.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/Expression.java Sun Dec 16 23:29:28 2007
@@ -39,8 +39,13 @@
  */
 public abstract class Expression {
 
+    /** zero */
     protected static final Double ZERO = new Double(0);
+
+    /** one */
     protected static final Double ONE = new Double(1);
+
+    /** NaN */
     protected static final Double NOT_A_NUMBER = new Double(Double.NaN);
 
     private boolean contextDependencyKnown = false;
@@ -49,8 +54,9 @@
     /**
      * Returns true if this expression should be re-evaluated
      * each time the current position in the context changes.
+     * @return boolean
      */
-    public boolean isContextDependent() {
+    public synchronized boolean isContextDependent() {
         if (!contextDependencyKnown) {
             contextDependent = computeContextDependent();
             contextDependencyKnown = true;
@@ -60,16 +66,31 @@
 
     /**
      * Implemented by subclasses and result is cached by isContextDependent()
+     * @return calculated context-dependentness as boolean
      */
     public abstract boolean computeContextDependent();
 
     /**
      * Evaluates the expression. If the result is a node set, returns
      * the first element of the node set.
+     * @param context evaluation context
+     * @return Object
      */
     public abstract Object computeValue(EvalContext context);
+
+    /**
+     * Evaluates the expression. If the result is a node set, returns
+     * the first element of the node set.
+     * @param context evaluation context
+     * @return Object
+     */
     public abstract Object compute(EvalContext context);
 
+    /**
+     * Iterate over the values from the specified context.
+     * @param context evaluation context
+     * @return value Iterator
+     */
     public Iterator iterate(EvalContext context) {
         Object result = compute(context);
         if (result instanceof EvalContext) {
@@ -81,6 +102,11 @@
         return ValueUtils.iterate(result);
     }
 
+    /**
+     * Iterate over the pointers from the specified context.
+     * @param context evaluation context
+     * @return pointer Iterator
+     */
     public Iterator iteratePointers(EvalContext context) {
         Object result = compute(context);
         if (result == null) {
@@ -99,6 +125,9 @@
                 context.getRootContext().getCurrentNodePointer().getLocale());
     }
 
+    /**
+     * Pointer iterator
+     */
     public static class PointerIterator implements Iterator {
         private Iterator iterator;
         private QName qname;
@@ -106,6 +135,10 @@
 
         //to what method does the following comment refer?
         /**
+         * Create a new PointerIterator
+         * @param it underlying Iterator
+         * @param qname name
+         * @param locale Locale
          * @deprecated Use the method that takes a NamespaceManager
          */
         public PointerIterator(Iterator it, QName qname, Locale locale) {
@@ -114,36 +147,61 @@
             this.locale = locale;
         }
 
+        /**
+         * {@inheritDoc}
+         */
         public boolean hasNext() {
             return iterator.hasNext();
         }
 
+        /**
+         * {@inheritDoc}
+         */
         public Object next() {
             Object o = iterator.next();
             return o instanceof Pointer ? o : NodePointer.newNodePointer(qname, o, locale);
         }
 
+        /**
+         * Unsupported.
+         */
         public void remove() {
             throw new UnsupportedOperationException();
         }
     }
 
+    /**
+     * Value Iterator
+     */
     public static class ValueIterator implements Iterator {
         private Iterator iterator;
 
+        /**
+         * Create a new ValueIterator.
+         * @param it underlying Iterator, may contain pointers
+         */
         public ValueIterator(Iterator it) {
             this.iterator = it;
         }
 
+        /**
+         * {@inheritDoc}
+         */
         public boolean hasNext() {
             return iterator.hasNext();
         }
 
+        /**
+         * {@inheritDoc}
+         */
         public Object next() {
             Object o = iterator.next();
             return o instanceof Pointer ? ((Pointer) o).getValue() : o;
         }
 
+        /**
+         * Unsupported.
+         */
         public void remove() {
             throw new UnsupportedOperationException();
         }

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/ExpressionPath.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/ExpressionPath.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/ExpressionPath.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/ExpressionPath.java Sun Dec 16 23:29:28 2007
@@ -43,7 +43,7 @@
     public ExpressionPath(
         Expression expression,
         Expression[] predicates,
-        Step[] steps) 
+        Step[] steps)
     {
         super(steps);
         this.expression = expression;
@@ -135,12 +135,12 @@
      */
     protected Object expressionPath(
         EvalContext evalContext,
-        boolean firstMatch) 
+        boolean firstMatch)
     {
         Object value = expression.compute(evalContext);
         EvalContext context;
         if (value instanceof InitialContext) {
-            // This is an optimization. We can avoid iterating through a 
+            // This is an optimization. We can avoid iterating through a
             // collection if the context bean is in fact one.
             context = (InitialContext) value;
         }

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/ExtensionFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/ExtensionFunction.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/ExtensionFunction.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/ExtensionFunction.java Sun Dec 16 23:29:28 2007
@@ -36,11 +36,20 @@
 
     private QName functionName;
 
-    public ExtensionFunction(QName functionName, Expression args[]) {
+    /**
+     * Create a new ExtensionFunction.
+     * @param functionName name of the function
+     * @param args Expression[] of function args
+     */
+    public ExtensionFunction(QName functionName, Expression[] args) {
         super(args);
         this.functionName = functionName;
     }
 
+    /**
+     * Get the function name
+     * @return QName
+     */
     public QName getFunctionName() {
         return functionName;
     }
@@ -48,16 +57,20 @@
     /**
      * An extension function gets the current context, therefore it MAY be
      * context dependent.
+     * @return true
      */
     public boolean computeContextDependent() {
         return true;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         StringBuffer buffer = new StringBuffer();
         buffer.append(functionName);
         buffer.append('(');
-        Expression args[] = getArguments();
+        Expression[] args = getArguments();
         if (args != null) {
             for (int i = 0; i < args.length; i++) {
                 if (i > 0) {
@@ -69,11 +82,17 @@
         buffer.append(')');
         return buffer.toString();
     }
-    
+
+    /**
+     * {@inheritDoc}
+     */
     public Object compute(EvalContext context) {
         return computeValue(context);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public Object computeValue(EvalContext context) {
         Object[] parameters = null;
         if (args != null) {
@@ -93,8 +112,13 @@
         return result instanceof NodeSet ? new NodeSetContext(context,
                 (NodeSet) result) : result;
     }
-    
+
+    /**
+     * Convert any incoming context to a value.
+     * @param object Object to convert
+     * @return context value or <code>object</code> unscathed.
+     */
     private Object convert(Object object) {
         return object instanceof EvalContext ? ((EvalContext) object).getValue() : object;
-    }  
+    }
 }

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/NodeNameTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/NodeNameTest.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/NodeNameTest.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/NodeNameTest.java Sun Dec 16 23:29:28 2007
@@ -26,27 +26,51 @@
     private QName qname;
     private String namespaceURI;
 
+    /**
+     * Create a new NodeNameTest.
+     * @param qname name to match
+     */
     public NodeNameTest(QName qname) {
         this.qname = qname;
     }
-    
+
+    /**
+     * Create a new NodeNameTest.
+     * @param qname name to match
+     * @param namespaceURI uri to match
+     */
     public NodeNameTest(QName qname, String namespaceURI) {
         this.qname = qname;
         this.namespaceURI = namespaceURI;
     }
 
+    /**
+     * Get the node name.
+     * @return QName
+     */
     public QName getNodeName() {
         return qname;
     }
-    
+
+    /**
+     * Get the ns URI.
+     * @return String
+     */
     public String getNamespaceURI() {
         return namespaceURI;
     }
-    
+
+    /**
+     * Learn whether this is a wildcard test.
+     * @return <code>true</code> if the node name is "*".
+     */
     public boolean isWildcard() {
         return qname.getName().equals("*");
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return qname.toString();
     }

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/Path.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/Path.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/Path.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/Path.java Sun Dec 16 23:29:28 2007
@@ -44,14 +44,25 @@
     private boolean basicKnown = false;
     private boolean basic;
 
+    /**
+     * Create a new Path.
+     * @param steps that compose the Path
+     */
     public Path(Step[] steps) {
         this.steps = steps;
     }
 
+    /**
+     * Get the steps.
+     * @return Step[]
+     */
     public Step[] getSteps() {
         return steps;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean computeContextDependent() {
         if (steps != null) {
             for (int i = 0; i < steps.length; i++) {
@@ -64,9 +75,10 @@
     }
 
     /**
-     * Recognized  paths formatted as <code>foo/bar[3]/baz[@name = 'biz']
-     * </code>.  The evaluation of such "simple" paths is optimized and
+     * Recognizes paths formatted as <code>foo/bar[3]/baz[@name = 'biz']</code>.
+     * The evaluation of such "simple" paths is optimized and
      * streamlined.
+     * @return <code>true</code> if this path is simple
      */
     public synchronized boolean isSimplePath() {
         if (!basicKnown) {
@@ -74,7 +86,7 @@
             basic = true;
             Step[] steps = getSteps();
             for (int i = 0; i < steps.length; i++) {
-                if (!isSimpleStep(steps[i])){
+                if (!isSimpleStep(steps[i])) {
                     basic = false;
                     break;
                 }
@@ -85,8 +97,10 @@
 
     /**
      * A Step is "simple" if it takes one of these forms: ".", "/foo",
-     * "@bar", "/foo[3]". If there are predicates, they should be 
+     * "@bar", "/foo[3]". If there are predicates, they should be
      * context independent for the step to still be considered simple.
+     * @param step the step to check
+     * @return boolean
      */
     protected boolean isSimpleStep(Step step) {
         if (step.getAxis() == Compiler.AXIS_SELF) {
@@ -103,7 +117,7 @@
         if (step.getAxis() == Compiler.AXIS_CHILD
                 || step.getAxis() == Compiler.AXIS_ATTRIBUTE) {
             NodeTest nodeTest = step.getNodeTest();
-            if (!(nodeTest instanceof NodeNameTest)){
+            if (!(nodeTest instanceof NodeNameTest)) {
                 return false;
             }
             if (((NodeNameTest) nodeTest).isWildcard()) {
@@ -114,7 +128,12 @@
         return false;
     }
 
-    protected boolean areBasicPredicates(Expression predicates[]) {
+    /**
+     * Learn whether the elements of the specified array are "basic" predicates.
+     * @param predicates the Expression[] to check
+     * @return boolean
+     */
+    protected boolean areBasicPredicates(Expression[] predicates) {
         if (predicates != null && predicates.length != 0) {
             boolean firstIndex = true;
             for (int i = 0; i < predicates.length; i++) {
@@ -142,6 +161,8 @@
     /**
      * Given a root context, walks a path therefrom and finds the
      * pointer to the first element matching the path.
+     * @param context evaluation context
+     * @return Pointer
      */
     protected Pointer getSingleNodePointerForSteps(EvalContext context) {
         if (steps.length == 0) {
@@ -175,15 +196,17 @@
      * fails, chop off another step and repeat. If it finds more than one
      * location - return null.
      * </p>
+     * @param context evaluation context
+     * @return Pointer
      */
     private Pointer searchForPath(EvalContext context) {
         EvalContext ctx = buildContextChain(context, steps.length, true);
         Pointer pointer = ctx.getSingleNodePointer();
-        
+
         if (pointer != null) {
             return pointer;
         }
-        
+
         for (int i = steps.length; --i > 0;) {
             if (!isSimpleStep(steps[i])) {
                 return null;
@@ -211,16 +234,24 @@
     /**
      * Given a root context, walks a path therefrom and builds a context
      * that contains all nodes matching the path.
+     * @param context evaluation context
+     * @return EvaluationContext
      */
     protected EvalContext evalSteps(EvalContext context) {
         return buildContextChain(context, steps.length, false);
     }
 
+    /**
+     * Build a context from a chain of contexts.
+     * @param context evaluation context
+     * @param stepCount number of steps to descend
+     * @param createInitialContext whether to create the initial context
+     * @return created context
+     */
     private EvalContext buildContextChain(
             EvalContext context,
             int stepCount,
-            boolean createInitialContext) 
-    {
+            boolean createInitialContext) {
         if (createInitialContext) {
             context = new InitialContext(context);
         }
@@ -233,7 +264,7 @@
                     context,
                     steps[i].getAxis(),
                     steps[i].getNodeTest());
-            Expression predicates[] = steps[i].getPredicates();
+            Expression[] predicates = steps[i].getPredicates();
             if (predicates != null) {
                 for (int j = 0; j < predicates.length; j++) {
                     if (j != 0) {
@@ -245,22 +276,25 @@
         }
         return context;
     }
-    
+
     /**
      * Different axes are serviced by different contexts. This method
      * allocates the right context for the supplied step.
+     * @param context evaluation context
+     * @param axis code
+     * @param nodeTest node test
+     * @return EvalContext
      */
     protected EvalContext createContextForStep(
         EvalContext context,
         int axis,
-        NodeTest nodeTest) 
-    {
+        NodeTest nodeTest) {
         if (nodeTest instanceof NodeNameTest) {
             QName qname = ((NodeNameTest) nodeTest).getNodeName();
             String prefix = qname.getPrefix();
             if (prefix != null) {
                 String namespaceURI = context.getJXPathContext()
-                        .getNamespaceURI(prefix); 
+                        .getNamespaceURI(prefix);
                 nodeTest = new NodeNameTest(qname, namespaceURI);
             }
         }
@@ -292,7 +326,8 @@
             return new ChildContext(context, nodeTest, true, true);
         case Compiler.AXIS_SELF :
             return new SelfContext(context, nodeTest);
+        default:
+            return null; // Never happens
         }
-        return null; // Never happens
     }
 }

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/Step.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/Step.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/Step.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/Step.java Sun Dec 16 23:29:28 2007
@@ -27,24 +27,46 @@
     private NodeTest nodeTest;
     private Expression[] predicates;
 
+    /**
+     * Create a new Step.
+     * @param axis axis code
+     * @param nodeTest step test
+     * @param predicates predicate expressions
+     */
     protected Step(int axis, NodeTest nodeTest, Expression[] predicates) {
         this.axis = axis;
         this.nodeTest = nodeTest;
         this.predicates = predicates;
     }
 
+    /**
+     * Get the axis code.
+     * @return int
+     */
     public int getAxis() {
         return axis;
     }
 
+    /**
+     * Get the step test.
+     * @return NodeTest
+     */
     public NodeTest getNodeTest() {
         return nodeTest;
     }
 
+    /**
+     * Get the predicates.
+     * @return Expression[]
+     */
     public Expression[] getPredicates() {
         return predicates;
     }
 
+    /**
+     * Learn whether this step contains any predicate that is context dependent.
+     * @return boolean
+     */
     public boolean isContextDependent() {
         if (predicates != null) {
             for (int i = 0; i < predicates.length; i++) {
@@ -56,6 +78,9 @@
         return false;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         StringBuffer buffer = new StringBuffer();
         int axis = getAxis();
@@ -81,7 +106,7 @@
         else if (axis == Compiler.AXIS_DESCENDANT_OR_SELF
                 && nodeTest instanceof NodeTypeTest
                 && ((NodeTypeTest) nodeTest).getNodeType()
-                    == Compiler.NODE_TYPE_NODE 
+                    == Compiler.NODE_TYPE_NODE
                 && (predicates == null || predicates.length == 0)) {
             buffer.append("");
         }
@@ -101,6 +126,13 @@
         return buffer.toString();
     }
 
+    /**
+     * Decode an axis code to its name.
+     * @param axis int code
+     * @return String name.
+     * @see Compiler
+     * @see http://www.w3.org/TR/xpath#axes
+     */
     public static String axisToString(int axis) {
         switch (axis) {
             case Compiler.AXIS_SELF :
@@ -129,7 +161,8 @@
                 return "preceding-sibling";
             case Compiler.AXIS_DESCENDANT_OR_SELF :
                 return "descendant-or-self";
+            default:
+                return "UNKNOWN";
         }
-        return "UNKNOWN";
     }
 }

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/TreeCompiler.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/TreeCompiler.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/TreeCompiler.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/TreeCompiler.java Sun Dec 16 23:29:28 2007
@@ -128,7 +128,7 @@
     public Object expressionPath(
         Object expression,
         Object[] predicates,
-        Object[] steps) 
+        Object[] steps)
     {
         return new ExpressionPath(
             (Expression) expression,

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/NodePointer.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/NodePointer.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/NodePointer.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/NodePointer.java Sun Dec 16 23:29:28 2007
@@ -34,7 +34,7 @@
 
 /**
  * Common superclass for Pointers of all kinds.  A NodePointer maps to
- * a deterministic XPath that represents the location of a node in an 
+ * a deterministic XPath that represents the location of a node in an
  * object graph. This XPath uses only simple axes: child, namespace and
  * attribute and only simple, context-independent predicates.
  *
@@ -54,7 +54,7 @@
     private boolean attribute = false;
     private transient Object rootNode;
     private NamespaceResolver namespaceResolver;
-    
+
     /**
      * Allocates an entirely new NodePointer by iterating through all installed
      * NodePointerFactories until it finds one that can create a pointer.
@@ -62,14 +62,14 @@
     public static NodePointer newNodePointer(
         QName name,
         Object bean,
-        Locale locale) 
+        Locale locale)
     {
         NodePointer pointer = null;
         if (bean == null) {
             pointer = new NullPointer(name, locale);
             return pointer;
         }
-        
+
         NodePointerFactory[] factories =
             JXPathContextReferenceImpl.getNodePointerFactories();
         for (int i = 0; i < factories.length; i++) {
@@ -125,11 +125,11 @@
         }
         return namespaceResolver;
     }
-    
+
     public void setNamespaceResolver(NamespaceResolver namespaceResolver) {
         this.namespaceResolver = namespaceResolver;
     }
-    
+
     public NodePointer getParent() {
         NodePointer pointer = parent;
         while (pointer != null && pointer.isContainer()) {
@@ -137,7 +137,7 @@
         }
         return pointer;
     }
-    
+
     public NodePointer getImmediateParentPointer() {
         return parent;
     }
@@ -174,7 +174,7 @@
     public boolean isNode() {
         return !isContainer();
     }
-     
+
     /**
      * If true, this node is axiliary and can only be used as an intermediate in
      * the chain of pointers.
@@ -221,7 +221,7 @@
         if (valuePointer != this) {
             return valuePointer.getValue();
         }
-        // Default behavior is to return the same as getNode() 
+        // Default behavior is to return the same as getNode()
         return getNode();
     }
 
@@ -230,7 +230,7 @@
      * this method returns the pointer to the contents.
      * Only an auxiliary (non-node) pointer can (and should) return a
      * value pointer other than itself.
-     * Note that you probably don't want to override 
+     * Note that you probably don't want to override
      * <code>getValuePointer()</code> directly.  Override the
      * <code>getImmediateValuePointer()</code> method instead.  The
      * <code>getValuePointer()</code> method is calls
@@ -249,14 +249,14 @@
 
     /**
      * @see #getValuePointer()
-     * 
+     *
      * @return NodePointer is either <code>this</code> or a pointer
      *   for the immediately contained value.
      */
     public NodePointer getImmediateValuePointer() {
         return this;
     }
-    
+
     /**
      * An actual pointer points to an existing part of an object graph, even
      * if it is null. A non-actual pointer represents a part that does not exist
@@ -318,7 +318,7 @@
         }
         return rootNode;
     }
-    
+
     /**
      * Returns the object the pointer points to; does not convert it
      * to a "canonical" type.
@@ -362,7 +362,7 @@
             if (nodeName == null) {
                 return false;
             }
-            
+
             String testPrefix = testName.getPrefix();
             String nodePrefix = nodeName.getPrefix();
             if (!equalStrings(testPrefix, nodePrefix)) {
@@ -396,7 +396,7 @@
      *  set value.
      *  @param context the owning JXPathContext
      *  @param value the new value to set
-     *  @return created NodePointer 
+     *  @return created NodePointer
      */
     public NodePointer createPath(JXPathContext context, Object value) {
         setValue(value);
@@ -439,7 +439,7 @@
         JXPathContext context,
         QName name,
         int index,
-        Object value) 
+        Object value)
     {
         throw new JXPathException("Cannot create an object for path "
                 + asPath() + "/" + name + "[" + (index + 1) + "]"
@@ -462,7 +462,7 @@
                 + asPath() + "/" + name + "[" + (index + 1) + "]"
                 + ", operation is not allowed for this type of node");
     }
-    
+
     /**
      * Called to create a non-existing attribute
      * @param context the owning JXPathCOntext
@@ -505,23 +505,23 @@
 //     * Installs the supplied manager as the namespace manager for this node
 //     * pointer. The {@link #getNamespaceURI(String) getNamespaceURI(prefix)}
 //     * uses this manager to resolve namespace prefixes.
-//     * 
+//     *
 //     * @param namespaceManager
 //     */
 //    public void setNamespaceManager(NamespaceManager namespaceManager) {
 //        this.namespaceManager = namespaceManager;
 //    }
-//    
+//
 //    public NamespaceManager getNamespaceManager() {
 //        if (namespaceManager != null) {
 //            return namespaceManager;
 //        }
 //        if (parent != null) {
 //            return parent.getNamespaceManager();
-//        }        
+//        }
 //        return null;
 //    }
-//    
+//
     /**
      * Returns a NodeIterator that iterates over all children or all children
      * that match the given NodeTest, starting with the specified one.
@@ -533,7 +533,7 @@
     public NodeIterator childIterator(
         NodeTest test,
         boolean reverse,
-        NodePointer startWith) 
+        NodePointer startWith)
     {
         NodePointer valuePointer = getValuePointer();
         return valuePointer == null || valuePointer == this ? null
@@ -634,7 +634,7 @@
     public Pointer getPointerByKey(
         JXPathContext context,
         String key,
-        String value) 
+        String value)
     {
         return context.getPointerByKey(key, value);
     }
@@ -707,7 +707,7 @@
         return asPath();
     }
 
-    
+
     public int compareTo(Object object) {
         if (object == this) {
             return 0;
@@ -747,7 +747,7 @@
         NodePointer p1,
         int depth1,
         NodePointer p2,
-        int depth2) 
+        int depth2)
     {
         if (depth1 < depth2) {
             int r = compareNodePointers(p1, depth1, p2.parent, depth2 - 1);

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/VariablePointer.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/VariablePointer.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/VariablePointer.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/VariablePointer.java Sun Dec 16 23:29:28 2007
@@ -40,6 +40,11 @@
     private NodePointer valuePointer;
     private boolean actual;
 
+    /**
+     * Create a new VariablePointer.
+     * @param variables Variables instance
+     * @param name variable name
+     */
     public VariablePointer(Variables variables, QName name) {
         super(null);
         this.variables = variables;
@@ -47,43 +52,68 @@
         actual = true;
     }
 
+    /**
+     * Create a new (non-actual) VariablePointer.
+     * @param name variable name
+     */
     public VariablePointer(QName name) {
         super(null);
         this.name = name;
         actual = false;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean isContainer() {
         return true;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public QName getName() {
         return name;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public Object getBaseValue() {
         if (!actual) {
             throw new JXPathException("Undefined variable: " + name);
         }
         return variables.getVariable(name.toString());
     }
-    
+
+    /**
+     * {@inheritDoc}
+     */
     public boolean isLeaf() {
         Object value = getNode();
         return value == null || JXPathIntrospector.getBeanInfo(value.getClass()).isAtomic();
     }
-    
+
+    /**
+     * {@inheritDoc}
+     */
     public boolean isCollection() {
         Object value = getBaseValue();
         return value != null && ValueUtils.isCollection(value);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public Object getImmediateNode() {
         Object value = getBaseValue();
         return index == WHOLE_COLLECTION ? ValueUtils.getValue(value)
                 : ValueUtils.getValue(value, index);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public void setValue(Object value) {
         if (!actual) {
             throw new JXPathException("Cannot set undefined variable: " + name);
@@ -98,15 +128,24 @@
         }
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean isActual() {
         return actual;
     }
-    
+
+    /**
+     * {@inheritDoc}
+     */
     public void setIndex(int index) {
         super.setIndex(index);
         valuePointer = null;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public NodePointer getImmediateValuePointer() {
         if (valuePointer == null) {
             Object value = null;
@@ -126,7 +165,10 @@
         }
         return valuePointer;
     }
-    
+
+    /**
+     * {@inheritDoc}
+     */
     public int getLength() {
         if (actual) {
             Object value = getBaseValue();
@@ -135,6 +177,9 @@
         return 0;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public NodePointer createPath(JXPathContext context, Object value) {
         if (actual) {
             setValue(value);
@@ -145,6 +190,9 @@
         return ptr;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public NodePointer createPath(JXPathContext context) {
         if (!actual) {
             AbstractFactory factory = getAbstractFactory(context);
@@ -159,11 +207,13 @@
         return this;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public NodePointer createChild(
         JXPathContext context,
         QName name,
-        int index) 
-    {
+        int index) {
         Object collection = createCollection(context, index);
         if (!isActual() || (index != 0 && index != WHOLE_COLLECTION)) {
             AbstractFactory factory = getAbstractFactory(context);
@@ -185,12 +235,14 @@
         return this;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public NodePointer createChild(
             JXPathContext context,
-            QName name, 
+            QName name,
             int index,
-            Object value) 
-    {
+            Object value) {
         Object collection = createCollection(context, index);
         ValueUtils.setValue(collection, index, value);
         NodePointer cl = (NodePointer) clone();
@@ -198,6 +250,12 @@
         return cl;
     }
 
+    /**
+     * Create a collection.
+     * @param context JXPathContext
+     * @param index collection index
+     * @return Object
+     */
     private Object createCollection(JXPathContext context, int index) {
         createPath(context);
 
@@ -226,6 +284,9 @@
         return collection;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public void remove() {
         if (actual) {
             if (index == WHOLE_COLLECTION) {
@@ -246,6 +307,10 @@
         }
     }
 
+    /**
+     * Assimilate the Variables instance associated with the specified context.
+     * @param context JXPathContext to search
+     */
     protected void findVariables(JXPathContext context) {
         valuePointer = null;
         JXPathContext varCtx = context;
@@ -260,12 +325,18 @@
         }
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode() {
         return (actual ? System.identityHashCode(variables) : 0)
             + name.hashCode()
             + index;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals(Object object) {
         if (object == this) {
             return true;
@@ -281,6 +352,9 @@
             && index == other.index;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String asPath() {
         StringBuffer buffer = new StringBuffer();
         buffer.append('$');
@@ -298,30 +372,49 @@
         return buffer.toString();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public NodeIterator childIterator(
         NodeTest test,
         boolean reverse,
-        NodePointer startWith) 
-    {
+        NodePointer startWith) {
         return getValuePointer().childIterator(test, reverse, startWith);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public NodeIterator attributeIterator(QName name) {
         return getValuePointer().attributeIterator(name);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public NodeIterator namespaceIterator() {
         return getValuePointer().namespaceIterator();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public NodePointer namespacePointer(String name) {
         return getValuePointer().namespacePointer(name);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean testNode(NodeTest nodeTest) {
         return getValuePointer().testNode(nodeTest);
     }
 
+    /**
+     * Find the AbstractFactory, if any, associated with the specified context.
+     * @param context JXPathContext to search
+     * @return AbstractFactory
+     */
     private AbstractFactory getAbstractFactory(JXPathContext context) {
         AbstractFactory factory = context.getFactory();
         if (factory == null) {
@@ -332,10 +425,12 @@
         return factory;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int compareChildNodePointers(
         NodePointer pointer1,
-        NodePointer pointer2) 
-    {
+        NodePointer pointer2) {
         return pointer1.getIndex() - pointer2.getIndex();
     }
 }

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/VariablePointerFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/VariablePointerFactory.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/VariablePointerFactory.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/VariablePointerFactory.java Sun Dec 16 23:29:28 2007
@@ -43,7 +43,7 @@
 
         /**
          * Get the original (unwrapped) context.
-         * 
+         *
          * @return JXPathContext.
          */
         public JXPathContext getContext() {
@@ -62,7 +62,7 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.commons.jxpath.ri.model.NodePointerFactory#createNodePointer(org.apache.commons.jxpath.ri.QName,
      *      java.lang.Object, java.util.Locale)
      */
@@ -87,7 +87,7 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.commons.jxpath.ri.model.NodePointerFactory#createNodePointer(org.apache.commons.jxpath.ri.model.NodePointer,
      *      org.apache.commons.jxpath.ri.QName, java.lang.Object)
      */
@@ -98,7 +98,7 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.commons.jxpath.ri.model.NodePointerFactory#getOrder()
      */
     public int getOrder() {

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/BeanAttributeIterator.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/BeanAttributeIterator.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/BeanAttributeIterator.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/BeanAttributeIterator.java Sun Dec 16 23:29:28 2007
@@ -31,6 +31,11 @@
     private int position = 0;
     private boolean includeXmlLang;
 
+    /**
+     * Create a new BeanAttributeIterator.
+     * @param parent parent pointer
+     * @param name name of this bean
+     */
     public BeanAttributeIterator(PropertyOwnerPointer parent, QName name) {
         super(
             parent,
@@ -43,18 +48,27 @@
         this.parent = parent;
         includeXmlLang =
             (name.getPrefix() != null && name.getPrefix().equals("xml"))
-                && (name.getName().equals("lang") 
+                && (name.getName().equals("lang")
                 || name.getName().equals("*"));
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public NodePointer getNodePointer() {
         return includeXmlLang && position == 1 ? new LangAttributePointer(parent) : super.getNodePointer();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int getPosition() {
         return position;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean setPosition(int position) {
         this.position = position;
         if (includeXmlLang) {

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/BeanPointer.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/BeanPointer.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/BeanPointer.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/BeanPointer.java Sun Dec 16 23:29:28 2007
@@ -41,7 +41,7 @@
             QName name,
             Object bean,
             JXPathBeanInfo beanInfo,
-            Locale locale) 
+            Locale locale)
     {
         super(null, locale);
         this.name = name;
@@ -56,7 +56,7 @@
             NodePointer parent,
             QName name,
             Object bean,
-            JXPathBeanInfo beanInfo) 
+            JXPathBeanInfo beanInfo)
     {
         super(parent);
         this.name = name;

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/BeanPropertyPointer.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/BeanPropertyPointer.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/BeanPropertyPointer.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/BeanPropertyPointer.java Sun Dec 16 23:29:28 2007
@@ -75,7 +75,7 @@
      */
     public String[] getPropertyNames() {
         if (names == null) {
-            PropertyDescriptor pds[] = getPropertyDescriptors();
+            PropertyDescriptor[] pds = getPropertyDescriptors();
             names = new String[pds.length];
             for (int i = 0; i < names.length; i++) {
                 names[i] = pds[i].getName();
@@ -178,11 +178,11 @@
         if (pd == null) {
             return false;
         }
-        
+
         if (pd instanceof IndexedPropertyDescriptor) {
             return true;
         }
-        
+
         int hint = ValueUtils.getCollectionHint(pd.getPropertyType());
         if (hint == -1) {
             return false;
@@ -190,11 +190,11 @@
         if (hint == 1) {
             return true;
         }
-        
+
         Object value = getBaseValue();
         return value != null && ValueUtils.isCollection(value);
     }
-    
+
     /**
      * If the property contains a collection, then the length of that
      * collection, otherwise - 1.
@@ -205,20 +205,20 @@
         if (pd == null) {
             return 1;
         }
-        
+
         if (pd instanceof IndexedPropertyDescriptor) {
             return ValueUtils.getIndexedPropertyLength(
                 getBean(),
                 (IndexedPropertyDescriptor) pd);
         }
-        
+
         int hint = ValueUtils.getCollectionHint(pd.getPropertyType());
         if (hint == -1) {
             return 1;
         }
         return ValueUtils.getLength(getBaseValue());
     }
-    
+
     /**
      * If index == WHOLE_COLLECTION, change the value of the property, otherwise
      * change the value of the index'th element of the collection

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/CollectionAttributeNodeIterator.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/CollectionAttributeNodeIterator.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/CollectionAttributeNodeIterator.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/CollectionAttributeNodeIterator.java Sun Dec 16 23:29:28 2007
@@ -31,14 +31,21 @@
 
     private QName name;
 
+    /**
+     * Create a new CollectionAttributeNodeIterator.
+     * @param pointer collection pointer
+     * @param name attribute name
+     */
     public CollectionAttributeNodeIterator(
         CollectionPointer pointer,
-        QName name) 
-    {
+        QName name) {
         super(pointer, false, null);
         this.name = name;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     protected NodeIterator getElementNodeIterator(NodePointer elementPointer) {
         return elementPointer.attributeIterator(name);
     }

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/CollectionChildNodeIterator.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/CollectionChildNodeIterator.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/CollectionChildNodeIterator.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/CollectionChildNodeIterator.java Sun Dec 16 23:29:28 2007
@@ -31,16 +31,25 @@
 
     private NodeTest test;
 
+    /**
+     * Create a new CollectionChildNodeIterator.
+     * @param pointer CollectionPointer
+     * @param test child test
+     * @param reverse iteration order
+     * @param startWith starting pointer
+     */
     public CollectionChildNodeIterator(
         CollectionPointer pointer,
         NodeTest test,
         boolean reverse,
-        NodePointer startWith) 
-    {
+        NodePointer startWith) {
         super(pointer, reverse, startWith);
         this.test = test;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     protected NodeIterator getElementNodeIterator(NodePointer elementPointer) {
         return elementPointer.childIterator(test, false, null);
     }

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/CollectionNodeIterator.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/CollectionNodeIterator.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/CollectionNodeIterator.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/CollectionNodeIterator.java Sun Dec 16 23:29:28 2007
@@ -33,35 +33,48 @@
 public abstract class CollectionNodeIterator implements NodeIterator {
     private CollectionPointer pointer;
     private boolean reverse;
-    private NodePointer startWith; 
+    private NodePointer startWith;
     private int position;
     private List collection;
 
+    /**
+     * Create a new CollectionNodeIterator.
+     * @param pointer collection pointer
+     * @param reverse iteration order
+     * @param startWith starting pointer
+     */
     protected CollectionNodeIterator(
         CollectionPointer pointer,
         boolean reverse,
-        NodePointer startWith) 
-    {
+        NodePointer startWith) {
         this.pointer = pointer;
         this.reverse = reverse;
         this.startWith = startWith;
     }
-    
+
     /**
-     * Implemened by subclasses to produce child/attribute node iterators.
+     * Implemented by subclasses to produce child/attribute node iterators.
+     * @param elementPointer owning pointer
+     * @return NodeIterator
      */
-    protected abstract NodeIterator 
+    protected abstract NodeIterator
             getElementNodeIterator(NodePointer elementPointer);
 
+    /**
+     * {@inheritDoc}
+     */
     public int getPosition() {
         return position;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean setPosition(int position) {
         if (collection == null) {
             prepare();
         }
-        
+
         if (position < 1 || position > collection.size()) {
             return false;
         }
@@ -69,13 +82,19 @@
         return true;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public NodePointer getNodePointer() {
         if (position == 0) {
             return null;
         }
         return (NodePointer) collection.get(position - 1);
     }
-    
+
+    /**
+     * Prepare...
+     */
     private void prepare() {
         collection = new ArrayList();
         NodePointer ptr = (NodePointer) pointer.clone();

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/CollectionPointerFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/CollectionPointerFactory.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/CollectionPointerFactory.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/CollectionPointerFactory.java Sun Dec 16 23:29:28 2007
@@ -40,7 +40,7 @@
     public NodePointer createNodePointer(
         QName name,
         Object bean,
-        Locale locale) 
+        Locale locale)
     {
         return ValueUtils.isCollection(bean) ? new CollectionPointer(bean, locale) : null;
     }
@@ -48,7 +48,7 @@
     public NodePointer createNodePointer(
         NodePointer parent,
         QName name,
-        Object bean) 
+        Object bean)
     {
         return ValueUtils.isCollection(bean) ? new CollectionPointer(parent, bean) : null;
     }

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/NullElementPointer.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/NullElementPointer.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/NullElementPointer.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/NullElementPointer.java Sun Dec 16 23:29:28 2007
@@ -49,11 +49,11 @@
     public Object getImmediateNode() {
         return null;
     }
-    
+
     public boolean isLeaf() {
         return true;
-    }    
-    
+    }
+
     public boolean isCollection() {
         return false;
     }
@@ -82,7 +82,7 @@
     public NodePointer createPath(JXPathContext context) {
         return parent.createChild(context, null, index);
     }
-    
+
     public NodePointer createPath(JXPathContext context, Object value) {
         return parent.createChild(context, null, index, value);
     }
@@ -101,14 +101,14 @@
         }
 
         NullElementPointer other = (NullElementPointer) object;
-        return getImmediateParentPointer() == other.getImmediateParentPointer() 
+        return getImmediateParentPointer() == other.getImmediateParentPointer()
             && index == other.index;
     }
 
     public int getLength() {
         return 0;
     }
-    
+
     public String asPath() {
         StringBuffer buffer = new StringBuffer();
         NodePointer parent = getImmediateParentPointer();
@@ -122,8 +122,8 @@
             }
             else if (parent != null
                     && parent.getImmediateParentPointer() != null
-                    && parent.getImmediateParentPointer().getIndex() != 
-                            WHOLE_COLLECTION) 
+                    && parent.getImmediateParentPointer().getIndex() !=
+                            WHOLE_COLLECTION)
             {
                 buffer.append("/.");
             }
@@ -131,5 +131,5 @@
         }
 
         return buffer.toString();
-    }    
+    }
 }

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/NullPointer.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/NullPointer.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/NullPointer.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/NullPointer.java Sun Dec 16 23:29:28 2007
@@ -31,48 +31,81 @@
     private QName name;
     private String id;
 
+    /**
+     * Create a new NullPointer.
+     * @param name node name
+     * @param locale Locale
+     */
     public NullPointer(QName name, Locale locale) {
         super(null, locale);
         this.name = name;
     }
 
     /**
-     * Used for the root node
+     * Used for the root node.
+     * @param parent parent pointer
+     * @param name node name
      */
     public NullPointer(NodePointer parent, QName name) {
         super(parent);
         this.name = name;
     }
 
+    /**
+     * Create a new NullPointer.
+     * @param locale Locale
+     * @param id String
+     */
     public NullPointer(Locale locale, String id) {
         super(null, locale);
         this.id = id;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public QName getName() {
         return name;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public Object getBaseValue() {
         return null;
     }
-    
+
+    /**
+     * {@inheritDoc}
+     */
     public boolean isCollection() {
         return false;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean isLeaf() {
         return true;
-    }        
+    }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean isActual() {
         return false;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public PropertyPointer getPropertyPointer() {
         return new NullPropertyPointer(this);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public NodePointer createPath(JXPathContext context, Object value) {
         if (parent != null) {
             return parent.createPath(context, value).getValuePointer();
@@ -81,6 +114,9 @@
             "Cannot create the root object: " + asPath());
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public NodePointer createPath(JXPathContext context) {
         if (parent != null) {
             return parent.createPath(context).getValuePointer();
@@ -89,27 +125,37 @@
             "Cannot create the root object: " + asPath());
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public NodePointer createChild(
         JXPathContext context,
         QName name,
-        int index) 
-    {
+        int index) {
         return createPath(context).createChild(context, name, index);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public NodePointer createChild(
         JXPathContext context,
-        QName name, 
+        QName name,
         int index,
-        Object value) 
-    {
+        Object value) {
         return createPath(context).createChild(context, name, index, value);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode() {
         return name == null ? 0 : name.hashCode();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals(Object object) {
         if (object == this) {
             return true;
@@ -123,6 +169,9 @@
         return name == other.name || name != null && name.equals(other.name);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String asPath() {
         if (id != null) {
             return "id(" + id + ")";
@@ -130,6 +179,9 @@
         return parent == null ? "null()" : super.asPath();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int getLength() {
         return 0;
     }

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/NullPropertyPointer.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/NullPropertyPointer.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/NullPropertyPointer.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/NullPropertyPointer.java Sun Dec 16 23:29:28 2007
@@ -59,7 +59,7 @@
 
     public boolean isLeaf() {
         return true;
-    }    
+    }
 
     public NodePointer getValuePointer() {
         return new NullPointer(this,  new QName(getPropertyName()));
@@ -111,8 +111,8 @@
             throw createBadFactoryException(context.getFactory());
         }
         // Consider these two use cases:
-        // 1. The parent pointer of NullPropertyPointer is 
-        //    a PropertyOwnerPointer other than NullPointer. When we call 
+        // 1. The parent pointer of NullPropertyPointer is
+        //    a PropertyOwnerPointer other than NullPointer. When we call
         //    createPath on it, it most likely returns itself. We then
         //    take a PropertyPointer from it and get the PropertyPointer
         //    to expand the collection for the corresponding property.
@@ -120,8 +120,8 @@
         // 2. The parent pointer of NullPropertyPointer is a NullPointer.
         //    When we call createPath, it may return a PropertyOwnerPointer
         //    or it may return anything else, like a DOMNodePointer.
-        //    In the former case we need to do exactly what we did in use 
-        //    case 1.  In the latter case, we simply request that the 
+        //    In the former case we need to do exactly what we did in use
+        //    case 1.  In the latter case, we simply request that the
         //    non-property pointer expand the collection by itself.
         if (newParent instanceof PropertyOwnerPointer) {
             PropertyOwnerPointer pop = (PropertyOwnerPointer) newParent;
@@ -146,20 +146,20 @@
         }
         return newParent.createChild(context, getName(), index, value);
     }
-    
+
     public NodePointer createChild(
             JXPathContext context,
-            QName name, 
+            QName name,
             int index)
     {
         return createPath(context).createChild(context, name, index);
     }
-        
+
     public NodePointer createChild(
             JXPathContext context,
-            QName name, 
+            QName name,
             int index,
-            Object value) 
+            Object value)
     {
         return createPath(context).createChild(context, name, index, value);
     }

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/PropertyIterator.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/PropertyIterator.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/PropertyIterator.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/PropertyIterator.java Sun Dec 16 23:29:28 2007
@@ -39,12 +39,18 @@
 
     private boolean includeStart = false;
 
+    /**
+     * Create a new PropertyIterator.
+     * @param pointer owning pointer
+     * @param name property name
+     * @param reverse iteration order
+     * @param startWith beginning pointer
+     */
     public PropertyIterator(
         PropertyOwnerPointer pointer,
         String name,
         boolean reverse,
-        NodePointer startWith) 
-    {
+        NodePointer startWith) {
         propertyNodePointer =
             (PropertyPointer) pointer.getPropertyPointer().clone();
         this.name = name;
@@ -55,7 +61,7 @@
             this.startIndex = -1;
         }
         if (startWith != null) {
-            while (startWith != null 
+            while (startWith != null
                     && startWith.getImmediateParentPointer() != pointer) {
                 startWith = startWith.getImmediateParentPointer();
             }
@@ -77,15 +83,25 @@
         }
     }
 
+    /**
+     * Get the property pointer.
+     * @return NodePointer
+     */
     protected NodePointer getPropertyPointer() {
         return propertyNodePointer;
     }
 
+    /**
+     * Reset property iteration.
+     */
     public void reset() {
         position = 0;
         targetReady = false;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public NodePointer getNodePointer() {
         if (position == 0) {
             if (name != null) {
@@ -118,14 +134,25 @@
         }
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int getPosition() {
         return position;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean setPosition(int position) {
         return name == null ? setPositionAllProperties(position) : setPositionIndividualProperty(position);
     }
 
+    /**
+     * Set position for an individual property.
+     * @param position int position
+     * @return whether this was a valid position
+     */
     private boolean setPositionIndividualProperty(int position) {
         this.position = position;
         if (position < 1) {
@@ -168,6 +195,11 @@
         return true;
     }
 
+    /**
+     * Set position for all properties
+     * @param position int position
+     * @return whether this was a valid position
+     */
     private boolean setPositionAllProperties(int position) {
         this.position = position;
         if (position < 1) {
@@ -236,11 +268,15 @@
         return false;
     }
 
+    /**
+     * Prepare for an individual property.
+     * @param name property name
+     */
     protected void prepareForIndividualProperty(String name) {
         targetReady = true;
         empty = true;
 
-        String names[] = propertyNodePointer.getPropertyNames();
+        String[] names = propertyNodePointer.getPropertyNames();
         if (!reverse) {
             if (startPropertyIndex == PropertyPointer.UNSPECIFIED_PROPERTY) {
                 startPropertyIndex = 0;
@@ -282,7 +318,8 @@
     }
 
     /**
-     * Computes length for the current pointer - ignores any exceptions
+     * Computes length for the current pointer - ignores any exceptions.
+     * @return length
      */
     private int getLength() {
         int length;

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/PropertyOwnerPointer.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/PropertyOwnerPointer.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/PropertyOwnerPointer.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/PropertyOwnerPointer.java Sun Dec 16 23:29:28 2007
@@ -40,7 +40,7 @@
     public NodeIterator childIterator(
         NodeTest test,
         boolean reverse,
-        NodePointer startWith) 
+        NodePointer startWith)
     {
         if (test == null) {
             return createNodeIterator(null, reverse, startWith);
@@ -61,7 +61,7 @@
     public NodeIterator createNodeIterator(
                 String property,
                 boolean reverse,
-                NodePointer startWith) 
+                NodePointer startWith)
     {
         return new PropertyIterator(this, property, reverse, startWith);
     }
@@ -155,7 +155,7 @@
      * @return PropertyPointer
      */
     public abstract PropertyPointer getPropertyPointer();
-    
+
     /**
      * @return true if the property owner can set a property "does not exist".
      *         A good example is a Map. You can always assign a value to any
@@ -167,7 +167,7 @@
 
     public int compareChildNodePointers(
         NodePointer pointer1,
-        NodePointer pointer2) 
+        NodePointer pointer2)
     {
         int r = pointer1.getName().toString().compareTo(pointer2.getName().toString());
         return r == 0 ? pointer1.getIndex() - pointer2.getIndex() : r;

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/PropertyPointer.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/PropertyPointer.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/PropertyPointer.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/PropertyPointer.java Sun Dec 16 23:29:28 2007
@@ -289,7 +289,7 @@
     }
 
     /**
-     * Get the required AbstractFactory configured on the specified JXPathContext. 
+     * Get the required AbstractFactory configured on the specified JXPathContext.
      * @param context JXPathContext
      * @return AbstractFactory
      * @throws JXPathException if no factory configured.

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/container/ContainerPointer.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/container/ContainerPointer.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/container/ContainerPointer.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/container/ContainerPointer.java Sun Dec 16 23:29:28 2007
@@ -37,11 +37,21 @@
     private Container container;
     private NodePointer valuePointer;
 
+    /**
+     * Create a new ContainerPointer.
+     * @param container Container object
+     * @param locale Locale
+     */
     public ContainerPointer(Container container, Locale locale) {
         super(null, locale);
         this.container = container;
     }
 
+    /**
+     * Create a new ContainerPointer.
+     * @param parent parent pointer
+     * @param container Container object
+     */
     public ContainerPointer(NodePointer parent, Container container) {
         super(parent);
         this.container = container;
@@ -49,33 +59,52 @@
 
     /**
      * This type of node is auxiliary.
+     * @return <code>true</code>.
      */
     public boolean isContainer() {
         return true;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public QName getName() {
         return null;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public Object getBaseValue() {
         return container;
     }
-    
+
+    /**
+     * {@inheritDoc}
+     */
     public boolean isCollection() {
         Object value = getBaseValue();
         return value != null && ValueUtils.isCollection(value);
     }
-    
+
+    /**
+     * {@inheritDoc}
+     */
     public int getLength() {
         Object value = getBaseValue();
         return value == null ? 1 : ValueUtils.getLength(value);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean isLeaf() {
         return getValuePointer().isLeaf();
-    }    
+    }
 
+    /**
+     * {@inheritDoc}
+     */
     public Object getImmediateNode() {
         Object value = getBaseValue();
         if (index != WHOLE_COLLECTION) {
@@ -84,11 +113,17 @@
         return ValueUtils.getValue(value);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public void setValue(Object value) {
         // TODO: what if this is a collection?
         container.setValue(value);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public NodePointer getImmediateValuePointer() {
         if (valuePointer == null) {
             Object value = getImmediateNode();
@@ -97,10 +132,16 @@
         return valuePointer;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode() {
         return System.identityHashCode(container) + index;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals(Object object) {
         if (object == this) {
             return true;
@@ -114,41 +155,63 @@
         return container == other.container && index == other.index;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public NodeIterator childIterator(
         NodeTest test,
         boolean reverse,
-        NodePointer startWith) 
-    {
+        NodePointer startWith) {
         return getValuePointer().childIterator(test, reverse, startWith);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public NodeIterator attributeIterator(QName name) {
         return getValuePointer().attributeIterator(name);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public NodeIterator namespaceIterator() {
         return getValuePointer().namespaceIterator();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public NodePointer namespacePointer(String namespace) {
         return getValuePointer().namespacePointer(namespace);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean testNode(NodeTest nodeTest) {
         return getValuePointer().testNode(nodeTest);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int compareChildNodePointers(
         NodePointer pointer1,
-        NodePointer pointer2) 
-    {
+        NodePointer pointer2) {
         return pointer1.getIndex() - pointer2.getIndex();
     }
-    
+
+    /**
+     * {@inheritDoc}
+     */
     public String getNamespaceURI(String prefix) {
         return getValuePointer().getNamespaceURI(prefix);
     }
-    
+
+    /**
+     * {@inheritDoc}
+     */
     public String asPath() {
         return parent == null ? "/" : parent.asPath();
     }

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/container/ContainerPointerFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/container/ContainerPointerFactory.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/container/ContainerPointerFactory.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/container/ContainerPointerFactory.java Sun Dec 16 23:29:28 2007
@@ -40,7 +40,7 @@
     public NodePointer createNodePointer(
         QName name,
         Object bean,
-        Locale locale) 
+        Locale locale)
     {
         return bean instanceof Container ? new ContainerPointer((Container) bean, locale) : null;
     }
@@ -48,7 +48,7 @@
     public NodePointer createNodePointer(
         NodePointer parent,
         QName name,
-        Object bean) 
+        Object bean)
     {
         return bean instanceof Container ? new ContainerPointer(parent, (Container) bean) : null;
     }

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMAttributePointer.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMAttributePointer.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMAttributePointer.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMAttributePointer.java Sun Dec 16 23:29:28 2007
@@ -60,14 +60,14 @@
     public Object getBaseValue() {
         return attr;
     }
-    
+
     public boolean isCollection() {
         return false;
     }
-    
+
     public int getLength() {
         return 1;
-    }    
+    }
 
     public Object getImmediateNode() {
         return attr;
@@ -125,7 +125,7 @@
 
     public int compareChildNodePointers(
         NodePointer pointer1,
-        NodePointer pointer2) 
+        NodePointer pointer2)
     {
         // Won't happen - attributes don't have children
         return 0;



Mime
View raw message