| 11 | */ |
| 12 | |
| 13 | export class Point { |
| 14 | /** The x-coordinate of the point. */ |
| 15 | x: number; |
| 16 | |
| 17 | /** The y-coordinate of the point. */ |
| 18 | y: number; |
| 19 | |
| 20 | constructor(x = 0, y = 0) { |
| 21 | this.x = x; |
| 22 | this.y = y; |
| 23 | } |
| 24 | |
| 25 | /** |
| 26 | * Returns a copy of this point. |
| 27 | */ |
| 28 | copy(): Point { |
| 29 | return new Point(this.x, this.y); |
| 30 | } |
| 31 | |
| 32 | /** |
| 33 | * Checks if two points are equal. |
| 34 | */ |
| 35 | equals(point: Point): boolean { |
| 36 | return this.x === point.x && this.y === point.y; |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Returns true if this point is the origin. |
| 41 | */ |
| 42 | isOrigin(): boolean { |
| 43 | return this.x === 0 && this.y === 0; |
| 44 | } |
| 45 | } |
nothing calls this directly
no outgoing calls
no test coverage detected