size.java

来自「一个免费wap站」· Java 代码 · 共 70 行

JAVA
70
字号
package com.blue.imageio;

/**
 * 
 * @author Lucifer
 *
 */
public class Size implements Cloneable, java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 8817855642408400854L;

	private int width;
	private int height;

	public Size() {
		width = height = 0;
	}

	public Size(int width, int height) {
		this.width = width;
		this.height = height;
	}

	public int getHeight() {
		return height;
	}

	public void setHeight(int height) {
		this.height = height;
	}

	public int getWidth() {
		return width;
	}

	public void setWidth(int width) {
		this.width = width;
	}

	protected Object clone() throws CloneNotSupportedException {
		try {
		    return super.clone();
		} catch (CloneNotSupportedException e) {
		    // this shouldn't happen, since we are Cloneable
		    throw new InternalError();
		}
	}

	public boolean equals(Object obj) {
		if (obj instanceof Size) {
			Size size = (Size) obj;
		    return (getWidth() == size.getWidth()) && (getHeight() == size.getWidth());
		}
		return super.equals(obj);
	}

	public int hashCode() {
		long bits = java.lang.Double.doubleToLongBits(getWidth());
		bits ^= java.lang.Double.doubleToLongBits(getHeight()) * 31;
		return (((int) bits) ^ ((int) (bits >> 32)));
	}

	public String toString() {
		return getClass().getName() + "[width=" + width + ",height=" + height + "]";
	}
}

⌨️ 快捷键说明

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