Sindbad~EG File Manager

Current Path : /usr/home/beeson/public_html/dynamicgeometry/org/dynamicgeometry/diagrammer/
Upload File :
Current File : /usr/home/beeson/public_html/dynamicgeometry/org/dynamicgeometry/diagrammer/Quadrilateral.java

/**
 * This class represents a Closed Polygon (with only 4 points)
 * displayed by Diagrammer.
 * File: Quadrilateral.java
 *
 * This code is in the public domain.
 *
 * @author Brian Chan
 */

package org.dynamicgeometry.diagrammer;

import java.util.*;

public class Quadrilateral extends ClosedPolygon {

	// the number of Points allowed for this Closed Polygon
	private final static int NUM_OF_POINTS = 4;

	/**
	 * A constructor for Quadrilateral
	 *
	 */
	public Quadrilateral()
	{
		// calls the construtor of Closed Polygon
		super();
	}

	/**
	 * A constructor for Quadrilateral
	 * Creates a Quadrilateral using the four Points as parameters.
	 *
	 * @param p1 the first Point of this Quadrilateral
	 * @param p2 the second Point of this Quadrilateral
	 * @param p3 the third Point of this Quadrilateral
	 * @param p4 the fourth Point of this Quadrilateral
	 */
	public Quadrilateral(Point p1, Point p2, Point p3, Point p4)
	{
		// calls the other constructor of Quadrilateral
		this();

		if(p1 instanceof Point &&
		   p2 instanceof Point &&
		   p3 instanceof Point &&
		   p4 instanceof Point)
		{
			this.Arguments.add(p1);
			this.Arguments.add(p2);
			this.Arguments.add(p3);
			this.Arguments.add(p4);
		}
	}

	/**
	 * Sets the Points used to create a Quadrilateral.
	 *
	 * @param the list of four new Points used for this Quadrilateral.
	 * @return true if the points were successfully set, false if not.
	 */
	public boolean setPoints(ArrayList<GeometricObject> points)
	{
		// checks if the number of Points in the List correspond to
		// the number of Points a Quadrilateral should have.
		if(points != null &&
		   points.size() == NUM_OF_POINTS)
		{
			return super.setPoints(points);
		}
		else return false;
	}
}

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists