directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: rev 21185 - incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/filter
Date Mon, 14 Jun 2004 04:10:31 GMT
Author: akarasulu
Date: Sun Jun 13 21:10:30 2004
New Revision: 21185

Modified:
   incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/filter/ExtensibleNode.java
   incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/filter/SimpleNode.java
Log:
changes to facilitate extensible matching

Modified: incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/filter/ExtensibleNode.java
==============================================================================
--- incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/filter/ExtensibleNode.java
(original)
+++ incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/filter/ExtensibleNode.java
Sun Jun 13 21:10:30 2004
@@ -202,70 +202,138 @@
  *   limitations under the License.
  *
  */
-
-/*
- * $Id: ExtensibleNode.java,v 1.4 2003/10/14 04:59:23 akarasulu Exp $
- *
- * -- (c) LDAPd Group                                                    --
- * -- Please refer to the LICENSE.txt file in the root directory of      --
- * -- any LDAPd project for copyright and distribution information.      --
- *
- */
-package org.apache.ldap.common.filter;
-
-
-/**
- * Filter expression tree node for extensible assertions.
- *
- * @author <a href="mailto:aok123@bellsouth.net">Alex Karasulu</a>
- * @author $author$
- * @version $Revision: 1.4 $
- */
-public class ExtensibleNode extends SimpleNode
-{
-    /** The matching rules id */
-    private final String m_matchingRuleId ;
-
-    /** The name of the dn attributes */
-    private boolean m_dnAttributes = false ;
-
- 
-    /**
-     * Creates a new ExtensibleNode object.
-     *
-     * @param a_attribute the attribute used for the extensible assertion
-     * @param a_value the value to match for
-     * @param a_matchingRuleId the OID of the matching rule
-     * @param a_dnAttributes the dn attributes
-     */
-    public ExtensibleNode( String a_attribute, String a_value,
-        String a_matchingRuleId, boolean a_dnAttributes )
-    {
-        super( a_attribute, a_value, EXTENSIBLE ) ;
-
-        m_matchingRuleId = a_matchingRuleId ;
-        this.m_dnAttributes = a_dnAttributes ;
-    }
-
-
-    /**
-     * Gets the Dn attributes.
-     *
-     * @return the dn attributes
-     */
-    public boolean dnAttributes(  )
-    {
-        return m_dnAttributes ;
-    }
-
-
-    /**
-     * Gets the matching rule id as an OID string.
-     *
-     * @return the OID 
-     */
-    public String getMatchingRuleId(  )
-    {
-        return m_matchingRuleId ;
-    }
-}
+
+/*
+ * $Id: ExtensibleNode.java,v 1.4 2003/10/14 04:59:23 akarasulu Exp $
+ *
+ * -- (c) LDAPd Group                                                    --
+ * -- Please refer to the LICENSE.txt file in the root directory of      --
+ * -- any LDAPd project for copyright and distribution information.      --
+ *
+ */
+package org.apache.ldap.common.filter;
+
+
+/**
+ * Filter expression tree node for extensible assertions.
+ *
+ * @author <a href="mailto:aok123@bellsouth.net">Alex Karasulu</a>
+ * @author $author$
+ * @version $Revision: 1.4 $
+ */
+public class ExtensibleNode extends LeafNode
+{
+    /** The value of the attribute to match for */
+    private final String value;
+    /** The matching rules id */
+    private final String m_matchingRuleId ;
+
+    /** The name of the dn attributes */
+    private boolean m_dnAttributes = false ;
+
+ 
+    /**
+     * Creates a new ExtensibleNode object.
+     *
+     * @param a_attribute the attribute used for the extensible assertion
+     * @param a_value the value to match for
+     * @param a_matchingRuleId the OID of the matching rule
+     * @param a_dnAttributes the dn attributes
+     */
+    public ExtensibleNode( String a_attribute, String a_value,
+        String a_matchingRuleId, boolean a_dnAttributes )
+    {
+        super( a_attribute, EXTENSIBLE ) ;
+
+        this.value = a_value ;
+        m_matchingRuleId = a_matchingRuleId ;
+        this.m_dnAttributes = a_dnAttributes ;
+    }
+
+
+    /**
+     * Gets the Dn attributes.
+     *
+     * @return the dn attributes
+     */
+    public boolean dnAttributes(  )
+    {
+        return m_dnAttributes ;
+    }
+
+
+    /**
+     * Gets the matching rule id as an OID string.
+     *
+     * @return the OID 
+     */
+    public String getMatchingRuleId(  )
+    {
+        return m_matchingRuleId ;
+    }
+
+
+    /**
+     * Gets the value.
+     *
+     * @return the value
+     */
+    public final String getValue()
+    {
+        return value ;
+    }
+
+
+    /**
+     * @see org.apache.ldap.common.filter.ExprNode#printToBuffer(
+     * java.lang.StringBuffer)
+     */
+    public void printToBuffer( StringBuffer a_buf )
+    {
+        a_buf.append( '(' ).append( getAttribute() );
+        a_buf.append( "-" );
+        a_buf.append( this.m_dnAttributes );
+        a_buf.append( "-EXTENSIBLE-" );
+        a_buf.append( this.m_matchingRuleId );
+        a_buf.append( "-" );
+        a_buf.append( this.value );
+        a_buf.append( ')' );
+
+        if ( ( null != getAnnotations() )
+                && getAnnotations().containsKey( "count" ) )
+        {
+            a_buf.append( '[' );
+            a_buf.append( getAnnotations().get( "count" ).toString() );
+            a_buf.append( "] " );
+        }
+        else
+        {
+            a_buf.append( ' ' );
+        }
+    }
+
+
+    /**
+     * @see java.lang.Object#toString()
+     */
+    public String toString()
+    {
+        StringBuffer l_buf = new StringBuffer() ;
+        printToBuffer( l_buf ) ;
+
+        return ( l_buf.toString() ) ;
+    }
+
+
+    /**
+     * @see org.apache.ldap.common.filter.ExprNode#accept(
+     * org.apache.ldap.common.filter.FilterVisitor)
+     */
+    public void accept( FilterVisitor a_visitor )
+    {
+        if ( a_visitor.canVisit( this ) )
+        {
+            a_visitor.visit( this ) ;
+        }
+    }
+}

Modified: incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/filter/SimpleNode.java
==============================================================================
--- incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/filter/SimpleNode.java
(original)
+++ incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/filter/SimpleNode.java
Sun Jun 13 21:10:30 2004
@@ -202,158 +202,159 @@
  *   limitations under the License.
  *
  */
-
-/*
- * $Id: SimpleNode.java,v 1.8 2003/10/14 04:59:23 akarasulu Exp $
- *
- * -- (c) LDAPd Group
- * -- Please refer to the LICENSE.txt file in the root directory of      --
- * -- any LDAPd project for copyright and distribution information.      --
- *
- */
-package org.apache.ldap.common.filter ;
-
-
-/**
- * A simple assertion value node.
- *
- * @author <a href="mailto:aok123@bellsouth.net">Alex Karasulu</a>
- * @author $author$
- * @version $Revision: 1.8 $
- */
-public class SimpleNode extends LeafNode
-{
-    /** the value */
-    private final String m_value ;
-
-
-    /**
-     * Creates a new SimpleNode object.
-     *
-     * @param a_attribute the attribute name
-     * @param a_value the value to test for 
-     * @param a_type the type of the assertion
-     */
-    public SimpleNode( String a_attribute, String a_value, int a_type )
-    {
-        super( a_attribute, a_type ) ;
-        m_value = a_value ;
-
-        switch ( a_type )
-        {
-        case ( APPROXIMATE ):
-            break ;
-
-        case ( EQUALITY ):
-            break ;
-
-        case ( EXTENSIBLE ):
-            throw new IllegalArgumentException( "Assertion type supplied is "
-                + "extensible.  Use ExtensibleNode instead." ) ;
-
-        case ( GREATEREQ ):
-            break ;
-
-        case ( LESSEQ ):
-            break ;
-
-        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." ) ;
-        }
-    }
-
-    /**
-     * Gets the value.
-     *
-     * @return the value
-     */
-    public final String getValue()
-    {
-        return m_value ;
-    }
-
-
-    /**
-     * @see org.apache.ldap.common.filter.ExprNode#printToBuffer(java.lang.StringBuffer)
-     */
-    public void printToBuffer( StringBuffer a_buf )
-    {
-        a_buf.append( '(' ).append( getAttribute() ) ;
-
-        switch ( getAssertionType() )
-        {
-        case ( APPROXIMATE ):
-            a_buf.append( "~=" ) ;
-
-            break ;
-
-        case ( EQUALITY ):
-            a_buf.append( "=" ) ;
-
-            break ;
-
-        case ( GREATEREQ ):
-            a_buf.append( ">=" ) ;
-
-            break ;
-
-        case ( LESSEQ ):
-            a_buf.append( "<=" ) ;
-
-            break ;
-
-        default:
-            a_buf.append( "UNKNOWN" ) ;
-        }
-
-
-        a_buf.append( m_value ) ;
-        a_buf.append( ')' ) ;
-
-        if ( ( null != getAnnotations() )
-                && getAnnotations().containsKey( "count" ) )
-        {
-            a_buf.append( '[' ) ;
-            a_buf.append( getAnnotations().get( "count" ).toString() ) ;
-            a_buf.append( "] " ) ;
-        }
-        else
-        {
-            a_buf.append( ' ' ) ;
-        }
-    }
-
-
-    /**
-     * @see java.lang.Object#toString()
-     */
-    public String toString()
-    {
-        StringBuffer l_buf = new StringBuffer() ;
-        printToBuffer( l_buf ) ;
-
-        return ( l_buf.toString() ) ;
-    }
-
-
-    /**
-     * @see org.apache.ldap.common.filter.ExprNode#accept(
-     * org.apache.ldap.common.filter.FilterVisitor)
-     */
-    public void accept( FilterVisitor a_visitor )
-    {
-        if ( a_visitor.canVisit( this ) ) 
-        {
-            a_visitor.visit( this ) ;
-        }
-    }
-}
+
+/*
+ * $Id: SimpleNode.java,v 1.8 2003/10/14 04:59:23 akarasulu Exp $
+ *
+ * -- (c) LDAPd Group
+ * -- Please refer to the LICENSE.txt file in the root directory of      --
+ * -- any LDAPd project for copyright and distribution information.      --
+ *
+ */
+package org.apache.ldap.common.filter ;
+
+
+/**
+ * A simple assertion value node.
+ *
+ * @author <a href="mailto:aok123@bellsouth.net">Alex Karasulu</a>
+ * @author $author$
+ * @version $Revision: 1.8 $
+ */
+public class SimpleNode extends LeafNode
+{
+    /** the value */
+    private final String m_value ;
+
+
+    /**
+     * Creates a new SimpleNode object.
+     *
+     * @param a_attribute the attribute name
+     * @param a_value the value to test for 
+     * @param a_type the type of the assertion
+     */
+    public SimpleNode( String a_attribute, String a_value, int a_type )
+    {
+        super( a_attribute, a_type ) ;
+        m_value = a_value ;
+
+        switch ( a_type )
+        {
+        case ( APPROXIMATE ):
+            break ;
+
+        case ( EQUALITY ):
+            break ;
+
+        case ( EXTENSIBLE ):
+            throw new IllegalArgumentException( "Assertion type supplied is "
+                + "extensible.  Use ExtensibleNode instead." ) ;
+
+        case ( GREATEREQ ):
+            break ;
+
+        case ( LESSEQ ):
+            break ;
+
+        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." ) ;
+        }
+    }
+
+    /**
+     * Gets the value.
+     *
+     * @return the value
+     */
+    public final String getValue()
+    {
+        return m_value ;
+    }
+
+
+    /**
+     * @see org.apache.ldap.common.filter.ExprNode#printToBuffer(
+     * java.lang.StringBuffer)
+     */
+    public void printToBuffer( StringBuffer a_buf )
+    {
+        a_buf.append( '(' ).append( getAttribute() ) ;
+
+        switch ( getAssertionType() )
+        {
+        case ( APPROXIMATE ):
+            a_buf.append( "~=" ) ;
+
+            break ;
+
+        case ( EQUALITY ):
+            a_buf.append( "=" ) ;
+
+            break ;
+
+        case ( GREATEREQ ):
+            a_buf.append( ">=" ) ;
+
+            break ;
+
+        case ( LESSEQ ):
+            a_buf.append( "<=" ) ;
+
+            break ;
+
+        default:
+            a_buf.append( "UNKNOWN" ) ;
+        }
+
+
+        a_buf.append( m_value ) ;
+        a_buf.append( ')' ) ;
+
+        if ( ( null != getAnnotations() )
+                && getAnnotations().containsKey( "count" ) )
+        {
+            a_buf.append( '[' ) ;
+            a_buf.append( getAnnotations().get( "count" ).toString() ) ;
+            a_buf.append( "] " ) ;
+        }
+        else
+        {
+            a_buf.append( ' ' ) ;
+        }
+    }
+
+
+    /**
+     * @see java.lang.Object#toString()
+     */
+    public String toString()
+    {
+        StringBuffer l_buf = new StringBuffer() ;
+        printToBuffer( l_buf ) ;
+
+        return ( l_buf.toString() ) ;
+    }
+
+
+    /**
+     * @see org.apache.ldap.common.filter.ExprNode#accept(
+     * org.apache.ldap.common.filter.FilterVisitor)
+     */
+    public void accept( FilterVisitor a_visitor )
+    {
+        if ( a_visitor.canVisit( this ) ) 
+        {
+            a_visitor.visit( this ) ;
+        }
+    }
+}

Mime
View raw message