package cn.edu.seu.ise.dca.app.php.model;

public class PHPFunction {
	private String name;
	private String fullName;
	private long revision;
	private long startLine;
	private long endLine;
	private boolean global;
	
	public PHPFunction(long revision) {
		this.revision = revision;
	}
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	public String getFullName() {
		return fullName;
	}

	public void setFullName(String fullName) {
		this.fullName = fullName;
	}
	
	public long getRevision() {
		return revision;
	}
	public void setRevision(long revision) {
		this.revision = revision;
	}
	public long getStartLine() {
		return startLine;
	}
	public void setStartLine(long startLine) {
		this.startLine = startLine;
	}
	public long getEndLine() {
		return endLine;
	}
	public void setEndLine(long endLine) {
		this.endLine = endLine;
	}

	public boolean isGlobal() {
		return global;
	}

	public void setGlobal(boolean global) {
		this.global = global;
	}
	
	/**
	 * Get the total lines of the function
	 * @return
	 */
	public long sizeOfLines() {
		return endLine - startLine + 1;
	}

	@Override
	public String toString() {
		StringBuffer buffer = new StringBuffer();
		buffer.append("[revision:").append(this.getRevision()).append(", function name:").append(this.getFullName())
			.append(", lines:").append(this.sizeOfLines()).append(", start line:").append(this.getStartLine())
			.append(", end line:").append(this.getEndLine()).append("]");
		return buffer.toString();
	}
	
	
	
}
