directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r656886 - in /directory: apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/ shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/
Date Thu, 15 May 2008 22:49:05 GMT
Author: elecharny
Date: Thu May 15 15:49:04 2008
New Revision: 656886

URL: http://svn.apache.org/viewvc?rev=656886&view=rev
Log:
o Javadoc addition
o Some warning removals

Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/ExpandingVisitor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizingVisitor.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AbstractExprNode.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AndNode.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ApproximateNode.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AssertionNode.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/BranchNode.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/BranchNormalizedVisitor.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/EqualityNode.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ExprNode.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ExtensibleNode.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/FilterVisitor.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/GreaterEqNode.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/LeafNode.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/LessEqNode.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/NotNode.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/OrNode.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/PresenceNode.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ScopeNode.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SimpleNode.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SubstringNode.java

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/ExpandingVisitor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/ExpandingVisitor.java?rev=656886&r1=656885&r2=656886&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/ExpandingVisitor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/ExpandingVisitor.java
Thu May 15 15:49:04 2008
@@ -52,6 +52,12 @@
     private final AttributeTypeRegistry attrRegistry;
 
 
+    /**
+     * 
+     * Creates a new instance of ExpandingVisitor.
+     *
+     * @param attrRegistry The AttributeType registry
+     */
     public ExpandingVisitor( AttributeTypeRegistry attrRegistry )
     {
         this.attrRegistry = attrRegistry;

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizingVisitor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizingVisitor.java?rev=656886&r1=656885&r2=656886&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizingVisitor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizingVisitor.java
Thu May 15 15:49:04 2008
@@ -20,6 +20,11 @@
 package org.apache.directory.server.core.normalization;
 
 
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.naming.NamingException;
+
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.entry.client.ClientBinaryValue;
@@ -41,11 +46,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.naming.NamingException;
-
-import java.util.ArrayList;
-import java.util.List;
-
 
 /**
  * A filter visitor which normalizes leaf node values as it visits them.  It also removes
@@ -67,7 +67,7 @@
 public class NormalizingVisitor implements FilterVisitor
 {
     /** logger used by this class */
-    private final static Logger log = LoggerFactory.getLogger( NormalizingVisitor.class );
+    private static final Logger log = LoggerFactory.getLogger( NormalizingVisitor.class );
 
     /** the name component normalizer used by this visitor */
     private final NameComponentNormalizer ncn;
@@ -76,6 +76,13 @@
     private final Registries registries;
 
 
+    /**
+     * 
+     * Creates a new instance of NormalizingVisitor.
+     *
+     * @param ncn The name component normalizer to use
+     * @param registries The global registries
+     */
     public NormalizingVisitor( NameComponentNormalizer ncn, Registries registries )
     {
         this.ncn = ncn;
@@ -85,13 +92,16 @@
 
     /**
      * A private method used to normalize a value
-     * @return
+     * 
+     * @param attribute The attribute's ID
+     * @param value The value to normalize
+     * @return the normalized value
      */
     private Value<?> normalizeValue( String attribute, Value<?> value )
     {
         try
         {
-            Value<?> normalized;
+            Value<?> normalized = null;
 
             AttributeType attributeType = registries.getAttributeTypeRegistry().lookup( attribute
);
 
@@ -137,6 +147,9 @@
     /**
      * Visit a PresenceNode. If the attribute exists, the node is returned, otherwise
      * null is returned.
+     * 
+     * @param node the node to visit
+     * @return The visited node
      */
     private ExprNode visitPresenceNode( PresenceNode node )
     {
@@ -160,6 +173,9 @@
      *  - EqualityNode
      *  - GreaterEqNode
      *  - LesserEqNode
+     *  
+     * @param node the node to visit
+     * @return the visited node
      */
     private ExprNode visitSimpleNode( SimpleNode node )
     {
@@ -196,6 +212,9 @@
      * null is returned. 
      * 
      * Normalizing substring value is pretty complex. It's not currently implemented...
+     * 
+     * @param node the node to visit
+     * @return the visited node
      */
     private ExprNode visitSubstringNode( SubstringNode node )
     {
@@ -291,6 +310,9 @@
      * null is returned. 
      * 
      * TODO implement the logic for ExtensibleNode
+     * 
+     * @param node the node to visit
+     * @return the visited node
      */
     private ExprNode visitExtensibleNode( ExtensibleNode node )
     {
@@ -312,6 +334,9 @@
      *  - AndNode
      *  - NotNode
      *  - OrNode
+     *  
+     * @param node the node to visit
+     * @return the visited node
      */
     private ExprNode visitBranchNode( BranchNode node )
     {
@@ -346,7 +371,7 @@
         else
         {
             // Manage AND and OR nodes.
-            BranchNode branchNode = ( BranchNode ) node;
+            BranchNode branchNode = node;
             List<ExprNode> children = node.getChildren();
 
             // For AND and OR, we may have more than one children.
@@ -409,6 +434,9 @@
      * 
      * The PresencNode is managed differently from other nodes, as it just check
      * for the attribute, not the value.
+     * 
+     * @param node the node to visit
+     * @return the visited node
      */
     public Object visit( ExprNode node )
     {

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AbstractExprNode.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AbstractExprNode.java?rev=656886&r1=656885&r2=656886&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AbstractExprNode.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AbstractExprNode.java
Thu May 15 15:49:04 2008
@@ -35,28 +35,106 @@
     /** The map of annotations */
     protected Map<String, Object> annotations;
 
+    /** The node type */
     protected final AssertionType assertionType;
     
     
     /**
      * Creates a node by setting abstract node type.
+     * 
+     * @param assertionType The node's type
      */
     protected AbstractExprNode( AssertionType assertionType )
     {
         this.assertionType = assertionType;
     }
-    
-    
+
+
     /**
      * @see ExprNode#getAssertionType()
+     * 
+     * @return the node's type
      */
     public AssertionType getAssertionType()
     {
         return assertionType;
     }
 
+
+    /**
+     * Tests to see if this node is a leaf or branch node.
+     * 
+     * @return true if the node is a leaf,false otherwise
+     */
+    public abstract boolean isLeaf();
+
     
     /**
+     * @see Object#equals(Object)
+     *@return <code>true</code> if both objects are equal 
+     */
+    public boolean equals( Object o )
+    {
+        // Shortcut for equals object
+        if ( this == o )
+        {
+            return true;
+        }
+        
+        if ( !( o instanceof AbstractExprNode ) )
+        {
+            return false;
+        }
+        
+        AbstractExprNode that = (AbstractExprNode)o;
+        
+        // Check the node type
+        if ( this.assertionType != that.assertionType )
+        {
+            return false;
+        }
+        
+        if ( annotations == null )
+        {
+            return that.annotations == null;
+        }
+        else if ( that.annotations == null )
+        {
+            return false;
+        }
+        
+        // Check all the annotation
+        for ( String key:annotations.keySet() )
+        {
+            if ( !that.annotations.containsKey( key ) )
+            {
+                return false;
+            }
+            
+            Object thisAnnotation = annotations.get( key ); 
+            Object thatAnnotation = that.annotations.get( key );
+            
+            if ( thisAnnotation == null )
+            {
+                if ( thatAnnotation != null )
+                {
+                    return false;
+                }
+            }
+            else
+            {
+                if ( !thisAnnotation.equals( thatAnnotation ) )
+                {
+                    return false;
+                }
+            }
+        }
+        
+        return true;
+    }
+
+
+    /**
      * @see Object#hashCode()
      * @return the instance's hash code 
      */
@@ -78,8 +156,11 @@
         return h;
     }
 
+
     /**
      * @see org.apache.directory.shared.ldap.filter.ExprNode#get(java.lang.Object)
+     * 
+     * @return the annotation value.
      */
     public Object get( Object key )
     {
@@ -106,7 +187,7 @@
         annotations.put( key, value );
     }
 
-    
+
     /**
      * Gets the annotations as a Map.
      * 
@@ -116,7 +197,21 @@
     {
         return annotations;
     }
-    
+
+
+    /**
+     * Default implementation for this method : just throw an exception.
+     * 
+     * @param buf the buffer to append to.
+     * @return The buffer in which the refinement has been appended
+     * @throws UnsupportedOperationException if this node isn't a part of a refinement.
+     */
+    public StringBuilder printRefinementToBuffer( StringBuilder buf )
+    {
+        throw new UnsupportedOperationException( "ScopeNode can't be part of a refinement"
);
+    }
+
+
     public String toString()
     {
         if ( ( null != getAnnotations() ) && getAnnotations().containsKey( "count"
) )

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AndNode.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AndNode.java?rev=656886&r1=656885&r2=656886&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AndNode.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AndNode.java
Thu May 15 15:49:04 2008
@@ -36,9 +36,9 @@
      * 
      * @param childList the child nodes under this branch node.
      */
-    public AndNode( List<ExprNode> children )
+    public AndNode( List<ExprNode> childList )
     {
-        super( children, AssertionType.AND );
+        super( childList, AssertionType.AND );
     }
 
 
@@ -97,8 +97,12 @@
     
     /**
      * @see ExprNode#printRefinementToBuffer(StringBuffer)
+     * 
+     * @param buf the buffer to append to.
+     * @return The buffer in which the refinement has been appended
+     * @throws UnsupportedOperationException if this node isn't a part of a refinement.
      */
-    public StringBuilder printRefinementToBuffer( StringBuilder buf ) throws UnsupportedOperationException
+    public StringBuilder printRefinementToBuffer( StringBuilder buf )
     {
         buf.append( "and: {" );
         boolean isFirst = true;
@@ -127,6 +131,7 @@
      * down.
      * 
      * @see java.lang.Object#toString()
+     * @return A string representing the AndNode
      */
     public String toString()
     {

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ApproximateNode.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ApproximateNode.java?rev=656886&r1=656885&r2=656886&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ApproximateNode.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ApproximateNode.java
Thu May 15 15:49:04 2008
@@ -41,18 +41,10 @@
     }
 
 
-    /**
-     * @see Object#hashCode()
-     * @return the instance's hash code 
-     */
-    public int hashCode()
-    {
-        return super.hashCode();
-    }
-
     
     /**
      * @see Object#toString()
+     * @return A string representing the AndNode
      */
     public String toString()
     {

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AssertionNode.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AssertionNode.java?rev=656886&r1=656885&r2=656886&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AssertionNode.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AssertionNode.java
Thu May 15 15:49:04 2008
@@ -95,6 +95,7 @@
      * Always returns true since an AssertionNode has no children.
      * 
      * @see org.apache.directory.shared.ldap.filter.ExprNode#isLeaf()
+     * @return true if the node is a leaf,false otherwise
      */
     public boolean isLeaf()
     {
@@ -103,15 +104,6 @@
 
 
     /**
-     * @see ExprNode#printRefinementToBuffer(StringBuffer)
-     */
-    public StringBuilder printRefinementToBuffer( StringBuilder buf ) throws UnsupportedOperationException
-    {
-        throw new UnsupportedOperationException( "AssertionNode can't be part of a refinement"
);
-    }
-
-
-    /**
      * @see Object#hashCode()
      * @return the instance's hash code 
      */
@@ -138,6 +130,7 @@
 
     /**
      * @see Object#toString
+     * @return A string representing the AndNode
      */
     public String toString()
     {

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/BranchNode.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/BranchNode.java?rev=656886&r1=656885&r2=656886&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/BranchNode.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/BranchNode.java
Thu May 15 15:49:04 2008
@@ -31,7 +31,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public abstract class BranchNode extends AbstractExprNode
+public class BranchNode extends AbstractExprNode
 {
     /** child node list for this branch node */
     protected List<ExprNode> children = null;
@@ -41,26 +41,29 @@
      * Creates a BranchNode using a logical operator and a list of children.
      * 
      * @param childList the child nodes under this branch node.
+     * @param assertionType the node's type
      */
-    public BranchNode( List<ExprNode> children, AssertionType assertionType )
+    protected BranchNode( List<ExprNode> childList, AssertionType assertionType )
     {
         super( assertionType );
 
-        if ( null == children )
+        if ( null == childList )
         {
             this.children = new ArrayList<ExprNode>( 2 );
         }
         else
         {
-            this.children = children;
+            this.children = childList;
         }
     }
 
 
     /**
      * Creates a BranchNode using a logical operator.
+     * 
+     * @param assertionType the node's type
      */
-    public BranchNode( AssertionType assertionType )
+    protected BranchNode( AssertionType assertionType )
     {
         this( null, assertionType );
     }
@@ -142,12 +145,14 @@
     /**
      * @see org.apache.directory.shared.ldap.filter.ExprNode#accept(
      *      org.apache.directory.shared.ldap.filter.FilterVisitor)
+     *      
+     * @return The modified element
      */
     public final Object accept( FilterVisitor visitor )
     {
         if ( visitor.isPrefix() )
         {
-            List<ExprNode> children = visitor.getOrder( this, this.children );
+            List<ExprNode> childrenList = visitor.getOrder( this, this.children );
             ExprNode result = null;
 
             if ( visitor.canVisit( this ) )
@@ -155,7 +160,7 @@
                 result = (ExprNode)visitor.visit( this );
             }
 
-            for ( ExprNode node:children )
+            for ( ExprNode node:childrenList )
             {
                 node.accept( visitor );
             }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/BranchNormalizedVisitor.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/BranchNormalizedVisitor.java?rev=656886&r1=656885&r2=656886&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/BranchNormalizedVisitor.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/BranchNormalizedVisitor.java
Thu May 15 15:49:04 2008
@@ -20,7 +20,6 @@
 package org.apache.directory.shared.ldap.filter;
 
 
-import java.io.IOException;
 import java.text.ParseException;
 import java.util.Comparator;
 import java.util.List;
@@ -119,12 +118,10 @@
      * @param filter
      *            the filter to normalize
      * @return the normalized version of the filter
-     * @throws java.io.IOException
-     *             if filter parser cannot be created
      * @throws java.text.ParseException
      *             if the filter is malformed
      */
-    public static String getNormalizedFilter( String filter ) throws IOException, ParseException
+    public static String getNormalizedFilter( String filter ) throws ParseException
     {
         ExprNode originalNode = FilterParser.parse( filter );
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/EqualityNode.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/EqualityNode.java?rev=656886&r1=656885&r2=656886&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/EqualityNode.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/EqualityNode.java
Thu May 15 15:49:04 2008
@@ -47,6 +47,7 @@
      * 
      * @param attribute the attribute name
      * @param value the value to test for
+     * @param assertionType The node's type
      */
     protected EqualityNode( String attribute, Value<?> value, AssertionType assertionType
)
     {
@@ -55,17 +56,8 @@
 
 
     /**
-     * @see Object#hashCode()
-     * @return the instance's hash code 
-     */
-    public int hashCode()
-    {
-        return super.hashCode();
-    }
-
-    
-    /**
      * @see Object#toString()
+     * @return A string representing the AndNode
      */
     public String toString()
     {

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ExprNode.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ExprNode.java?rev=656886&r1=656885&r2=656886&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ExprNode.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ExprNode.java
Thu May 15 15:49:04 2008
@@ -69,9 +69,10 @@
      * descendants in prefix notation to a buffer.
      * 
      * @param buf the buffer to append to.
+     * @return The buffer in which the refinement has been appended
      * @throws UnsupportedOperationException if this node isn't a part of a refinement.
      */
-    StringBuilder printRefinementToBuffer( StringBuilder buf ) throws UnsupportedOperationException;
+    StringBuilder printRefinementToBuffer( StringBuilder buf );
     
     
     /**

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ExtensibleNode.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ExtensibleNode.java?rev=656886&r1=656885&r2=656886&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ExtensibleNode.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ExtensibleNode.java
Thu May 15 15:49:04 2008
@@ -45,6 +45,8 @@
 
     /**
      * Creates a new emptyExtensibleNode object.
+     * 
+     * @param attribute The attribute's ID for this node
      */
     public ExtensibleNode( String attribute )
     {
@@ -127,6 +129,8 @@
 
     /**
      * Sets the matching rule id as an OID string.
+     * 
+     * @param matchingRuleId The maching rule ID
      */
     public void setMatchingRuleId( String matchingRuleId )
     {
@@ -154,6 +158,8 @@
 
     /**
      * Sets the value.
+     * 
+     * @param value the value
      */
     public final void setValue( String value)
     {
@@ -162,15 +168,6 @@
 
     
     /**
-     * @see ExprNode#printRefinementToBuffer(StringBuilder)
-     */
-    public StringBuilder printRefinementToBuffer( StringBuilder buf ) throws UnsupportedOperationException
-    {
-        throw new UnsupportedOperationException( "ExtensibleNode can't be part of a refinement"
);
-    }
-
-
-    /**
      * @see Object#hashCode()
      * @return the instance's hash code 
      */
@@ -189,6 +186,7 @@
 
     /**
      * @see java.lang.Object#toString()
+     * @return A string representing the AndNode
      */
     public String toString()
     {

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/FilterVisitor.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/FilterVisitor.java?rev=656886&r1=656885&r2=656886&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/FilterVisitor.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/FilterVisitor.java
Thu May 15 15:49:04 2008
@@ -49,6 +49,7 @@
      * Visits a filter expression AST using a specific visitation order.
      * 
      * @param node the node to visit
+     * @return node the resulting modified node
      */
     Object visit( ExprNode node );
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/GreaterEqNode.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/GreaterEqNode.java?rev=656886&r1=656885&r2=656886&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/GreaterEqNode.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/GreaterEqNode.java
Thu May 15 15:49:04 2008
@@ -44,17 +44,8 @@
 
 
     /**
-     * @see Object#hashCode()
-     * @return the instance's hash code 
-     */
-    public int hashCode()
-    {
-        return super.hashCode();
-    }
-
-
-    /**
      * @see Object#toString()
+     * @return A string representing the AndNode
      */
     public String toString()
     {

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/LeafNode.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/LeafNode.java?rev=656886&r1=656885&r2=656886&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/LeafNode.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/LeafNode.java
Thu May 15 15:49:04 2008
@@ -26,7 +26,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public abstract class LeafNode extends AbstractExprNode
+public class LeafNode extends AbstractExprNode
 {
     /** attribute on which this leaf is based */
     private String attribute;
@@ -36,7 +36,7 @@
      * Creates a leaf node.
      * 
      * @param attribute the attribute this node is based on
-     * @param type the type of this leaf node
+     * @param assertionType the type of this leaf node
      */
     protected LeafNode( String attribute, AssertionType assertionType )
     {
@@ -79,6 +79,26 @@
 
     
     /**
+     * @see org.apache.directory.shared.ldap.filter.ExprNode#accept(
+     *      org.apache.directory.shared.ldap.filter.FilterVisitor)
+     * 
+     * @param visitor the filter expression tree structure visitor
+     * @return The modified element
+     */
+    public final Object accept( FilterVisitor visitor )
+    {
+        if ( visitor.canVisit( this ) )
+        {
+            return visitor.visit( this );
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+
+    /**
      * @see Object#hashCode()
      * @return the instance's hash code 
      */
@@ -117,21 +137,4 @@
             
         return attribute.equals( ( ( LeafNode ) other ).getAttribute() );
     }
-
-
-    /**
-     * @see org.apache.directory.shared.ldap.filter.ExprNode#accept(
-     *      org.apache.directory.shared.ldap.filter.FilterVisitor)
-     */
-    public final Object accept( FilterVisitor visitor )
-    {
-        if ( visitor.canVisit( this ) )
-        {
-            return visitor.visit( this );
-        }
-        else
-        {
-            return null;
-        }
-    }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/LessEqNode.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/LessEqNode.java?rev=656886&r1=656885&r2=656886&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/LessEqNode.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/LessEqNode.java
Thu May 15 15:49:04 2008
@@ -44,17 +44,8 @@
 
 
     /**
-     * @see Object#hashCode()
-     * @return the instance's hash code 
-     */
-    public int hashCode()
-    {
-        return super.hashCode();
-    }
-
-
-    /**
      * @see Object#toString()
+     * @return A string representing the AndNode
      */
     public String toString()
     {

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/NotNode.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/NotNode.java?rev=656886&r1=656885&r2=656886&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/NotNode.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/NotNode.java
Thu May 15 15:49:04 2008
@@ -38,13 +38,13 @@
      * 
      * @param childList the child nodes under this branch node.
      */
-    public NotNode( List<ExprNode> children )
+    public NotNode( List<ExprNode> childList )
     {
         super( AssertionType.NOT );
-        
-        if ( this.children.size() > 1 )
+
+        if ( childList != null )
         {
-            throw new IllegalStateException( "Cannot add more than one element to a negation
node." );            
+            setChildren( childList );
         }
     }
 
@@ -64,9 +64,9 @@
      */
     public void addNode( ExprNode node )
     {
-        if ( children.size() >= 1 )
+        if ( ( children != null ) && ( children.size() >= 1 ) )
         {
-            throw new IllegalStateException( "Cannot add more than one element to a negation
node." );            
+            throw new IllegalStateException( "Cannot add more than one element to a negation
node." );
         }
         
         children.add( node );
@@ -92,16 +92,16 @@
     /**
      * Sets the list of children under this node.
      * 
-     * @param list the list of children to set.
+     * @param childList the list of children to set.
      */
-    public void setChildren( List<ExprNode> list )
+    public void setChildren( List<ExprNode> childList )
     {
-        if ( ( list != null ) && ( list.size() > 1 ) )
+        if ( ( childList != null ) && ( childList.size() > 1 ) )
         {
             throw new IllegalStateException( "Cannot add more than one element to a negation
node." );            
         }
 
-        children = list;
+        children = childList;
     }
 
     
@@ -151,8 +151,11 @@
 
     /**
      * @see ExprNode#printRefinementToBuffer(StringBuffer)
+     * 
+     * @return The buffer in which the refinement has been appended
+     * @throws UnsupportedOperationException if this node isn't a part of a refinement.
      */
-    public StringBuilder printRefinementToBuffer( StringBuilder buf ) throws UnsupportedOperationException
+    public StringBuilder printRefinementToBuffer( StringBuilder buf )
     {
         buf.append( "not: {" );
         boolean isFirst = true;
@@ -181,6 +184,7 @@
      * down.
      * 
      * @see java.lang.Object#toString()
+     * @return A string representing the AndNode
      */
     public String toString()
     {
@@ -194,17 +198,4 @@
         
         return buf.toString();
     }
-
-
-    /**
-     * @see Object#hashCode()
-     * @return the instance's hash code 
-     */
-    public int hashCode()
-    {
-        int hash = 37;
-        hash = hash*17 + AssertionType.NOT.hashCode();
-        hash = hash*17 + ( annotations == null ? 0 : annotations.hashCode() );
-        return hash;
-    }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/OrNode.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/OrNode.java?rev=656886&r1=656885&r2=656886&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/OrNode.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/OrNode.java
Thu May 15 15:49:04 2008
@@ -36,9 +36,9 @@
      * 
      * @param childList the child nodes under this branch node.
      */
-    public OrNode( List<ExprNode> children)
+    public OrNode( List<ExprNode> childList)
     {
-        super( children, AssertionType.OR );
+        super( childList, AssertionType.OR );
     }
 
 
@@ -99,8 +99,11 @@
 
     /**
      * @see ExprNode#printRefinementToBuffer(StringBuffer)
+     * 
+     * @return The buffer in which the refinement has been appended
+     * @throws UnsupportedOperationException if this node isn't a part of a refinement.
      */
-    public StringBuilder printRefinementToBuffer( StringBuilder buf ) throws UnsupportedOperationException
+    public StringBuilder printRefinementToBuffer( StringBuilder buf )
     {
         buf.append( "or: {" );
         boolean isFirst = true;
@@ -129,6 +132,7 @@
      * down.
      * 
      * @see java.lang.Object#toString()
+     * @return A string representing the AndNode
      */
     public String toString()
     {

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/PresenceNode.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/PresenceNode.java?rev=656886&r1=656885&r2=656886&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/PresenceNode.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/PresenceNode.java
Thu May 15 15:49:04 2008
@@ -42,6 +42,7 @@
 
     /**
      * @see java.lang.Object#toString()
+     * @return A string representing the AndNode
      */
     public String toString()
     {
@@ -55,13 +56,4 @@
         
         return buf.toString();
     }
-
-    
-    /**
-     * @see ExprNode#printRefinementToBuffer(StringBuilder)
-     */
-    public StringBuilder printRefinementToBuffer( StringBuilder buf ) throws UnsupportedOperationException
-    {
-        throw new UnsupportedOperationException( "PresenceNode can't be part of a refinement"
);
-    }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ScopeNode.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ScopeNode.java?rev=656886&r1=656885&r2=656886&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ScopeNode.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ScopeNode.java
Thu May 15 15:49:04 2008
@@ -64,6 +64,7 @@
      * Always returns true since a scope node has no children.
      * 
      * @see ExprNode#isLeaf()
+     * @return <code>true</code>
      */
     public boolean isLeaf()
     {
@@ -108,17 +109,11 @@
 
 
     /**
-     * @see ExprNode#printRefinementToBuffer(StringBuilder)
-     */
-    public StringBuilder printRefinementToBuffer( StringBuilder buf ) throws UnsupportedOperationException
-    {
-        throw new UnsupportedOperationException( "ScopeNode can't be part of a refinement"
);
-    }
-
-
-    /**
      * @see org.apache.directory.shared.ldap.filter.ExprNode#accept(
      *      org.apache.directory.shared.ldap.filter.FilterVisitor)
+     * 
+     * @param visitor the filter expression tree structure visitor
+     * @return The modified element
      */
     public Object accept( FilterVisitor visitor )
     {
@@ -131,7 +126,7 @@
             return null;
         }
     }
-    
+
 
     /**
      * @see Object#hashCode()
@@ -152,6 +147,7 @@
 
     /**
      * @see Object#toString()
+     * @return A string representing the AndNode
      */
     public String toString()
     {
@@ -178,6 +174,7 @@
 
             default:
                 buf.append( "UNKNOWN" );
+                break;
         }
         
         buf.append( ", '" );

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SimpleNode.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SimpleNode.java?rev=656886&r1=656885&r2=656886&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SimpleNode.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SimpleNode.java
Thu May 15 15:49:04 2008
@@ -30,14 +30,16 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Revision$
  */
-public abstract class SimpleNode extends LeafNode
+public class SimpleNode extends LeafNode
 {
     /** the value */
     protected Value<?> value;
 
-    /** Constants for comparisons */
-    public final static boolean EVAL_GREATER = true;
-    public final static boolean EVAL_LESSER = false;
+    /** Constants for comparisons : > */
+    public static final boolean EVAL_GREATER = true;
+    
+    /** Constants for comparisons : < */
+    public static final boolean EVAL_LESSER = false;
 
 
     /**
@@ -45,6 +47,7 @@
      * 
      * @param attribute the attribute name
      * @param value the value to test for
+     * @param assertionType the node's type
      */
     protected SimpleNode( String attribute, Value<?> value, AssertionType assertionType
)
     {
@@ -76,28 +79,11 @@
 
 
     /**
-     * @see org.apache.directory.shared.ldap.filter.ExprNode#printToBuffer(
-     *      java.lang.StringBuilder)
-     */
-    public StringBuilder printToBuffer( StringBuilder buf )
-    {
-        if ( ( null != getAnnotations() ) && getAnnotations().containsKey( "count"
) )
-        {
-            buf.append( ":[" );
-            buf.append( getAnnotations().get( "count" ).toString() );
-            buf.append( "] " );
-        }
-
-        buf.append( ')' );
-
-        return buf;
-    }
-
-
-    /**
      * @see ExprNode#printRefinementToBuffer(StringBuilder)
+     * @return The buffer in which the refinement has been appended
+     * @throws UnsupportedOperationException if this node isn't a part of a refinement.
      */
-    public StringBuilder printRefinementToBuffer( StringBuilder buf ) throws UnsupportedOperationException
+    public StringBuilder printRefinementToBuffer( StringBuilder buf )
     {
         if ( getAttribute() == null || !SchemaConstants.OBJECT_CLASS_AT.equalsIgnoreCase(
getAttribute() ) )
         {

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SubstringNode.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SubstringNode.java?rev=656886&r1=656885&r2=656886&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SubstringNode.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SubstringNode.java
Thu May 15 15:49:04 2008
@@ -70,8 +70,7 @@
      * Creates a new SubstringNode object without any value
      * 
      * @param attribute the name of the attribute to substring assert
-     * @param initialPattern the initial fragment
-     * @param finalPattern the final fragment
+     * @param attribute The attribute's ID
      */
     public SubstringNode( String attribute )
     {
@@ -177,9 +176,11 @@
      * Gets the compiled regular expression for the substring expression.
      * 
      * @return the equivalent compiled regular expression
-     * @throws RESyntaxException if the regular expression is invalid
+     * @param normalizer The normalizer to use for the substring expressions
+     * @exception NamingException If the substring can't be normalized
+     * @exception PatternSyntaxException If the regexp is invalid
      */
-    public final Pattern getRegex( Normalizer normalizer ) throws PatternSyntaxException,
NamingException
+    public final Pattern getRegex( Normalizer normalizer ) throws NamingException
     {
         if ( ( anyPattern != null ) && ( anyPattern.size() > 0 ) )
         {
@@ -257,6 +258,7 @@
 
     /**
      * @see java.lang.Object#toString()
+     * @return A string representing the AndNode
      */
     public String toString()
     {
@@ -293,13 +295,4 @@
         
         return buf.toString();
     }
-
-
-    /**
-     * @see ExprNode#printRefinementToBuffer(StringBuilder)
-     */
-    public StringBuilder printRefinementToBuffer( StringBuilder buf ) throws UnsupportedOperationException
-    {
-        throw new UnsupportedOperationException( "SubstringNode can't be part of a refinement"
);
-    }
 }



Mime
View raw message