The class
TreeSDMLink
represents the links of the graph. Its definition is as shown in
the following code example.
public class TreeSDMLink implements IlvSDMLink { ...
The link implementation can therefore make use of all the
predefined methods of the IlvSDMLink interface.
Data Stored
Each link has a reference to a parent node and a child node,
which can be retrieved using the getFrom and getTo methods, see the following code
example.
Keeping track of link data: parent and
child
private TreeSDMNode parent, child; public TreeSDMLink(TreeSDMNode parent, TreeSDMNode child) { this.parent = parent; this.child = child; } public IlvSDMNode getFrom() { return parent; } public IlvSDMNode getTo() { return child; }
Implementation of the IlvSDMNode interface
The IlvSDMLink interface inherits from the IlvSDMNode interface and so the same
methods must be implemented as for a node.
The tag (type) of links is
treelink
. and this value can be retrieved using the
getTag
method, see the following code example.
public String getTag() { return "treelink"; }
The remaining methods are mostly empty,
since in this example links have no properties.