001    package org.maltparser.parser.algorithm.covington;
002    
003    import org.maltparser.core.exception.MaltChainedException;
004    import org.maltparser.core.syntaxgraph.DependencyStructure;
005    import org.maltparser.parser.SingleMalt;
006    
007    /**
008     * 
009     * @author Joakim Nivre
010     * @author Johan Hall
011     * @since 1.0
012    */
013    public class CovingtonNonProjective extends Covington {
014    
015            public CovingtonNonProjective(SingleMalt configuration) throws MaltChainedException {
016                    super(configuration);
017            }
018            
019            protected void updateLeft(DependencyStructure dg, int trans) {
020                    if (trans == SHIFT) {
021                            left = leftstop - 1;
022                    } else { 
023                            left--;
024                            while (left >= leftstop) {
025                                    if (input.get(right).findComponent().getIndex() != input.get(left).findComponent().getIndex() &&
026                                                    !(input.get(left).hasHead() && input.get(right).hasHead())) {
027                                            break;
028                                    }
029                                    left--;
030                            }
031                    }
032            }
033            
034            public String getName() {
035                    return "covnonproj";
036            }
037    }