GraphLab Project

graphlab.graph.graph
Class EdgeModel

java.lang.Object
  extended by graphlab.library.BaseEdge<VertexModel>
      extended by graphlab.graph.graph.EdgeModel
All Implemented Interfaces:
java.lang.Comparable<BaseEdge<VertexModel>>

public class EdgeModel
extends BaseEdge<VertexModel>

User: azin azadi,roozbeh ebrahimi


Field Summary
 GraphPoint curveControlPoint
           
 java.awt.geom.Line2D.Double line
          it's a straight line between source and target vertices
 EdgeModelListener view
           
 
Fields inherited from class graphlab.library.BaseEdge
prop, source, target
 
Constructor Summary
EdgeModel(EdgeModel edge, VertexModel source, VertexModel target)
          copy constructor creates a copy (clone) of edge, the source and target of edge will be source and target parameters other properties of edge will be copied from edge parameter
EdgeModel(VertexModel v1, VertexModel v2)
           
 
Method Summary
static void addGlobalUserDefinedAttribute(java.lang.String name, java.lang.Object defaultvalue)
          sets and stores a global user defined attribute for the vertex.
 double getAngle()
          Returns the getAngle, in radians, of the edge from the positive x-axis, where the source vertex marks the origin of the edge.
 Arrow getArrow()
           
 EdgeModel getCopy(VertexModel vm1, VertexModel vm2)
          This is the copy constructor method for the Edge Model
 GraphPoint getCurveControlPoint()
           
 java.lang.String getId()
           
 java.lang.String getLabel()
           
 GraphPoint getLabelLocation()
           
 GStroke getStroke()
           
<t> t
getUserDefinedAttribute(java.lang.String name)
          returns the specified user defined attribute, or null if it does not exists.
 java.util.HashMap<java.lang.String,java.lang.Object> getUserDefinedAttributes()
           
 boolean isSelected()
           
 boolean isShowWeight()
           
static void removeGlobalUserDefinedAttribute(java.lang.String name)
           
 void removeUserDefinedAttribute(java.lang.String name)
          removes the given attribute from the list of user defined attributes
 void setArrow(Arrow a)
           
 void setColor(int color)
          Sets the color of the edge.
 void setCurveControlPoint(GraphPoint controlPoint)
           
 void setEdgeModelListener(EdgeModelListener listener)
           
 void setLabel(java.lang.String label)
           
 void setLabelLocation(GraphPoint graphPoint)
           
 void setMark(boolean m)
          Sets the mark of the edge.
 void setProp(BaseEdgeProperties prop)
          Sets properties object for this edge; Overwrites the existing.
 void setSelected(boolean selected)
           
 void setShowWeight(boolean showWeight)
           
 void setStroke(GStroke stroke)
           
 void setUserDefinedAttribute(java.lang.String name, java.lang.Object value)
          sets and stores a user defined attribute for the vertex.
 void setWeight(int weight)
          Sets the weight of the edge.
 java.lang.String toString()
           
 void updateBounds()
           
 
Methods inherited from class graphlab.library.BaseEdge
compareTo, getColor, getMark, getProp, getWeight
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

view

public EdgeModelListener view

line

public java.awt.geom.Line2D.Double line
it's a straight line between source and target vertices


curveControlPoint

public GraphPoint curveControlPoint
Constructor Detail

EdgeModel

public EdgeModel(EdgeModel edge,
                 VertexModel source,
                 VertexModel target)
copy constructor creates a copy (clone) of edge, the source and target of edge will be source and target parameters other properties of edge will be copied from edge parameter

Parameters:
edge -

EdgeModel

public EdgeModel(VertexModel v1,
                 VertexModel v2)
Method Detail

setUserDefinedAttribute

public void setUserDefinedAttribute(java.lang.String name,
                                    java.lang.Object value)
sets and stores a user defined attribute for the vertex. here you can put any attribute you like that are not available in the standard attributes. your attributes will be editable in property editor part of GUI. Use this method carefully. user defined attributes are stored in HashMap and bad use of them will cause memory leak in large graphs

Parameters:
name -
value -

getUserDefinedAttribute

public <t> t getUserDefinedAttribute(java.lang.String name)
returns the specified user defined attribute, or null if it does not exists.

Parameters:
name -
Returns:

removeUserDefinedAttribute

public void removeUserDefinedAttribute(java.lang.String name)
removes the given attribute from the list of user defined attributes

Parameters:
name -

getUserDefinedAttributes

public java.util.HashMap<java.lang.String,java.lang.Object> getUserDefinedAttributes()
Returns:
a HashMap containing all user defined attributes.

addGlobalUserDefinedAttribute

public static void addGlobalUserDefinedAttribute(java.lang.String name,
                                                 java.lang.Object defaultvalue)
sets and stores a global user defined attribute for the vertex. this attributes will be added to each vertex on constructing time using setUserDefinedAttribute method.

note that this method only affects the afterward created vertices, and current vertices will not affected by this method.


removeGlobalUserDefinedAttribute

public static void removeGlobalUserDefinedAttribute(java.lang.String name)
See Also:
VertexModel.addGlobalUserDefinedAttribute(java.lang.String, java.lang.Object)

getCopy

public EdgeModel getCopy(VertexModel vm1,
                         VertexModel vm2)
This is the copy constructor method for the Edge Model

Overrides:
getCopy in class BaseEdge<VertexModel>
Parameters:
vm1 -
vm2 -
Returns:

setMark

public void setMark(boolean m)
Description copied from class: BaseEdge
Sets the mark of the edge.

Overrides:
setMark in class BaseEdge<VertexModel>
Parameters:
m - Sets m as the mark of the edge.

setStroke

public void setStroke(GStroke stroke)

getStroke

public GStroke getStroke()

setWeight

public void setWeight(int weight)
Description copied from class: BaseEdge
Sets the weight of the edge.

Overrides:
setWeight in class BaseEdge<VertexModel>
Parameters:
weight - Sets w as the color of the edge.

setProp

public void setProp(BaseEdgeProperties prop)
Description copied from class: BaseEdge
Sets properties object for this edge; Overwrites the existing.

Overrides:
setProp in class BaseEdge<VertexModel>
Parameters:
prop - The property object to set.

setColor

public void setColor(int color)
Description copied from class: BaseEdge
Sets the color of the edge.

Overrides:
setColor in class BaseEdge<VertexModel>
Parameters:
color - Sets col as the color of the edge.

getArrow

public Arrow getArrow()

setArrow

public void setArrow(Arrow a)

setEdgeModelListener

public void setEdgeModelListener(EdgeModelListener listener)

getAngle

public double getAngle()
Returns the getAngle, in radians, of the edge from the positive x-axis, where the source vertex marks the origin of the edge. The getAngle will be in the range of 0 to 2pi and will increase counter-clockwise around the origin. (this method taked from GraphMaker Project)

Returns:
getAngle in radians from positive x-axis.

toString

public java.lang.String toString()
Overrides:
toString in class BaseEdge<VertexModel>

isSelected

public boolean isSelected()

setSelected

public void setSelected(boolean selected)

getId

public java.lang.String getId()

getCurveControlPoint

public GraphPoint getCurveControlPoint()
Returns:
return the curve control point of this edge, relative to the center of the edge the abstract position can be give by: (src.x + trg.x) / 2 + ctrlPnt.x , also for y

setCurveControlPoint

public void setCurveControlPoint(GraphPoint controlPoint)

setLabel

public void setLabel(java.lang.String label)

getLabel

public java.lang.String getLabel()

isShowWeight

public boolean isShowWeight()

setShowWeight

public void setShowWeight(boolean showWeight)

updateBounds

public void updateBounds()

setLabelLocation

public void setLabelLocation(GraphPoint graphPoint)

getLabelLocation

public GraphPoint getLabelLocation()

GraphLab Project