Coalesce Predicate Information and Improve Predicate Testing - #5342
Conversation
da9a8e9 to
1dcbd26
Compare
|
Edit to add: review assisted by opus |
|
Sidenote, but tests blow up for now x3 something while forming a multi crashes |
add set settings copy settings
count with new interface instead of PredicateSettings organize methods in MultiPredicate
…ed to the MultiPredicate instead of its children javadoc
at least merge if b is single
also don't increment count for -1 global/slice max
|
So, the reason many tests were failing is due to certain multiblocks, namely the Large Chemical Reactor, not forming correctly. The formation failure is because the global/slice count maps can have "duplicated" keys. The keys are being duplicated because they (base predicates and multi predicates) are being copied in the A quick fix is to stop copying on combination, but this then results in undesirable mutation (parents) when using the same multipredicate reference combined with two other multi predicates. like so: var a = blocks(...)
var b = blocks(...).and(a) // a is parent to {a + b}
var c = blocks(...).and(a) // a is now parent to {a + c}I could use a list of parents, but then it becomes difficult to determine which parent to call in I've also made an attempt to implement an equals method for BasePredicate and TestablePredicate, but this doesn't seem to help, the duplicate keys are still present in the count maps. I'm not entirely sure how to fix this. |
move TestType into own class create PredicateResult to keep track of MultiPredicate call chain `getPredicateAtPos()` now returns a nonnull result rework XOR to not require a full override of `getPredicateAtPos()` delete parent field in BasePredicate and MultiPredicate remove leaf and branch methods in MultiPredicate
check if a is single as well sort on combine
simplify TestablePredicate hash
rename with -> set
test self in and/or/xor get rid of second condition in MultiPredicate as it's redundant now
move air and any stuff into MultiPredicate only move set default settings to type makePredicate MultiPredicate of -> ofSingle
improve XorPredicate on predicate match
fixed missed count in PredicateResult
improve xor a bit
76f36ab to
84f5c8b
Compare
get rid of is top method add javadoc simplify TestType error methods a bit
What
Multipredicates should now be able to be treated like base predicates for testing min/max counts
Implementation Details
Added record
PredicateSettingswhich combines several of BasePredicate's fieldsMultiPredicate also has a settings field, which is nonnull by default
MultiPredicate settings are checked along with their children
getPredicateAtPos()now returns a PredicateResult record, which stores the matched base predicate and a parent chainBasePredicate's Air/any fields are removed and handled completely in MultiPredicate
multi predicate and base predicate have copy, equals, and hash methods
the predicate context counts both base predicates and multi predicates
added TestType enum to clean up testing logic between base predicate and multi predicate
AI Usage
Outcome
you should be able to do
a.or(b).setMinCount(4)to mean "4 combined of either predicates" nowHow Was This Tested
ran client, only check the assembly line which formed as expected