Advertisement
bokoness

mmn15 q2

Jun 23rd, 2020
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.85 KB | None | 0 0
  1. package Mavo2020.Playground;
  2.  
  3.  
  4. /**
  5.  * Represent a single Node in the polygon list
  6.  */
  7. public class PointNode {
  8.     private Point _point;
  9.     private PointNode _next;
  10.  
  11.     public PointNode(Point p) {
  12.         this._point = new Point(p);
  13.         this._next = null;
  14.     }
  15.  
  16.     public PointNode(Point p, PointNode n) {
  17.         this._point = new Point(p);
  18.         this._next = n;
  19.     }
  20.  
  21.     public PointNode(PointNode p) {
  22.         this._point = p.getPoint(); //no aliasing because getPoint returns a copy
  23.         this._next = p.getNext();
  24.     }
  25.  
  26.     public Point getPoint() {
  27.         return new Point(this._point);
  28.     }
  29.  
  30.     public PointNode getNext() {
  31.         return _next;
  32.     }
  33.  
  34.     public void setPoint(Point p) {
  35.         this._point = new Point(p);
  36.     }
  37.  
  38.     public void setNext(PointNode next) {
  39.         this._next = next;
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement