edu.ucla.stat.SOCR.touchgraph.graphlayout
Class Edge

java.lang.Object
  extended by edu.ucla.stat.SOCR.touchgraph.graphlayout.Edge

public class Edge
extends java.lang.Object

Edge.

Version:
1.22-jre1.1 $Id: Edge.java,v 1.1 2010/01/20 20:38:32 jiecui Exp $
Author:
Alexander Shapiro

Field Summary
protected  java.awt.Color col
           
static java.awt.Color DEFAULT_COLOR
           
static int DEFAULT_LENGTH
           
 Node from
           
static java.awt.Color HIGHLIGHT_COLOR
           
protected  boolean highlighted
           
protected  java.lang.String id
           
protected  int length
           
static java.awt.Color MOUSE_OVER_COLOR
           
static java.awt.Color SELECT_COLOR
           
 Node to
           
protected  boolean visible
           
 
Constructor Summary
Edge(Node f, Node t)
          Constructor with two Nodes, which uses a default length.
Edge(Node f, Node t, int len)
          Constructor with two Nodes and a length.
 
Method Summary
 boolean containsPoint(double px, double py)
           
 double distFromPoint(double px, double py)
           
 java.awt.Color getColor()
          Returns the color of this edge as Color.
 Node getFrom()
          Returns the starting "from" node of this edge as Node.
 java.lang.String getID()
          Returns the ID of this Edge as a String.
 int getLength()
          Returns the length of this Edge as a double.
 Node getOtherEndpt(Node n)
           
 Node getTo()
          Returns the terminating "to" node of this edge as Node.
 boolean intersects(java.awt.Dimension d)
           
 boolean isVisible()
          Return the visibility of this Edge as a boolean.
 void paint(java.awt.Graphics g, TGPanel tgPanel)
           
static void paintArrow(java.awt.Graphics g, int x1, int y1, int x2, int y2, java.awt.Color c)
           
 void reverse()
          Switches the endpoints of the edge
 void setColor(java.awt.Color color)
          Set the color of this Edge to the Color color.
static void setEdgeDefaultColor(java.awt.Color color)
           
static void setEdgeDefaultLength(int length)
           
static void setEdgeMouseOverColor(java.awt.Color color)
           
 void setHighlighted(boolean flag)
           
 void setID(java.lang.String id)
          Set the ID of this Edge to the String id.
 void setLength(int len)
          Set the length of this Edge to the int len.
 void setVisible(boolean v)
          Set the visibility of this Edge to the boolean v.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_COLOR

public static java.awt.Color DEFAULT_COLOR

HIGHLIGHT_COLOR

public static java.awt.Color HIGHLIGHT_COLOR

SELECT_COLOR

public static java.awt.Color SELECT_COLOR

MOUSE_OVER_COLOR

public static java.awt.Color MOUSE_OVER_COLOR

DEFAULT_LENGTH

public static int DEFAULT_LENGTH

from

public Node from

to

public Node to

col

protected java.awt.Color col

length

protected int length

visible

protected boolean visible

id

protected java.lang.String id

highlighted

protected boolean highlighted
Constructor Detail

Edge

public Edge(Node f,
            Node t,
            int len)
Constructor with two Nodes and a length.


Edge

public Edge(Node f,
            Node t)
Constructor with two Nodes, which uses a default length.

Method Detail

setEdgeDefaultColor

public static void setEdgeDefaultColor(java.awt.Color color)

setEdgeMouseOverColor

public static void setEdgeMouseOverColor(java.awt.Color color)

setEdgeDefaultLength

public static void setEdgeDefaultLength(int length)

getFrom

public Node getFrom()
Returns the starting "from" node of this edge as Node.


getTo

public Node getTo()
Returns the terminating "to" node of this edge as Node.


getColor

public java.awt.Color getColor()
Returns the color of this edge as Color.


setColor

public void setColor(java.awt.Color color)
Set the color of this Edge to the Color color.


getID

public java.lang.String getID()
Returns the ID of this Edge as a String.


setID

public void setID(java.lang.String id)
Set the ID of this Edge to the String id.


getLength

public int getLength()
Returns the length of this Edge as a double.


setLength

public void setLength(int len)
Set the length of this Edge to the int len.


setHighlighted

public void setHighlighted(boolean flag)

setVisible

public void setVisible(boolean v)
Set the visibility of this Edge to the boolean v.


isVisible

public boolean isVisible()
Return the visibility of this Edge as a boolean.


getOtherEndpt

public Node getOtherEndpt(Node n)

reverse

public void reverse()
Switches the endpoints of the edge


intersects

public boolean intersects(java.awt.Dimension d)

distFromPoint

public double distFromPoint(double px,
                            double py)

containsPoint

public boolean containsPoint(double px,
                             double py)

paintArrow

public static void paintArrow(java.awt.Graphics g,
                              int x1,
                              int y1,
                              int x2,
                              int y2,
                              java.awt.Color c)

paint

public void paint(java.awt.Graphics g,
                  TGPanel tgPanel)