//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public org.maltparser.core.syntaxgraph.edge.Edge addDependencyEdge(org.maltparser.core.syntaxgraph.node.DependencyNode head, org.maltparser.core.syntaxgraph.node.DependencyNode dependent) throws org.maltparser.core.exception.MaltChainedException public virtual Edge.Edge addDependencyEdge(DependencyNode head, DependencyNode dependent) { if (head == null || dependent == null || head.BelongsToGraph != this || dependent.BelongsToGraph != this) { throw new SyntaxGraphException("Head or dependent node is missing."); } else if (!dependent.Root) { if (singleHeadedConstraint && dependent.hasHead()) { throw new SyntaxGraphException("The dependent already have a head. "); } DependencyNode hc = ((DependencyNode)head).findComponent(); DependencyNode dc = ((DependencyNode)dependent).findComponent(); if (hc != dc) { link(hc, dc); numberOfComponents--; } Edge.Edge e = edgePool.checkOut(); e.BelongsToGraph = this; e.setEdge((Node.Node)head, (Node.Node)dependent, Edge_Fields.DEPENDENCY_EDGE); graphEdges.Add(e); return(e); } else { throw new SyntaxGraphException("Head node is not a root node or a terminal node."); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: protected org.maltparser.core.syntaxgraph.edge.Edge addDependencyEdge(org.maltparser.core.syntaxgraph.node.DependencyNode head, org.maltparser.core.syntaxgraph.node.DependencyNode dependent) throws org.maltparser.core.exception.MaltChainedException protected internal virtual Edge.Edge addDependencyEdge(DependencyNode head, DependencyNode dependent) { if (head == null || dependent == null) { throw new SyntaxGraphException("Head or dependent node is missing."); } else if (!dependent.Root) { if (singleHeadedConstraint && dependent.hasHead()) { return(moveDependencyEdge(head, dependent)); } //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.maltparser.core.syntaxgraph.node.DependencyNode hc = ((org.maltparser.core.syntaxgraph.node.DependencyNode)head).findComponent(); DependencyNode hc = ((DependencyNode)head).findComponent(); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.maltparser.core.syntaxgraph.node.DependencyNode dc = ((org.maltparser.core.syntaxgraph.node.DependencyNode)dependent).findComponent(); DependencyNode dc = ((DependencyNode)dependent).findComponent(); if (hc != dc) { link(hc, dc); numberOfComponents--; } Edge.Edge e = edgePool.checkOut(); e.BelongsToGraph = this; e.setEdge((Node.Node)head, (Node.Node)dependent, Edge_Fields.DEPENDENCY_EDGE); graphEdges.Add(e); return(e); } else { throw new SyntaxGraphException("Head node is not a root node or a terminal node."); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public HistoryNode getNewHistoryNode(HistoryNode previousNode, org.maltparser.parser.history.action.GuideUserAction action) throws org.maltparser.core.exception.MaltChainedException public override HistoryNode getNewHistoryNode(HistoryNode previousNode, GuideUserAction action) { HistoryNode node = nodePool.checkOut(); node.Action = action; node.PreviousNode = previousNode; list.Add(node); return(node); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public org.maltparser.core.syntaxgraph.node.PhraseStructureNode addNonTerminalNode(int index) throws org.maltparser.core.exception.MaltChainedException public virtual PhraseStructureNode addNonTerminalNode(int index) { NonTerminal node = nonTerminalPool.checkOut(); node.Index = index; node.BelongsToGraph = this; nonTerminalNodes[index] = node; return(node); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public org.maltparser.core.syntaxgraph.edge.Edge addPhraseStructureEdge(org.maltparser.core.syntaxgraph.node.PhraseStructureNode parent, org.maltparser.core.syntaxgraph.node.PhraseStructureNode child) throws org.maltparser.core.exception.MaltChainedException public virtual Edge.Edge addPhraseStructureEdge(PhraseStructureNode parent, PhraseStructureNode child) { if (parent == null || child == null) { throw new MaltChainedException("Parent or child node is missing."); } else if (parent is NonTerminalNode && !child.Root) { Edge.Edge e = edgePool.checkOut(); e.BelongsToGraph = this; e.setEdge((Node.Node)parent, (Node.Node)child, Edge_Fields.PHRASE_STRUCTURE_EDGE); graphEdges.Add(e); return(e); } else { throw new MaltChainedException("Parent or child node is not of correct node type."); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public HistoryNode getNewHistoryNode(HistoryNode previousNode, org.maltparser.parser.history.action.GuideUserAction action) throws org.maltparser.core.exception.MaltChainedException public override HistoryNode getNewHistoryNode(HistoryNode previousNode, GuideUserAction action) { HistoryNode node = nodePool.checkOut(); node.Action = action; if (previousNode == null) { node.PreviousNode = root; } else { node.PreviousNode = previousNode; } return(node); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public LabelSet checkOutNewLabelSet() throws org.maltparser.core.exception.MaltChainedException public virtual LabelSet CheckOutNewLabelSet() { return(labelSetPool.checkOut()); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: protected org.maltparser.core.syntaxgraph.node.Token getOrAddTerminalNode(int index) throws org.maltparser.core.exception.MaltChainedException protected internal virtual Token getOrAddTerminalNode(int index) { Token node = terminalNodes[index]; if (node == null) { // if (!terminalNodes.containsKey(index)) { if (index > 0) { node = terminalPool.checkOut(); node.Index = index; node.BelongsToGraph = this; if (index > 1) { Token prev = terminalNodes[index - 1]; if (prev == null) { try { prev = terminalNodes[terminalNodes.headMap(index).lastKey()]; } catch (NoSuchElementException) { } } if (prev != null) { prev.setSuccessor(node); node.setPredecessor(prev); } if (terminalNodes.lastKey() > index) { Token succ = terminalNodes[index + 1]; if (succ == null) { try { succ = terminalNodes[terminalNodes.tailMap(index).firstKey()]; } catch (NoSuchElementException) { } } if (succ != null) { succ.setPredecessor(node); node.setSuccessor(succ); } } } } terminalNodes[index] = node; numberOfComponents++; } // else { // node = terminalNodes.get(index); // } return(node); }