Advertisement
Guest User

Untitled

a guest
Dec 4th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. package geometry;
  2.  
  3. /**
  4. * Created by fabian on 04.12.2016.
  5. */
  6. public class Triangle {
  7.  
  8. private Point P1;
  9. private Point P2;
  10. private Point P3;
  11.  
  12. public Triangle(Point P1,Point P2,Point P3){
  13. this.P1 = P1;
  14. this.P2 = P2;
  15. this.P3 = P3;
  16. }
  17. public Point getP1(){
  18. return P1;
  19. }
  20. public Point getP2(){
  21. return P2;
  22. }
  23. public Point getP3(){
  24. return P3;
  25. }
  26. public Line [] getLines(){
  27. Line [] Lines = new Line[3];
  28. Lines[0] = new Line(this.getP1(),this.getP2());
  29. Lines[1] = new Line(this.getP2(),this.getP3());
  30. Lines[2] = new Line(this.getP3(),this.getP1());
  31. return Lines;
  32. }
  33.  
  34. @Override
  35.  
  36. public boolean equals (Object o,Object o2,Object o3){
  37. Point P1 = (Point) o;
  38. Point P2 = (Point) o2;
  39. Point P3 = (Point) o3;
  40.  
  41.  
  42. if (this.P1 == o && this.P2 == o2&&this.P3==o3)
  43. {
  44. return true;
  45. }else{
  46. return false;
  47. }
  48. }
  49. @Override
  50. public String toString(){
  51. String str1 = this.P1.toString();
  52. String str2 = this.P2.toString();
  53. String str3 = this.P3.toString();
  54. String ausgabe= str1+","+str2+","+str3;
  55. return ausgabe;
  56. }
  57.  
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement