
import java.awt.Color;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintWriter;

public class LineObj 
{

	int x1, y1, x2, y2;
	int width, height;
	Color color;
	boolean selected;

	public LineObj()
	{
	}
	public LineObj(int x1, int y1, int x2, int y2, Color c)
	{
			this.x1 = x1;
			this.y1 = y1;
			this.x2 = x2;
			this.y2 = y2;
			color = c;
			selected = false;
	}
	
	public void setX1(int x1)
	{
	       this.x1=x1;
    }  
	    
    public int getX1()
    {
        return x1;
    }
		    
    public void setY1(int y1)
    {
        this.y1=y1;
    }   
	    
    public int getY1()
    {
        return y1;
    }
		    
    public void setX2(int x2)
    {
        this.x2=x2;
    }   
	    
    public int getX2()
    {
    	return x2;
    }
		    
    public void setY2(int y2)
    {
        this.y2=y2;
    }   
		 
    public int getY2()
    {
    	return y2;
    }
	
	public void setSelected(boolean select)
	{
		selected = select;
	}

	public void setUnSelected(boolean state) 
	{ 
	   	selected = state; 
  	}
	    
	public boolean getsetSelected()
	{
		return selected;
	}
		
	public void toggleSelected() 
	{ 
		selected = !selected; 
	}
		
	public boolean isSelected() 
	{ 
		return selected; 
	}
	
	public void saveTo(PrintWriter aFile) 
	{
	        aFile.println( getX1() );
	        aFile.println( getY1() );
	        aFile.println( getX2() );
	        aFile.println( getY2() );
	        aFile.println(selected);
	}
	
    public static LineObj loadFrom(BufferedReader aFile) throws IOException 
    {
        LineObj   aLine = new LineObj();
        aLine.setX1( Integer.parseInt(aFile.readLine()) );
        aLine.setY1( Integer.parseInt(aFile.readLine()) );
        aLine.setX2( Integer.parseInt(aFile.readLine()) );
        aLine.setY2( Integer.parseInt(aFile.readLine()) );
        aLine.setSelected(Boolean.valueOf(aFile.readLine()).booleanValue());
        return aLine;
    }
	
}
