package gvs.business.logic.physics.helpers;

import java.awt.Point;

/**
 * A point in the layouting area
 * 
 * @author aegli
 *
 */
public class AreaPoint {
  private double x = 0;
  private double y = 0;

  /**
   * Represents a default particle point in area
   *
   */
  public AreaPoint() {
    this(0, 0);
  }

  /**
   * Sets a particle position by point
   * 
   * @param point
   */
  public AreaPoint(Point point) {
    this.setX(point.x);
    this.setY(point.y);
  }

  /**
   * Sets a particle position by coordinates
   * 
   * @param x
   * @param y
   */
  public AreaPoint(double x, double y) {
    this.setX(x);
    this.setY(y);
  }

  /**
   * Adds an acceleretation vecor to a point
   * 
   * @param v
   */
  public void addVector(AreaVector v) {
    this.setX(this.getX() + v.getX());
    this.setY(this.getY() + v.getY());
  }

  /**
   * Returns x position of a point
   * 
   * @return
   */
  public double getX() {
    return this.x;
  }

  /**
   * Returns y position of a point
   * 
   * @return
   */
  public double getY() {
    return this.y;
  }

  /**
   * Returns x or y position of point according to request
   * 
   * @param i
   * @return
   */
  public double getField(int i) {
    if (i == 0) {
      return getX();
    } else {
      return getY();
    }
  }

  /**
   * Sets x or y postion according to param i.
   * 
   * @param i
   * @param d
   */
  public void setField(int i, double d) {
    if (i == 0) {
      setX(d);
    } else {
      setY(d);
    }
  }

  public void setX(double x) {
    this.x = x;
  }

  public void setY(double y) {
    this.y = y;
  }
}

@@ -42,32 +42,8 @@
 s;%0A%0A
-import java.awt.Point;%0A%0A
 /**%0A
@@ -128,16 +128,17 @@
 Point %7B%0A
+%0A
   privat
@@ -147,20 +147,16 @@
 double x
- = 0
 ;%0A  priv
@@ -171,12 +171,8 @@
 le y
- = 0
 ;%0A%0A 
@@ -359,186 +359,8 @@
  */%0A
-  public AreaPoint(Point point) %7B%0A    this.setX(point.x);%0A    this.setY(point.y);%0A  %7D%0A%0A  /**%0A   * Sets a particle position by coordinates%0A   * %0A   * @param x%0A   * @param y%0A   */%0A
   pu
@@ -409,15 +409,13 @@
 his.
-setX(x)
+x = x
 ;%0A  
@@ -425,15 +425,13 @@
 his.
-setY(y)
+y = y
 ;%0A  

remove atw point class from business layer