Sindbad~EG File Manager
/**
* This class represents a Closed Polygon (with only 3 points)
* displayed by Diagrammer.
* File: Triangle.java
*
* This code is in the public domain.
*
* @author Brian Chan
*/
package org.dynamicgeometry.diagrammer;
import java.util.*;
public class Triangle extends ClosedPolygon {
// the number of Points allowed for this Closed Polygon
private final static int NUM_OF_POINTS = 3;
/**
* A constructor for Triangle
*
*/
public Triangle()
{
// calls the constructor of Closed Polygon
super();
}
/**
* A constructor for Triangle
* Creates a Triangle using three Points as parameters.
*
* @param p1 the first Point of the Triangle
* @param p2 the second Point of the Triangle
* @param p3 the third Point of the Triangle
*/
public Triangle(Point p1, Point p2, Point p3)
{
// calls the other Constructor of this Triangle
this();
if(p1 instanceof Point &&
p2 instanceof Point &&
p3 instanceof Point)
{
this.Arguments.add(p1);
this.Arguments.add(p2);
this.Arguments.add(p3);
}
}
/**
* Sets the Points used to create a Quadrilateral.
*
* @param the list of three 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 Triangle 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