//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public org.maltparser.core.syntaxgraph.edge.Edge moveDependencyEdge(org.maltparser.core.syntaxgraph.node.DependencyNode newHead, org.maltparser.core.syntaxgraph.node.DependencyNode dependent) throws org.maltparser.core.exception.MaltChainedException public virtual Edge.Edge moveDependencyEdge(DependencyNode newHead, DependencyNode dependent) { if (dependent == null || !dependent.hasHead() || newHead.BelongsToGraph != this || dependent.BelongsToGraph != this) { return(null); } Edge.Edge headEdge = dependent.HeadEdge; LabelSet labels = null; if (headEdge.Labeled) { labels = CheckOutNewLabelSet(); foreach (SymbolTable table in headEdge.LabelTypes) { labels.put(table, headEdge.getLabelCode(table)); } } headEdge.clear(); headEdge.BelongsToGraph = this; headEdge.setEdge((Node.Node)newHead, (Node.Node)dependent, Edge_Fields.DEPENDENCY_EDGE); if (labels != null) { headEdge.addLabel(labels); labels.clear(); CheckInLabelSet(labels); } return(headEdge); }
/// <summary> /// Adds a label (an integer value) to the symbol table and to the graph element. /// </summary> /// <param name="table"> the symbol table </param> /// <param name="code"> a label code </param> /// <exception cref="MaltChainedException"> </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void addLabel(org.maltparser.core.symbol.SymbolTable table, int code) throws org.maltparser.core.exception.MaltChainedException public virtual void addLabel(SymbolTable table, int code) { if (!ReferenceEquals(table.getSymbolCodeToString(code), null)) { if (labelSet == null) { if (belongsToGraph == null) { throw new SyntaxGraphException("The graph element doesn't belong to any graph. "); } labelSet = belongsToGraph.CheckOutNewLabelSet(); } labelSet.put(table, code); setChanged(); notifyObservers(table); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: protected org.maltparser.core.syntaxgraph.edge.Edge moveDependencyEdge(org.maltparser.core.syntaxgraph.node.DependencyNode newHead, org.maltparser.core.syntaxgraph.node.DependencyNode dependent) throws org.maltparser.core.exception.MaltChainedException protected internal virtual Edge.Edge moveDependencyEdge(DependencyNode newHead, DependencyNode dependent) { if (dependent == null || !dependent.hasHead()) { return(null); } Edge.Edge headEdge = dependent.HeadEdge; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final LabelSet labels = checkOutNewLabelSet(); LabelSet labels = CheckOutNewLabelSet(); foreach (SymbolTable table in headEdge.LabelTypes) { labels.put(table, headEdge.getLabelCode(table)); } headEdge.clear(); headEdge.BelongsToGraph = this; headEdge.setEdge((Node.Node)newHead, (Node.Node)dependent, Edge_Fields.DEPENDENCY_EDGE); headEdge.addLabel(labels); labels.clear(); CheckInLabelSet(labels); return(headEdge); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void setRootLabels(String rootLabelOption, java.util.SortedMap<String, org.maltparser.core.symbol.SymbolTable> edgeSymbolTables) throws org.maltparser.core.exception.MaltChainedException public virtual void setRootLabels(string rootLabelOption, SortedDictionary<string, SymbolTable> edgeSymbolTables) { if (edgeSymbolTables == null) { return; } else if (ReferenceEquals(rootLabelOption, null) || rootLabelOption.Trim().Length == 0) { foreach (SymbolTable table in edgeSymbolTables.Values) { rootLabelCodes.put(table, table.addSymbol(DEFAULT_ROOTSYMBOL)); } } else if (rootLabelOption.Trim().IndexOf(',') == -1) { int index = rootLabelOption.Trim().IndexOf('='); if (index == -1) { foreach (SymbolTable table in edgeSymbolTables.Values) { rootLabelCodes.put(table, table.addSymbol(rootLabelOption.Trim())); } } else { string name = rootLabelOption.Trim().Substring(0, index); if (edgeSymbolTables[name] == null) { throw new SyntaxGraphException("The symbol table '" + name + "' cannot be found when defining the root symbol. "); } else { rootLabelCodes.put(edgeSymbolTables[name], edgeSymbolTables[name].addSymbol(rootLabelOption.Trim().Substring(index + 1))); if (edgeSymbolTables.Count > 1) { foreach (SymbolTable table in edgeSymbolTables.Values) { if (!table.Name.Equals(name)) { rootLabelCodes.put(table, table.addSymbol(DEFAULT_ROOTSYMBOL)); } } } } } } else { string[] items = rootLabelOption.Trim().Split(",", true); for (int i = 0; i < items.Length; i++) { int index = items[i].Trim().IndexOf('='); if (index == -1) { throw new SyntaxGraphException("The root symbol is undefinied. "); } else { string name = items[i].Trim().Substring(0, index); if (edgeSymbolTables[name] == null) { throw new SyntaxGraphException("The symbol table'" + name + "' cannot be found when defining the root symbol. "); } else { rootLabelCodes.put(edgeSymbolTables[name], edgeSymbolTables[name].addSymbol(items[i].Trim().Substring(index + 1))); } } } foreach (SymbolTable table in edgeSymbolTables.Values) { if (!rootLabelCodes.containsKey(table)) { rootLabelCodes.put(table, table.addSymbol(DEFAULT_ROOTSYMBOL)); } } } }