Red-Blue Partitioning of int[]
- RedBluePartionerOfInt:
abstract class having a partition() method that
rearranges the elements in a given array of type int[]
into segments containing RED and BLUE (i.e., non-RED) values,
respectively. A concrete child class must provide the body of
the isRed(int) method, which decides into which
category (RED or BLUE) each int value falls.
- EvenOddPartioner:
concrete child class of RedBluePartitionerOfInt having
an isRed() method that classifies even numbers as RED
and odd numbers as BLUE.
- NegPosPartitioner:
concrete child class of RedBluePartitionerOfInt having
an isRed() method that classifies negative numbers as RED
and nonnegative numbers as BLUE.
- RedBluePartTester:
Java application that can be used for testing the classes
listed above.