001package org.maltparser.core.syntaxgraph.node; 002 003import java.util.SortedSet; 004 005import org.maltparser.core.exception.MaltChainedException; 006import org.maltparser.core.syntaxgraph.Element; 007import org.maltparser.core.syntaxgraph.edge.Edge; 008 009public interface ComparableNode extends Element, Comparable<ComparableNode> { 010 /** 011 * Returns the index of the node. 012 * 013 * @return the index of the node. 014 */ 015 public int getIndex(); 016 /** 017 * Returns the index of the node (only used internal by compareTo). 018 * 019 * @return the index of the node (only used internal by compareTo). 020 */ 021 public int getCompareToIndex(); 022 /** 023 * Returns <i>true</i> if the node is a root node, otherwise <i>false</i>. 024 * 025 * @return <i>true</i> if the node is a root node, otherwise <i>false</i>. 026 */ 027 public boolean isRoot(); 028 /** 029 * Returns the left-most proper terminal descendant node (excluding itself). 030 * 031 * @return the left-most proper terminal descendant node. 032 * @throws MaltChainedException 033 */ 034 public ComparableNode getLeftmostProperDescendant() throws MaltChainedException; 035 /** 036 * Returns the right-most proper terminal descendant node (excluding itself). 037 * 038 * @return the right-most proper terminal descendant node. 039 * @throws MaltChainedException 040 */ 041 public ComparableNode getRightmostProperDescendant() throws MaltChainedException; 042 /** 043 * Returns the index of the left-most proper terminal descendant node (excluding itself). 044 * 045 * @return the index of the left-most proper terminal descendant node. 046 * @throws MaltChainedException 047 */ 048 public int getLeftmostProperDescendantIndex() throws MaltChainedException; 049 /** 050 * Returns the index of the right-most proper terminal descendant node (excluding itself). 051 * 052 * @return the index of the right-most proper terminal descendant node. 053 * @throws MaltChainedException 054 */ 055 public int getRightmostProperDescendantIndex() throws MaltChainedException; 056 /** 057 * Returns the left-most terminal descendant node. 058 * 059 * @return the left-most terminal descendant node. 060 * @throws MaltChainedException 061 */ 062 public ComparableNode getLeftmostDescendant() throws MaltChainedException; 063 /** 064 * Returns the right-most terminal descendant node. 065 * 066 * @return the right-most terminal descendant node. 067 * @throws MaltChainedException 068 */ 069 public ComparableNode getRightmostDescendant() throws MaltChainedException; 070 /** 071 * Returns the index of the left-most terminal descendant node. 072 * 073 * @return the index of the left-most terminal descendant node. 074 * @throws MaltChainedException 075 */ 076 public int getLeftmostDescendantIndex() throws MaltChainedException; 077 /** 078 * Returns the index of the right-most terminal descendant node. 079 * 080 * @return the index of the right-most terminal descendant node. 081 * @throws MaltChainedException 082 */ 083 public int getRightmostDescendantIndex() throws MaltChainedException; 084 /** 085 * Returns the in degree of the node (number of incoming edges of all types of edges). 086 * 087 * @return the in degree of the node (number of incoming edges of all types of edges). 088 */ 089 public int getInDegree(); 090 /** 091 * Returns the out degree of the node (number of outgoing edges of all types of edges). 092 * 093 * @return the out degree of the node (number of outgoing edges of all types of edges). 094 */ 095 public int getOutDegree(); 096 /** 097 * Returns a sorted set of incoming secondary edges. 098 * 099 * @return a sorted set of incoming secondary edges. 100 */ 101 public SortedSet<Edge> getIncomingSecondaryEdges() throws MaltChainedException; 102 /** 103 * Returns a sorted set of outgoing secondary edges. 104 * 105 * @return a sorted set of outgoing secondary edges. 106 */ 107 public SortedSet<Edge> getOutgoingSecondaryEdges() throws MaltChainedException; 108}