You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2007/09/14 22:15:03 UTC
svn commit: r575783 [3/4] - in /directory:
apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/
apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/
apacheds/trunk/core/src/main/java/org/apache/directory/server...
Added: 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=575783&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AndNode.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AndNode.java Fri Sep 14 13:14:59 2007
@@ -0,0 +1,275 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.shared.ldap.filter;
+
+
+import java.util.List;
+
+/**
+ * Node representing an AND connector in a filter operation
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 517453 $
+ */
+public class AndNode extends BranchNode
+{
+ /**
+ * Creates a AndNode using a logical operator and a list of children.
+ *
+ * @param childList the child nodes under this branch node.
+ */
+ public AndNode( List<ExprNode> children)
+ {
+ super( children );
+ }
+
+
+ /**
+ * Creates an empty AndNode
+ */
+ public AndNode()
+ {
+ this( null );
+ }
+
+
+ /**
+ * Gets the operator for this branch node.
+ *
+ * @return the operator constant.
+ */
+ public AssertionEnum getOperator()
+ {
+ return AssertionEnum.AND;
+ }
+
+
+ /**
+ * Tests whether or not this node is a disjunction (a OR'ed branch).
+ *
+ * @return true if the operation is a OR, false otherwise.
+ */
+ public boolean isDisjunction()
+ {
+ return false;
+ }
+
+
+ /**
+ * Tests whether or not this node is a conjunction (a AND'ed branch).
+ *
+ * @return true if the operation is a AND, false otherwise.
+ */
+ public boolean isConjunction()
+ {
+ return true;
+ }
+
+
+ /**
+ * Tests whether or not this node is a negation (a NOT'ed branch).
+ *
+ * @return true if the operation is a NOT, false otherwise.
+ */
+ public boolean isNegation()
+ {
+ return false;
+ }
+
+
+ /**
+ * Recursively prints the String representation of this node and all its
+ * descendents to a buffer.
+ *
+ * @see org.apache.directory.shared.ldap.filter.ExprNode#printToBuffer(java.lang.StringBuffer)
+ */
+ public StringBuilder printToBuffer( StringBuilder buf )
+ {
+ buf.append( "(&" );
+
+ for ( ExprNode node:children )
+ {
+ node.printToBuffer( buf );
+ }
+
+ buf.append( ')' );
+
+ if ( ( null != getAnnotations() ) && getAnnotations().containsKey( "count" ) )
+ {
+ buf.append( '[' );
+ buf.append( ( ( Long ) getAnnotations().get( "count" ) ).toString() );
+ buf.append( "] " );
+ }
+ else
+ {
+ buf.append( ' ' );
+ }
+
+ return buf;
+ }
+
+
+ /**
+ * @see ExprNode#printRefinementToBuffer(StringBuffer)
+ */
+ public StringBuilder printRefinementToBuffer( StringBuilder buf ) throws UnsupportedOperationException
+ {
+ buf.append( "and: {" );
+ boolean isFirst = true;
+
+ for ( ExprNode node:children )
+ {
+ if ( isFirst )
+ {
+ isFirst = false;
+ }
+ else
+ {
+ buf.append( ", " );
+ }
+
+ node.printRefinementToBuffer( buf );
+ }
+
+ buf.append( '}' );
+
+ return buf;
+ }
+
+ /**
+ * Gets the recursive prefix string represent of the filter from this node
+ * down.
+ *
+ * @see java.lang.Object#toString()
+ */
+ public String toString()
+ {
+ StringBuffer buf = new StringBuffer();
+ buf.append( "AND" );
+
+ if ( ( null != getAnnotations() ) && getAnnotations().containsKey( "count" ) )
+ {
+ buf.append( '[' );
+ buf.append( ( ( Long ) getAnnotations().get( "count" ) ) );
+ buf.append( "] " );
+ }
+ else
+ {
+ buf.append( ' ' );
+ }
+
+ return buf.toString();
+ }
+
+
+ /**
+ * @see org.apache.directory.shared.ldap.filter.ExprNode#accept(
+ * org.apache.directory.shared.ldap.filter.FilterVisitor)
+ */
+ public void accept( FilterVisitor visitor )
+ {
+ if ( visitor.isPrefix() )
+ {
+ List<ExprNode> children = visitor.getOrder( this, this.children );
+
+ if ( visitor.canVisit( this ) )
+ {
+ visitor.visit( this );
+ }
+
+ for ( ExprNode node:children )
+ {
+ node.accept( visitor );
+ }
+ }
+ else
+ {
+ List<ExprNode> children = visitor.getOrder( this, this.children );
+
+ for ( ExprNode node:children )
+ {
+ node.accept( visitor );
+ }
+
+ if ( visitor.canVisit( this ) )
+ {
+ visitor.visit( this );
+ }
+ }
+ }
+
+ /**
+ * @see Object#hashCode()
+ */
+ public int hashCode()
+ {
+ int hash = 7;
+ hash = hash*31 + AssertionEnum.AND.hashCode();
+ hash = hash*31 + ( annotations == null ? 0 : annotations.hashCode() );
+ return hash;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals( Object other )
+ {
+ if ( this == other )
+ {
+ return true;
+ }
+
+ if ( !( other instanceof AndNode ) )
+ {
+ return false;
+ }
+
+ AndNode otherExprNode = ( AndNode ) other;
+
+ List<ExprNode> otherChildren = otherExprNode.getChildren();
+
+ if ( otherChildren == children )
+ {
+ return true;
+ }
+
+ if ( children.size() != otherChildren.size() )
+ {
+ return false;
+ }
+
+ for ( int i = 0; i < children.size(); i++ )
+ {
+ ExprNode child = children.get( i );
+ ExprNode otherChild = children.get( i );
+
+ if ( !child.equals( otherChild ) )
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+}
Added: 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=575783&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ApproximateNode.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ApproximateNode.java Fri Sep 14 13:14:59 2007
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.shared.ldap.filter;
+
+
+/**
+ * A simple assertion value node.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Revision: 519266 $
+ */
+public class ApproximateNode extends SimpleNode
+{
+ /**
+ * Creates a new ApproximateNode object.
+ *
+ * @param attribute the attribute name
+ * @param value the value to test for
+ */
+ public ApproximateNode( String attribute, byte[] value )
+ {
+ super( attribute, value );
+ }
+
+
+ /**
+ * Creates a new ApproximateNode object.
+ *
+ * @param attribute the attribute name
+ * @param value the value to test for
+ */
+ public ApproximateNode( String attribute, String value )
+ {
+ super( attribute, value );
+ }
+
+ /**
+ * @see org.apache.directory.shared.ldap.filter.ExprNode#printToBuffer(
+ * java.lang.StringBuilder)
+ */
+ public StringBuilder printToBuffer( StringBuilder buf )
+ {
+ buf.append( '(' ).append( getAttribute() ).append( "~=" ).append( value ).append( ')' );
+
+ return super.printToBuffer( buf );
+ }
+
+
+ /**
+ * @see org.apache.directory.shared.ldap.filter.ExprNode#accept(
+ * org.apache.directory.shared.ldap.filter.FilterVisitor)
+ */
+ public void accept( FilterVisitor visitor )
+ {
+ if ( visitor.canVisit( this ) )
+ {
+ visitor.visit( this );
+ }
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals( Object other )
+ {
+ if ( this == other )
+ {
+ return true;
+ }
+
+ if ( !( other instanceof ApproximateNode ) )
+ {
+ return false;
+ }
+
+ ApproximateNode otherNode = (ApproximateNode) other;
+
+ return ( value == null ? otherNode.value == null : value.equals( otherNode.value ) );
+ }
+}
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=575783&r1=575782&r2=575783&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 Fri Sep 14 13:14:59 2007
@@ -39,10 +39,10 @@
private static final String MAX_STR = "[" + MAX.toString() + "]";
/** The assertion or predicate to apply */
- private final Assertion m_assertion;
+ private final Assertion assertion;
/** Description of assertion for polish printouts */
- private final String m_desc;
+ private final String desc;
// ------------------------------------------------------------------------
@@ -52,12 +52,11 @@
/**
* Creates an AssertionNode using an arbitrary candidate assertion.
*
- * @param a_assertion
- * the arbitrary selection logic.
+ * @param assertion the arbitrary selection logic.
*/
- public AssertionNode(Assertion a_assertion)
+ public AssertionNode(Assertion assertion)
{
- this( a_assertion, "ASSERTION" );
+ this( assertion, "ASSERTION" );
}
@@ -65,16 +64,14 @@
* Creates an AssertionNode using an arbitrary candidate assertion with a
* descriptions used for filter AST walker dumps.
*
- * @param a_assertion
- * the arbitrary selection logic.
- * @param a_desc
- * the printout representation for filter prints.
- */
- public AssertionNode(Assertion a_assertion, String a_desc)
- {
- super( AssertionEnum.ASSERTION );
- m_desc = a_desc;
- m_assertion = a_assertion;
+ * @param assertion the arbitrary selection logic.
+ * @param desc the printout representation for filter prints.
+ */
+ public AssertionNode( Assertion assertion, String desc )
+ {
+ super();
+ this.desc = desc;
+ this.assertion = assertion;
/*
* We never want this node to ever make it to the point of becoming a
@@ -92,7 +89,7 @@
*/
public Assertion getAssertion()
{
- return m_assertion;
+ return assertion;
}
@@ -114,16 +111,16 @@
/**
* @see org.apache.directory.shared.ldap.filter.ExprNode#printToBuffer(java.lang.StringBuffer)
*/
- public StringBuffer printToBuffer( StringBuffer a_buf )
+ public StringBuilder printToBuffer( StringBuilder buf )
{
- return a_buf.append( m_desc ).append( MAX_STR );
+ return buf.append( desc ).append( MAX_STR );
}
/**
* @see ExprNode#printRefinementToBuffer(StringBuffer)
*/
- public StringBuffer printRefinementToBuffer( StringBuffer a_buf ) throws UnsupportedOperationException
+ public StringBuilder printRefinementToBuffer( StringBuilder buf ) throws UnsupportedOperationException
{
throw new UnsupportedOperationException( "AssertionNode can't be part of a refinement" );
}
@@ -133,8 +130,8 @@
* @see org.apache.directory.shared.ldap.filter.ExprNode#accept(
* org.apache.directory.shared.ldap.filter.FilterVisitor)
*/
- public void accept( FilterVisitor a_visitor )
+ public void accept( FilterVisitor visitor )
{
- a_visitor.visit( this );
+ visitor.visit( this );
}
}
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=575783&r1=575782&r2=575783&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 Fri Sep 14 13:14:59 2007
@@ -22,7 +22,6 @@
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
/**
@@ -32,113 +31,72 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-public class BranchNode extends AbstractExprNode
+public abstract class BranchNode extends AbstractExprNode
{
- /** logical operator for this branch node */
- private final AssertionEnum operator;
-
/** child node list for this branch node */
- private List<ExprNode> children = null;
+ protected List<ExprNode> children = null;
/**
* Creates a BranchNode using a logical operator and a list of children.
*
- * @param operator
- * the logical operator to use for this branch node.
- * @param childList
- * the child nodes under this branch node.
+ * @param childList the child nodes under this branch node.
*/
- public BranchNode( AssertionEnum operator, List<ExprNode> childList)
+ public BranchNode( List<ExprNode> children)
{
- super( operator );
+ super();
- if ( null == childList )
+ if ( null == children )
{
- children = new ArrayList<ExprNode>( 2 );
+ this.children = new ArrayList<ExprNode>( 2 );
}
else
{
- children = childList;
- }
-
- this.operator = operator;
-
- switch ( operator )
- {
- case AND :
- case NOT :
- case OR :
- break;
-
- default:
- throw new IllegalArgumentException( "Logical operator argument in constructor is undefined." );
+ this.children = children;
}
}
/**
* Creates a BranchNode using a logical operator.
- *
- * @param operator
- * the logical operator to use for this branch node.
*/
- public BranchNode( AssertionEnum operator)
+ public BranchNode()
{
- this( operator, null );
+ this( null );
}
-
/**
- * Adds a child node to this branch node if it allows it. Some branch nodes
- * like the negation node does not allow more than one child. An attempt to
- * add more than one node to a negation branch node will result in an
- * IllegalStateException.
- *
- * @param node
- * the child expression to add to this branch node
+ * @see org.apache.directory.shared.ldap.filter.ExprNode#isLeaf()
+ * @return false all the time.
*/
- public void addNode( ExprNode node )
+ public final boolean isLeaf()
{
- if ( ( AssertionEnum.NOT == operator ) && ( children.size() >= 1 ) )
- {
- throw new IllegalStateException( "Cannot add more than one element" + " to a negation node." );
- }
-
- children.add( node );
+ return false;
}
/**
- * Adds a child node to this branch node if it allows it at the head rather
- * than the tail. Some branch nodes like the negation node does not allow
- * more than one child. An attempt to add more than one node to a negation
- * branch node will result in an IllegalStateException.
+ * Adds a child node to this branch node node
*
- * @param node
- * the child expression to add to this branch node
+ * @param node the child expression to add to this branch node
*/
- public void addNodeToHead( ExprNode node )
+ public void addNode( ExprNode node )
{
- if ( ( AssertionEnum.NOT == operator ) && ( children.size() >= 1 ) )
- {
- throw new IllegalStateException( "Cannot add more than one element" + " to a negation node." );
- }
-
- children.add( 0, node );
+ children.add( node );
}
/**
- * @see org.apache.directory.shared.ldap.filter.ExprNode#isLeaf()
- * @return false all the time.
+ * Adds a child node to this branch node at the head rather than the tail.
+ *
+ * @param node the child expression to add to this branch node
*/
- public final boolean isLeaf()
+ public void addNodeToHead( ExprNode node )
{
- return false;
+ children.add( 0, node );
}
-
+
/**
* Gets the children below this BranchNode. We purposefully do not clone the
* array list so that backends can sort the order of children using their
@@ -154,228 +112,30 @@
/**
- * Convenience method that gets the first child in the children array. Its
- * very useful for NOT nodes since they only have one child by avoiding code
- * that looks like: <code> ( ExprNode ) m_children.get( 0 ) </code>
- *
- * @return the first child
- */
- public ExprNode getChild()
- {
- if ( children.size() > 0 )
- {
- return children.get( 0 );
- }
-
- return null;
- }
-
-
- /**
* Sets the list of children under this node.
*
- * @param list
- * the list of children to set.
+ * @param list the list of children to set.
*/
void setChildren( List<ExprNode> list )
{
children = list;
}
-
-
- /**
- * Gets the operator for this branch node.
- *
- * @return the operator constant.
- */
- public AssertionEnum getOperator()
- {
- return operator;
- }
-
-
- /**
- * Tests whether or not this node is a disjunction (a OR'ed branch).
- *
- * @return true if the operation is a OR, false otherwise.
- */
- public boolean isDisjunction()
- {
- return AssertionEnum.OR == operator;
- }
-
-
- /**
- * Tests whether or not this node is a conjunction (a AND'ed branch).
- *
- * @return true if the operation is a AND, false otherwise.
- */
- public boolean isConjunction()
- {
- return AssertionEnum.AND == operator;
- }
-
-
- /**
- * Tests whether or not this node is a negation (a NOT'ed branch).
- *
- * @return true if the operation is a NOT, false otherwise.
- */
- public boolean isNegation()
- {
- return AssertionEnum.NOT == operator;
- }
-
-
- /**
- * Recursively prints the String representation of this node and all its
- * descendents to a buffer.
- *
- * @see org.apache.directory.shared.ldap.filter.ExprNode#printToBuffer(java.lang.StringBuffer)
- */
- public StringBuffer printToBuffer( StringBuffer buf )
- {
- buf.append( '(' );
-
- switch ( operator )
- {
- case AND :
- buf.append( "& " );
- break;
-
- case NOT :
- buf.append( "! " );
- break;
-
- case OR :
- buf.append( "| " );
- break;
-
- default:
- buf.append( "UNKNOWN" );
- }
-
- for ( ExprNode node:children )
- {
- node.printToBuffer( buf );
- }
-
- buf.append( ')' );
-
- if ( ( null != getAnnotations() ) && getAnnotations().containsKey( "count" ) )
- {
- buf.append( '[' );
- buf.append( ( ( Long ) getAnnotations().get( "count" ) ).toString() );
- buf.append( "] " );
- }
- else
- {
- buf.append( ' ' );
- }
-
- return buf;
- }
-
/**
- * @see ExprNode#printRefinementToBuffer(StringBuffer)
- */
- public StringBuffer printRefinementToBuffer( StringBuffer buf ) throws UnsupportedOperationException
- {
-
-
- switch ( operator )
- {
- case AND :
- buf.append( "and" );
- break;
- case OR :
- buf.append( "or" );
- break;
- case NOT :
- buf.append( "not" );
- break;
- }
-
-
- buf.append( ':' );
- buf.append( ' ' );
- buf.append( '{' );
-
- for ( Iterator<ExprNode> it = children.iterator(); it.hasNext(); )
- {
- ExprNode node = it.next();
- node.printRefinementToBuffer( buf );
-
- if(it.hasNext())
- {
- buf.append( ',' );
- buf.append( ' ' );
- }
- }
-
- buf.append( '}' );
-
- return buf;
- }
-
- /**
- * Gets a human readable representation for the operators: AND for '&', OR
- * for '|' and NOT for '!'.
- *
- * @param operator
- * the operator constant.
- * @return one of the strings AND, OR, or NOT.
- */
- public static String getOperatorString( AssertionEnum operator )
- {
- String opstr = null;
-
- switch ( operator )
- {
- case AND :
- opstr = "AND";
- break;
-
- case NOT :
- opstr = "NOT";
- break;
-
- case OR :
- opstr = "OR";
- break;
-
- default:
- opstr = "UNKNOWN";
- }
-
- return opstr;
- }
-
-
- /**
- * Gets the recursive prefix string represent of the filter from this node
- * down.
+ * Convenience method that gets the first child in the children array. Its
+ * very useful for NOT nodes since they only have one child by avoiding code
+ * that looks like: <code> ( ExprNode ) m_children.get( 0 ) </code>
*
- * @see java.lang.Object#toString()
+ * @return the first child
*/
- public String toString()
+ public ExprNode getFirstChild()
{
- StringBuffer buf = new StringBuffer();
- buf.append( getOperatorString( operator ) );
-
- if ( ( null != getAnnotations() ) && getAnnotations().containsKey( "count" ) )
- {
- buf.append( '[' );
- buf.append( ( ( Long ) getAnnotations().get( "count" ) ).toString() );
- buf.append( "] " );
- }
- else
+ if ( children.size() > 0 )
{
- buf.append( ' ' );
+ return children.get( 0 );
}
- return buf.toString();
+ return null;
}
@@ -413,51 +173,5 @@
visitor.visit( this );
}
}
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals( Object other )
- {
- if ( null == other )
- {
- return false;
- }
-
- if ( this == other )
- {
- return true;
- }
-
- if ( !( other instanceof BranchNode ) )
- {
- return false;
- }
-
- if ( !super.equals( other ) )
- {
- return false;
- }
-
- BranchNode otherExprNode = ( BranchNode ) other;
-
- List<ExprNode> otherChildren = otherExprNode.getChildren();
-
- if ( otherExprNode.getOperator() != operator )
- {
- return false;
- }
-
- if ( otherChildren == children )
- {
- return true;
- }
-
- return ( ( null != children ) && ( null != otherChildren ) &&
- children.equals( otherChildren ) );
}
}
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=575783&r1=575782&r2=575783&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 Fri Sep 14 13:14:59 2007
@@ -53,7 +53,7 @@
BranchNode branch = ( BranchNode ) node;
- if ( branch.getOperator() == AssertionEnum.NOT )
+ if ( branch instanceof NotNode )
{
return;
}
@@ -139,7 +139,7 @@
visitor.visit( filter );
- StringBuffer normalized = new StringBuffer();
+ StringBuilder normalized = new StringBuilder();
filter.printToBuffer( normalized );
@@ -150,7 +150,7 @@
{
public int compare( ExprNode o1, ExprNode o2 )
{
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
buf.setLength( 0 );
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=575783&r1=575782&r2=575783&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 Fri Sep 14 13:14:59 2007
@@ -33,20 +33,17 @@
/**
* Gets an annotation on the tree by key.
*
- * @param a_key
- * the annotation key.
+ * @param key the annotation key.
* @return the annotation value.
*/
- Object get( Object a_key );
+ Object get( Object key );
/**
* Sets a annotation key to a value.
*
- * @param key
- * the annotation key.
- * @param value
- * the annotation value.
+ * @param key the annotation key.
+ * @param value the annotation value.
*/
void set( String key, Object value );
@@ -63,29 +60,25 @@
* Recursively appends this String representation of this node and its
* descendents in prefix notation to a buffer.
*
- * @param a_buf
- * the buffer to append to.
+ * @param buf the buffer to append to.
*/
- StringBuffer printToBuffer( StringBuffer a_buf );
+ StringBuilder printToBuffer( StringBuilder buf );
/**
* Recursively appends the refinement string representation of this node and its
* descendents in prefix notation to a buffer.
*
- * @param a_buf
- * the buffer to append to.
- * @throws UnsupportedOperationException
- * if this node isn't a part of a refinement.
+ * @param buf the buffer to append to.
+ * @throws UnsupportedOperationException if this node isn't a part of a refinement.
*/
- StringBuffer printRefinementToBuffer( StringBuffer a_buf ) throws UnsupportedOperationException;
+ StringBuilder printRefinementToBuffer( StringBuilder buf ) throws UnsupportedOperationException;
/**
* Element/node accept method for visitor pattern.
*
- * @param a_visitor
- * the filter expression tree structure visitor
+ * @param visitor the filter expression tree structure visitor
*/
- void accept( FilterVisitor a_visitor );
+ void accept( FilterVisitor visitor );
}
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=575783&r1=575782&r2=575783&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 Fri Sep 14 13:14:59 2007
@@ -44,14 +44,10 @@
/**
* Creates a new ExtensibleNode object.
*
- * @param attribute
- * the attribute used for the extensible assertion
- * @param value
- * the value to match for
- * @param matchingRuleId
- * the OID of the matching rule
- * @param dnAttributes
- * the dn attributes
+ * @param attribute the attribute used for the extensible assertion
+ * @param value the value to match for
+ * @param matchingRuleId the OID of the matching rule
+ * @param dnAttributes the dn attributes
*/
public ExtensibleNode(String attribute, String value, String matchingRuleId, boolean dnAttributes)
{
@@ -62,18 +58,14 @@
/**
* Creates a new ExtensibleNode object.
*
- * @param attribute
- * the attribute used for the extensible assertion
- * @param value
- * the value to match for
- * @param matchingRuleId
- * the OID of the matching rule
- * @param dnAttributes
- * the dn attributes
+ * @param attribute the attribute used for the extensible assertion
+ * @param value the value to match for
+ * @param matchingRuleId the OID of the matching rule
+ * @param dnAttributes the dn attributes
*/
public ExtensibleNode(String attribute, byte[] value, String matchingRuleId, boolean dnAttributes)
{
- super( attribute, AssertionEnum.EXTENSIBLE );
+ super( attribute );
this.value = value;
this.matchingRuleId = matchingRuleId;
@@ -116,9 +108,9 @@
/**
* @see org.apache.directory.shared.ldap.filter.ExprNode#printToBuffer(
- * java.lang.StringBuffer)
+ * java.lang.StringBuilder)
*/
- public StringBuffer printToBuffer( StringBuffer buf )
+ public StringBuilder printToBuffer( StringBuilder buf )
{
buf.append( '(' ).append( getAttribute() );
buf.append( "-" );
@@ -126,9 +118,9 @@
buf.append( "-EXTENSIBLE-" );
buf.append( this.matchingRuleId );
buf.append( "-" );
- buf.append( StringTools.utf8ToString( this.value ) );
+ buf.append( StringTools.utf8ToString( value ) );
buf.append( "/" );
- buf.append( StringTools.dumpBytes( this.value ) );
+ buf.append( StringTools.dumpBytes( value ) );
buf.append( ')' );
if ( ( null != getAnnotations() ) && getAnnotations().containsKey( "count" ) )
@@ -147,9 +139,9 @@
/**
- * @see ExprNode#printRefinementToBuffer(StringBuffer)
+ * @see ExprNode#printRefinementToBuffer(StringBuilder)
*/
- public StringBuffer printRefinementToBuffer( StringBuffer a_buf ) throws UnsupportedOperationException
+ public StringBuilder printRefinementToBuffer( StringBuilder buf ) throws UnsupportedOperationException
{
throw new UnsupportedOperationException( "ExtensibleNode can't be part of a refinement" );
}
@@ -160,7 +152,7 @@
*/
public String toString()
{
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
printToBuffer( buf );
return ( buf.toString() );
Added: 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=575783&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/GreaterEqNode.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/GreaterEqNode.java Fri Sep 14 13:14:59 2007
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.shared.ldap.filter;
+
+
+/**
+ * A assertion value node for GreaterOrEqual.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Revision: 519266 $
+ */
+public class GreaterEqNode extends SimpleNode
+{
+ /**
+ * Creates a new GreaterOrEqual object.
+ *
+ * @param attribute the attribute name
+ * @param value the value to test for
+ */
+ public GreaterEqNode( String attribute, byte[] value )
+ {
+ super( attribute, value );
+ }
+
+
+ /**
+ * Creates a new GreaterOrEqual object.
+ *
+ * @param attribute the attribute name
+ * @param value the value to test for
+ */
+ public GreaterEqNode( String attribute, String value )
+ {
+ super( attribute, value );
+ }
+
+ /**
+ * @see org.apache.directory.shared.ldap.filter.ExprNode#printToBuffer(
+ * java.lang.StringBuilder)
+ */
+ public StringBuilder printToBuffer( StringBuilder buf )
+ {
+ buf.append( '(' ).append( getAttribute() ).append( ">=" ).append( value ).append( ')' );
+
+ return super.printToBuffer( buf );
+ }
+
+
+ /**
+ * @see org.apache.directory.shared.ldap.filter.ExprNode#accept(
+ * org.apache.directory.shared.ldap.filter.FilterVisitor)
+ */
+ public void accept( FilterVisitor visitor )
+ {
+ if ( visitor.canVisit( this ) )
+ {
+ visitor.visit( this );
+ }
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals( Object other )
+ {
+ if ( this == other )
+ {
+ return true;
+ }
+
+ if ( !( other instanceof GreaterEqNode ) )
+ {
+ return false;
+ }
+
+ GreaterEqNode otherNode = (GreaterEqNode) other;
+
+ return ( value == null ? otherNode.value == null : value.equals( otherNode.value ) );
+ }
+}
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=575783&r1=575782&r2=575783&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 Fri Sep 14 13:14:59 2007
@@ -38,9 +38,9 @@
* @param attribute the attribute this node is based on
* @param type the type of this leaf node
*/
- protected LeafNode( String attribute, AssertionEnum type )
+ protected LeafNode( String attribute )
{
- super( type );
+ super();
this.attribute = attribute;
}
@@ -85,11 +85,6 @@
*/
public boolean equals( Object other )
{
- if ( null == other )
- {
- return false;
- }
-
if ( this == other )
{
return true;
Added: 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=575783&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/LessEqNode.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/LessEqNode.java Fri Sep 14 13:14:59 2007
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.shared.ldap.filter;
+
+
+/**
+ * A assertion value node for LessOrEqual.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Revision: 519266 $
+ */
+public class LessEqNode extends SimpleNode
+{
+ /**
+ * Creates a new LessEqNode object.
+ *
+ * @param attribute the attribute name
+ * @param value the value to test for
+ */
+ public LessEqNode( String attribute, byte[] value )
+ {
+ super( attribute, value );
+ }
+
+
+ /**
+ * Creates a new LessEqNode object.
+ *
+ * @param attribute the attribute name
+ * @param value the value to test for
+ */
+ public LessEqNode( String attribute, String value )
+ {
+ super( attribute, value );
+ }
+
+ /**
+ * @see org.apache.directory.shared.ldap.filter.ExprNode#printToBuffer(
+ * java.lang.StringBuilder)
+ */
+ public StringBuilder printToBuffer( StringBuilder buf )
+ {
+ buf.append( '(' ).append( getAttribute() ).append( "<=" ).append( value ).append( ')' );
+
+ return super.printToBuffer( buf );
+ }
+
+
+ /**
+ * @see org.apache.directory.shared.ldap.filter.ExprNode#accept(
+ * org.apache.directory.shared.ldap.filter.FilterVisitor)
+ */
+ public void accept( FilterVisitor visitor )
+ {
+ if ( visitor.canVisit( this ) )
+ {
+ visitor.visit( this );
+ }
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals( Object other )
+ {
+ if ( this == other )
+ {
+ return true;
+ }
+
+ if ( !( other instanceof LessEqNode ) )
+ {
+ return false;
+ }
+
+ LessEqNode otherNode = (LessEqNode) other;
+
+ return ( value == null ? otherNode.value == null : value.equals( otherNode.value ) );
+ }
+}
Added: 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=575783&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/NotNode.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/NotNode.java Fri Sep 14 13:14:59 2007
@@ -0,0 +1,329 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.shared.ldap.filter;
+
+
+import java.util.List;
+
+/**
+ * Node representing an Not connector in a filter operation
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 517453 $
+ */
+public class NotNode extends BranchNode
+{
+ /**
+ * Creates a NotNode using a logical operator and a list of children.
+ *
+ * A Not node should contain only one child
+ *
+ * @param childList the child nodes under this branch node.
+ */
+ public NotNode( List<ExprNode> children)
+ {
+ super();
+
+ if ( this.children.size() > 1 )
+ {
+ throw new IllegalStateException( "Cannot add more than one element to a negation node." );
+ }
+ }
+
+
+ /**
+ * Creates an empty NotNode
+ */
+ public NotNode()
+ {
+ this( null );
+ }
+
+ /**
+ * Adds a child node to this NOT node node
+ *
+ * @param node the child expression to add to this NOT node
+ */
+ public void addNode( ExprNode node )
+ {
+ if ( children.size() >= 1 )
+ {
+ throw new IllegalStateException( "Cannot add more than one element to a negation node." );
+ }
+
+ children.add( node );
+ }
+
+
+ /**
+ * Adds a child node to this NOT node at the head rather than the tail.
+ *
+ * @param node the child expression to add to this branch node
+ */
+ public void addNodeToHead( ExprNode node )
+ {
+ if ( children.size() >= 1 )
+ {
+ throw new IllegalStateException( "Cannot add more than one element to a negation node." );
+ }
+
+ children.add( node );
+ }
+
+
+ /**
+ * Sets the list of children under this node.
+ *
+ * @param list the list of children to set.
+ */
+ public void setChildren( List<ExprNode> list )
+ {
+ if ( ( list != null ) && ( list.size() >= 1 ) )
+ {
+ throw new IllegalStateException( "Cannot add more than one element to a negation node." );
+ }
+
+ children = list;
+ }
+
+
+ /**
+ * Gets the operator for this branch node.
+ *
+ * @return the operator constant.
+ */
+ public AssertionEnum getOperator()
+ {
+ return AssertionEnum.NOT;
+ }
+
+
+ /**
+ * Tests whether or not this node is a disjunction (a OR'ed branch).
+ *
+ * @return true if the operation is a OR, false otherwise.
+ */
+ public boolean isDisjunction()
+ {
+ return false;
+ }
+
+
+ /**
+ * Tests whether or not this node is a conjunction (a AND'ed branch).
+ *
+ * @return true if the operation is a AND, false otherwise.
+ */
+ public boolean isConjunction()
+ {
+ return false;
+ }
+
+
+ /**
+ * Tests whether or not this node is a negation (a NOT'ed branch).
+ *
+ * @return true if the operation is a NOT, false otherwise.
+ */
+ public boolean isNegation()
+ {
+ return true;
+ }
+
+
+ /**
+ * Recursively prints the String representation of this node and all its
+ * descendents to a buffer.
+ *
+ * @see org.apache.directory.shared.ldap.filter.ExprNode#printToBuffer(java.lang.StringBuffer)
+ */
+ public StringBuilder printToBuffer( StringBuilder buf )
+ {
+ buf.append( "(!" );
+
+ for ( ExprNode node:children )
+ {
+ node.printToBuffer( buf );
+ }
+
+ buf.append( ')' );
+
+ if ( ( null != getAnnotations() ) && getAnnotations().containsKey( "count" ) )
+ {
+ buf.append( '[' );
+ buf.append( ( ( Long ) getAnnotations().get( "count" ) ).toString() );
+ buf.append( "] " );
+ }
+ else
+ {
+ buf.append( ' ' );
+ }
+
+ return buf;
+ }
+
+
+ /**
+ * @see ExprNode#printRefinementToBuffer(StringBuffer)
+ */
+ public StringBuilder printRefinementToBuffer( StringBuilder buf ) throws UnsupportedOperationException
+ {
+ buf.append( "not: {" );
+ boolean isFirst = true;
+
+ for ( ExprNode node:children )
+ {
+ if ( isFirst )
+ {
+ isFirst = false;
+ }
+ else
+ {
+ buf.append( ", " );
+ }
+
+ node.printRefinementToBuffer( buf );
+ }
+
+ buf.append( '}' );
+
+ return buf;
+ }
+
+ /**
+ * Gets the recursive prefix string represent of the filter from this node
+ * down.
+ *
+ * @see java.lang.Object#toString()
+ */
+ public String toString()
+ {
+ StringBuffer buf = new StringBuffer();
+ buf.append( "NOT" );
+
+ if ( ( null != getAnnotations() ) && getAnnotations().containsKey( "count" ) )
+ {
+ buf.append( '[' );
+ buf.append( ( ( Long ) getAnnotations().get( "count" ) ) );
+ buf.append( "] " );
+ }
+ else
+ {
+ buf.append( ' ' );
+ }
+
+ return buf.toString();
+ }
+
+
+ /**
+ * @see org.apache.directory.shared.ldap.filter.ExprNode#accept(
+ * org.apache.directory.shared.ldap.filter.FilterVisitor)
+ */
+ public void accept( FilterVisitor visitor )
+ {
+ if ( visitor.isPrefix() )
+ {
+ List<ExprNode> children = visitor.getOrder( this, this.children );
+
+ if ( visitor.canVisit( this ) )
+ {
+ visitor.visit( this );
+ }
+
+ for ( ExprNode node:children )
+ {
+ node.accept( visitor );
+ }
+ }
+ else
+ {
+ List<ExprNode> children = visitor.getOrder( this, this.children );
+
+ for ( ExprNode node:children )
+ {
+ node.accept( visitor );
+ }
+
+ if ( visitor.canVisit( this ) )
+ {
+ visitor.visit( this );
+ }
+ }
+ }
+
+ /**
+ * @see Object#hashCode()
+ */
+ public int hashCode()
+ {
+ int hash = 7;
+ hash = hash*31 + AssertionEnum.NOT.hashCode();
+ hash = hash*31 + ( annotations == null ? 0 : annotations.hashCode() );
+ return hash;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals( Object other )
+ {
+ if ( this == other )
+ {
+ return true;
+ }
+
+ if ( !( other instanceof NotNode ) )
+ {
+ return false;
+ }
+
+ NotNode otherExprNode = ( NotNode ) other;
+
+ List<ExprNode> otherChildren = otherExprNode.getChildren();
+
+ if ( otherChildren == children )
+ {
+ return true;
+ }
+
+ if ( children.size() != otherChildren.size() )
+ {
+ return false;
+ }
+
+ for ( int i = 0; i < children.size(); i++ )
+ {
+ ExprNode child = children.get( i );
+ ExprNode otherChild = children.get( i );
+
+ if ( !child.equals( otherChild ) )
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+}
Added: 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=575783&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/OrNode.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/OrNode.java Fri Sep 14 13:14:59 2007
@@ -0,0 +1,277 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.shared.ldap.filter;
+
+
+import java.util.List;
+
+/**
+ * Node representing an OR connector in a filter operation
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 517453 $
+ */
+public class OrNode extends BranchNode
+{
+ /**
+ * Creates a OrNode using a logical operator and a list of children.
+ *
+ * @param childList the child nodes under this branch node.
+ */
+ public OrNode( List<ExprNode> children)
+ {
+ super( children );
+ }
+
+
+ /**
+ * Creates an empty OrNode
+ */
+ public OrNode()
+ {
+ this( null );
+ }
+
+
+
+
+ /**
+ * Gets the operator for this branch node.
+ *
+ * @return the operator constant.
+ */
+ public AssertionEnum getOperator()
+ {
+ return AssertionEnum.OR;
+ }
+
+
+ /**
+ * Tests whether or not this node is a disjunction (a OR'ed branch).
+ *
+ * @return true if the operation is a OR, false otherwise.
+ */
+ public boolean isDisjunction()
+ {
+ return true;
+ }
+
+
+ /**
+ * Tests whether or not this node is a conjunction (a AND'ed branch).
+ *
+ * @return true if the operation is a AND, false otherwise.
+ */
+ public boolean isConjunction()
+ {
+ return false;
+ }
+
+
+ /**
+ * Tests whether or not this node is a negation (a NOT'ed branch).
+ *
+ * @return true if the operation is a NOT, false otherwise.
+ */
+ public boolean isNegation()
+ {
+ return false;
+ }
+
+
+ /**
+ * Recursively prints the String representation of this node and all its
+ * descendents to a buffer.
+ *
+ * @see org.apache.directory.shared.ldap.filter.ExprNode#printToBuffer(java.lang.StringBuffer)
+ */
+ public StringBuilder printToBuffer( StringBuilder buf )
+ {
+ buf.append( "(|" );
+
+ for ( ExprNode node:children )
+ {
+ node.printToBuffer( buf );
+ }
+
+ buf.append( ')' );
+
+ if ( ( null != getAnnotations() ) && getAnnotations().containsKey( "count" ) )
+ {
+ buf.append( '[' );
+ buf.append( ( ( Long ) getAnnotations().get( "count" ) ).toString() );
+ buf.append( "] " );
+ }
+ else
+ {
+ buf.append( ' ' );
+ }
+
+ return buf;
+ }
+
+
+ /**
+ * @see ExprNode#printRefinementToBuffer(StringBuffer)
+ */
+ public StringBuilder printRefinementToBuffer( StringBuilder buf ) throws UnsupportedOperationException
+ {
+ buf.append( "or: {" );
+ boolean isFirst = true;
+
+ for ( ExprNode node:children )
+ {
+ if ( isFirst )
+ {
+ isFirst = false;
+ }
+ else
+ {
+ buf.append( ", " );
+ }
+
+ node.printRefinementToBuffer( buf );
+ }
+
+ buf.append( '}' );
+
+ return buf;
+ }
+
+ /**
+ * Gets the recursive prefix string represent of the filter from this node
+ * down.
+ *
+ * @see java.lang.Object#toString()
+ */
+ public String toString()
+ {
+ StringBuffer buf = new StringBuffer();
+ buf.append( "OR" );
+
+ if ( ( null != getAnnotations() ) && getAnnotations().containsKey( "count" ) )
+ {
+ buf.append( '[' );
+ buf.append( ( ( Long ) getAnnotations().get( "count" ) ) );
+ buf.append( "] " );
+ }
+ else
+ {
+ buf.append( ' ' );
+ }
+
+ return buf.toString();
+ }
+
+
+ /**
+ * @see org.apache.directory.shared.ldap.filter.ExprNode#accept(
+ * org.apache.directory.shared.ldap.filter.FilterVisitor)
+ */
+ public void accept( FilterVisitor visitor )
+ {
+ if ( visitor.isPrefix() )
+ {
+ List<ExprNode> children = visitor.getOrder( this, this.children );
+
+ if ( visitor.canVisit( this ) )
+ {
+ visitor.visit( this );
+ }
+
+ for ( ExprNode node:children )
+ {
+ node.accept( visitor );
+ }
+ }
+ else
+ {
+ List<ExprNode> children = visitor.getOrder( this, this.children );
+
+ for ( ExprNode node:children )
+ {
+ node.accept( visitor );
+ }
+
+ if ( visitor.canVisit( this ) )
+ {
+ visitor.visit( this );
+ }
+ }
+ }
+
+ /**
+ * @see Object#hashCode()
+ */
+ public int hashCode()
+ {
+ int hash = 7;
+ hash = hash*31 + AssertionEnum.OR.hashCode();
+ hash = hash*31 + ( annotations == null ? 0 : annotations.hashCode() );
+ return hash;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals( Object other )
+ {
+ if ( this == other )
+ {
+ return true;
+ }
+
+ if ( !( other instanceof OrNode ) )
+ {
+ return false;
+ }
+
+ OrNode otherExprNode = ( OrNode ) other;
+
+ List<ExprNode> otherChildren = otherExprNode.getChildren();
+
+ if ( otherChildren == children )
+ {
+ return true;
+ }
+
+ if ( children.size() != otherChildren.size() )
+ {
+ return false;
+ }
+
+ for ( int i = 0; i < children.size(); i++ )
+ {
+ ExprNode child = children.get( i );
+ ExprNode otherChild = children.get( i );
+
+ if ( !child.equals( otherChild ) )
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+}
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=575783&r1=575782&r2=575783&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 Fri Sep 14 13:14:59 2007
@@ -32,23 +32,20 @@
/**
* Creates a PresenceNode object based on an attribute.
*
- * @param attribute
- * the attribute to assert the presence of
+ * @param attribute the attribute to assert the presence of
*/
public PresenceNode( String attribute )
{
- super( attribute, AssertionEnum.PRESENCE );
+ super( attribute );
}
/**
- * @see org.apache.directory.shared.ldap.filter.ExprNode#printToBuffer(java.lang.StringBuffer)
+ * @see org.apache.directory.shared.ldap.filter.ExprNode#printToBuffer(java.lang.StringBuilder)
*/
- public StringBuffer printToBuffer( StringBuffer buf )
+ public StringBuilder printToBuffer( StringBuilder buf )
{
- buf.append( '(' ).append( getAttribute() ).append( "=*" );
-
- buf.append( ')' );
+ buf.append( '(' ).append( getAttribute() ).append( "=*)" );
if ( ( null != getAnnotations() ) && getAnnotations().containsKey( "count" ) )
{
@@ -70,7 +67,7 @@
*/
public String toString()
{
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
printToBuffer( buf );
return ( buf.toString() );
@@ -78,9 +75,9 @@
/**
- * @see ExprNode#printRefinementToBuffer(StringBuffer)
+ * @see ExprNode#printRefinementToBuffer(StringBuilder)
*/
- public StringBuffer printRefinementToBuffer( StringBuffer a_buf ) throws UnsupportedOperationException
+ 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=575783&r1=575782&r2=575783&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 Fri Sep 14 13:14:59 2007
@@ -28,7 +28,7 @@
/**
- * Node used not to represent an published assertion but an assertion on the
+ * Node used not to represent a published assertion but an assertion on the
* scope of the search.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
@@ -49,16 +49,13 @@
/**
* Creates a new ScopeNode object.
*
- * @param derefAliases
- * the alias dereferencing mode
- * @param baseDn
- * the search base
- * @param scope
- * the search scope
+ * @param derefAliases the alias dereferencing mode
+ * @param baseDn the search base
+ * @param scope the search scope
*/
public ScopeNode(DerefAliasesEnum derefAliases, String baseDn, int scope)
{
- super( AssertionEnum.SCOPE );
+ super();
this.scope = scope;
this.baseDn = baseDn;
this.derefAliases = derefAliases;
@@ -68,20 +65,17 @@
/**
* Creates a new ScopeNode object.
*
- * @param env
- * the JNDI environment from which to extract the alias
+ * @param env the JNDI environment from which to extract the alias
* dereferencing mode
- * @param baseDn
- * the search base
- * @param scope
- * the search scope
+ * @param baseDn the search base
+ * @param scope the search scope
*/
public ScopeNode( Map<String, DerefAliasesEnum> env, String baseDn, int scope )
{
- super( AssertionEnum.SCOPE );
+ super();
this.scope = scope;
this.baseDn = baseDn;
- this.derefAliases = DerefAliasesEnum.getEnum( env );
+ derefAliases = DerefAliasesEnum.getEnum( env );
}
@@ -106,7 +100,7 @@
*/
public int getScope()
{
- return this.scope;
+ return scope;
}
@@ -117,7 +111,7 @@
*/
public String getBaseDn()
{
- return this.baseDn;
+ return baseDn;
}
@@ -128,16 +122,16 @@
*/
public DerefAliasesEnum getDerefAliases()
{
- return this.derefAliases;
+ return derefAliases;
}
/**
- * @see ExprNode#printToBuffer(StringBuffer)
+ * @see ExprNode#printToBuffer(StringBuilder)
*/
- public StringBuffer printToBuffer( StringBuffer buf )
+ public StringBuilder printToBuffer( StringBuilder buf )
{
- switch ( this.scope )
+ switch ( scope )
{
case ( SearchControls.OBJECT_SCOPE ):
buf.append( "OBJECT_SCOPE" );
@@ -170,9 +164,9 @@
/**
- * @see ExprNode#printRefinementToBuffer(StringBuffer)
+ * @see ExprNode#printRefinementToBuffer(StringBuilder)
*/
- public StringBuffer printRefinementToBuffer( StringBuffer a_buf ) throws UnsupportedOperationException
+ public StringBuilder printRefinementToBuffer( StringBuilder buf ) throws UnsupportedOperationException
{
throw new UnsupportedOperationException( "ScopeNode can't be part of a refinement" );
}
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=575783&r1=575782&r2=575783&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 Fri Sep 14 13:14:59 2007
@@ -30,90 +30,36 @@
*/
public class SimpleNode extends LeafNode
{
- /** the value */
- private Object value;
+ /** the value */
+ protected Object value;
+ /** Constants for comparisons */
+ public final static boolean EVAL_GREATER = true;
+ public final static boolean EVAL_LESSER = false;
/**
* Creates a new SimpleNode object.
*
- * @param attribute
- * the attribute name
- * @param value
- * the value to test for
- * @param type
- * the type of the assertion
+ * @param attribute the attribute name
+ * @param value the value to test for
*/
- public SimpleNode( String attribute, byte[] value, AssertionEnum type )
+ public SimpleNode( String attribute, byte[] value )
{
-// this( attribute, StringTools.utf8ToString( value ), type );
- super( attribute, type );
+ super( attribute );
this.value = value;
-
- switch ( type )
- {
- case APPROXIMATE :
- case EQUALITY :
- case GREATEREQ :
- case LESSEQ :
- break;
-
- case EXTENSIBLE :
- throw new IllegalArgumentException( "Assertion type supplied is "
- + "extensible. Use ExtensibleNode instead." );
-
- case PRESENCE :
- throw new IllegalArgumentException( "Assertion type supplied is "
- + "presence. Use PresenceNode instead." );
-
- case SUBSTRING :
- throw new IllegalArgumentException( "Assertion type supplied is "
- + "substring. Use SubstringNode instead." );
-
- default:
- throw new IllegalArgumentException( "Attribute value assertion type is undefined." );
- }
}
/**
* Creates a new SimpleNode object.
*
- * @param attribute
- * the attribute name
- * @param value
- * the value to test for
- * @param type
- * the type of the assertion
+ * @param attribute the attribute name
+ * @param value the value to test for
*/
- public SimpleNode( String attribute, String value, AssertionEnum type )
+ public SimpleNode( String attribute, String value )
{
- super( attribute, type );
+ super( attribute );
this.value = value;
-
- switch ( type )
- {
- case APPROXIMATE :
- case EQUALITY :
- case GREATEREQ :
- case LESSEQ :
- break;
-
- case EXTENSIBLE :
- throw new IllegalArgumentException( "Assertion type supplied is "
- + "extensible. Use ExtensibleNode instead." );
-
- case PRESENCE :
- throw new IllegalArgumentException( "Assertion type supplied is "
- + "presence. Use PresenceNode instead." );
-
- case SUBSTRING :
- throw new IllegalArgumentException( "Assertion type supplied is "
- + "substring. Use SubstringNode instead." );
-
- default:
- throw new IllegalArgumentException( "Attribute value assertion type is undefined." );
- }
}
@@ -141,37 +87,10 @@
/**
* @see org.apache.directory.shared.ldap.filter.ExprNode#printToBuffer(
- * java.lang.StringBuffer)
+ * java.lang.StringBuilder)
*/
- public StringBuffer printToBuffer( StringBuffer buf )
+ public StringBuilder printToBuffer( StringBuilder buf )
{
- buf.append( '(' ).append( getAttribute() );
-
- switch ( getAssertionType() )
- {
- case APPROXIMATE :
- buf.append( "~=" );
- break;
-
- case EQUALITY :
- buf.append( "=" );
- break;
-
- case GREATEREQ :
- buf.append( ">=" );
- break;
-
- case LESSEQ :
- buf.append( "<=" );
- break;
-
- default:
- buf.append( "UNKNOWN" );
- }
-
- buf.append( value );
- buf.append( ')' );
-
if ( ( null != getAnnotations() ) && getAnnotations().containsKey( "count" ) )
{
buf.append( '[' );
@@ -188,38 +107,16 @@
/**
- * @see ExprNode#printRefinementToBuffer(StringBuffer)
+ * @see ExprNode#printRefinementToBuffer(StringBuilder)
*/
- public StringBuffer printRefinementToBuffer( StringBuffer buf ) throws UnsupportedOperationException
+ public StringBuilder printRefinementToBuffer( StringBuilder buf ) throws UnsupportedOperationException
{
-
- switch ( getAssertionType() )
- {
- case EQUALITY:
- break;
-
- case APPROXIMATE:
- throw new UnsupportedOperationException( "Approximate assertion isn't valid for a refinement" );
-
- case GREATEREQ:
- throw new UnsupportedOperationException( "GreaterOrEqual assertion isn't valid for a refinement" );
-
- case LESSEQ:
- throw new UnsupportedOperationException( "LessOrEqual assertion isn't valid for a refinement" );
-
- default:
- throw new UnsupportedOperationException( "Undefined assertion for a refinement" );
- }
-
if ( getAttribute() == null || !SchemaConstants.OBJECT_CLASS_AT.equalsIgnoreCase( getAttribute() ) )
{
throw new UnsupportedOperationException( "Invalid attribute " + getAttribute() + " for a refinement" );
}
- buf.append( "item" );
- buf.append( ':' );
- buf.append( ' ' );
- buf.append( getValue() );
+ buf.append( "item: " ).append( value );
return buf;
}
@@ -230,7 +127,7 @@
*/
public String toString()
{
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
printToBuffer( buf );
return ( buf.toString() );
}
@@ -256,11 +153,6 @@
*/
public boolean equals( Object other )
{
- if ( null == other )
- {
- return false;
- }
-
if ( this == other )
{
return true;
@@ -271,11 +163,8 @@
return false;
}
- if ( !super.equals( other ) )
- {
- return false;
- }
+ SimpleNode otherNode = (SimpleNode)other;
- return value.equals( ( ( SimpleNode ) other ).getValue() );
+ return ( value == null ? otherNode.value == null : value.equals( otherNode.value ) );
}
}
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=575783&r1=575782&r2=575783&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 Fri Sep 14 13:14:59 2007
@@ -46,24 +46,21 @@
private final String finalPattern;
/** List of fragments between wildcards */
- private final List anyPattern;
+ private final List<String> anyPattern;
/**
* Creates a new SubstringNode object with only one wildcard and no internal
* any fragments between wildcards.
*
- * @param attribute
- * the name of the attribute to substring assert
- * @param initialPattern
- * the initial fragment
- * @param finalPattern
- * the final fragment
+ * @param attribute the name of the attribute to substring assert
+ * @param initialPattern the initial fragment
+ * @param finalPattern the final fragment
*/
- public SubstringNode(String attribute, String initialPattern, String finalPattern)
+ public SubstringNode( String attribute, String initialPattern, String finalPattern )
{
- super( attribute, AssertionEnum.SUBSTRING );
+ super( attribute );
- anyPattern = new ArrayList( 2 );
+ anyPattern = new ArrayList<String>( 2 );
this.finalPattern = finalPattern;
this.initialPattern = initialPattern;
}
@@ -73,18 +70,14 @@
* Creates a new SubstringNode object more than one wildcard and an any
* list.
*
- * @param anyPattern
- * list of internal fragments between wildcards
- * @param attribute
- * the name of the attribute to substring assert
- * @param initialPattern
- * the initial fragment
- * @param finalPattern
- * the final fragment
+ * @param anyPattern list of internal fragments between wildcards
+ * @param attribute the name of the attribute to substring assert
+ * @param initialPattern the initial fragment
+ * @param finalPattern the final fragment
*/
public SubstringNode( List<String> anyPattern, String attribute, String initialPattern, String finalPattern )
{
- super( attribute, AssertionEnum.SUBSTRING );
+ super( attribute );
this.anyPattern = anyPattern;
this.finalPattern = finalPattern;
@@ -119,7 +112,7 @@
*
* @return the any fragments
*/
- public final List getAny()
+ public final List<String> getAny()
{
return anyPattern;
}
@@ -129,8 +122,7 @@
* Gets the compiled regular expression for the substring expression.
*
* @return the equivalent compiled regular expression
- * @throws RESyntaxException
- * if the regular expression is invalid
+ * @throws RESyntaxException if the regular expression is invalid
*/
public final Pattern getRegex( Normalizer normalizer ) throws PatternSyntaxException, NamingException
{
@@ -141,6 +133,7 @@
for ( int i = 0; i < any.length; i++ )
{
any[i] = ( String ) normalizer.normalize( anyPattern.get( i ) );
+
if ( any[i].length() == 0 )
{
any[i] = " ";
@@ -187,7 +180,7 @@
*/
public String toString()
{
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
printToBuffer( buf );
return ( buf.toString() );
@@ -195,9 +188,9 @@
/**
- * @see org.apache.directory.shared.ldap.filter.ExprNode#printToBuffer(java.lang.StringBuffer)
+ * @see org.apache.directory.shared.ldap.filter.ExprNode#printToBuffer(java.lang.StringBuilder)
*/
- public StringBuffer printToBuffer( StringBuffer buf )
+ public StringBuilder printToBuffer( StringBuilder buf )
{
buf.append( '(' ).append( getAttribute() ).append( '=' );
@@ -210,9 +203,9 @@
buf.append( '*' );
}
- for ( int i = 0; i < anyPattern.size(); i++ )
+ for ( String any:anyPattern )
{
- buf.append( anyPattern.get( i ).toString() );
+ buf.append( any );
buf.append( '*' );
}
@@ -239,9 +232,9 @@
/**
- * @see ExprNode#printRefinementToBuffer(StringBuffer)
+ * @see ExprNode#printRefinementToBuffer(StringBuilder)
*/
- public StringBuffer printRefinementToBuffer( StringBuffer a_buf ) throws UnsupportedOperationException
+ public StringBuilder printRefinementToBuffer( StringBuilder buf ) throws UnsupportedOperationException
{
throw new UnsupportedOperationException( "SubstringNode can't be part of a refinement" );
}
@@ -251,11 +244,11 @@
* @see org.apache.directory.shared.ldap.filter.ExprNode#accept(
* org.apache.directory.shared.ldap.filter.FilterVisitor)
*/
- public void accept( FilterVisitor a_visitor )
+ public void accept( FilterVisitor visitor )
{
- if ( a_visitor.canVisit( this ) )
+ if ( visitor.canVisit( this ) )
{
- a_visitor.visit( this );
+ visitor.visit( this );
}
}
}
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java?rev=575783&r1=575782&r2=575783&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java Fri Sep 14 13:14:59 2007
@@ -443,7 +443,7 @@
req.getFilter().accept( visitor );
filter.accept( visitor );
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
filter.printToBuffer( buf );
String myFilterString = buf.toString();
@@ -459,7 +459,7 @@
*/
public String toString()
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append( " SearchRequest\n" );
sb.append( " baseDn : '" ).append( baseDn ).append( "'\n" );
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/subtree/BaseSubtreeSpecification.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/subtree/BaseSubtreeSpecification.java?rev=575783&r1=575782&r2=575783&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/subtree/BaseSubtreeSpecification.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/subtree/BaseSubtreeSpecification.java Fri Sep 14 13:14:59 2007
@@ -246,7 +246,7 @@
*
* @param buffer the string buffer
*/
- public void printToBuffer( StringBuffer buffer )
+ public void printToBuffer( StringBuilder buffer )
{
buffer.append( '{' );
@@ -346,7 +346,7 @@
// Must use a tempBuffer here because the
// exception could occur after some characters
// were added to the buffer.
- StringBuffer tempBuffer = new StringBuffer();
+ StringBuilder tempBuffer = new StringBuilder();
refinement.printRefinementToBuffer( tempBuffer );
buffer.append( tempBuffer );
}
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/subtree/SubtreeSpecification.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/subtree/SubtreeSpecification.java?rev=575783&r1=575782&r2=575783&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/subtree/SubtreeSpecification.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/subtree/SubtreeSpecification.java Fri Sep 14 13:14:59 2007
@@ -125,6 +125,6 @@
*
* @param buffer the string buffer
*/
- void printToBuffer( StringBuffer buffer );
+ void printToBuffer( StringBuilder buffer );
}
Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/filter/BranchNormalizedVisitorTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/filter/BranchNormalizedVisitorTest.java?rev=575783&r1=575782&r2=575783&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/filter/BranchNormalizedVisitorTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/filter/BranchNormalizedVisitorTest.java Fri Sep 14 13:14:59 2007
@@ -49,11 +49,11 @@
visitor.visit( altered );
- StringBuffer oriBuf = new StringBuffer();
+ StringBuilder oriBuf = new StringBuilder();
ori.printToBuffer( oriBuf );
- StringBuffer alteredBuf = new StringBuffer();
+ StringBuilder alteredBuf = new StringBuilder();
altered.printToBuffer( alteredBuf );
@@ -75,11 +75,11 @@
visitor.visit( altered );
- StringBuffer oriBuf = new StringBuffer();
+ StringBuilder oriBuf = new StringBuilder();
ori.printToBuffer( oriBuf );
- StringBuffer alteredBuf = new StringBuffer();
+ StringBuilder alteredBuf = new StringBuilder();
altered.printToBuffer( alteredBuf );
@@ -103,11 +103,11 @@
visitor.visit( altered );
- StringBuffer oriBuf = new StringBuffer();
+ StringBuilder oriBuf = new StringBuilder();
ori.printToBuffer( oriBuf );
- StringBuffer alteredBuf = new StringBuffer();
+ StringBuilder alteredBuf = new StringBuilder();
altered.printToBuffer( alteredBuf );
@@ -131,11 +131,11 @@
visitor.visit( altered );
- StringBuffer oriBuf = new StringBuffer();
+ StringBuilder oriBuf = new StringBuilder();
ori.printToBuffer( oriBuf );
- StringBuffer alteredBuf = new StringBuffer();
+ StringBuilder alteredBuf = new StringBuilder();
altered.printToBuffer( alteredBuf );