Java bindings: OBMol.SetData()

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Java bindings: OBMol.SetData()

Jon Fuller
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Java bindings: OBMol.SetData()

Noel O'Boyle
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Java bindings: OBMol.SetData()

Jon Fuller
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Java bindings: OBMol.SetData()

elizadd
This post has NOT been accepted by the mailing list yet.
In reply to this post by Jon Fuller
I would also motivate just about every person to save this web page for any favorite assistance to assist posted the appearance.
find out
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

read

robertfcrocker
This post has NOT been accepted by the mailing list yet.
It was wondering if I could use this write-up on my other website, I will link it back to your website though.Great Thanks.
read
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Java bindings: OBMol.SetData()

ACTprepclasses
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.  
Loading...