[Nice-commit] Nice/stdlib/nice/lang collections.nice,1.58,1.59 java.nice,1.50,1.51
Brought to you by:
bonniot
From: <ar...@us...> - 2003-12-19 18:52:48
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1:/tmp/cvs-serv14429/F:/nice/stdlib/nice/lang Modified Files: collections.nice java.nice Log Message: Simplified retypings and made Comparator contravariant. Index: collections.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/collections.nice,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** collections.nice 16 Dec 2003 14:55:28 -0000 1.58 --- collections.nice 19 Dec 2003 18:52:45 -0000 1.59 *************** *** 175,179 **** } ! class NiceComparator<T> implements java.util.Comparator { final (T,T) -> int comparator; --- 175,179 ---- } ! class NiceComparator<-T> implements java.util.Comparator<T> { final (T,T) -> int comparator; Index: java.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/java.nice,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** java.nice 19 Dec 2003 17:18:06 -0000 1.50 --- java.nice 19 Dec 2003 18:52:45 -0000 1.51 *************** *** 98,109 **** <T> T next(Iterator<T>) = native Object Iterator.next(); <T> void remove(Iterator<T>) = native void Iterator.remove(); ! <T,U | U <: T> void add(ListIterator<T>, U) = native void ListIterator.add(Object); <T> boolean hasPrevious(ListIterator<T>) = native boolean ListIterator.hasPrevious(); <T> int nextIndex(ListIterator<T>) = native int ListIterator.nextIndex(); <T> T previous(ListIterator<T>) = native Object ListIterator.previous(); <T> int previousIndex(ListIterator<T>) = native int ListIterator.previousIndex(); ! <T,U | U <: T> void set(ListIterator<T>, U) = native void ListIterator.set(Object); <T> int compare(Comparator<T>, T, T) = native int Comparator.compare(Object, Object); ! <T,U | U <: T> ?Comparator<U> comparator(SortedSet<T>) = native Comparator SortedSet.comparator(); <T> T first(SortedSet<T>) = native Object SortedSet.first(); <T> T last(SortedSet<T>) = native Object SortedSet.last(); --- 98,109 ---- <T> T next(Iterator<T>) = native Object Iterator.next(); <T> void remove(Iterator<T>) = native void Iterator.remove(); ! <T> void add(ListIterator<T>, T) = native void ListIterator.add(Object); <T> boolean hasPrevious(ListIterator<T>) = native boolean ListIterator.hasPrevious(); <T> int nextIndex(ListIterator<T>) = native int ListIterator.nextIndex(); <T> T previous(ListIterator<T>) = native Object ListIterator.previous(); <T> int previousIndex(ListIterator<T>) = native int ListIterator.previousIndex(); ! <T> void set(ListIterator<T>, T) = native void ListIterator.set(Object); <T> int compare(Comparator<T>, T, T) = native int Comparator.compare(Object, Object); ! <T> ?Comparator<T> comparator(SortedSet<T>) = native Comparator SortedSet.comparator(); <T> T first(SortedSet<T>) = native Object SortedSet.first(); <T> T last(SortedSet<T>) = native Object SortedSet.last(); *************** *** 115,119 **** <K,V> boolean isEmpty(Map<K,V>) = native boolean Map.isEmpty(); <K,V> int size(Map<K,V>) = native int Map.size(); ! <K,V,T | K <: T> ?Comparator<T> comparator(SortedMap<K,V>) = native Comparator SortedMap.comparator(); <K,V> K firstKey(SortedMap<K,V>) = native Object SortedMap.firstKey(); <K,V> K lastKey(SortedMap<K,V>) = native Object SortedMap.lastKey(); --- 115,119 ---- <K,V> boolean isEmpty(Map<K,V>) = native boolean Map.isEmpty(); <K,V> int size(Map<K,V>) = native int Map.size(); ! <K,V> ?Comparator<K> comparator(SortedMap<K,V>) = native Comparator SortedMap.comparator(); <K,V> K firstKey(SortedMap<K,V>) = native Object SortedMap.firstKey(); <K,V> K lastKey(SortedMap<K,V>) = native Object SortedMap.lastKey(); *************** *** 197,209 **** <T> TreeSet<T> TreeSet() = native new TreeSet(); <T,U | U <: T> TreeSet<T> TreeSet(Collection<U>) = native new TreeSet(Collection); ! <T,U | T <: U> TreeSet<T> TreeSet(Comparator<U>) = native new TreeSet(Comparator); <T> TreeSet<T> TreeSet(SortedSet<T>) = native new TreeSet(SortedSet); <K,V> TreeMap<K,V> TreeMap() = native new TreeMap(); ! <K,V,T | K <: T> TreeMap<K,V> TreeMap(Comparator<T>) = native new TreeMap(Comparator); <K,K0,V,V0 | K0 <: K, V0 <: V> TreeMap<K,V> TreeMap(Map<K0,V0>) = native new TreeMap(Map); <K,V> TreeMap<K,V> TreeMap(SortedMap<K,V>) = native new TreeMap(SortedMap); interface Collection<T> = native java.util.Collection; ! interface Comparator<T> = native java.util.Comparator; interface Enumeration<T> = native java.util.Enumeration; interface List<T> extends Collection<T> = native java.util.List; --- 197,209 ---- <T> TreeSet<T> TreeSet() = native new TreeSet(); <T,U | U <: T> TreeSet<T> TreeSet(Collection<U>) = native new TreeSet(Collection); ! <T> TreeSet<T> TreeSet(Comparator<T>) = native new TreeSet(Comparator); <T> TreeSet<T> TreeSet(SortedSet<T>) = native new TreeSet(SortedSet); <K,V> TreeMap<K,V> TreeMap() = native new TreeMap(); ! <K,V> TreeMap<K,V> TreeMap(Comparator<K>) = native new TreeMap(Comparator); <K,K0,V,V0 | K0 <: K, V0 <: V> TreeMap<K,V> TreeMap(Map<K0,V0>) = native new TreeMap(Map); <K,V> TreeMap<K,V> TreeMap(SortedMap<K,V>) = native new TreeMap(SortedMap); interface Collection<T> = native java.util.Collection; ! interface Comparator<-T> = native java.util.Comparator; interface Enumeration<T> = native java.util.Enumeration; interface List<T> extends Collection<T> = native java.util.List; *************** *** 320,328 **** <T> void shuffle(List<T>, Random) = native void Collections.shuffle(List, Random); ! <T,U | T <: U> T max(Collection<T>, Comparator<U>) = native Object Collections.max(Collection, Comparator); ! <T,U | T <: U> T min(Collection<T>, Comparator<U>) = native Object Collections.max(Collection, Comparator); ! <T, U | T <: U> void sort(List<T>, Comparator<U>) = native void Collections.sort(List, Comparator); <T> void swap(List<T>, int, int) = --- 320,328 ---- <T> void shuffle(List<T>, Random) = native void Collections.shuffle(List, Random); ! <T> T max(Collection<T>, Comparator<T>) = native Object Collections.max(Collection, Comparator); ! <T> T min(Collection<T>, Comparator<T>) = native Object Collections.max(Collection, Comparator); ! <T> void sort(List<T>, Comparator<T>) = native void Collections.sort(List, Comparator); <T> void swap(List<T>, int, int) = *************** *** 336,344 **** <T,U | T <: U> int lastIndexOfSubList(List<T>, List<U>) = native int Collections.lastIndexOfSubList(List, List); ! <T,U,V | T <: U, T <: V> int binarySearch(List<T>, U, Comparator<V>) = native int Collections.binarySearch(List, Object, Comparator); ! <T,U | T <: U> List<U> singletonList(T) = native List Collections.singletonList(Object); ! <K,K0,V,V0 | K <: K0, V <: V0> Map<K0,V0> singletonMap(K, V) = native Map Collections.singletonMap(Object, Object); <T> Collection<T> synchronizedCollection(Collection<T>) = --- 336,344 ---- <T,U | T <: U> int lastIndexOfSubList(List<T>, List<U>) = native int Collections.lastIndexOfSubList(List, List); ! <T,U | T <: U> int binarySearch(List<T>, U, Comparator<T>) = native int Collections.binarySearch(List, Object, Comparator); ! <T> List<T> singletonList(T) = native List Collections.singletonList(Object); ! <K,V> Map<K,V> singletonMap(K, V) = native Map Collections.singletonMap(Object, Object); <T> Collection<T> synchronizedCollection(Collection<T>) = |