-
Notifications
You must be signed in to change notification settings - Fork 0
/
ValidatorBTDefault.java
30 lines (27 loc) · 1020 Bytes
/
ValidatorBTDefault.java
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
/**
* A default validator which says that all trees are valid
*/
public class ValidatorBTDefault<E> implements IBTValidator<E> {
/**
* A placeholder validator that says all adds are valid (even if they don't make sense)
* @param oldTree the given tree we assume respects the invariants
* @param elt the element to add
* @param newTree the new tree which we are validating
* @return true always
*/
@Override
public boolean validAdd(IBinTree<E> oldTree, E elt, IBinTree<E> newTree) {
return true;
}
/**
* A placeholder validator that says all removals are valid (even if they don't make sense)
* @param oldTree the given tree we assume respects the invariants
* @param elt the element to remove
* @param newTree the new tree which we are validating
* @return true always
*/
@Override
public boolean validRemove(IBinTree<E> oldTree, E elt, IBinTree<E> newTree) {
return true;
}
}