1 26 27 package com.opensugar.cube.ldap; 28 29 import java.util.Dictionary ; 30 import java.util.Vector ; 31 32 public class EqualsClause extends SimpleClause { 34 35 public EqualsClause( String key, String value, boolean keysCaseSensitive ) { 36 super( key, value, keysCaseSensitive ); 37 } 38 39 public boolean filter( Dictionary props ) { 40 Object obj = getProperty( getKey(), props ); 41 if ( obj == null ) { 42 return false; 43 } 44 45 if ( obj instanceof Object [] || obj instanceof Vector ) { 46 int[] result = compareSets( obj, getValue() ); 47 int ret = Integer.MAX_VALUE; 48 for ( int i = 0; i < result.length; i++ ) { 49 if ( Math.abs( result[ i ] ) < ret ) { 50 ret = Math.abs( result[ i ] ); 51 } 52 } 53 return ret == 0; 54 } 55 56 return compare( obj, getValue() ) == 0; 57 } 58 59 public String getCanonicalForm() { 60 return "(" + getKey() + Filter.EQUALS + getValue() + ")"; 61 } 62 63 } 64 | Popular Tags |