public ConstantRange constantRange ( String fldName ) { ConstantRange cr = null ; for ( Term t : terms ) { Constant c = t . oppositeConstant ( fldName ) ; if ( c != null ) { Operator op = t . operator ( fldName ) ; if ( op == OP_GT ) cr = cr == null ? ConstantRange . newInstance ( c , false , null , false ) : cr . applyLow ( c , false ) ; else if ( op == OP_GTE ) cr = cr == null ? ConstantRange . newInstance ( c , true , null , false ) : cr . applyLow ( c , true ) ; else if ( op == OP_EQ ) cr = cr == null ? ConstantRange . newInstance ( c ) : cr . applyConstant ( c ) ; else if ( op == OP_LTE ) cr = cr == null ? ConstantRange . newInstance ( null , false , c , true ) : cr . applyHigh ( c , true ) ; else if ( op == OP_LT ) cr = cr == null ? ConstantRange . newInstance ( null , false , c , false ) : cr . applyHigh ( c , false ) ; } } // validate the constant range if ( cr != null && cr . isValid ( ) && ( cr . hasLowerBound ( ) || cr . hasUpperBound ( ) ) ) return cr ; return null ; }
Determines if the specified field is constrained by a constant range in this predicate . If so the method returns that range . If not the method returns null .