1  /*
  2   *  File:  Quadrilateral.java
  3   *
  4   *  Quadrilateral class
  5   *
  6   *  Copyright:  Northeast Parallel Architectures Center
  7   *  
  8   */
  9  
 10  import java.awt.Point;
 11  
 12  // A quadrilateral is a polygon with four sides:
 13  public class Quadrilateral extends MovablePolygon {
 14  
 15     // Quadrilateral constructor #1:
 16     public Quadrilateral() {
 17        // invoke the no-argument constructor of the superclass:
 18        super();
 19     }
 20  
 21     // Quadrilateral constructor #2:
 22     public Quadrilateral( int x1, int y1, 
 23                           int x2, int y2, 
 24                           int x3, int y3, 
 25                           int x4, int y4  ) {
 26   
 27        // invoke the no-argument constructor of the superclass:
 28        super();
 29   
 30        // the 'this' reference is optional:
 31        this.addPoint( x1, y1 );
 32        this.addPoint( x2, y2 );
 33        this.addPoint( x3, y3 );
 34        this.addPoint( x4, y4 );
 35   
 36     }
 37  
 38     // Quadrilateral constructor #3:
 39     public Quadrilateral( Point p1, Point p2, Point p3, Point p4 ) {
 40   
 41        // invoke Quadrilateral constructor #2:
 42        this( p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, p4.x, p4.y  );
 43   
 44     }
 45  
 46  }