public accessor to parse.parts

Developers
2010-07-28
2013-04-16
  • Michael Liguori

    Michael Liguori - 2010-07-28

    Hi,

    Is there a reason why there isn't a public accessor to parse.parts?  I'm trying to store in a StringBuffer what parse.show() outputs and the only accessor not available is one for "parts".  I'm trying to use the Iterator on the LinkList.

    Is there another way to get the contents of what parse.show() does?

    Error Msg:

    $ /cygdrive/c/Program\ Files/Java/jdk1.6.0_21/bin/javac.exe DictationManagerTes
    t.java
    DictationManagerTest.java:63: parts has private access in opennlp.tools.parser.P
    arse
        for (Iterator i = parses.parts.iterator(); i.hasNext();) {
                                ^
    1 error


    Mike

     
  • Joern Kottmann

    Joern Kottmann - 2010-07-28

    Is there a reason why there isn't a public accessor to parse.parts?

    Yes the object state should be encapsulated. Thats why Parse only gives you
    an array which contains all the references to the parts, but not direct access to the parts list object itself.

    To get such an array call getChildren.

    Hope that helps,
    Jörn

     
  • Michael Liguori

    Michael Liguori - 2010-07-29

    Jörn,

    Thanks.

    Mike

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks