Implementazione parziale di tree
This commit is contained in:
33
tree/Tree.java
Normal file
33
tree/Tree.java
Normal file
@@ -0,0 +1,33 @@
|
||||
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;
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user