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

📄 point.java

📁 生物物种进化历程的演示
💻 JAVA
字号:
/*   Copyright (c) 2002 Compaq Computer Corporation      SOFTWARE RELEASE      Permission is hereby granted, free of charge, to any person obtaining   a copy of this software and associated documentation files (the   "Software"), to deal in the Software without restriction, including   without limitation the rights to use, copy, modify, merge, publish,   distribute, sublicense, and/or sell copies of the Software, and to   permit persons to whom the Software is furnished to do so, subject to   the following conditions:      - Redistributions of source code must retain the above copyright     notice, this list of conditions and the following disclaimer.      - Redistributions in binary form must reproduce the above copyright     notice, this list of conditions and the following disclaimer in the     documentation and/or other materials provided with the distribution.      - Neither the names of Compaq Research, Compaq Computer Corporation     nor the names of its contributors may be used to endorse or promote     products derived from this Software without specific prior written     permission.      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.    IN NO EVENT SHALL COMPAQ COMPUTER CORPORATION BE LIABLE FOR ANY CLAIM,   DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR   OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR   THE USE OR OTHER DEALINGS IN THE SOFTWARE.*/package TreeJuxtaposer;/** * A class representing a point in a plane.  * Has integer (pixel) (x,y) coordinates stored in (p[0],p[1]). *  * @author  Yunhong Zhou * @see AccordionDrawer.Tree  * @see AccordionDrawer.TreeNode * */class Point{    /** private data */    private int[] p=new int[2];	    /**     * Constructor     * @param x1 the first coordinate     * @param y1 the second coordinate     */    public Point (int x1, int y1)    {	p[0] = x1;	p[1] = y1;    }    /**      * copy constructor      * @param pp the pointed to be copied     */    public Point (Point pp)    {	p[0] = pp.get(0);	p[1] = pp.get(1);    }     /** Get one coordinate from the point object     * @param i The parameter can only be either 0 or 1     */    int get(int i)    {	return p[i];    }    void set(int i,int x)     { 	p[i]= x;    }    /** two points are equal if their corresponding coordinates are all equal */    boolean equals (Point pp)    {   	boolean eq=true;   	int i=0;   	while ((i<pp.length()) && eq) 	    eq = (p[i]==pp.get(i));	   	return eq;    }    /** output the point as a string */    public String toString()    {	return p[0]+" "+p[1];    }       /** the length of the p array should be 2 */    int length()    {	return p.length;    }     /** to make a copy of the point */    public Object clone()    {	return new Point(this);    }  };

⌨️ 快捷键说明

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