public boolean equals( Object other ) { if ( this == other ) { return true; } if ( !( other instanceof LeafNode ) ) { return false; } //noinspection SimplifiableIfStatement if ( other.getClass() != this.getClass() ) { return false; } return attribute.equals( ( ( LeafNode ) other ).getAttribute() ); } }
/** * Clone the Node */ @Override public ExprNode clone() { return super.clone(); }
if ( !super.equals( other ) )
if ( !attributeRegistry.hasAttributeType( ln.getAttribute() ) ) buf.append( ln.getAttribute() ); buf.append( "' not evaluted at all. Returning empty enumeration." ); log.warn( buf.toString() ); if ( !attributeRegistry.hasAttributeType( ln.getAttribute() ) ) buf.append( ln.getAttribute() ); buf.append( "' not evaluted at all. Returning empty enumeration." ); log.warn( buf.toString() ); if ( attributeRegistry.hasDescendants( leaf.getAttribute() ) ) Iterator descendants = attributeRegistry.descendants( leaf.getAttribute() ); AttributeType descendant = ( AttributeType ) descendants.next(); switch( leaf.getAssertionType() ) default: throw new IllegalStateException( "Unknown assertion type: " + leaf.getAssertionType() );
/** * @see Evaluator#evaluate(ExprNode, String, Attributes) */ public boolean evaluate( ExprNode node, String dn, Attributes entry ) throws NamingException { if ( node instanceof ScopeNode ) { return scopeEvaluator.evaluate( node, dn, entry ); } switch ( ( ( LeafNode ) node ).getAssertionType() ) { case ( LeafNode.APPROXIMATE ): return evalEquality( ( SimpleNode ) node, entry ); case ( LeafNode.EQUALITY ): return evalEquality( ( SimpleNode ) node, entry ); case ( LeafNode.EXTENSIBLE ): throw new NotImplementedException(); case ( LeafNode.GREATEREQ ): return evalGreater( ( SimpleNode ) node, entry, true ); case ( LeafNode.LESSEQ ): return evalGreater( ( SimpleNode ) node, entry, false ); case ( LeafNode.PRESENCE ): String attrId = ( ( PresenceNode ) node ).getAttribute(); return evalPresence( attrId, entry ); case ( LeafNode.SUBSTRING ): return substringEvaluator.evaluate( node, dn, entry ); default: throw new NamingException( "Unrecognized leaf node type: " + ( ( LeafNode ) node ).getAssertionType() ); } }
/** * @see Object#hashCode() * @return the instance's hash code */ public int hashCode() { int h = 37; h = h * 17 + super.hashCode(); h = h * 17 + ( value == null ? 0 : value.hashCode() ); return h; }
/** * @see java.lang.Object#toString() * @return A string representing the AndNode */ public String toString() { StringBuilder buf = new StringBuilder(); buf.append( '(' ).append( getAttribute() ).append( "=*" ); buf.append( super.toString() ); buf.append( ')' ); return buf.toString(); } }
try if ( attrRegistry.hasDescendants( leaf.getAttribute() ) ) Iterator descendants = attrRegistry.descendants( leaf.getAttribute() ); while ( descendants.hasNext() ) AttributeType descendant = ( AttributeType ) descendants.next(); switch( leaf.getAssertionType() ) default: throw new IllegalStateException( "Unknown assertion type: " + leaf.getAssertionType() );
/** * @see org.apache.directory.server.core.partition.impl.btree.Evaluator#evaluate(ExprNode, IndexRecord) */ public boolean evaluate( ExprNode node, IndexRecord record ) throws NamingException { if ( node instanceof ScopeNode ) { return scopeEvaluator.evaluate( node, record ); } switch ( ( ( LeafNode ) node ).getAssertionType() ) { case ( LeafNode.APPROXIMATE ): return evalEquality( ( SimpleNode ) node, record ); case ( LeafNode.EQUALITY ): return evalEquality( ( SimpleNode ) node, record ); case ( LeafNode.EXTENSIBLE ): throw new NotImplementedException(); case ( LeafNode.GREATEREQ ): return evalGreater( ( SimpleNode ) node, record, true ); case ( LeafNode.LESSEQ ): return evalGreater( ( SimpleNode ) node, record, false ); case ( LeafNode.PRESENCE ): String attrId = ( ( PresenceNode ) node ).getAttribute(); return evalPresence( attrId, record ); case ( LeafNode.SUBSTRING ): return substringEvaluator.evaluate( node, record ); default: throw new NamingException( "Unrecognized leaf node type: " + ( ( LeafNode ) node ).getAssertionType() ); } }
/** * @see Object#hashCode() * @return the instance's hash code */ public int hashCode() { int h = 37; h = h*17 + super.hashCode(); h = h*17 + ( dnAttributes ? 1 : 0 ); h = h*17 + matchingRuleId.hashCode(); h = h*17 + value.hashCode(); return h; }
/** * @see java.lang.Object#toString() * @return A string representing the AndNode */ public String toString() { StringBuilder buf = new StringBuilder(); buf.append( '(' ).append( getAttribute() ); buf.append( "-" ); buf.append( dnAttributes ); buf.append( "-EXTENSIBLE-" ); buf.append( matchingRuleId ); buf.append( "-" ); buf.append( value ); buf.append( super.toString() ); buf.append( ')' ); return buf.toString(); } }
/** * Gets the total number of entries within the database index if one is * available otherwise the count of all the entries within the database is * returned. * * @param node the leaf node to get a full scan count for * @return the worst case full scan count * @throws NamingException if there is an error access database indices */ private BigInteger getFullScan( LeafNode node ) throws NamingException { if ( db.hasUserIndexOn( node.getAttribute() ) ) { Index idx = db.getUserIndex( node.getAttribute() ); int count = idx.count(); return BigInteger.valueOf( count ); } return MAX; }
/** * Clone the Node */ @Override public ExprNode clone() { ExprNode clone = (ExprNode)super.clone(); if ( anyPattern != null ) { ((SubstringNode)clone).anyPattern = new ArrayList<String>(); for ( String any:anyPattern ) { ((SubstringNode)clone).anyPattern.add( any ); } } return clone; }
switch ( leaf.getAssertionType() )
/** * @see Object#hashCode() * @return the instance's hash code */ public int hashCode() { int h = 37; h = h*17 + super.hashCode(); h = h*17 + ( initialPattern != null ? initialPattern.hashCode() : 0 ); if ( anyPattern != null ) { for ( String pattern:anyPattern ) { h = h*17 + pattern.hashCode(); } } h = h*17 + ( finalPattern != null ? finalPattern.hashCode() : 0 ); return h; }
buf.append( super.toString() );
if ( db.hasUserIndexOn( leaf.getAttribute() ) ) Index idx = db.getUserIndex( leaf.getAttribute() ); return BigInteger.valueOf( idx.count() );
/** * Clone the Node */ @Override public ExprNode clone() { ExprNode clone = super.clone(); // Clone the value ((SimpleNode<T>)clone).value = value.clone(); return clone; }
switch ( leaf.getAssertionType() )
if ( !attributeRegistry.hasAttributeType( ln.getAttribute() ) ) buf.append( ln.getAttribute() ); buf.append( "' not evaluted at all. Only using scope node." ); log.warn( buf.toString() );