package com.onaro.util.jfc.grouping; /** * A grouping criterion that is associated with a single table column. The value * that identifies the group is the value of the node at that column. */ public class ColumnCriterion implements Criterion { /** * The column number of the encapsulated table with which this criterion is * associated. */ private int columnNumber; /** * Sets the column number of the encapsulated table with which this criterion is * associated. * @param columnNumber the column number */ public ColumnCriterion(int columnNumber) { this.columnNumber = columnNumber; } /** * Gets the value of the node at the column this criterion is associated with. * @param node the node to get its criterion value * @return the value at the {@link ColumnCriterion#columnNumber} */ public Object getValue(Node node) { return node.getValueAt(columnNumber); } /** * Gets the number of the column used by this criterion. Used for unit * tests only. * @return an array of the column numbers the criterion is using */ public int[] getColumnNumbers() { return new int[] {columnNumber}; } }