private ResultSet mainQueryPlan ( Criteria [ ] expressions ) { ResultSetInternal results = new ResultSetImpl ( this . fields ) ; if ( expressions == null || expressions . length == 0 ) { results . addResults ( searchableCollection . all ( ) ) ; } /* I am sure this looked easy to read when I wrote it. * If there is only one expression and first expression is a group then * the group is that first expression otherwise wrap * all of the expressions in an and clause. */ Group group = expressions . length == 1 && expressions [ 0 ] instanceof Group ? ( Group ) expressions [ 0 ] : ObjectFilter . and ( expressions ) ; /** * Run the filter on the group. */ doFilterGroup ( group , results ) ; return results ; }
This is the main criteria plan in case the name was not obvious .