@@ -140,7 +140,7 @@ public static ArrayList<MethodWrapper> getMethods(ArrayList<Pair<String, String>
140140 for (MethodWrapper method : methods .values ()) {
141141
142142
143- if (method .getUpdateOperation ().equals (Constants .METHOD_DELETED ) || method . isTrainingMethod () )
143+ if (method .getUpdateOperation ().equals (Constants .METHOD_DELETED ))
144144 continue ;
145145
146146 filteredList .add (method );
@@ -187,20 +187,31 @@ private static ArrayList<MethodWrapper> filterList(ArrayList<Pair<String, String
187187
188188 for (String methodSignature : methods .keySet ()) {
189189
190- if ((filters .contains (Constants .FILE_FILTER ) && !methodSignature .contains (currentFile ))
191- || (!filters .contains (Constants .DELETED_FILTER ) && methods .get (methodSignature ).getUpdateOperation ().equals (Constants .METHOD_DELETED ))
192- || (methods .get (methodSignature ).isTrainingMethod () && !filters .contains (Constants .TRAIN_FILTER )))
193- continue ;
194-
195- for (Category category : methods .get (methodSignature ).getCategories ()) {
196-
197- if ((filters .contains (Constants .DELETED_FILTER ) && methods .get (methodSignature ).getUpdateOperation ().equals (Constants .METHOD_DELETED ))
198- || filters .contains (new Pair <>(Constants .FILTER_TYPE , Formatter .toTitleCase (category .toString ())))
199- || filters .contains (new Pair <>(Constants .FILTER_CWE , Formatter .toTitleCase (category .toString ())))
200- || (methods .get (methodSignature ).isTrainingMethod () && filters .contains (Constants .TRAIN_FILTER ))) {
201-
202- filteredList .add (methods .get (methodSignature ));
203- break ;
190+ if (filters .size ()==1 && filters .contains (Constants .TRAIN_FILTER ) && methods .get (methodSignature ).isTrainingMethod ()){
191+ filteredList .add (methods .get (methodSignature ));
192+ }else if ((filters .contains (Constants .FILE_FILTER ) && !methodSignature .contains (currentFile ))
193+ || (!filters .contains (Constants .DELETED_FILTER ) && methods .get (methodSignature ).getUpdateOperation ().equals (Constants .METHOD_DELETED ))){
194+ } else if (filters .size ()>1 && filters .contains (Constants .TRAIN_FILTER )) {
195+ for (Category category : methods .get (methodSignature ).getCategories ()) {
196+ Pair <String , String > typePair = new Pair <>(Constants .FILTER_TYPE , Formatter .toTitleCase (category .toString ()));
197+ Pair <String , String > cwePair = new Pair <>(Constants .FILTER_CWE , Formatter .toTitleCase (category .toString ()));
198+ boolean isDeleted = filters .contains (Constants .DELETED_FILTER ) && methods .get (methodSignature ).getUpdateOperation ().equals (Constants .METHOD_DELETED );
199+ boolean isTypeFilter = filters .contains (typePair ) || filters .contains (cwePair );
200+ if ((isDeleted || isTypeFilter ) && methods .get (methodSignature ).isTrainingMethod ()){
201+ filteredList .add (methods .get (methodSignature ));
202+ break ;
203+ }
204+ }
205+ } else {
206+ for (Category category : methods .get (methodSignature ).getCategories ()) {
207+ Pair <String , String > typePair = new Pair <>(Constants .FILTER_TYPE , Formatter .toTitleCase (category .toString ()));
208+ Pair <String , String > cwePair = new Pair <>(Constants .FILTER_CWE , Formatter .toTitleCase (category .toString ()));
209+ boolean isDeleted = filters .contains (Constants .DELETED_FILTER ) && methods .get (methodSignature ).getUpdateOperation ().equals (Constants .METHOD_DELETED );
210+ boolean isTypeFilter = filters .contains (typePair ) || filters .contains (cwePair );
211+ if (isDeleted || isTypeFilter ){
212+ filteredList .add (methods .get (methodSignature ));
213+ break ;
214+ }
204215 }
205216 }
206217 }
0 commit comments