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