Skip to content
Snippets Groups Projects
Select Git revision
  • 8e80017678c1a874454cfc0d9b7ecfaede212352
  • develop default protected
  • master protected
  • kristin_optim_test
  • 3.9.0
  • 3.8.0
  • 3.7.0
  • 3.6.0
  • 3.5.0
  • 3.4.1
  • 3.4.0
  • 3.3.3
  • 3.3.2
  • 3.3.0
  • 3.2.14
  • 3.2.13
  • 3.2.12
17 results

SourcePosition.txt

Blame
  • user avatar
    Jens Bendisposto authored
    8e800176
    History
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    SourcePosition.txt 790 B
    /** 
     * (c) 2009 Lehrstuhl fuer Softwaretechnik und Programmiersprachen, 
     * Heinrich Heine Universitaet Duesseldorf
     * This software is licenced under EPL 1.0 (http://www.eclipse.org/org/documents/epl-v10.html) 
     * */
    
    package de.hhu.stups.sablecc.patch;
    
    public class SourcePosition implements Comparable<SourcePosition>  {
    
    	private final int line;
    
    	private final int pos;
    
    	public SourcePosition(final int line, final int pos) {
    		this.line = line;
    		this.pos = pos;
    	}
    
    	public int getLine() {
    		return line;
    	}
    
    	public int getPos() {
    		return pos;
    	}
    	
    	public int compareTo(SourcePosition that) {
    		if (that.line < line) return 1;
    		if (that.line > line) return -1;
    		return pos-that.pos;
    	}
    	
    	@Override
    	public String toString() {
    		return "(" + line + "," + pos + ")";
    	}
    	
    	
    }