Skip to content
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

Added/removed strengths from StrengthVarManager are not reflected in model #12

Open
michi42 opened this issue Feb 3, 2019 · 0 comments

Comments

@michi42
Copy link
Contributor

michi42 commented Feb 3, 2019

At the moment, adding or removing strengths to or from a StrengthVarManager in a model (using get StrengthVarManager().getStrengthVarSet(). addAllStrengths()) is not reflected in the model: the resulting strengths can be changed, but changes are never passed to MAD-X.

The reason for this behavior is that JMadModelImpl has to register its listener for each strength to be passed to MAD-X. The only happens on initialization but not when the contents of the StrengthVarManager are modified.

To fix this, we would probably have to provide a listener in StrengthVarSet to observe strengths added/removed, and use this in JMadModelImpl to register the listener on the newly added strenghts (or remove it from deleted strengths, respectively).
In a second step, observing and concentrating the changes for all contained strengths could be completely delegated to StrengthVarSet, and the model would only add a single listener to StrengthVarSet (strengthValueChanged(Strength, newValue)) instead of tracking each Strength individually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant