Point.java

Point.java  让我们来找茬,(⊙o⊙)看看哪里不一样咯!!!

package algorithm_graphics_2;/** Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.*********************///package java.awt;import java.awt.geom.Point2D;
import java.beans.Transient;/*** A point representing a location in {@code (x,y)} coordinate space,* specified in integer precision.** @author      Sami Shaio* @since       1.0*/
public class Point extends Point2D implements java.io.Serializable
{/*** The X coordinate of this <code>Point</code>.* If no X coordinate is set it will default to 0.** @serial* @see #getLocation()* @see #move(int, int)* @since 1.0*/public double x;/*** The Y coordinate of this <code>Point</code>.* If no Y coordinate is set it will default to 0.** @serial* @see #getLocation()* @see #move(int, int)* @since 1.0*/public double y;/** JDK 1.1 serialVersionUID*/private static final long serialVersionUID = -5276940640259749850L;/*** Constructs and initializes a point at the origin (0,&nbsp;0) of the coordinate space.* * @since 1.1*/public Point(){this(0, 0);}/*** Constructs and initializes a point with the same location as the specified <code>Point</code> object.* * @param p a point* @since 1.1*/public Point(Point p){this(p.x, p.y);}/*** Constructs and initializes a point at the specified {@code (x,y)} location in the coordinate space.* * @param x the X coordinate of the newly constructed <code>Point</code>* @param y the Y coordinate of the newly constructed <code>Point</code>* @since 1.0*/public Point(double x, double y){this.x = x;this.y = y;}/*** {@inheritDoc}* @since 1.2*/public double getX(){return x;}/*** {@inheritDoc}* @since 1.2*/public double getY(){return y;}/*** Returns the location of this point.* This method is included for completeness, to parallel the <code>getLocation</code> method of <code>Component</code>.* * @return a copy of this point, at the same location* @see    java.awt.Component#getLocation* @see    java.awt.Point#setLocation(java.awt.Point)* @see    java.awt.Point#setLocation(int, int)* @since  1.1*/@Transientpublic Point getLocation(){return new Point(x, y);}/*** Sets the location of the point to the specified location. * This method is included for completeness, to parallel the <code>setLocation</code> method of <code>Component</code>.* * @param p  a point, the new location for this point* @see   java.awt.Component#setLocation(java.awt.Point)* @see   java.awt.Point#getLocation* @since 1.1*/public void setLocation(Point p){setLocation(p.x, p.y);}/*** Changes the point to have the specified location.* <p>* This method is included for completeness, to parallel the <code>setLocation</code> method of <code>Component</code>.* Its behavior is identical with <code>move(int,&nbsp;int)</code>.* * @param       x the X coordinate of the new location* @param       y the Y coordinate of the new location* @see         java.awt.Component#setLocation(int, int)* @see         java.awt.Point#getLocation* @see         java.awt.Point#move(int, int)* @since       1.1*/public void setLocation(int x, int y){move(x, y);}/*** Sets the location of this point to the specified double coordinates.* The double values will be rounded to integer values.* Any number smaller than <code>Integer.MIN_VALUE</code> will be reset to <code>MIN_VALUE</code>, and any number larger than <code>Integer.MAX_VALUE</code> will be reset to <code>MAX_VALUE</code>.* * * @param x the X coordinate of the new location* @param y the Y coordinate of the new location* @see #getLocation*/public void setLocation(double x, double y){this.x = (int) Math.floor(x + 0.5);this.y = (int) Math.floor(y + 0.5);}/*** Moves this point to the specified location in the {@code (x,y)} coordinate plane. * This method is identical with <code>setLocation(int,&nbsp;int)</code>.* * * @param       x the X coordinate of the new location* @param       y the Y coordinate of the new location* @see         java.awt.Component#setLocation(int, int)*/public void move(int x, int y){this.x = x;this.y = y;}/*** Translates this point, at location {@code (x,y)}, by {@code dx} along the {@code x} axis and {@code dy} along the {@code y} axis so that it now represents the point {@code (x+dx,y+dy)}.* * @param dx the distance to move this point along the X axis* @param dy the distance to move this point along the Y axis*/public void translate(int dx, int dy){this.x += dx;this.y += dy;}/*** Determines whether or not two points are equal. * Two instances of <code>Point2D</code> are equal if the values of their <code>x</code> and <code>y</code> member fields, representing their position in the coordinate space, are the same.* * @param obj an object to be compared with this <code>Point2D</code>* @return <code>true</code> if the object to be compared is an instance of <code>Point2D</code> and has the same values; <code>false</code> otherwise.*/public boolean equals(Object obj){if (obj instanceof Point){Point pt = (Point) obj;return (x == pt.x) && (y == pt.y);}return super.equals(obj);}/*** Returns a string representation of this point and its location* in the {@code (x,y)} coordinate space. This method is* intended to be used only for debugging purposes, and the content* and format of the returned string may vary between implementations.* The returned string may be empty but may not be <code>null</code>.** @return  a string representation of this point*/public String toString(){return getClass().getName() + "[x=" + x + ",y=" + y + "]";}
}

Point.java

/** Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.*********************/package java.awt;import java.awt.geom.Point2D;
import java.beans.Transient;/*** A point representing a location in {@code (x,y)} coordinate space,* specified in integer precision.** @author      Sami Shaio* @since       1.0*/
public class Point extends Point2D implements java.io.Serializable {/*** The X coordinate of this <code>Point</code>.* If no X coordinate is set it will default to 0.** @serial* @see #getLocation()* @see #move(int, int)* @since 1.0*/public int x;/*** The Y coordinate of this <code>Point</code>.* If no Y coordinate is set it will default to 0.** @serial* @see #getLocation()* @see #move(int, int)* @since 1.0*/public int y;/** JDK 1.1 serialVersionUID*/private static final long serialVersionUID = -5276940640259749850L;/*** Constructs and initializes a point at the origin* (0,&nbsp;0) of the coordinate space.* @since       1.1*/public Point() {this(0, 0);}/*** Constructs and initializes a point with the same location as* the specified <code>Point</code> object.* @param       p a point* @since       1.1*/public Point(Point p) {this(p.x, p.y);}/*** Constructs and initializes a point at the specified* {@code (x,y)} location in the coordinate space.* @param x the X coordinate of the newly constructed <code>Point</code>* @param y the Y coordinate of the newly constructed <code>Point</code>* @since 1.0*/public Point(int x, int y) {this.x = x;this.y = y;}/*** {@inheritDoc}* @since 1.2*/public double getX() {return x;}/*** {@inheritDoc}* @since 1.2*/public double getY() {return y;}/*** Returns the location of this point.* This method is included for completeness, to parallel the* <code>getLocation</code> method of <code>Component</code>.* @return      a copy of this point, at the same location* @see         java.awt.Component#getLocation* @see         java.awt.Point#setLocation(java.awt.Point)* @see         java.awt.Point#setLocation(int, int)* @since       1.1*/@Transientpublic Point getLocation() {return new Point(x, y);}/*** Sets the location of the point to the specified location.* This method is included for completeness, to parallel the* <code>setLocation</code> method of <code>Component</code>.* @param       p  a point, the new location for this point* @see         java.awt.Component#setLocation(java.awt.Point)* @see         java.awt.Point#getLocation* @since       1.1*/public void setLocation(Point p) {setLocation(p.x, p.y);}/*** Changes the point to have the specified location.* <p>* This method is included for completeness, to parallel the* <code>setLocation</code> method of <code>Component</code>.* Its behavior is identical with <code>move(int,&nbsp;int)</code>.* @param       x the X coordinate of the new location* @param       y the Y coordinate of the new location* @see         java.awt.Component#setLocation(int, int)* @see         java.awt.Point#getLocation* @see         java.awt.Point#move(int, int)* @since       1.1*/public void setLocation(int x, int y) {move(x, y);}/*** Sets the location of this point to the specified double coordinates.* The double values will be rounded to integer values.* Any number smaller than <code>Integer.MIN_VALUE</code>* will be reset to <code>MIN_VALUE</code>, and any number* larger than <code>Integer.MAX_VALUE</code> will be* reset to <code>MAX_VALUE</code>.** @param x the X coordinate of the new location* @param y the Y coordinate of the new location* @see #getLocation*/public void setLocation(double x, double y) {this.x = (int) Math.floor(x+0.5);this.y = (int) Math.floor(y+0.5);}/*** Moves this point to the specified location in the* {@code (x,y)} coordinate plane. This method* is identical with <code>setLocation(int,&nbsp;int)</code>.* @param       x the X coordinate of the new location* @param       y the Y coordinate of the new location* @see         java.awt.Component#setLocation(int, int)*/public void move(int x, int y) {this.x = x;this.y = y;}/*** Translates this point, at location {@code (x,y)},* by {@code dx} along the {@code x} axis and {@code dy}* along the {@code y} axis so that it now represents the point* {@code (x+dx,y+dy)}.** @param       dx   the distance to move this point*                            along the X axis* @param       dy    the distance to move this point*                            along the Y axis*/public void translate(int dx, int dy) {this.x += dx;this.y += dy;}/*** Determines whether or not two points are equal. Two instances of* <code>Point2D</code> are equal if the values of their* <code>x</code> and <code>y</code> member fields, representing* their position in the coordinate space, are the same.* @param obj an object to be compared with this <code>Point2D</code>* @return <code>true</code> if the object to be compared is*         an instance of <code>Point2D</code> and has*         the same values; <code>false</code> otherwise.*/public boolean equals(Object obj) {if (obj instanceof Point) {Point pt = (Point)obj;return (x == pt.x) && (y == pt.y);}return super.equals(obj);}/*** Returns a string representation of this point and its location* in the {@code (x,y)} coordinate space. This method is* intended to be used only for debugging purposes, and the content* and format of the returned string may vary between implementations.* The returned string may be empty but may not be <code>null</code>.** @return  a string representation of this point*/public String toString() {return getClass().getName() + "[x=" + x + ",y=" + y + "]";}
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://xiahunao.cn/news/2799737.html

如若内容造成侵权/违法违规/事实不符,请联系瞎胡闹网进行投诉反馈,一经查实,立即删除!

相关文章

Zabbix 6.2.1 安装

目录 1、监控介绍 监控的重要性 网站的可用性 监控范畴 如何监控 2、Zabbix 介绍 zabbix 简介 zabbix 主要功能 zabbix 监控范畴 Zabbix 监控组件 zabbix 常见进程 zabbix agentd 工作模式 zabbix 环境监控中概念 3、搭建LNMP 拓扑规划 安装MySQL 安装 Nginx …

【视频编解码】M-JPEG压缩、H.264压缩 对比

简介 参考这篇文章&#xff1a;https://blog.csdn.net/qq_41248872/article/details/83590337 写的比较好&#xff0c;这里就不赘述了。 我们在视频传输的时候&#xff0c;需要压缩&#xff0c;常见的压缩包括: jpeg 压缩h264 压缩 当然使用最多的还是 264, 毕竟他的压缩比…

【Flink经济】Flink 内存管理

面临的问题 目前&#xff0c; 大数据计算引擎主要用 Java 或是基于 JVM 的编程语言实现的&#xff0c;例如 Apache Hadoop、 Apache Spark、 Apache Drill、 Apache Flink 等。 Java 语言的好处在于程序员不需要太关注底层内存资源的管理&#xff0c;但同样会面临一个问题&…

【快速搞定Webpack5】修改输出文件目录及自动清理上次打包文件(五)

介绍 默认情况下webpack打包后&#xff0c;我们的图片和js等文件都会被打包到dist目录下&#xff0c;文件多了混淆在一起一方面不利于文件的查找和管理&#xff0c;另外一方面看上去也不美观。 所以今天我们学习的内容就是控制输出后的文件进入不同的目录。 一、配置 新增4…

小米标准模组+MCU 快速上手开发(二)——之模组串口调试

小米标准模组MCU 开发笔记之固件调试 背景技术名词简介● 小米IoT开发者平台● 小米IoT 模组● 固件● OTA● CRC32 固件双串口调试● MHCWB6S-IB 模组资料下载● MHCWB6S-IB 模组管脚图● 上电调试 背景 小米标准模组MCU的开发过程中&#xff0c;由于部分官方资料较为古早&am…

压缩感知常用的重建算法

重建算法的基本概念 在压缩感知&#xff08;Compressed Sensing, CS&#xff09;框架中&#xff0c;重建算法是指将从原始信号中以低于奈奎斯特率采集得到的压缩测量值恢复成完整信号的数学和计算过程。由于信号在采集过程中被压缩&#xff0c;因此重建算法的目标是找到最符合…

MATLAB 导出可编辑的eps格式图像

任务描述&#xff1a;部分期刊要求提交可编辑的eps格式图像&#xff0c;方便美工编辑对图像进行美化 我试了直接print或者在figure窗口导出&#xff0c;发现导出的文件放到Adobe AI中并不能编辑&#xff0c;经Google找到解决办法&#xff1a; %EPS exportgraphics(gcf,myVect…

微信小程序 ---- 慕尚花坊 项目初始化

目录 项目介绍 01. 项目概述 02. 项目演示 03. 项目技术栈 04. 接口文档 申请开发权限 项目初始化 01. 创建项目与项目初始化 02. 自定义构建 npm 集成Sass 03. 集成项目页面文件 04. VsCode 开发小程序项目 项目介绍 01. 项目概述 [慕尚花坊] 是一款 同城鲜花订购…

js设计模式:依赖注入模式

作用: 在对象外部完成两个对象的注入绑定等操作 这样可以将代码解耦,方便维护和扩展 vue中使用use注册其他插件就是在外部创建依赖关系的 示例: class App{constructor(appName,appFun){this.appName appNamethis.appFun appFun}}class Phone{constructor(app) {this.nam…

【C++初阶】类和对象(中)

目录 一.类的6个默认成员函数 1.知识引入 ​编辑 2.构造函数 (1)概念 (2)语法特性 (3)特征 ①问题引入1 ②问题引入2 &#xff08;缺少默认构造函数&#xff09; 3.析构函数 (1)概念 (2)特性 4.拷贝构造函数 (1)概念 (2)特征 ①拷贝构造函数是构造函数的一…

pclpy SOR去除异常值(统计滤波)

pclpy SOR去除异常值-统计滤波 一、算法原理1.背景2.原理 二、代码三、结果1.原点云2.sor处理后的点云&#xff08;内点&#xff09;3.sor处理后的点云&#xff08;外点&#xff09; 四、相关数据 一、算法原理 1.背景 激光扫描通常会生成不同点密度的点云数据集。此外&#…

【OpenSSH+Jenkins搭建项目自动化部署】

OpenSSHJenkins搭建项目自动化部署 一、Windows安装OpenSSH1.下载2.解压3.安装4.启停服务5.SSH免密登录 二、Jenkins安装1.下载2.安装启动3.登录 三、项目自动化部署1.SSH配置2.项目配置3.权限控制 一、Windows安装OpenSSH 1.下载 https://github.com/PowerShell/Win32-0penS…

常见的排序算法整理

1.冒泡排序 1.1 冒泡排序普通版 每次冒泡过程都是从数列的第一个元素开始&#xff0c;然后依次和剩余的元素进行比较&#xff0c;若小于相邻元素&#xff0c;则交换两者位置&#xff0c;同时将较大元素作为下一个比较的基准元素&#xff0c;继续将该元素与其相邻的元素进行比…

用于扫描机密的开源解决方案

TruffleHog 最初是在 2016 年独立创作的一个研究工具。当发布它时&#xff0c;没有工具扫描 Git 修订历史记录以获取秘密。我的预感是旧版本的代码中隐藏着很多秘密&#xff0c;但没有工具可以查找它们。 我的预感是对的。该工具迅速流行并变得非常流行。如今&#xff0c;它在…

数据库管理-第153期 Oracle Vector DB AI-05(20240221)

数据库管理153期 2024-02-21 数据库管理-第153期 Oracle Vector DB & AI-05&#xff08;20240221&#xff09;1 Oracle Vector的其他特性示例1&#xff1a;示例2 2 简单使用Oracle Vector环境创建包含Vector数据类型的表插入向量数据 总结 数据库管理-第153期 Oracle Vecto…

启动node服务报错Error: listen EACCES: permission denied 0.0.0.0:5000

启动node服务报错&#xff1a; 解决方案&#xff1a; 将监听端口改成3000或者其他 修改后结果&#xff1a; 参考原文&#xff1a; Error: listen EACCES: permission denied_error when starting dev server: error: listen eacc-CSDN博客

板块一 Servlet编程:第八节 文件上传下载操作 来自【汤米尼克的JavaEE全套教程专栏】

板块一 Servlet编程&#xff1a;第八节 文件的上传下载操作 一、文件上传&#xff08;1&#xff09;前端内容&#xff08;2&#xff09;后端内容 二、文件下载&#xff08;1&#xff09;前端的超链接下载&#xff08;2&#xff09;后端下载 在之前的内容中我们终于结束了Servle…

【云原生】Docker 安全与CA证书生成

目录 容器的安全行问题 Docker 容器与虚拟机的区别 Docker 存在的安全问题 1.Docker 自身漏洞 2.Docker 源码问题 Docker 架构缺陷与安全机制 1. 容器之间的局域网攻击 2. DDoS 攻击耗尽资源 3. 有漏洞的系统调用 4. 共享root用户权限 Docker 安全基线标准 1. 内…

sympy奇异函数

文章目录 简介SingularityFunctionrewrite 简介 奇异函数是一类不连续函数&#xff0c;可用麦考利括号表示为 f ( t ) < t − t 0 > n f(t)\lt t-t_0\gt^n f(t)<t−t0​>n 当 n < 0 n\lt 0 n<0时&#xff0c;记 N − n − 1 ≥ 0 N-n-1\geq0 N−n−1≥0&…

【云原生】持续集成持续部署

本文主要总结CI/CD的流程&#xff0c;不会详细介绍每个知识点。 啥是集成&#xff1f;啥是部署&#xff1f; 集成&#xff0c;就是把应用程序、相关环境、配置全局打包放在一个容器中的操作。部署就不解释了。 CI/CD 如果是自己手动部署的话&#xff0c;流程应该是这样的&am…