com.reades.mapthing
Class Link

java.lang.Object
  extended by com.reades.mapthing.Link
All Implemented Interfaces:
Serializable

public class Link
extends Object
implements Serializable

A simple link class that holds references to two Node objects. You would usually want to extend this class to do something more clever around weighting and such, but the idea here is that this class is easier to work with in Processing and allows us to implement zoom and pan without too much effort.

Author:
jereades
See Also:
Node, Serialized Form

Field Summary
 boolean DEBUG
           
 
Constructor Summary
Link(int id, Node n1, Node n2)
          Constructor takes two SimpleNode (or extensions of SimpleNode) objects and stores them for later retrieval.
Link(int id, Node n1, Node n2, double val)
          Create a Link object
Link(int id, Node n1, Node n2, double val, String nm)
          Create a Link object
Link(int id, Node n1, Node n2, String nm)
          Constructor takes two SimpleNode (or extensions of SimpleNode) objects and stores them for later retrieval.
 
Method Summary
 int getId()
          Get the id of the link
 String getName()
          Get the name of the link
 Node getNode1()
          Get the first node
 Node getNode2()
          Get the second node
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public boolean DEBUG
Constructor Detail

Link

public Link(int id,
            Node n1,
            Node n2)
Constructor takes two SimpleNode (or extensions of SimpleNode) objects and stores them for later retrieval.

Parameters:
id - a unique id for the link
n1 - the origin node of the link
n2 - the destination node of the link

Link

public Link(int id,
            Node n1,
            Node n2,
            String nm)
Constructor takes two SimpleNode (or extensions of SimpleNode) objects and stores them for later retrieval.

Parameters:
id - a unique id for the link
n1 - the origin node of the link
n2 - the destination node of the link
nm - a name for the link (if using labels)

Link

public Link(int id,
            Node n1,
            Node n2,
            double val)
Create a Link object

Parameters:
id - a unique identifier for the link
n1 - the origin node for the link
n2 - the destination node for the link
val - a link weight/value

Link

public Link(int id,
            Node n1,
            Node n2,
            double val,
            String nm)
Create a Link object

Parameters:
id - a unique identifier for the link
n1 - the origin node for the link
n2 - the destination node for the link
val - a link weight/value
nm - a name for the link (if labelling)
Method Detail

getId

public int getId()
Get the id of the link

Returns:
An integer identifier

getName

public String getName()
Get the name of the link

Returns:
An integer identifier

getNode1

public Node getNode1()
Get the first node

Returns:
An object of class Node
See Also:
Node

getNode2

public Node getNode2()
Get the second node

Returns:
An object of class Node
See Also:
Node


Processing library MapThing by Jon Reades. (C) 2013