Simplifying the body of the acceptDate() method in class TransactionListFilteredBySearch, which is a static class of class FilteredLists. The huge if-elseif-else conditional statements in the body of this method have been changed to switch statement.
Self-encapsulate the type code (dateFilter).
New abstract class under the name DateType is created.
Eleven subclasses of the abstract class DateType is created, a subclass for each type code (Today, Yesterday, ThisWeek, ThisSemiMonth, LastSemiMonth, ThisMonth, LastMonth, ThisQuarter, LastQuarter, ThisYear, LastYear).
Now, all the cases of the switch statement in the acceptDate() method are invoking the getDateTypeCode(Date today, Transaction t) method in these subclasses.
Local variable today of type Date moved from method acceptDate() to the abstract class DateType.
The switch statement is removed from acceptDate(...) method. Instead, a new switch method is used in the abstract class DateType to create the right runtime subclass type. In this way, we get rid of the switch statement code smell by replacing the code type with strategy pattern, and now polymorphism is used to invoke the method from the right subclass.