139 lines
2.3 KiB
Java
139 lines
2.3 KiB
Java
package set;
|
|
|
|
import position.NodePositionList;
|
|
import position.PositionList;
|
|
import utility.DefaultComparator;
|
|
import utility.merge.MergeTemplate;
|
|
|
|
import java.util.Comparator;
|
|
|
|
/**
|
|
* Created with xgiovio.macbookair.
|
|
* User: xgiovio
|
|
* Date: 14/05/14
|
|
* Time: 14:23
|
|
*/
|
|
|
|
public class OrderedListSet <E> implements Set<E> {
|
|
private Comparator<E> c;
|
|
private PositionList<E> L;
|
|
|
|
|
|
|
|
OrderedListSet() {
|
|
L = new NodePositionList<E>();
|
|
c = new DefaultComparator();
|
|
}
|
|
|
|
OrderedListSet(Comparator<E> in_c) {
|
|
L = new NodePositionList<E>();
|
|
c = in_c;
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
public int size() {
|
|
return L.size();
|
|
}
|
|
|
|
@Override
|
|
public boolean isEmpty() {
|
|
return L.isEmpty();
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
public Set<E> union(Set<E> B) {return null;
|
|
}
|
|
|
|
@Override
|
|
public Set<E> intersect(Set<E> B) {
|
|
return null;
|
|
}
|
|
|
|
@Override
|
|
public Set<E> subtract(Set<E> B) {
|
|
return null;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//////////////////////// inner class override methods from merge template /////
|
|
|
|
protected class MergeUnion<E> extends MergeTemplate<E>{
|
|
|
|
public MergeUnion (PositionList<E> A , PositionList<E> B, DefaultComparator<E> c){
|
|
super(A,B,c);
|
|
}
|
|
|
|
@Override
|
|
protected void aIsLess(E a) {
|
|
|
|
}
|
|
|
|
@Override
|
|
protected void bIsLess(E b) {
|
|
|
|
}
|
|
|
|
@Override
|
|
protected void bothAreEqual(E a, E b) {
|
|
|
|
}
|
|
}
|
|
|
|
protected class MergeIntersect<E> extends MergeTemplate<E>{
|
|
|
|
public MergeIntersect (PositionList<E> A , PositionList<E> B, DefaultComparator<E> c){
|
|
super(A,B,c);
|
|
}
|
|
|
|
@Override
|
|
protected void aIsLess(E a) {
|
|
|
|
}
|
|
|
|
@Override
|
|
protected void bIsLess(E b) {
|
|
|
|
}
|
|
|
|
@Override
|
|
protected void bothAreEqual(E a, E b) {
|
|
|
|
}
|
|
}
|
|
|
|
protected class MergeSubtract<E> extends MergeTemplate<E>{
|
|
|
|
public MergeSubtract (PositionList<E> A , PositionList<E> B, DefaultComparator<E> c){
|
|
super(A,B,c);
|
|
}
|
|
|
|
@Override
|
|
protected void aIsLess(E a) {
|
|
|
|
}
|
|
|
|
@Override
|
|
protected void bIsLess(E b) {
|
|
|
|
}
|
|
|
|
@Override
|
|
protected void bothAreEqual(E a, E b) {
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} |