    001    package org.maltparser.core.syntaxgraph;
    002
    003    import java.util.Set;
    004
    005    import org.maltparser.core.exception.MaltChainedException;
    006    import org.maltparser.core.symbol.SymbolTable;
    007    /**
    008    *
    009    *
    010    * @author Johan Hall
    011    */
    012    public interface Element {
    013            /**
    014             * Adds a label (a string value) to the symbol table and to the graph element.
    015             *
    016             * @param table the symbol table
    017             * @param symbol a label symbol
    018             * @throws MaltChainedException
    019             */
    020            public void addLabel(SymbolTable table, String symbol) throws MaltChainedException;
    021            /**
    022             * Adds a label (an integer value) to the symbol table and to the graph element.
    023             *
    024             * @param table the symbol table
    025             * @param code a label code
    026             * @throws MaltChainedException
    027             */
    028            public void addLabel(SymbolTable table, int code) throws MaltChainedException;
    029            /**
    030             * Adds the labels of the label set to the label set of the graph element.
    031             *
    032             * @param labelSet a label set.
    033             * @throws MaltChainedException
    034             */
    035            public void addLabel(LabelSet labelSet) throws MaltChainedException;
    036            /**
    037             * Returns <i>true</i> if the graph element has a label for the symbol table, otherwise <i>false</i>.
    038             *
    039             * @param table the symbol table
    040             * @return <i>true</i> if the graph element has a label for the symbol table, otherwise <i>false</i>.
    041             * @throws MaltChainedException
    042             */
    043            public boolean hasLabel(SymbolTable table) throws MaltChainedException;
    044            /**
    045             * Returns the label symbol(a string representation) of the symbol table if it exists, otherwise
    046             * an exception is thrown.
    047             *
    048             * @param table the symbol table
    049             * @return the label (a string representation) of the symbol table if it exists.
    050             * @throws MaltChainedException
    051             */
    052            public String getLabelSymbol(SymbolTable table) throws MaltChainedException;
    053            /**
    054             * Returns the label code (an integer representation) of the symbol table if it exists, otherwise
    055             * an exception is thrown.
    056             *
    057             * @param table the symbol table
    058             * @return the label code (an integer representation) of the symbol table if it exists
    059             * @throws MaltChainedException
    060             */
    061            public int getLabelCode(SymbolTable table) throws MaltChainedException;
    062            /**
    063             * Returns <i>true</i> if the graph element has one or more labels, otherwise <i>false</i>.
    064             *
    065             * @return <i>true</i> if the graph element has one or more labels, otherwise <i>false</i>.
    066             */
    067            public boolean isLabeled();
    068            /**
    069             * Returns the number of labels of the graph element.
    070             *
    071             * @return the number of labels of the graph element.
    072             */
    073            public int nLabels();
    074            /**
    075             * Returns a set of symbol tables (labeling functions or label types) that labels the graph element.
    076             *
    077             * @return a set of symbol tables (labeling functions or label types)
    078             */
    079            public Set<SymbolTable> getLabelTypes();
    080            /**
    081             * Returns the label set.
    082             *
    083             * @return the label set.
    084             */
    085            public LabelSet getLabelSet();
    086
    087            public void removeLabel(SymbolTable table) throws MaltChainedException;
    088            public void removeLabels() throws MaltChainedException;
    089
    090            /**
    091             * Returns the graph (structure) in which the graph element belongs to.
    092             *
    093             * @return the graph (structure) in which the graph element belongs to.
    094             */
    095            public SyntaxGraph getBelongsToGraph();
    096            /**
    097             * Sets the graph (structure) in which the graph element belongs to.
    098             *
    099             * @param belongsToGraph a graph (structure).
    100             */
    101            public void setBelongsToGraph(SyntaxGraph belongsToGraph);
    102            /**
    103             * Resets the graph element.
    104             *
    105             * @throws MaltChainedException
    106             */
    107            public void clear() throws MaltChainedException;
    108    }