Skip to content

Commit e7fa878

Browse files
committed
Javadoc clean-up
1 parent eb56f0e commit e7fa878

File tree

106 files changed

+731
-596
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+731
-596
lines changed

src/com/jwetherell/algorithms/data_structures/AVLTree.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
* trees are more rigidly balanced, they are faster than red-black trees for
1313
* lookup intensive applications. However, red-black trees are faster for
1414
* insertion and removal.
15-
*
16-
* http://en.wikipedia.org/wiki/AVL_tree
17-
*
15+
* <p>
16+
* @see <a href="https://en.wikipedia.org/wiki/AVL_tree">AVL Tree (Wikipedia)</a>
17+
* <br>
1818
* @author Justin Wetherell <[email protected]>
1919
*/
2020
public class AVLTree<T extends Comparable<T>> extends BinarySearchTree<T> {

src/com/jwetherell/algorithms/data_structures/BTree.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
* two children. Unlike self-balancing binary search trees, the B-tree is
1515
* optimized for systems that read and write large blocks of data. It is
1616
* commonly used in databases and file-systems.
17-
*
18-
* http://en.wikipedia.org/wiki/B-tree
19-
*
17+
* <p>
18+
* @see <a href="https://en.wikipedia.org/wiki/B-tree">B-Tree (Wikipedia)</a>
19+
* <br>
2020
* @author Justin Wetherell <[email protected]>
2121
*/
2222
@SuppressWarnings("unchecked")

src/com/jwetherell/algorithms/data_structures/BinaryHeap.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
* the tree is not complete, the nodes of that level are filled from left to
1717
* right. 2) The heap property: each node is right than or equal to each of its
1818
* children according to a comparison predicate defined for the data structure.
19-
*
20-
* http://en.wikipedia.org/wiki/Binary_heap
21-
*
19+
* <p>
20+
* @see <a href="https://en.wikipedia.org/wiki/Binary_heap">Binary Heap (Wikipedia)</a>
21+
* <br>
2222
* @author Justin Wetherell <[email protected]>
2323
*/
2424
@SuppressWarnings("unchecked")

src/com/jwetherell/algorithms/data_structures/BinarySearchTree.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
* keys less than the node's key. 2) The right subtree of a node contains only
2020
* nodes with keys greater than the node's key. 3) Both the left and right
2121
* subtrees must also be binary search trees.
22-
*
23-
* http://en.wikipedia.org/wiki/Binary_search_tree
24-
*
22+
* <p>
23+
* @see <a href="https://en.wikipedia.org/wiki/Binary_search_tree">Binary Search Tree (Wikipedia)</a>
24+
* <br>
2525
* @author Justin Wetherell <[email protected]>
2626
*/
2727
@SuppressWarnings("unchecked")

src/com/jwetherell/algorithms/data_structures/CompactSuffixTrie.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
* string in a way that allows for a particularly fast implementation of many
99
* important string operations. This implementation is based upon a patricia
1010
* trie which IS a compact trie.
11-
*
12-
* http://en.wikipedia.org/wiki/Suffix_trie
13-
*
11+
* <p>
12+
* @see <a href="https://en.wikipedia.org/wiki/Suffix_trie">Suffix Trie (Wikipedia)</a>
13+
* <br>
1414
* @author Justin Wetherell <[email protected]>
1515
*/
1616
@SuppressWarnings("unchecked")

src/com/jwetherell/algorithms/data_structures/DisjointSet.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
/**
44
* In computer science, a disjoint-set data structure, also called a union–find data structure or merge–find set, is a data structure that keeps track of a set of
55
* elements partitioned into a number of disjoint (non-overlapping) subsets.
6-
*
7-
* It supports two useful operations:
6+
* <p>
7+
* It supports two useful operations:<br>
88
* Find: Determine which subset a particular element is in. Find typically returns an item from this set that serves as its "representative"; by comparing the
9-
* result of two Find operations, one can determine whether two elements are in the same subset.
10-
* Union: Join two subsets into a single subset.
11-
*
12-
* http://en.wikipedia.org/wiki/Disjoint-set_data_structure
13-
*
9+
* result of two Find operations, one can determine whether two elements are in the same subset.<br>
10+
* Union: Join two subsets into a single subset.<br>
11+
* <p>
12+
* @see <a href="https://en.wikipedia.org/wiki/Disjoint-set_data_structure">Disjoint Set (Wikipedia)</a>
13+
* <br>
1414
* @author Justin Wetherell <[email protected]>
1515
*/
1616
@SuppressWarnings("unchecked")

src/com/jwetherell/algorithms/data_structures/FenwickTree.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
* for calculation and manipulation of the prefix sums of a table of values. Fenwick trees
1111
* primarily solve the problem of balancing prefix sum calculation efficiency with element
1212
* modification efficiency.
13-
*
14-
* http://en.wikipedia.org/wiki/Fenwick_tree
15-
*
13+
* <p>
1614
* This class is meant to be somewhat generic, all you'd have to do is extend
1715
* the Data abstract class to store your custom data. I've included a range sum
1816
* implementations.
19-
*
17+
* <p>
18+
* @see <a href="https://en.wikipedia.org/wiki/Fenwick_tree">Fenwick Tree (Wikipedia)</a>
19+
* <br>
2020
* @author Justin Wetherell <[email protected]>
2121
*/
2222
@SuppressWarnings("unchecked")

src/com/jwetherell/algorithms/data_structures/Graph.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
* Graph. Could be directed or undirected depending on the TYPE enum. A graph is
1111
* an abstract representation of a set of objects where some pairs of the
1212
* objects are connected by links.
13-
*
14-
* http://en.wikipedia.org/wiki/Graph_(mathematics)
15-
*
13+
* <p>
14+
* @see <a href="https://en.wikipedia.org/wiki/Graph_(mathematics)">Graph (Wikipedia)</a>
15+
* <br>
1616
* @author Justin Wetherell <[email protected]>
1717
*/
1818
@SuppressWarnings("unchecked")

src/com/jwetherell/algorithms/data_structures/HashArrayMappedTrie.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
* A hash array mapped trie (HAMT) is an implementation of an associative
1111
* array that combines the characteristics of a hash table and an array mapped
1212
* trie. It is a refined version of the more general notion of a hash tree.
13-
*
13+
* <p>
1414
* This implementation is 32-bit and steps in 5-bit intervals, maximum tree
1515
* height of 7.
16-
*
17-
* http://en.wikipedia.org/wiki/Hash_array_mapped_trie
18-
*
16+
* <p>
17+
* @see <a href="https://en.wikipedia.org/wiki/Hash_array_mapped_trie">Hash Array Mapped Trie (Wikipedia)</a>
18+
* <br>
1919
* @author Justin Wetherell <[email protected]>
2020
*/
2121
@SuppressWarnings("unchecked")

src/com/jwetherell/algorithms/data_structures/HashMap.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
* Hash Map using either chaining or probing. hash map is a data structure that
1010
* uses a hash function to map identifying values, known as keys, to their
1111
* associated values.
12-
*
13-
* http://en.wikipedia.org/wiki/Hash_table
14-
*
12+
* <p>
13+
* @see <a href="https://en.wikipedia.org/wiki/Hash_table">Hash Map/Table (Wikipedia)</a>
14+
* <br>
1515
* @author Justin Wetherell <[email protected]>
1616
*/
1717
@SuppressWarnings("unchecked")

src/com/jwetherell/algorithms/data_structures/ImplicitKeyTreap.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@
99
/**
1010
* A Treap is a self-balancing binary search tree that uses randomization to maintain
1111
* a low height. In this version, it is used emulate the operations of an array and linked list.
12-
*
12+
* <p>
1313
* Time Complexity: Assuming the join/merge functions have constant complexity.
1414
* add(value), add(index,value), remove(index), set(index,value), get(index) all have O(log N).
1515
* remove(value), get(value), contains(value) all have O(N).
16-
*
16+
* <p>
1717
* Space Complexity: O(N)
18-
*
18+
* <p>
1919
* Note: This implementation is 0-based, meaning that all
2020
* indices from 0 to size() - 1, inclusive, are accessible.
21-
*
22-
* http://en.wikipedia.org/wiki/Treap
23-
*
21+
* <p>
22+
* @see <a href="https://en.wikipedia.org/wiki/Treap">Treap (Wikipedia)</a>
23+
* <br>
2424
* @author Justin Wetherell <[email protected]>
2525
*/
2626
@SuppressWarnings("unchecked")

src/com/jwetherell/algorithms/data_structures/IntervalTree.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
* An interval tree is an ordered tree data structure to hold intervals.
1313
* Specifically, it allows one to efficiently find all intervals that overlap
1414
* with any given interval or point.
15-
*
16-
* http://en.wikipedia.org/wiki/Interval_tree
17-
*
15+
* <p>
16+
* @see <a href="https://en.wikipedia.org/wiki/Interval_tree">Interval Tree (Wikipedia)</a>
17+
* <br>
1818
* @author Justin Wetherell <[email protected]>
1919
*/
2020
public class IntervalTree<O extends Object> {

src/com/jwetherell/algorithms/data_structures/KdTree.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@
2121
* useful data structure for several applications, such as searches involving a
2222
* multidimensional search key (e.g. range searches and nearest neighbor
2323
* searches). k-d trees are a special case of binary space partitioning trees.
24+
* <p>
25+
* @see <a href="https://en.wikipedia.org/wiki/K-d_tree">K-D Tree (Wikipedia)</a>
2426
* <br>
2527
* @author Justin Wetherell <[email protected]>
26-
* @see <a href="http://en.wikipedia.org/wiki/K-d_tree">K-d_tree (Wikipedia)</a>
2728
*/
2829
public class KdTree<T extends KdTree.XYZPoint> implements Iterable<T> {
2930

src/com/jwetherell/algorithms/data_structures/LCPArray.java

+23-22
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,33 @@
77
* data structure to the suffix array. It stores the lengths of the longest common
88
* prefixes (LCPs) between all pairs of consecutive suffixes in a sorted suffix array.
99
* <p>
10-
* https://en.wikipedia.org/wiki/LCP_array
10+
* @see <a href="https://en.wikipedia.org/wiki/LCP_array">LCP Array (Wikipedia)</a>
1111
* <br>
1212
* @author Jakub Szarawarski <[email protected]>
1313
* @author Justin Wetherell <[email protected]>
1414
*/
15-
public class LCPArray {
15+
public class LCPArray<C extends CharSequence> {
1616

1717
private static final char DEFAULT_END_SEQ_CHAR = '$';
1818

19-
private char END_SEQ_CHAR;
20-
private SuffixArray suffixArrayBuilder;
21-
private ArrayList<Integer> LCP;
19+
private final char endSeqChar;
2220

23-
public LCPArray(CharSequence sequence){
21+
private SuffixArray suffixArray;
22+
private ArrayList<Integer> lcp;
23+
24+
public LCPArray(C sequence){
2425
this(sequence, DEFAULT_END_SEQ_CHAR);
2526
}
2627

27-
public LCPArray(CharSequence sequence, char endChar) {
28-
END_SEQ_CHAR = endChar;
29-
suffixArrayBuilder = new SuffixArray(sequence, END_SEQ_CHAR);
28+
public LCPArray(C sequence, char endChar) {
29+
endSeqChar = endChar;
30+
suffixArray = new SuffixArray(sequence, endSeqChar);
3031
}
3132

3233
public ArrayList<Integer> getLCPArray() {
33-
if (LCP == null)
34+
if (lcp == null)
3435
LCPAlgorithm();
35-
return LCP;
36+
return lcp;
3637
}
3738

3839
private void LCPAlgorithm() {
@@ -41,20 +42,20 @@ private void LCPAlgorithm() {
4142
}
4243

4344
private ArrayList<Integer> getLCPR() {
44-
final ArrayList<Integer> KMRArray = suffixArrayBuilder.getKMRarray();
45-
final ArrayList<Integer> suffixArray = suffixArrayBuilder.getSuffixArray();
46-
final String string = suffixArrayBuilder.getString();
47-
final int length = KMRArray.size();
45+
final ArrayList<Integer> KMRArrayList = suffixArray.getKMRarray();
46+
final ArrayList<Integer> suffixArrayList = suffixArray.getSuffixArray();
47+
final String string = suffixArray.getString();
48+
final int length = KMRArrayList.size();
4849
final ArrayList<Integer> LCPR = new ArrayList<Integer>(); // helper array, LCP[i] = LCPR[suffixArray[i]]
4950

5051
int startingValue = 0;
5152
for (int i=0; i<length; i++) {
52-
if(KMRArray.get(i).equals(0)) {
53+
if(KMRArrayList.get(i).equals(0)) {
5354
LCPR.add(0);
5455
startingValue = 0;
5556
} else {
5657
int LCPRValue = startingValue;
57-
final int predecessor = suffixArray.get(KMRArray.get(i)-1);
58+
final int predecessor = suffixArrayList.get(KMRArrayList.get(i)-1);
5859
while (string.charAt(i+LCPRValue) == string.charAt(predecessor+LCPRValue))
5960
LCPRValue++;
6061
LCPR.add(LCPRValue);
@@ -66,12 +67,12 @@ private ArrayList<Integer> getLCPR() {
6667
}
6768

6869
private void getLCPfromLCPR(ArrayList<Integer> LCPR) {
69-
final ArrayList<Integer> suffixArray = suffixArrayBuilder.getSuffixArray();
70-
final int length = suffixArray.size();
70+
final ArrayList<Integer> suffixArrayList = suffixArray.getSuffixArray();
71+
final int length = suffixArrayList.size();
7172

72-
LCP = new ArrayList<Integer>();
73-
LCP.add(null); //no value for LCP[0]
73+
lcp = new ArrayList<Integer>();
74+
lcp.add(null); //no value for LCP[0]
7475
for (int i=1; i<length; i++)
75-
LCP.add(LCPR.get(suffixArray.get(i)));
76+
lcp.add(LCPR.get(suffixArrayList.get(i)));
7677
}
7778
}

src/com/jwetherell/algorithms/data_structures/List.java

+20-12
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,24 @@
44

55
import com.jwetherell.algorithms.data_structures.interfaces.IList;
66

7+
/**
8+
* In mathematics, a sequence is an enumerated collection of objects in which repetitions are allowed. Like a set, it contains members (also called elements, or terms). The number of elements
9+
* (possibly infinite) is called the length of the sequence. Unlike a set, order matters, and exactly the same elements can appear multiple times at different positions in the sequence.
10+
* <p>
11+
* @see <a href="https://en.wikipedia.org/wiki/Sequence">Sequence (Wikipedia)</a>
12+
* <br>
13+
* @author Justin Wetherell <[email protected]>
14+
*/
715
@SuppressWarnings("unchecked")
816
public abstract class List<T> implements IList<T> {
917

1018
/**
1119
* A dynamic array, growable array, resizable array, dynamic table, or array
1220
* list is a random access, variable-size list data structure that allows
1321
* elements to be added or removed.
14-
*
15-
* http://en.wikipedia.org/wiki/Dynamic_array
16-
*
22+
* <p>
23+
* @see <a href="https://en.wikipedia.org/wiki/Dynamic_array">Dynamic Array (Wikipedia)</a>
24+
* <br>
1725
* @author Justin Wetherell <[email protected]>
1826
*/
1927
public static class ArrayList<T> extends List<T> {
@@ -280,9 +288,9 @@ public T set(int index, T value) {
280288
/**
281289
* Linked List (Singly link). A linked list is a data structure consisting
282290
* of a group of nodes which together represent a sequence.
283-
*
284-
* http://en.wikipedia.org/wiki/Linked_list
285-
*
291+
* <p>
292+
* @see <a href="https://en.wikipedia.org/wiki/Linked_list">Linked List (Wikipedia)</a>
293+
* <br>
286294
* @author Justin Wetherell <[email protected]>
287295
*/
288296
public static class SinglyLinkedList<T> extends List<T> {
@@ -477,9 +485,9 @@ public String toString() {
477485
/**
478486
* Linked List (singly link). A linked list is a data structure consisting
479487
* of a group of nodes which together represent a sequence.
480-
*
481-
* http://en.wikipedia.org/wiki/Linked_list
482-
*
488+
* <p>
489+
* @see <a href="https://en.wikipedia.org/wiki/Linked_list">Linked List (Wikipedia)</a>
490+
* <br>
483491
* @author Justin Wetherell <[email protected]>
484492
*/
485493
public static class JavaCompatibleSinglyLinkedList<T> extends java.util.AbstractSequentialList<T> {
@@ -688,9 +696,9 @@ public T previous() {
688696
/**
689697
* Linked List (doubly link). A linked list is a data structure consisting
690698
* of a group of nodes which together represent a sequence.
691-
*
692-
* http://en.wikipedia.org/wiki/Linked_list
693-
*
699+
* <p>
700+
* @see <a href="https://en.wikipedia.org/wiki/Linked_list">Linked List (Wikipedia)</a>
701+
* <br>
694702
* @author Justin Wetherell <[email protected]>
695703
*/
696704
public static class DoublyLinkedList<T> extends List<T> {

src/com/jwetherell/algorithms/data_structures/Matrix.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
/**
88
* Matrx. This Matrix implementation is designed to be more efficient
99
* in cache. A matrix is a rectangular array of numbers, symbols, or expressions.
10-
*
11-
* http://en.wikipedia.org/wiki/Matrix_(mathematics)
12-
*
10+
* <p>
11+
* @see <a href="https://en.wikipedia.org/wiki/Matrix_(mathematics)">Matrix (Wikipedia)</a>
12+
* <br>
1313
* @author Justin Wetherell <[email protected]>
1414
*/
1515
@SuppressWarnings("unchecked")

src/com/jwetherell/algorithms/data_structures/PatriciaTrie.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
* non-terminating (black) node with only one child is merged with its child.
1010
* The result is that every internal non-terminating (black) node has at least
1111
* two children. Each terminating node (white) represents the end of a string.
12-
*
13-
* http://en.wikipedia.org/wiki/Radix_tree
14-
*
12+
* <p>
13+
* @see <a href="https://en.wikipedia.org/wiki/Radix_tree">Radix Tree / Patricia Trie (Wikipedia)</a>
14+
* <br>
1515
* @author Justin Wetherell <[email protected]>
1616
*/
1717
@SuppressWarnings("unchecked")

src/com/jwetherell/algorithms/data_structures/QuadTree.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
* A quadtree is a tree data structure in which each internal node has exactly four children. Quadtrees
1212
* are most often used to partition a two dimensional space by recursively subdividing it into four
1313
* quadrants or regions. The regions may be square or rectangular, or may have arbitrary shapes.
14-
*
15-
* http://en.wikipedia.org/wiki/Quadtree
16-
*
14+
* <p>
15+
* @see <a href="https://en.wikipedia.org/wiki/Quadtree">QuadTree (Wikipedia)</a>
16+
* <br>
1717
* @author Justin Wetherell <[email protected]>
1818
*/
1919
@SuppressWarnings("unchecked")

0 commit comments

Comments
 (0)