提交 15f1a4ef 编写于 作者: L lancea

7097386: Correct error in Predicate javadoc example

Reviewed-by: alanb, shade
上级 c41d63a2
...@@ -56,44 +56,43 @@ import java.sql.*; ...@@ -56,44 +56,43 @@ import java.sql.*;
* <pre>{@code * <pre>{@code
* public class Range implements Predicate { * public class Range implements Predicate {
* *
* private Object lo[]; * private int[] lo;
* private Object hi[]; * private int[] hi;
* private int idx[]; * private int[] idx;
* *
* public Range(Object[] lo, Object[] hi, int[] idx) { * public Range(int[] lo, int[] hi, int[] idx) {
* this.lo = lo; * this.lo = lo;
* this.hi = hi; * this.hi = hi;
* this.idx = idx; * this.idx = idx;
* } * }
* *
* public boolean evaluate(RowSet rs) { * public boolean evaluate(RowSet rs) {
* CachedRowSet crs = (CachedRowSet)rs;
* boolean bool1,bool2;
* *
* // Check the present row determine if it lies * // Check the present row determine if it lies
* // within the filtering criteria. * // within the filtering criteria.
* *
* for (int i = 0; i < idx.length; i++) { * for (int i = 0; i < idx.length; i++) {
* int value;
* try {
* value = (Integer) rs.getObject(idx[i]);
* } catch (SQLException ex) {
* Logger.getLogger(Range.class.getName()).log(Level.SEVERE, null, ex);
* return false;
* }
* *
* if ((rs.getObject(idx[i]) >= lo[i]) && * if (value < lo[i] && value > hi[i]) {
* (rs.getObject(idx[i]) >= hi[i]) { * // outside of filter constraints
* bool1 = true; // within filter constraints * return false;
* } else { * }
* bool2 = true; // outside of filter constraints * }
* } * // Within filter constraints
* } * return true;
*
* if (bool2) {
* return false;
* } else {
* return true;
* }
* } * }
* } * }
* }</pre> * }</pre>
* <P> * <P>
* The example above implements a simple range predicate. Note, that * The example above implements a simple range predicate. Note, that
* implementations should but are not required to provider <code>String</code> * implementations should but are not required to provide <code>String</code>
* and integer index based constructors to provide for JDBC RowSet Implementation * and integer index based constructors to provide for JDBC RowSet Implementation
* applications that use both column identification conventions. * applications that use both column identification conventions.
* *
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册