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

📄 singlelocation.java

📁 软件工程实践课程的答案哦
💻 JAVA
字号:
/*
 * This class encapsulates all the data to signify 
 * the position and color of a square.
 */

public class SingleLocation {
	public int x;
	public int y;
	public int color;
	
	public SingleLocation()
	{
		this(-1,-1,-1);
	}
	
	public SingleLocation(int pX,int pY,int pColor)
	{
		this.x=pX;
		this.y=pY;
		this.color=pColor;
	}
	/**
	 * increase x by 1*/
	public void increaseX()
	{
		this.x++;
	}
	/**
	 * decrease x by 1*/
	public void decreaseX()
	{
		this.x=this.x-1;
	}
	/**
	 * increase y by 1*/
	public void increaseY()
	{
		this.y++;
	}
	/**
	 * decrease x by 1*/
	public void decreaseY()
	{
		this.y=this.y-1;
	}
	
	/**
	 * get and set color
	 */
	public int getColor()
	{
		return this.color;
	}
	
	public void setColor(int pColor)
	{
		this.color=pColor;
	}
	
	/**
	 * get and set x
	 */
	public int getX()
	{
		return this.x;
	}
	
	public void setX(int pX)
	{
		this.x=pX;
	}
	
	/**
	 * get and set y
	 */
	public int getY()
	{
		return this.y;
	}
	
	public void setY(int pY)
	{
		this.y=pY;
	}
	
	
}

⌨️ 快捷键说明

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