-
Notifications
You must be signed in to change notification settings - Fork 8
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
Clean indexed terms when removing an equation #808
Conversation
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@gmail.com>
@@ -152,6 +152,14 @@ public Equation<V, E> removeEquation(int num, E type) { | |||
if (equation != null) { | |||
Pair<ElementType, Integer> element = Pair.of(type.getElementType(), num); | |||
equationsByElement.get(element).remove(equation); | |||
if (equationTermsByElement != null) { |
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.
This is not working on my case and I don't know exactly why. If I put
public Equation<V, E> removeEquation(int num, E type) {
Pair<Integer, E> p = Pair.of(num, type);
Equation<V, E> equation = equations.remove(p);
if (equation != null) {
Pair<ElementType, Integer> element = Pair.of(type.getElementType(), num);
equationsByElement.get(element).remove(equation);
equationTermsByElement = null;
indexAllTerms();
notifyEquationChange(equation, EquationEventType.EQUATION_REMOVED);
}
return equation;
}
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.
it is supposed to be equivalent but faster. The way you did it reindex everything which would be very slow.
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.
looking at test case I did, does it seem ok?
Kudos, SonarCloud Quality Gate passed! |
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com> (cherry picked from commit c4d6405)
Please check if the PR fulfills these requirements
Does this PR already have an issue describing the problem?
No
What kind of change does this PR introduce?
Bug fix
What is the current behavior?
When an equation is removed, corresponding indexed terms are not cleaned.
Does this PR introduce a breaking change or deprecate an API?
Other information: