/** * Check if this result set contains the given row. * * @param values the row * @return true if the row exists */ public boolean containsDistinct(Value[] values) { if (distinctRows == null) { distinctRows = ValueHashMap.newInstance(); for (Value[] row : rows) { ValueArray array = getArrayOfVisible(row); distinctRows.put(array, array.getList()); } } ValueArray array = ValueArray.get(values); return distinctRows.get(array) != null; }
private ValueArray getArrayOfVisible(Value[] values) { if (values.length > visibleColumnCount) { Value[] v2 = new Value[visibleColumnCount]; System.arraycopy(values, 0, v2, 0, visibleColumnCount); values = v2; } return ValueArray.get(values); }
/** * Remove the row from the result set if it exists. * * @param values the row */ public void removeDistinct(Value[] values) { if (!distinct) { DbException.throwInternalError(); } ValueArray array = ValueArray.get(values); distinctRows.remove(array); rowCount = distinctRows.size(); }