⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 codelocation.java

📁 plugin for eclipse
💻 JAVA
字号:
/*
 * Created on Jun 1, 2005
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package isis.anp.common;


/**
 * Represents a location in a source file.
 * @author sallai 
 */
public class CodeLocation {
	String fileName = "";
	int lineNum = 0;
	int columnNum = 0;
	int endLineNum = 0;
	int endColumnNum = 0;

	public CodeLocation() {
	}

	public CodeLocation(String fileName, int lineNum, int columnNum) {
		this();
		this.fileName = fileName;
		this.lineNum = lineNum;
		this.columnNum = columnNum;
	}
	
	public CodeLocation(String fileName, int lineNum, int columnNum, int endLineNum, int endColumnNum) {
		this(fileName, lineNum, columnNum);
		this.endLineNum = endLineNum;
		this.endColumnNum = endColumnNum;
	}
	
	public CodeLocation(CToken t) {
		this(t.getFilename(), t.getLine(), t.getColumn(), t.getLine(), t.getColumn()+t.getLength());
	}
	
	public CodeLocation(TNode n) {
		this(n.getFileName(), n.getLineNum(), n.getColumnNum());
		TNode last = n.getLastDescendant(); 
		this.endLineNum =  last.getLineNum();
		this.endColumnNum = last.getColumnNum()+last.getTokenLength();
	}
	/**
	 * @return Returns the columnNum.
	 */
	public int getColumnNum() {
		return columnNum;
	}
	/**
	 * @return Returns the endColumnNum.
	 */
	public int getEndColumnNum() {
		return endColumnNum;
	}
	/**
	 * @return Returns the endLineNum.
	 */
	public int getEndLineNum() {
		return endLineNum;
	}
	/**
	 * @return Returns the fileName.
	 */
	public String getFileName() {
		return fileName;
	}
	/**
	 * @return Returns the lineNum.
	 */
	public int getLineNum() {
		return lineNum;
	}
	
	public String toString() {
		StringBuffer sb = new StringBuffer();
		sb.append(Integer.toString(lineNum));
		sb.append(":");
		sb.append(Integer.toString(columnNum));
		sb.append("-");
		sb.append(Integer.toString(endLineNum));
		sb.append(":");
		sb.append(Integer.toString(endColumnNum));
		sb.append(" in file ");
		sb.append(fileName);
		return sb.toString();
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -