annotate NGSrich_0.5.5/src/datastructures/AVLNode.java @ 0:89ad0a9cca52 default tip

Uploaded
author pfrommolt
date Mon, 21 Nov 2011 08:12:19 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
1 package datastructures;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
2
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
3
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
4 // Basic node stored in AVL trees
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
5 // Note that this class is not accessible outside
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
6 // of package DataStructures
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
7
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
8 class AVLNode
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
9 {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
10 // Constructors
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
11 @SuppressWarnings("unchecked")
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
12 AVLNode( Comparable theElement )
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
13 {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
14 this( theElement, null, null );
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
15 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
16
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
17 @SuppressWarnings("unchecked")
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
18 AVLNode( Comparable theElement, AVLNode lt, AVLNode rt )
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
19 {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
20 element = theElement;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
21 left = lt;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
22 right = rt;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
23 height = 0;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
24 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
25
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
26 // Friendly data; accessible by other package routines
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
27 @SuppressWarnings("unchecked")
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
28 Comparable element; // The data in the node
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
29 AVLNode left; // Left child
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
30 AVLNode right; // Right child
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
31 int height; // Height
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
32 }