Dear All,
I had a question about the use of OBMol.SetData() through the Java bindings. I would expect to be able to do something like this: OBCommentData comment = new OBCommentData() comment.SetData("This is a comment"); comment.SetAttribute("cmt"); mol.SetData(comment); Then to read back something like this: OBCommentData commentBack = (OBCommentData) mol.GetData("cmt"); However the SetData method does not exist in the OBMol class. As I understand this differs to the C++ classes: e.g. http://openbabel.org/dev-api/classOpenBabel_1_1OBGenericData.shtml where I could use (here for the OBAtom): atom.SetData(label); Could anyone provide a suggestion as to how I should approach this problem? I am using the OpenBabel 2.3.1 jar file (and related install). Many thanks in advance, Jon Fuller ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ OpenBabel-discuss mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/openbabel-discuss |
Administrator
|
Use CloneData instead of SetData.
On 17 September 2012 15:16, Jon Fuller <[hidden email]> wrote: > Dear All, > > I had a question about the use of OBMol.SetData() through the Java > bindings. I would expect to be able to do something like this: > > OBCommentData comment = new OBCommentData() > comment.SetData("This is a comment"); > comment.SetAttribute("cmt"); > mol.SetData(comment); > > Then to read back something like this: > OBCommentData commentBack = (OBCommentData) mol.GetData("cmt"); > > > However the SetData method does not exist in the OBMol class. As I > understand this differs to the C++ classes: > e.g. http://openbabel.org/dev-api/classOpenBabel_1_1OBGenericData.shtml > where I could use (here for the OBAtom): > atom.SetData(label); > > Could anyone provide a suggestion as to how I should approach this problem? > > I am using the OpenBabel 2.3.1 jar file (and related install). > > Many thanks in advance, > > Jon Fuller > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > OpenBabel-discuss mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/openbabel-discuss ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ OpenBabel-discuss mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/openbabel-discuss |
Thanks very much. Problem solved.
As a point of interest (it is also noted in the wiki). I needed to use: OBCommentData commentBack = openbabel_java.toCommentData(mol.GetData("cmt")); instead of: OBCommentData commentBack = (OBCommentData) mol.GetData("cmt"); Best, Jon On 17 September 2012 16:24, Noel O'Boyle <[hidden email]> wrote: > Use CloneData instead of SetData. > > On 17 September 2012 15:16, Jon Fuller <[hidden email]> wrote: >> Dear All, >> >> I had a question about the use of OBMol.SetData() through the Java >> bindings. I would expect to be able to do something like this: >> >> OBCommentData comment = new OBCommentData() >> comment.SetData("This is a comment"); >> comment.SetAttribute("cmt"); >> mol.SetData(comment); >> >> Then to read back something like this: >> OBCommentData commentBack = (OBCommentData) mol.GetData("cmt"); >> >> >> However the SetData method does not exist in the OBMol class. As I >> understand this differs to the C++ classes: >> e.g. http://openbabel.org/dev-api/classOpenBabel_1_1OBGenericData.shtml >> where I could use (here for the OBAtom): >> atom.SetData(label); >> >> Could anyone provide a suggestion as to how I should approach this problem? >> >> I am using the OpenBabel 2.3.1 jar file (and related install). >> >> Many thanks in advance, >> >> Jon Fuller >> >> ------------------------------------------------------------------------------ >> Live Security Virtual Conference >> Exclusive live event will cover all the ways today's security and >> threat landscape has changed and how IT managers can respond. Discussions >> will include endpoint security, mobile security and the latest in malware >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> _______________________________________________ >> OpenBabel-discuss mailing list >> [hidden email] >> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ OpenBabel-discuss mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/openbabel-discuss |
This post has NOT been accepted by the mailing list yet.
In reply to this post by Jon Fuller
THIS POST IS INFORMATIVE FOR ME. i have an online education website so i try to read many blogs and forum related to education. from those forum i got many java tips. so i use this knowledge to share in my sites.
|
Free forum by Nabble | Edit this page |