Forms
Class FormsAdministrator

java.lang.Object
  |
  +--Forms.FormsAdministrator

public class FormsAdministrator
extends Object

This class provides tools to administrate the forms. The forms are in a vector and we can manipulate them.

Version:
1.0
Author:
Sebastien Baehni
See Also:
Forms, FormsError, FormsAdministratorError, MyCircle, MyRectangle, MyPolygon

Field Summary
protected  Vector circleVector
          The circle vector.
protected  Vector polygonVector
          The polygon vector.
protected  Vector rectangleVector
          The rectangle vector.
 
Constructor Summary
FormsAdministrator()
          The constructor.
 
Method Summary
 void addCircle(int xCenter, int yCenter, int radius)
          We add a circle in the bag of circles.
 void addPolygon(int precision)
          We add a polygon in the bag of polygons.
 void addRectangle(int xOrigin, int yOrigin, int width, int height)
          We add a rectangle in the bag of rectangles.
 void clearAll()
          We remove all the elements from the different vector.
 int indexCircle()
          This method return the size of the circle vector.
 int indexPolygon()
          This method return the size of the polygon vector.
 int indexRectangle()
          This method return the size of the rectangle vector.
 void removeCircle(int indexCircle)
          We remove a circle in the bag of circles.
 void removePolygon(int indexPolygon)
          We remove a polygon in the bag of polygons.
 void removeRectangle(int indexRectangle)
          We remove a rectangle in the bag of rectangles.
 MyCircle returnCircle(int indexCircle)
          This fonction return a circle in the bag of circles.
 int[] returnCircleCenter(int indexCircle)
          This method return the center of a circle.
 int returnIndexCircle(int x, int y)
          This method return the circle (his index in the bag) if it contains the point specified in parameters.
 int returnIndexPolygon(int x, int y)
          This method return the polygon (his index in the bag) if it contains the point specified in parameters.
 int returnIndexRectangle(int x, int y)
          This method return the rectangle (his index in the bag) if it contains the point specified in parameters.
 MyPolygon returnPolygon(int indexPolygon)
          This fonction return a polygon in the bag of polygons.
 int returnPolygonHeight(int indexPolygon)
          This method return the height of a polygon.
 int returnPolygonWidth(int indexPolygon)
          This method return the width of a polygon.
 int returnRadius(int indexCircle)
          Return the radius of the circle at index indexCircle.
 MyRectangle returnRectangle(int indexRectangle)
          This fonction return a rectangle in the bag of rectangles.
 int returnRectangleHeight(int indexRectangle)
          This method return the height of a rectangle.
 int returnRectangleWidth(int indexRectangle)
          This method return the width of a rectangle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

circleVector

protected Vector circleVector
The circle vector.

rectangleVector

protected Vector rectangleVector
The rectangle vector.

polygonVector

protected Vector polygonVector
The polygon vector.
Constructor Detail

FormsAdministrator

public FormsAdministrator()
The constructor. It initialize the vectors.
Method Detail

clearAll

public void clearAll()
We remove all the elements from the different vector.

addCircle

public void addCircle(int xCenter,
                      int yCenter,
                      int radius)
We add a circle in the bag of circles.
Parameters:
xCenter - The x center of the circle.
yCenter - The y center of the circle.
radius - The radius of the circle.

addRectangle

public void addRectangle(int xOrigin,
                         int yOrigin,
                         int width,
                         int height)
We add a rectangle in the bag of rectangles.
Parameters:
xOrigin - The x coordinate of the first corner of the rectangle.
yOrigin - The y coordinate of the first corner of the rectangle.
width - The width of the rectangle.
height - The height of the rectangle.

addPolygon

public void addPolygon(int precision)
We add a polygon in the bag of polygons.
Parameters:
precision - The final point of the segment will be taken has the final point if it is in a circle of radius precision, center first point.

removeCircle

public void removeCircle(int indexCircle)
                  throws FormsAdministratorError
We remove a circle in the bag of circles.
Parameters:
indexCircle - The index of the circle we want to remove.
Throws:
FormsAdministratorError - A new error that said that the circle doesn't exist.
See Also:
FormsAdministratorError

removeRectangle

public void removeRectangle(int indexRectangle)
                     throws FormsAdministratorError
We remove a rectangle in the bag of rectangles.
Parameters:
indexRectangle - The index of the rectangle we want to remove.
Throws:
FormsAdministratorError - A new error that said that the rectangle doesn't exist.
See Also:
FormsAdministratorError

removePolygon

public void removePolygon(int indexPolygon)
                   throws FormsAdministratorError
We remove a polygon in the bag of polygons.
Parameters:
indexPolygon - The index of the polygon we want to remove.
Throws:
FormsAdministratorError - A new error that said that the polygon doesn't exist.
See Also:
FormsAdministratorError

returnCircle

public MyCircle returnCircle(int indexCircle)
                      throws FormsAdministratorError
This fonction return a circle in the bag of circles.
Parameters:
indexCircle - The circle we want to return is at position indexCircle.
Returns:
The circle specified by the index or throw an exception if there is no circle at the specified index.
Throws:
FormsAdministratorError - A new error that said that the circle doesn't exist.
See Also:
FormsAdministratorError

returnIndexCircle

public int returnIndexCircle(int x,
                             int y)
                      throws FormsAdministratorError
This method return the circle (his index in the bag) if it contains the point specified in parameters.
Parameters:
x - The x coordinate of the point to test if it is in the circle.
y - The y coordinate of the point to test if it is in the circle.
Returns:
The index of the circle that contains the point or Integer.MIN_VALUE if there is no circle that contains the point.
Throws:
FormsAdministratorError - A new error that said that the circle doesn't exist.
See Also:
FormsAdministratorError

returnRadius

public int returnRadius(int indexCircle)
                 throws FormsAdministratorError
Return the radius of the circle at index indexCircle.
Parameters:
indexCircle - The index of the circle we want to have the radius.
Returns:
The radius of the specified circle or an error (if the specified index is not a valid one).
Throws:
FormsAdministratorError - A new error that said that the circle doesn't exist.
See Also:
FormsAdministratorError

returnCircleCenter

public int[] returnCircleCenter(int indexCircle)
                         throws FormsAdministratorError
This method return the center of a circle.
Parameters:
indexCircle - The index of the circle we want to have the center.
Returns:
The center of the specified circle or an error (if the specified index is not a valid one).
Throws:
FormsAdministratorError - A new error that said that the circle doesn't exist.
See Also:
FormsAdministratorError

returnRectangle

public MyRectangle returnRectangle(int indexRectangle)
                            throws FormsAdministratorError
This fonction return a rectangle in the bag of rectangles.
Parameters:
indexRectangle - The rectangle we want to return is at position indexRectangle.
Throws:
FormsAdministratorError - A new error that said that the rectangle doesn't exist.
See Also:
FormsAdministratorError

returnIndexRectangle

public int returnIndexRectangle(int x,
                                int y)
                         throws FormsAdministratorError
This method return the rectangle (his index in the bag) if it contains the point specified in parameters.
Parameters:
x - The x coordinate of the point to test if it is in the rectangle.
y - The y coordinate of the point to test if it is in the rectangle.
Returns:
The index of the rectangle that contains the point or Integer.MIN_VALUE if there is no rectangle that contains the point.
Throws:
FormsAdministratorError - A new error that said that the rectangle doesn't exist.
See Also:
FormsAdministratorError

returnRectangleWidth

public int returnRectangleWidth(int indexRectangle)
                         throws FormsAdministratorError
This method return the width of a rectangle.
Parameters:
indexRectangle - The rectangle we want to return it's width is at position indexRectangle.
Returns:
The width of the rectangle or an error if the indexRectangle isn't a valide parameters.
Throws:
FormsAdministratorError - A new error that said that the rectangle doesn't exist.
See Also:
FormsAdministratorError

returnRectangleHeight

public int returnRectangleHeight(int indexRectangle)
                          throws FormsAdministratorError
This method return the height of a rectangle.
Parameters:
indexRectangle - The rectangle we want to return it's height is at position indexRectangle.
Returns:
The height of the rectangle or an error if the indexRectangle isn't a valide parameters.
Throws:
FormsAdministratorError - A new error that said that the rectangle doesn't exist.
See Also:
FormsAdministratorError

returnPolygon

public MyPolygon returnPolygon(int indexPolygon)
                        throws FormsAdministratorError
This fonction return a polygon in the bag of polygons.
Parameters:
indexPolygon - The polygon we want to return is at position indexPolygon.
Throws:
FormsAdministratorError - A new error that said that the rectangle doesn't exist.
See Also:
FormsAdministratorError

returnIndexPolygon

public int returnIndexPolygon(int x,
                              int y)
                       throws FormsAdministratorError
This method return the polygon (his index in the bag) if it contains the point specified in parameters.
Parameters:
x - The x coordinate of the point to test if it is in the polygon.
y - The y coordinate of the point to test if it is in the polygon.
Returns:
The index of the polygon that contains the point or Integer.MIN_VALUE if there is no polygon that contains the point.
Throws:
FormsAdministratorError - A new error that said that the polygon doesn't exist.
See Also:
FormsAdministratorError

returnPolygonWidth

public int returnPolygonWidth(int indexPolygon)
                       throws FormsAdministratorError
This method return the width of a polygon.
Parameters:
indexPolygon - The polygon we want to return it's width is at position indexPolygon.
Returns:
The width of the polygon or an error if the indexPolygon isn't a valide parameters.
Throws:
FormsAdministratorError - A new error that said that the polygon doesn't exist.
See Also:
FormsAdministratorError

returnPolygonHeight

public int returnPolygonHeight(int indexPolygon)
                        throws FormsAdministratorError
This method return the height of a polygon.
Parameters:
indexPolygon - The polygon we want to return it's height is at position indexPolygon.
Returns:
The height of the polygon or an error if the indexPolygon isn't a valide parameters.
Throws:
FormsAdministratorError - A new error that said that the polygon doesn't exist.
See Also:
FormsAdministratorError

indexCircle

public int indexCircle()
This method return the size of the circle vector.
Returns:
The size of the circle vector.

indexRectangle

public int indexRectangle()
This method return the size of the rectangle vector.
Returns:
The size of the rectangle vector.

indexPolygon

public int indexPolygon()
This method return the size of the polygon vector.
Returns:
The size of the polygon vector.