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

📄 shape.java

📁 国外的数据结构与算法分析用书
💻 JAVA
字号:
/**	A shape with a position. */
public class Shape
{
	/**	x and y coordinantes of the position of the shape. */
	public int x, y;

	/**	Go to the position newX and newY. 
		Analysis: Time = O(1) */
	public void goPosition(int newX, int newY)
	{
		x = newX;
		y = newY;
	}

	/**	Shift the position of the shape by shiftX and shiftY. 
		Analysis: Time = O(1) */
	public void shift(int shiftX, int shiftY)
	{
		x = x + shiftX;
		y = y + shiftY;
	}

	/**	A string of blanks used to indent nested shapes. */
	public static String indent = "";

	/**	String representation of the position of the shape. 
		Analysis: Time = O(1) */
	public String toString() 
	{
		return indent + "  Position: " + x + ", " + y + "\n";
	}
} 

⌨️ 快捷键说明

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