Projecto
Class RectangleClass

java.lang.Object
  extended by Projecto.RectangleClass
All Implemented Interfaces:
Geometric_Figure

public class RectangleClass
extends java.lang.Object
implements Geometric_Figure

Classe que representa os rectângulos. Docente: Hugo Vieira P3

Author:
Ricardo Gaspar Nr: 35277, Tiago Silva Nr: 35411

Constructor Summary
RectangleClass(java.lang.String id, double xUpperLeft, double xLowerRight, double yUpperLeft, double yLowerRight)
          Construtor da classe Rectangle que permite criar uma figura rectangle dados o seu ID e as coordenadas dos seus pontos.
 
Method Summary
 double boundingRectXLowerRight()
          Devolve a coordenada X do canto inferior direito do rectângulo envolvente.
 double boundingRectXUpperLeft()
          Devolve a coordenada X do canto superior esquerdo do rectângulo envolvente.
 double boundingRectYLowerRight()
          Devolve a coordenada Y do canto inferior direito do rectângulo envolvente.
 double boundingRectYUpperLeft()
          Devolve a coordenada Y do canto superior esquerdo do rectângulo envolvente.
 double getArea()
          Devolve a área da figura geométrica.
 java.lang.String getID()
          Devolve o ID (nome único) da figura.
 double getPerimeter()
          Devolve o perímetro da figura geométrica.
 java.lang.String getType()
          Devolve o tipo de figura geométrica (i.e. triângulo, rectângulo, etc.).
 void translation(double translationX, double translationY)
          Método que permite fazer a translação das figuras geométricas no referêncial cartesiano.
 boolean validate()
          Verifica se não existe nenhuma coordenada X igual.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RectangleClass

public RectangleClass(java.lang.String id,
                      double xUpperLeft,
                      double xLowerRight,
                      double yUpperLeft,
                      double yLowerRight)
Construtor da classe Rectangle que permite criar uma figura rectangle dados o seu ID e as coordenadas dos seus pontos.

Parameters:
id - - ID da figura.
xUpperLeft - - Coordenada X do ponto superior esquerdo.
xLowerRight - - Coordenada X do ponto inferior direito.
yUpperLeft - - Coordenada Y do ponto superior esquerdo.
yLowerRight - - Coordenada Y do ponto inferior direito.
Method Detail

validate

public boolean validate()
Verifica se não existe nenhuma coordenada X igual.

Specified by:
validate in interface Geometric_Figure
Returns:
true se as coordenadas da figura estivem correctas, caso contrário devolve false.

getType

public java.lang.String getType()
Description copied from interface: Geometric_Figure
Devolve o tipo de figura geométrica (i.e. triângulo, rectângulo, etc.).

Specified by:
getType in interface Geometric_Figure
Returns:
String tipo de figura geométrica.

getID

public java.lang.String getID()
Description copied from interface: Geometric_Figure
Devolve o ID (nome único) da figura.

Specified by:
getID in interface Geometric_Figure
Returns:
String ID da figura.

getArea

public double getArea()
Description copied from interface: Geometric_Figure
Devolve a área da figura geométrica.

Specified by:
getArea in interface Geometric_Figure
Returns:
double área da figura geométrica.

getPerimeter

public double getPerimeter()
Description copied from interface: Geometric_Figure
Devolve o perímetro da figura geométrica.

Specified by:
getPerimeter in interface Geometric_Figure
Returns:
double perímetro da figura geométrica.

translation

public void translation(double translationX,
                        double translationY)
Description copied from interface: Geometric_Figure
Método que permite fazer a translação das figuras geométricas no referêncial cartesiano.

Specified by:
translation in interface Geometric_Figure
Parameters:
translationX - - deslocação segundo o eixo dos xx.
translationY - - deslocação segundo o eixo dos yy.

boundingRectXUpperLeft

public double boundingRectXUpperLeft()
Description copied from interface: Geometric_Figure
Devolve a coordenada X do canto superior esquerdo do rectângulo envolvente.

Specified by:
boundingRectXUpperLeft in interface Geometric_Figure
Returns:
double coordenada X do ponto do canto superior esquerdo.

boundingRectYUpperLeft

public double boundingRectYUpperLeft()
Description copied from interface: Geometric_Figure
Devolve a coordenada Y do canto superior esquerdo do rectângulo envolvente.

Specified by:
boundingRectYUpperLeft in interface Geometric_Figure
Returns:
double coordenada Y do ponto do canto superior esquerdo.

boundingRectXLowerRight

public double boundingRectXLowerRight()
Description copied from interface: Geometric_Figure
Devolve a coordenada X do canto inferior direito do rectângulo envolvente.

Specified by:
boundingRectXLowerRight in interface Geometric_Figure
Returns:
double coordenada X do ponto do canto inferior direito.

boundingRectYLowerRight

public double boundingRectYLowerRight()
Description copied from interface: Geometric_Figure
Devolve a coordenada Y do canto inferior direito do rectângulo envolvente.

Specified by:
boundingRectYLowerRight in interface Geometric_Figure
Returns:
double coordenada Y do ponto do canto inferior direito.