package graph;

import java.util.ArrayList;


public class Vertice 
{
	protected int _type = 0;
	protected int _id;
	
	public static final int ENTITY = 1;
	public static final int RULE = 2;
	public static final int TYPE = 3;
	public static final int FUNCTION = 4;
	
	protected ArrayList<Edge> _edges = null;
	
	protected String _name;
	protected String _sourceFileName = "nil";
	protected int _sourceStartLine = -1;
	protected int _sourceLineCount = -1;
	
	public Vertice()
	{
		_edges = new ArrayList<Edge>();
		_name = null;
		_id = -1;
		_type = 0;
	}
	
	public void addEdge(Edge e)
	{
		_edges.add(e);
	}
	
	public ArrayList<Edge> getEdges()
	{
		return _edges;
	}
	
	public String getName()
	{
		return _name;
	}
	
	public void setName(String name)
	{
		_name = name;
	}
	
	public int getId()
	{
		return _id;
	}
	
	public void setId(int id)
	{
		_id = id;
	}
	
	public int getType()
	{
		return _type;
	}
	
	public void setType(int type)
	{
		_type = type;
	}
	
	public boolean equals(Object o)
	{
		if(o.getClass().getCanonicalName() == this.getClass().getCanonicalName())
		{
			Vertice v = (Vertice) o;
			if(v.getId() == getId())
			{
				return true;
			}		
		}
		
		return false;
	}
	
	public String getSourceFileName() {
		return _sourceFileName;
	}

	public void setSourceFileName(String fileName) {
		_sourceFileName = fileName;
	}

	public int getSourceLineCount() {
		return _sourceLineCount;
	}

	public void setSourceLineCount(int lineCount) {
		_sourceLineCount = lineCount;
	}

	public int getSourceStartLine() {
		return _sourceStartLine;
	}

	public void setSourceStartLine(int startLine) {
		_sourceStartLine = startLine;
	}
	
}
