package ru.job4j.condition;
/**
* @author Andrey Baranov
* @version $Id$
* @since 0.1
*/
public class Triangle {
/**
* field a.
*/
private Point a;
/**
* field b.
*/
private Point b;
/**
* field c.
*/
private Point c;
/**
* constructor initializes private fields of class.
*@param x initializes field a
*@param y initializes field b
*@param z initializes field c
*/
public Triangle(Point x, Point y, Point z) {
        this.a = x;
        this.b = y;
        this.c = z;
}
/**
* constructor initializes private fields of class.
*@return square
*/
public double area() {
        if ((a.getX() != b.getX() || a.getY() != b.getY()) && (b.getX() != c.getX() || b.getY() != c.getY()) && (a.getX() != c.getX() || a.getY() != c.getY())) {
            double ab = Math.sqrt(Mat.sqr(a.getX() - b.getX(), 2) + Mat.sqr(a.getY() - b.getY(), 2));
            double bc = Math.sqrt(Mat.sqr(b.getX() - c.getX(), 2) + Mat.sqr(b.getY() - c.getY(), 2));
            double ac = Math.sqrt(Mat.sqr(a.getX() - c.getX(), 2) + Mat.sqr(a.getY() - c.getY(), 2));
            double p = (ab + ac + bc) / 2;
            double s = Math.sqrt(p * (p - ab) * (p - ac) * (p - bc));
            return s;
        }
        return 0;
    }
}
@@ -476,55 +476,33 @@
 *%0A* 
-constructor initializes private fields of class
+returns length of side AB
 .%0A*@
@@ -512,14 +512,10 @@
 urn 
-square
+AB
 %0A*/%0A
@@ -532,29 +532,43 @@
 ble 
-area() %7B%0A        if (
+getAB() %7B%0A%09return Math.sqrt(Mat.sqr
 (a.g
@@ -573,18 +573,17 @@
 .getX() 
-!=
+-
  b.getX(
@@ -587,61 +587,33 @@
 tX()
- %7C%7C a.getY() != b.getY()) && (b.getX() != c
+, 2) + Mat.sqr(a
 .get
-X() %7C%7C
+Y() -
  b.g
@@ -621,98 +621,96 @@
 tY()
- != c.getY()) && (a.getX() != c.getX() %7C%7C a.getY() != c.getY())) %7B%0A            double ab =
+, 2));%0A%7D%0A/**%0A* returns length of side BC.%0A*@return BC%0A*/%0Apublic double getBC() %7B%0A%09return
  Mat
@@ -716,33 +716,33 @@
 th.sqrt(Mat.sqr(
-a
+b
 .getX() - b.getX
@@ -727,33 +727,33 @@
 .sqr(b.getX() - 
-b
+c
 .getX(), 2) + Ma
@@ -750,33 +750,33 @@
 ), 2) + Mat.sqr(
-a
+b
 .getY() - b.getY
@@ -761,33 +761,33 @@
 .sqr(b.getY() - 
-b
+c
 .getY(), 2));%0A  
@@ -788,31 +788,89 @@
 ));%0A
-            double bc =
+%7D%0A/**%0A* returns length of side AC.%0A*@return AC%0A*/%0Apublic double getAC() %7B%0A%09return
  Mat
@@ -876,33 +876,33 @@
 th.sqrt(Mat.sqr(
-b
+a
 .getX() - c.getX
@@ -910,33 +910,33 @@
 ), 2) + Mat.sqr(
-b
+a
 .getY() - c.getY
@@ -948,59 +948,146 @@
 ));%0A
-            double ac = Math.sqrt(Mat.sqr(a
+%7D%0A/**%0A* returns square.%0A*@return square%0A*/%0Apublic double area() %7B%0A        if ((a.getX() != b.getX() %7C%7C a.getY() != b.getY()) && (b
 .getX() 
 - c.
@@ -1074,33 +1074,34 @@
 )) && (b.getX() 
--
+!=
  c.getX(), 2) + 
@@ -1089,39 +1089,78 @@
  != c.getX()
-, 2) + Mat.sqr(
+ %7C%7C b.getY() != c.getY()) && (a.getX() != c.getX() %7C%7C 
 a.getY() - c
@@ -1148,33 +1148,34 @@
 X() %7C%7C a.getY() 
--
+!=
  c.getY(), 2));%0A
@@ -1167,22 +1167,20 @@
 c.getY()
-, 2));
+)) %7B
 %0A       
@@ -1200,20 +1200,35 @@
  = (
-ab + ac + bc
+getAB() + getAC() + getBC()
 ) / 
@@ -1276,10 +1276,15 @@
 p - 
-ab
+getAB()
 ) * 
@@ -1288,18 +1288,23 @@
  * (p - 
-ac
+getAC()
 ) * (p -
@@ -1308,10 +1308,15 @@
 p - 
-bc
+getBC()
 ));%0A

fix duplication