Rev | Line | |
---|
[31] | 1 | package vnsim.gui; |
---|
| 2 | |
---|
| 3 | public class MyPoint{ |
---|
| 4 | private float x; |
---|
| 5 | private float y; |
---|
| 6 | |
---|
| 7 | public MyPoint(float x, float y){ |
---|
| 8 | this.x=x; |
---|
| 9 | this.y=y; |
---|
| 10 | } |
---|
| 11 | |
---|
| 12 | public float getX() { |
---|
| 13 | return x; |
---|
| 14 | } |
---|
| 15 | |
---|
| 16 | public void setX(float x) { |
---|
| 17 | this.x = x; |
---|
| 18 | } |
---|
| 19 | |
---|
| 20 | public float getY() { |
---|
| 21 | return y; |
---|
| 22 | } |
---|
| 23 | |
---|
| 24 | public void setY(float y) { |
---|
| 25 | this.y = y; |
---|
| 26 | } |
---|
| 27 | |
---|
| 28 | public boolean equals(Object obj){ |
---|
| 29 | if (!(obj instanceof MyPoint)){ |
---|
| 30 | return false; |
---|
| 31 | } |
---|
| 32 | MyPoint altPunct=(MyPoint) obj; |
---|
| 33 | if ((x-altPunct.getX())*(x-altPunct.getX())+(y-altPunct.getY())*(y-altPunct.getY())>2.25){ |
---|
| 34 | return false; |
---|
| 35 | } |
---|
| 36 | return true; |
---|
| 37 | } |
---|
| 38 | |
---|
| 39 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.