-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTree.java
More file actions
30 lines (26 loc) · 943 Bytes
/
Tree.java
File metadata and controls
30 lines (26 loc) · 943 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import java.util.Iterator;
import java.lang.Iterable;
import java.lang.IllegalArgumentException;
/**
* Tree is an interface for the ADT Tree
* uses the Position interface defined in the adt list.
*
* Based on Goodrich, Tamassia, Goldwasser
*
* @author Francois Major
* @version 1.0
* @since 1.0
*/
public interface Tree<E> extends Iterable<E> {
Position<E> root();
Position<E> parent( Position<E> p ) throws IllegalArgumentException;
Iterable<Position<E>> children( Position<E> p ) throws IllegalArgumentException;
int numChildren( Position<E> p ) throws IllegalArgumentException;
boolean isInternal( Position<E> p ) throws IllegalArgumentException;
boolean isExternal( Position<E> p ) throws IllegalArgumentException;
boolean isRoot( Position<E> p ) throws IllegalArgumentException;
int size();
boolean isEmpty();
Iterator<E> iterator();
Iterable<Position<E>> positions();
}