### Question:
Predicate implements Serializable { public boolean filter(Tuple t) { Field opField= t.getField(numField); return opField.compare(op,operand); } Predicate(int field, Op op, Field operand); int getField(); Op getOp(); Field getOperand(); boolean filter(Tuple t); String toString();  }### Answer:
@Test public void filter() { int[] vals = new int[] { -1, 0, 1 }; for (int i : vals) { Predicate p = new Predicate(0, Predicate.Op.EQUALS, TestUtil.getField(i)); assertFalse(p.filter(Utility.getHeapTuple(i - 1))); assertTrue(p.filter(Utility.getHeapTuple(i))); assertFalse(p.filter(Utility.getHeapTuple(i + 1))); } for (int i : vals) { Predicate p = new Predicate(0, Predicate.Op.GREATER_THAN, TestUtil.getField(i)); assertFalse(p.filter(Utility.getHeapTuple(i - 1))); assertFalse(p.filter(Utility.getHeapTuple(i))); assertTrue(p.filter(Utility.getHeapTuple(i + 1))); } for (int i : vals) { Predicate p = new Predicate(0, Predicate.Op.GREATER_THAN_OR_EQ, TestUtil.getField(i)); assertFalse(p.filter(Utility.getHeapTuple(i - 1))); assertTrue(p.filter(Utility.getHeapTuple(i))); assertTrue(p.filter(Utility.getHeapTuple(i + 1))); } for (int i : vals) { Predicate p = new Predicate(0, Predicate.Op.LESS_THAN, TestUtil.getField(i)); assertTrue(p.filter(Utility.getHeapTuple(i - 1))); assertFalse(p.filter(Utility.getHeapTuple(i))); assertFalse(p.filter(Utility.getHeapTuple(i + 1))); } for (int i : vals) { Predicate p = new Predicate(0, Predicate.Op.LESS_THAN_OR_EQ, TestUtil.getField(i)); assertTrue(p.filter(Utility.getHeapTuple(i - 1))); assertTrue(p.filter(Utility.getHeapTuple(i))); assertFalse(p.filter(Utility.getHeapTuple(i + 1))); } }