-
Notifications
You must be signed in to change notification settings - Fork 0
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
phase out using getSymbol() to determine the element of an atom #1
Comments
Hi @egonw, I'd like to make my first contribution. Is this ticket still valid? |
Yep - we have some enum constants for Elements (Elements.Carbon) but I've always thought it would be nice to have the integer constants too. In other toolkits I use the nice an concise:
where
I'm not if @egonw has any ideas about an intermediate between these. |
I think adding them to the IAtom interface would be okay:
Then the second step I would add a |
I think either of the two options are good: if (atom.getAtomicNumber() == IAtom.H) { and if (atom.getElement() == IAtom.H) { The second is actually what I tried to make patches for at some point in the past, but it caused so many regressions back then. The idea behind all this was that String comparisons were expensive. Of course, this is may have quite changed in newer Java versions with internalized(?) Strings. The problem was that created every new John, I'd be delighted with either way forward. |
|
|
What about using a |
Sure - could technically by a byte... but neither would save much. Java likes to work in Integers so most of the time types get upcast first. |
Hi guys, thanks for the context and discussion. Very helpful. I've managed to build the project and will open up a PR after making some progress. Are there contribution guidelines that I should be aware of? |
We do not have these clearly written up, but your patches will be peer reviewed by an experienced CDK developer. The replies may vary from time to time. Make simple, clean, clear patches help. Patches cannot be too small. In patches particularly, solve one thing. For example, if you run into a likely bug during your updates (that happens!), then put that bug fix in a separate patch. Also, whitespace clean up, leave that to John's scripts: putting that in your patch makes it harder to find the functional changes. Important, all patches must compile and not introduce regressions. So, before you submit a PR, make sure all tests still succeed. General advice, start simple and small, and see how we reply. All feedback will not block the patch in the end, and is aimed at improving the code. (Generally, sometimes a patch is rejected, e.g. because a better solution comes up during the discussions.) |
Hi you should fork the project, push to a branch there and then open a PR |
Opened a PR here: cdk/cdk#636 |
Recently, the CDK IAtom was updated to combine the atom number and the symbol, making it principally atom number-based. In the past the symbol was the main source of information, and the atom number is not required to be always set. This means that a lot of code can now use the atom number, which is faster.
Therefore, one jobs is to replace the old code with the new code. For example,
can be rewritten as:
We welcome such patches. A single patch can make sure updates for one or more Java classes. It is appreciated if you check if there is a unit test for the method, ensuring that our test suite can pick up possible regressions (which should not happen in this case, but we never know).
The text was updated successfully, but these errors were encountered: