-
Notifications
You must be signed in to change notification settings - Fork 291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filter Units Based on Weapon Class #3932
Conversation
Add Weapon Class Counts to MechSummary
Adds a new FT called WeaponClassFT that is adjacent to EquipmentFT. Additionally adds an Integer member to ExpNode. This is set to null when ExpNode is constructed with a String (only constructor before). But the new constructor (which takes an Integer instead of a String), sets the weaponClass. If the ExpNode has a non-null weaponClass, we know it's a request for a filter on weaponClass instead of general equipment. Logic is then added to filter units based on weapon class (which was added to the MechSummary in a previous commit).
Codecov ReportBase: 23.56% // Head: 23.54% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #3932 +/- ##
============================================
- Coverage 23.56% 23.54% -0.02%
Complexity 4810 4810
============================================
Files 2212 2212
Lines 243034 243165 +131
Branches 45481 45506 +25
============================================
Hits 57264 57264
- Misses 184311 184442 +131
Partials 1459 1459
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
/** | ||
* A table model for displaying weapon types | ||
*/ | ||
public class WeaponClassTableModel extends AbstractTableModel { |
Check notice
Code scanning / CodeQL
Inner class could be static
@@ -1294,6 +1461,25 @@ | |||
} | |||
} | |||
|
|||
public class WeaponClassFT extends FilterTokens { |
Check notice
Code scanning / CodeQL
Inner class could be static
Bail on filter if null equipment or ExpNode encountered.
This pull request introduces 2 alerts when merging 381b54a into 1390a08 - view on LGTM.com new alerts:
|
This pull request introduces 2 alerts and fixes 1 when merging 6a5c09d into 1390a08 - view on LGTM.com new alerts:
fixed alerts:
|
We would need the issues identified in the automated code review addressed before we can do a final review. |
This pull request fixes 1 alert when merging 852010f into 1390a08 - view on LGTM.com fixed alerts:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple minor changes, looks good otherwise.
@NickAragua I'm not sure why it won't let me respond to your comment about the exception, but here we are. |
This pull request fixes 1 alert when merging 7f92ce0 into 1390a08 - view on LGTM.com fixed alerts:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I'll get it merged later tonight.
I think there might be an issue with this. I started by setting up a search for Gauss and LRMs. It returned no results, but if I set up a search with Gauss rifles (Clan and IS) and all the common LRMs(clan and IS) in the normal search it returns over 50 meks. Going back into the search I get the following. Nulls in the search. |
Huh. I didn't test with Gauss. I'll check on my end. |
Yep. I get the same problem. I'll have a look-see. Incidentally, while filtering on LRMs works, when you close, then re-open the advanced search, you eventually get a (1 null) string, like you're seeing with the Gauss. |
Also looks like no matter what you do if you come back into advanced search the null values above are there. I love this ability to search like this..btw. |
This PR should be reverted. I made a mistake and was filtering based on the Aero weapon class, not a human understanding of weapon classes. The primary result of this is that Gauss weapons are labeled under AC class, since that is how Aero classifies them. The feature will have to be implemented via a different method. |
This branch enables the advanced filter to filter units based on weapon class in addition to just individual weapons/equipment. For example, if you previously wanted to get all mechs that mounted any type of LRM (intro, standard, or advanced), you would have to add a whole plethora of weapons to the filter list. Now you just selected the "LRM" class and add that to the filter.
To implement this feature, I added a list of weapon classes to the MechSummary object, along with corresponding quantity counts for each weapon class the unit mounts. The advanced filter was then updated to include a weapon class table that allows advanced filtering based on weapon class. This also involved modifying the filter tokens (adding a new WeaponClassFT class), the ExpNode class (adding a weaponClass field and a new constructor to fill it in), and the evaluate functions (to take the list of weapon classes the mech mounts, and to compare it correctly with the ExpNode).