KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > prefuse > data > tuple > TableNode


1 package prefuse.data.tuple;
2
3 import java.util.Iterator JavaDoc;
4
5 import prefuse.data.Edge;
6 import prefuse.data.Graph;
7 import prefuse.data.Node;
8 import prefuse.data.Table;
9
10 /**
11  * Node implementation that reads Node data from a backing node table.
12  *
13  * @author <a HREF="http://jheer.org">jeffrey heer</a>
14  */

15 public class TableNode extends TableTuple implements Node {
16
17     /**
18      * The backing graph.
19      */

20     protected Graph m_graph;
21     
22     /**
23      * Initialize a new Node backed by a node table. This method is used by
24      * the appropriate TupleManager instance, and should not be called
25      * directly by client code, unless by a client-supplied custom
26      * TupleManager.
27      * @param table the node Table
28      * @param graph the backing Graph
29      * @param row the row in the node table to which this Node instance
30      * corresponds.
31      */

32     protected void init(Table table, Graph graph, int row) {
33         m_table = table;
34         m_graph = graph;
35         m_row = m_table.isValidRow(row) ? row : -1;
36     }
37     
38     /**
39      * @see prefuse.data.Node#getGraph()
40      */

41     public Graph getGraph() {
42         return m_graph;
43     }
44     
45     // ------------------------------------------------------------------------
46
// Graph Methods
47

48     /**
49      * @see prefuse.data.Node#getInDegree()
50      */

51     public int getInDegree() {
52         return m_graph.getInDegree(this);
53     }
54
55     /**
56      * @see prefuse.data.Node#getOutDegree()
57      */

58     public int getOutDegree() {
59         return m_graph.getOutDegree(this);
60     }
61
62     /**
63      * @see prefuse.data.Node#getDegree()
64      */

65     public int getDegree() {
66         return m_graph.getDegree(this);
67     }
68
69     /**
70      * @see prefuse.data.Node#inEdges()
71      */

72     public Iterator JavaDoc inEdges() {
73         return m_graph.inEdges(this);
74     }
75
76     /**
77      * @see prefuse.data.Node#outEdges()
78      */

79     public Iterator JavaDoc outEdges() {
80         return m_graph.outEdges(this);
81     }
82
83     /**
84      * @see prefuse.data.Node#edges()
85      */

86     public Iterator JavaDoc edges() {
87         return m_graph.edges(this);
88     }
89     
90     /**
91      * @see prefuse.data.Node#inNeighbors()
92      */

93     public Iterator JavaDoc inNeighbors() {
94         return m_graph.inNeighbors(this);
95     }
96     
97     /**
98      * @see prefuse.data.Node#outNeighbors()
99      */

100     public Iterator JavaDoc outNeighbors() {
101         return m_graph.outNeighbors(this);
102     }
103     
104     /**
105      * @see prefuse.data.Node#neighbors()
106      */

107     public Iterator JavaDoc neighbors() {
108         return m_graph.neighbors(this);
109     }
110
111     
112     // ------------------------------------------------------------------------
113
// Tree Methods
114

115     /**
116      * @see prefuse.data.Node#getParent()
117      */

118     public Node getParent() {
119         return m_graph.getSpanningTree().getParent(this);
120     }
121
122     /**
123      * @see prefuse.data.Node#getParentEdge()
124      */

125     public Edge getParentEdge() {
126         return m_graph.getSpanningTree().getParentEdge(this);
127     }
128     
129     /**
130      * @see prefuse.data.Node#getChildCount()
131      */

132     public int getChildCount() {
133         return m_graph.getSpanningTree().getChildCount(m_row);
134     }
135
136     /**
137      * @see prefuse.data.Node#getChildIndex(prefuse.data.Node)
138      */

139     public int getChildIndex(Node child) {
140         return m_graph.getSpanningTree().getChildIndex(this, child);
141     }
142     
143     /**
144      * @see prefuse.data.Node#getChild(int)
145      */

146     public Node getChild(int idx) {
147         return m_graph.getSpanningTree().getChild(this, idx);
148     }
149     
150     /**
151      * @see prefuse.data.Node#getFirstChild()
152      */

153     public Node getFirstChild() {
154         return m_graph.getSpanningTree().getFirstChild(this);
155     }
156     
157     /**
158      * @see prefuse.data.Node#getLastChild()
159      */

160     public Node getLastChild() {
161         return m_graph.getSpanningTree().getLastChild(this);
162     }
163     
164     /**
165      * @see prefuse.data.Node#getPreviousSibling()
166      */

167     public Node getPreviousSibling() {
168         return m_graph.getSpanningTree().getPreviousSibling(this);
169     }
170     
171     /**
172      * @see prefuse.data.Node#getNextSibling()
173      */

174     public Node getNextSibling() {
175         return m_graph.getSpanningTree().getNextSibling(this);
176     }
177     
178     /**
179      * @see prefuse.data.Node#children()
180      */

181     public Iterator JavaDoc children() {
182         return m_graph.getSpanningTree().children(this);
183     }
184
185     /**
186      * @see prefuse.data.Node#childEdges()
187      */

188     public Iterator JavaDoc childEdges() {
189         return m_graph.getSpanningTree().childEdges(this);
190     }
191
192     /**
193      * @see prefuse.data.Node#getDepth()
194      */

195     public int getDepth() {
196         return m_graph.getSpanningTree().getDepth(m_row);
197     }
198
199 } // end of class TableNode
200
Popular Tags