34 lines
1.0 KiB
Java
34 lines
1.0 KiB
Java
package tree;
|
|
|
|
import exceptions.BoundaryViolationException;
|
|
import exceptions.EmptyTreeException;
|
|
import exceptions.InvalidPositionException;
|
|
import position.Position;
|
|
|
|
import java.util.Iterator;
|
|
|
|
/**
|
|
* Created with xgiovio.macbookair.
|
|
* User: xgiovio
|
|
* Date: 07/04/14
|
|
* Time: 15:17
|
|
*/
|
|
public interface Tree<E> extends Iterable<E> {
|
|
|
|
|
|
public int size();
|
|
public boolean isEmpty();
|
|
|
|
public Iterable<Position<E>> positions ();
|
|
public E replace (Position<E> v, E e) throws InvalidPositionException;
|
|
public Position<E> root () throws EmptyTreeException;
|
|
public Position<E> parent (Position <E> v) throws InvalidPositionException, BoundaryViolationException;
|
|
public Iterable <Position<E>> children (Position<E> v) throws InvalidPositionException; // anche se e' foglia
|
|
|
|
public boolean isInternal (Position<E> v) throws InvalidPositionException;
|
|
public boolean isExternal (Position<E> v) throws InvalidPositionException;
|
|
public boolean isRoot (Position <E> v) throws InvalidPositionException;
|
|
|
|
|
|
}
|