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

wip: add getAtomQueryFeaturesObject #205

Merged
merged 3 commits into from
May 27, 2024
Merged

wip: add getAtomQueryFeaturesObject #205

merged 3 commits into from
May 27, 2024

Conversation

lpatiny
Copy link
Member

@lpatiny lpatiny commented May 13, 2024

No description provided.

Copy link
Member Author

@lpatiny lpatiny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@targos I could not find a good way to return a JavaScriptObject from a Java class. I wanted to do this to expose the queryFeatures of the atoms. Could you help me ?

@targos
Copy link
Member

targos commented May 13, 2024

It depends what you want to return. If you want a plain JS object, you should not create a new Java class.

@lpatiny lpatiny marked this pull request as ready for review May 27, 2024 09:40
@lpatiny lpatiny merged commit c1843b8 into main May 27, 2024
4 checks passed
@lpatiny lpatiny deleted the queryFeatures branch May 27, 2024 10:51
PlainJSObject moleculeQueryFeatures = PlainJSObject.create();

moleculeQueryFeatures.setPropertyBoolean("aromatic",
(oclMolecule.getAtomQueryFeatures(atom) & Molecule.cAtomQFAromatic) > 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be significantly faster to call getAtomQueryFeatures(atom) only once and put the value in a local variable?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed good idea! The method getAtomQueryFeatures is super small so probably small impact but the code will look any much better and we will have the possibility to optimise the part that is 'int' and not long. Thanks.

public long getAtomQueryFeatures(int atom) {
return mAtomQueryFeatures[atom];
}

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

Successfully merging this pull request may close these issues.

None yet

2 participants