package uk.me.graphe.client;

public class EdgeDrawable {
    private int mStartX;
    private int mStartY;

    private int mEndX;
    private int mEndY;

    /**
     * determines of the edge needs an arrow
     * 
     * arrows are always at the end edge
     */
    private boolean mArrow;
    private boolean mHilighted;

    /**
     * creates a new EdgeDrawable, with no arrow
     * 
     * @param startX
     *            the start x of the edge
     * @param startY
     *            the start y of the edge
     * @param endX
     *            the end x of the edge
     * @param endY
     *            the end y of the edge
     */
    public EdgeDrawable(int startX, int startY, int endX, int endY) {
        this(startX, startY, endX, endY, false);
    }

    /**
     * creates a new EdgeDrawable
     * 
     * @param startX
     *            the start x of the edge
     * @param startY
     *            the start y of the edge
     * @param endX
     *            the end x of the edge
     * @param endY
     *            the end y of the edge
     * @param needsArrow
     *            whether the end of the line needs an arrow
     */
    public EdgeDrawable(int startX, int startY, int endX, int endY, boolean needsArrow) {
        mStartX = startX;
        mStartY = startY;

        mEndX = endX;
        mEndY = endY;

        mArrow = needsArrow;
    }

    /**
     * gets the x of the start of the line
     * 
     * @return int representing x at the start of the line
     */
    public int getStartX() {
        return mStartX;
    }

    /**
     * gets the y of the start of the line
     * 
     * @return int representing y at the start of the line
     */
    public int getStartY() {
        return mStartY;
    }

    /**
     * gets the x of the end of the line
     * 
     * @return int represehnting x at the end of the line
     */
    public int getEndX() {
        return mEndX;
    }

    /**
     * gets the y at the end of the line
     * 
     * @return int representing y at the end of the line
     */
    public int getEndY() {
        return mEndY;
    }

    /**
     * determines if the line needs an arrow at the end
     * 
     * @return true if the line needs an arrow at the end else false
     */
    public boolean needsArrow() {
        return mArrow;
    }
    
    
    public boolean isHilighted() {
        return mHilighted;
    }
    
    public void setHilighted(boolean h) {
        mHilighted = h;
    } 
}

@@ -23,16 +23,61 @@
 lient;%0A%0A
+import uk.me.graphe.shared.VertexDirection;%0A%0A
 public c
@@ -320,22 +320,39 @@
 ate 
-boolean mArrow
+VertexDirection mArrowDirection
 ;%0A  
@@ -810,21 +810,36 @@
 , endY, 
-false
+VertexDirection.both
 );%0A    %7D
@@ -1148,26 +1148,24 @@
  @param 
-needsA
+a
 rrow
+Dir
 %0A     * 
@@ -1179,50 +1179,56 @@
     
-whether the end of the line needs an arrow
+the direction in which the arrow should be drawn
 %0A   
@@ -1300,34 +1300,40 @@
 t endY, 
-boolean needsA
+VertexDirection a
 rrow
+Dir
 ) %7B%0A    
@@ -1444,21 +1444,28 @@
 rrow
- = needsA
+Direction = a
 rrow
+Dir
 ;%0A  
@@ -2251,26 +2251,39 @@
 n arrow 
-at
+in
  the 
-end
+fromTo direction
 %0A     * 
@@ -2334,37 +2334,148 @@
 row 
-at
+in
  the 
-end else false%0A     */
+fromTo direction%0A     */%0A    public boolean needsFromToArrow() %7B%0A        return mArrowDirection == VertexDirection.fromTo;%0A    %7D%0A    
 %0A   
@@ -2495,16 +2495,22 @@
 an needs
+ToFrom
 Arrow() 
@@ -2532,16 +2532,51 @@
 n mArrow
+Direction == VertexDirection.toFrom
 ;%0A    %7D%0A

make arrows on edge drawable well directioned