001    package org.maltparser.core.syntaxgraph.node;
002    
003    import java.util.Set;
004    import java.util.SortedSet;
005    
006    import org.maltparser.core.exception.MaltChainedException;
007    import org.maltparser.core.symbol.SymbolTable;
008    import org.maltparser.core.syntaxgraph.LabelSet;
009    import org.maltparser.core.syntaxgraph.edge.Edge;
010    
011    
012    
013    public interface DependencyNode extends ComparableNode {
014            /**
015             * Returns <i>true</i> if the node has at most one head, otherwise <i>false</i>.
016             * 
017             * @return <i>true</i> if the node has at most one head, otherwise <i>false</i>.
018             */
019            public boolean hasAtMostOneHead();
020            /**
021             * Returns <i>true</i> if the node has one or more head(s), otherwise <i>false</i>.
022             * 
023             * @return <i>true</i> if the node has one or more head(s), otherwise <i>false</i>.
024             */ 
025            public boolean hasHead();
026            public Set<DependencyNode> getHeads() throws MaltChainedException;
027            public Set<Edge> getHeadEdges() throws MaltChainedException;
028            
029    
030            /**
031             * Returns the head dependency node if it exists, otherwise <i>null</i>. If there exists more
032             * than one head the first head is returned according to the linear order of the terminals 
033             * or the root if it is one of the heads.
034             * 
035             * @return the head dependency node if it exists, otherwise <i>null</i>.
036             * @throws MaltChainedException
037             */
038            public DependencyNode getHead() throws MaltChainedException;
039            /**
040             * Returns the edge between the head and the node if it exists, otherwise <i>null</i>. If there exists more
041             * than one head edge the first head edge is returned according to the linear order of the terminals 
042             * or the root if it is one of the heads.
043             * 
044             * @return the edge between the head and the node if it exists, otherwise <i>null</i>.
045             * @throws MaltChainedException
046             */
047            public Edge getHeadEdge() throws MaltChainedException;
048            public boolean hasAncestorInside(int left, int right) throws MaltChainedException;
049            public void addHeadEdgeLabel(SymbolTable table, String symbol) throws MaltChainedException;
050            public void addHeadEdgeLabel(SymbolTable table, int code) throws MaltChainedException;
051            public void addHeadEdgeLabel(LabelSet labelSet) throws MaltChainedException;
052            public boolean hasHeadEdgeLabel(SymbolTable table) throws MaltChainedException;
053            public String getHeadEdgeLabelSymbol(SymbolTable table) throws MaltChainedException;
054            public int getHeadEdgeLabelCode(SymbolTable table) throws MaltChainedException;
055            public boolean isHeadEdgeLabeled() throws MaltChainedException;
056            public int nHeadEdgeLabels() throws MaltChainedException;
057            public Set<SymbolTable> getHeadEdgeLabelTypes() throws MaltChainedException;
058            public LabelSet getHeadEdgeLabelSet() throws MaltChainedException;
059    
060            
061            public boolean hasDependent();
062            /**
063             * Returns <i>true</i> if the node has one or more left dependents, otherwise <i>false</i>.
064             * 
065             * @return <i>true</i> if the node has one or more left dependents, otherwise <i>false</i>.
066             */
067            public boolean hasLeftDependent();
068            /**
069             * Returns the left dependent at the position <i>index</i>, where <i>index==0</i> equals the left most dependent.
070             * 
071             * @param index the index
072             * @return the left dependent at the position <i>index</i>, where <i>index==0</i> equals the left most dependent
073             */
074            public DependencyNode getLeftDependent(int index);
075            /**
076             * Return the number of left dependents
077             * 
078             * @return the number of left dependents
079             */
080            public int getLeftDependentCount();
081            /**
082             * Returns a sorted set of left dependents.
083             * 
084             * @return a sorted set of left dependents.
085             */
086            public SortedSet<DependencyNode> getLeftDependents();
087            /**
088             * Returns the left sibling if it exists, otherwise <code>null</code>
089             * 
090             * @return the left sibling if it exists, otherwise <code>null</code>
091             */
092            public DependencyNode getLeftSibling() throws MaltChainedException;
093            /**
094             * Returns the left sibling at the same side of head as the node it self. If not found <code>null</code is returned
095             * 
096             * @return the left sibling at the same side of head as the node it self. If not found <code>null</code is returned
097             */
098            public DependencyNode getSameSideLeftSibling() throws MaltChainedException;
099            /**
100             * Returns the closest left dependent to the node it self, if not found <code>null</code> is returned.
101             * 
102             * @return the closest left dependent to the node it self, if not found <code>null</code> is returned.
103             */
104            public DependencyNode getClosestLeftDependent();
105            public DependencyNode getLeftmostDependent();
106            public DependencyNode getRightDependent(int index);
107            /**
108             * Return the number of right dependents
109             * 
110             * @return the number of right dependents
111             */
112            public int getRightDependentCount();
113            /**
114             * Returns a sorted set of right dependents.
115             * 
116             * @return a sorted set of right dependents.
117             */
118            public SortedSet<DependencyNode> getRightDependents();
119            /**
120             * Returns the right sibling if it exists, otherwise <code>null</code>
121             * 
122             * @return the right sibling if it exists, otherwise <code>null</code>
123             */
124            public DependencyNode getRightSibling() throws MaltChainedException;
125            /**
126             * Returns the right sibling at the same side of head as the node it self. If not found <code>null</code is returned
127             * 
128             * @return the right sibling at the same side of head as the node it self. If not found <code>null</code is returned
129             */
130            public DependencyNode getSameSideRightSibling() throws MaltChainedException;
131            /**
132             * Returns the closest right dependent to the node it self, if not found <code>null</code> is returned.
133             * 
134             * @return the closest right dependent to the node it self, if not found <code>null</code> is returned.
135             */
136            public DependencyNode getClosestRightDependent();
137            public DependencyNode getRightmostDependent();
138            public boolean hasRightDependent();
139            /**
140             * Returns <i>true</i> if the head edge is projective, otherwise <i>false</i>. Undefined if the node has 
141             * more than one head.
142             * 
143             * @return <i>true</i> if the head edge is projective, otherwise <i>false</i>.
144             * @throws MaltChainedException
145             */
146            public boolean isProjective() throws MaltChainedException;
147            /**
148             * Returns the depth of the node. The root node has the depth 0.
149             * @return the depth of the node.
150             * @throws MaltChainedException
151             */
152            public int getDependencyNodeDepth() throws MaltChainedException;
153            public int getRank();
154            public void setRank(int r);
155            public DependencyNode findComponent();
156            public DependencyNode getComponent();
157            public void setComponent(DependencyNode x);
158    }