Class UserGraph

Implemented Interfaces:
MouseListener, MouseMotionListener

public class UserGraph
extends JPanel
implements MouseListener, MouseMotionListener

Field Summary

private Node
actualNode
private int
countSelectedVertexes
private Graph
graph
private boolean
isDijkstraExec
private boolean
lock
private int
missingVertexes
private int
mouseX
private int
mouseY
private ArrayList
nodesError
(package private) static BasicStroke
normalStroke
private ShortestPath
parent
private int
reduntantVertexes
private Node
startSelection
(package private) static BasicStroke
wideStroke

Constructor Summary

UserGraph(ShortestPath parent)

Method Summary

private Node
clickedOnNode(int x, int y)
void
countErrors()
To store the different Errors
private void
drawCosts(Graphics g)
Method drawCosts.
void
drawEdge(Graphics g, Vertex v, FontMetrics fm)
void
drawNode(Graphics g, Node n, FontMetrics fm)
private void
drawTempLine(Node node, Graphics g)
void
execDijkstra()
Method execDijkstra.
int
getCountSelectedVertexes()
int
getMissingVertexes()
ArrayList
getNodesError()
int
getReduntantVertexes()
boolean
isDijkstraExec()
Returns the isDijkstraExec.
boolean
isLock()
Returns the lock.
void
mouseClicked(MouseEvent e)
void
mouseDragged(MouseEvent e)
void
mouseEntered(MouseEvent e)
void
mouseExited(MouseEvent e)
void
mouseMoved(MouseEvent e)
void
mousePressed(MouseEvent e)
Method mousePressed.
void
mouseReleased(MouseEvent e)
void
paint(Graphics g)
void
setCountSelectedVertexes(int i)
void
setGraph(Graph graph)
Method setGraph.
void
setIsDijkstraExec(boolean isDijkstraExec)
Sets the isDijkstraExec.
void
setLock(boolean lock)
Sets the lock.
void
setNodesError(ArrayList list)
protected void
setSolutionValues(ShortestPathTree spt)
Function use: The use of this function is to add the computize solution to the graph.

Field Details

actualNode

private Node actualNode

countSelectedVertexes

private int countSelectedVertexes

graph

private Graph graph

isDijkstraExec

private boolean isDijkstraExec

lock

private boolean lock

missingVertexes

private int missingVertexes

mouseX

private int mouseX

mouseY

private int mouseY

nodesError

private ArrayList nodesError

normalStroke

(package private) static final BasicStroke normalStroke

parent

private ShortestPath parent

reduntantVertexes

private int reduntantVertexes

startSelection

private Node startSelection

wideStroke

(package private) static final BasicStroke wideStroke

Constructor Details

UserGraph

public UserGraph(ShortestPath parent)

Method Details

clickedOnNode

private Node clickedOnNode(int x,
                           int y)

countErrors

public void countErrors()
To store the different Errors

drawCosts

private void drawCosts(Graphics g)
Method drawCosts.
Parameters:
g -

drawEdge

public void drawEdge(Graphics g,
                     Vertex v,
                     FontMetrics fm)

drawNode

public void drawNode(Graphics g,
                     Node n,
                     FontMetrics fm)

drawTempLine

private void drawTempLine(Node node,
                          Graphics g)
Parameters:
node -

execDijkstra

public void execDijkstra()
Method execDijkstra.

getCountSelectedVertexes

public int getCountSelectedVertexes()
Returns:

getMissingVertexes

public int getMissingVertexes()
Returns:

getNodesError

public ArrayList getNodesError()
Returns:

getReduntantVertexes

public int getReduntantVertexes()
Returns:

isDijkstraExec

public boolean isDijkstraExec()
Returns the isDijkstraExec.
Returns:
boolean

isLock

public boolean isLock()
Returns the lock.
Returns:
boolean

mouseClicked

public void mouseClicked(MouseEvent e)

mouseDragged

public void mouseDragged(MouseEvent e)

mouseEntered

public void mouseEntered(MouseEvent e)

mouseExited

public void mouseExited(MouseEvent e)

mouseMoved

public void mouseMoved(MouseEvent e)

mousePressed

public void mousePressed(MouseEvent e)
Method mousePressed.
Parameters:
e -

mouseReleased

public void mouseReleased(MouseEvent e)

paint

public void paint(Graphics g)

setCountSelectedVertexes

public void setCountSelectedVertexes(int i)
Parameters:
i -

setGraph

public void setGraph(Graph graph)
Method setGraph.
Parameters:
graph -

setIsDijkstraExec

public void setIsDijkstraExec(boolean isDijkstraExec)
Sets the isDijkstraExec.
Parameters:
isDijkstraExec - The isDijkstraExec to set

setLock

public void setLock(boolean lock)
Sets the lock.
Parameters:
lock - The lock to set

setNodesError

public void setNodesError(ArrayList list)
Parameters:
list -

setSolutionValues

protected void setSolutionValues(ShortestPathTree spt)
Function use: The use of this function is to add the computize solution to the graph. So, we can compare user input, which the real score. First, we compare the distance values and than we compare the settings of the edges.