Example #1
0
//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);
        }
Example #2
0
//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);
        }