### Question:
FastPointInPolygon extends FastInPolygon implements Predicate<Point> { @Override public boolean test(Point point) { return crossingNumber(point, true) % 2 == 1; } <P extends Geometry & Polygonal> FastPointInPolygon(P geom); @Override boolean test(Point point);  }### Answer:
@Test public void testPointInPolygon() { Polygon p = createPolygon(); FastPointInPolygon pip = new FastPointInPolygon(p); GeometryFactory gf = new GeometryFactory(); assertEquals(pip.test(gf.createPoint(new Coordinate(-0.5,0))), true); assertEquals(pip.test(gf.createPoint(new Coordinate(0.5,0))), false); assertEquals(pip.test(gf.createPoint(new Coordinate(1.5,0))), false); }
@Test public void testPointInPolygonWithHole() { Polygon p = createPolygonWithHole(); FastPointInPolygon pip = new FastPointInPolygon(p); GeometryFactory gf = new GeometryFactory(); assertEquals(pip.test(gf.createPoint(new Coordinate(2.25,0))), true); assertEquals(pip.test(gf.createPoint(new Coordinate(3,0))), false); assertEquals(pip.test(gf.createPoint(new Coordinate(4.5,0))), false); }
@Test public void testPointInMultiPolygon() { MultiPolygon p = createMultiPolygon(); FastPointInPolygon pip = new FastPointInPolygon(p); GeometryFactory gf = new GeometryFactory(); assertEquals(pip.test(gf.createPoint(new Coordinate(-0.5,0))), true); assertEquals(pip.test(gf.createPoint(new Coordinate(0.5,0))), false); assertEquals(pip.test(gf.createPoint(new Coordinate(1.5,0))), false); assertEquals(pip.test(gf.createPoint(new Coordinate(2.25,0))), true); assertEquals(pip.test(gf.createPoint(new Coordinate(3,0))), false); assertEquals(pip.test(gf.createPoint(new Coordinate(4.5,0))), false); }