Fixato bug e implementato alcune funzioni.
This commit is contained in:
@@ -7,7 +7,7 @@ import set.OrderedListSet;
|
||||
import set.Set;
|
||||
import utility.DefaultComparator;
|
||||
|
||||
import java.security.InvalidKeyException;
|
||||
import exceptions.InvalidKeyException;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
@@ -40,23 +40,18 @@ public class ListPartition <E> implements Partition<E> {
|
||||
|
||||
@Override
|
||||
public Set<E> makeSet(E x) {
|
||||
try {
|
||||
|
||||
OrderedListSet<E> o = new OrderedListSet<E>(x, new DefaultComparator<E>());
|
||||
elementi.put(x, o);
|
||||
partizione.addLast(o);
|
||||
o.setLocation(partizione.last());
|
||||
return o;
|
||||
}
|
||||
catch (InvalidKeyException e){
|
||||
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<E> union(Set<E> A, Set<E> B) {
|
||||
try {
|
||||
|
||||
if (A.size() > B.size()){
|
||||
OrderedListSet<E> AA = (OrderedListSet<E>) A;
|
||||
OrderedListSet<E> BB = (OrderedListSet<E>) B;
|
||||
@@ -82,23 +77,13 @@ public class ListPartition <E> implements Partition<E> {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
catch (InvalidKeyException e){
|
||||
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<E> find(E x) {
|
||||
try {
|
||||
return elementi.get(x);
|
||||
}
|
||||
catch (InvalidKeyException e){
|
||||
|
||||
}
|
||||
return null;
|
||||
return elementi.get(x);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user