    001    package org.maltparser.core.syntaxgraph;
    002
    003    import java.util.SortedSet;
    004
    005    import org.maltparser.core.exception.MaltChainedException;
    006    import org.maltparser.core.syntaxgraph.node.TokenNode;
    007
    008    /**
    009    *
    010    *
    011    * @author Johan Hall
    012    */
    013    public interface TokenStructure extends Structure, LabeledStructure {
    014            /**
    015             * Adds a token node with index <i>n + 1</i>, where <i>n</i> is the index of the last token node.
    016             *
    017             * @return the added token node.
    018             * @throws MaltChainedException
    019             */
    020            public TokenNode addTokenNode() throws MaltChainedException;
    021            /**
    022             * Adds a token node with index <i>index</i>.
    023             *
    024             * @param index the index of the token node.
    025             * @return the added token node.
    026             */
    027            public TokenNode addTokenNode(int index) throws MaltChainedException;
    028            /**
    029             * Returns the token node with index <i>index</i>.
    030             *
    031             * @param index the index of the token node.
    032             * @return a token node with index <i>index</i>.
    033             * @throws MaltChainedException
    034             */
    035            public TokenNode getTokenNode(int index);
    036            /**
    037             * Returns the number of token nodes in the token structure (sentence).
    038             *
    039             * @return the number of token nodes in the token structure (sentence).
    040             */
    041            public int nTokenNode();
    042            /**
    043             * Returns a sorted set of integers {s,...,n}, where each index i identifies a token node. Index <i>s</i>
    044             * is the first token node and index <i>n</i> is the last token node.
    045             *
    046             * @return a sorted set of integers {s,...,n}.
    047             */
    048            public SortedSet<Integer> getTokenIndices();
    049            /**
    050             * Returns the index of the last token node.
    051             *
    052             * @return the index of the last token node.
    053             */
    054            public int getHighestTokenIndex();
    055            /**
    056             *  Returns <i>true</i> if the token structure (sentence) has any token nodes, otherwise <i>false</i>.
    057             *
    058             * @return <i>true</i> if the token structure (sentence) has any token nodes, otherwise <i>false</i>.
    059             */
    060            public boolean hasTokens();
    061            /**
    062             * Returns the sentence ID
    063             *
    064             * @return the sentence ID
    065             */
    066            public int getSentenceID();
    067            /**
    068             * Sets the sentence ID
    069             *
    070             * @param sentenceID a sentence ID
    071             */
    072            public void setSentenceID(int sentenceID);
    073    }