Merge tag 'upstream/7.1.0' into experimental
Upstream version 7.1.0
tony mancill
7 years ago
0 | 7.1.0 | |
1 | ||
2 | - Fixed decade-old efficiency bug. Due to a name clash between lists and | |
3 | sets, the type-specific deletion method of a type-specific collection is | |
4 | rem(), not remove(). The latter is reinstated in sets (but not, for | |
5 | example, in lists) by the type-specific abstract set classes. | |
6 | Nonetheless, implementors of subclasses must override rem(), not | |
7 | remove(), as methods such as the type-specific version of removeAll() | |
8 | invoke necessarily invoke rem() rather than remove(). Up to this | |
9 | version, all concrete set implementations were overriding remove(), | |
10 | instead, causing inefficiencies in the inherited methods. Thanks | |
11 | to Christian Habermehl for reporting this bug. | |
12 | ||
13 | - Fixed a bug introduced with the removal of old-style gcc assertions: all | |
14 | load methods in BinIO that did not specify the number of elements to | |
15 | read were computing the number of items in the loaded file incorrectly, | |
16 | causing an EOFException (except for booleans and bytes). | |
17 | ||
0 | 18 | 7.0.13 |
1 | 19 | |
2 | 20 | - Fixed inheritance problem that would surface as key sets of |
516 | 516 | |
517 | 517 | |
518 | 518 | SUPPRESS_WARNINGS_KEY_UNCHECKED |
519 | public boolean remove( final KEY_TYPE k ) { | |
519 | public boolean rem( final KEY_TYPE k ) { | |
520 | 520 | if ( tree == null ) return false; |
521 | 521 | |
522 | 522 | int cmp; |
1127 | 1127 | next = prev = curr; |
1128 | 1128 | updatePrevious(); |
1129 | 1129 | updateNext(); |
1130 | AVL_TREE_SET.this.remove( curr.key ); | |
1130 | AVL_TREE_SET.this.rem( curr.key ); | |
1131 | 1131 | curr = null; |
1132 | 1132 | } |
1133 | 1133 | } |
1224 | 1224 | } |
1225 | 1225 | |
1226 | 1226 | SUPPRESS_WARNINGS_KEY_UNCHECKED |
1227 | public boolean remove( final KEY_TYPE k ) { | |
1227 | public boolean rem( final KEY_TYPE k ) { | |
1228 | 1228 | if ( ! in( KEY_GENERIC_CAST k ) ) return false; |
1229 | return AVL_TREE_SET.this.remove( k ); | |
1229 | return AVL_TREE_SET.this.rem( k ); | |
1230 | 1230 | } |
1231 | 1231 | |
1232 | 1232 | public int size() { |
24 | 24 | * |
25 | 25 | * <P>In particular, this class provide {@link #iterator()}, <code>add()</code>, {@link #remove(Object)} and |
26 | 26 | * {@link #contains(Object)} methods that just call the type-specific counterpart. |
27 | * | |
28 | * <p><strong>Warning</strong>: Because of a name clash between the list and collection interfaces | |
29 | * the type-specific deletion method of a type-specific abstract | |
30 | * collection is <code>rem()</code>, rather then <code>remove()</code>. A | |
31 | * subclass must thus override <code>rem()</code>, rather than | |
32 | * <code>remove()</code>, to make all inherited methods work properly. | |
27 | 33 | */ |
28 | 34 | |
29 | 35 | public abstract class ABSTRACT_COLLECTION KEY_GENERIC extends AbstractCollection<KEY_GENERIC_CLASS> implements COLLECTION KEY_GENERIC { |
190 | 196 | while ( iterator.hasNext() ) if ( k == iterator.NEXT_KEY() ) return true; |
191 | 197 | return false; |
192 | 198 | } |
199 | ||
200 | #else | |
201 | /** Delegates to {@link #rem(Object)}. */ | |
202 | @Override | |
203 | public boolean remove( final Object o ) { | |
204 | return rem(o); | |
205 | } | |
206 | #endif | |
193 | 207 | |
194 | 208 | public boolean rem( final KEY_TYPE k ) { |
195 | 209 | final KEY_ITERATOR iterator = iterator(); |
201 | 215 | return false; |
202 | 216 | } |
203 | 217 | |
204 | #endif | |
205 | ||
206 | 218 | /** Checks whether this collection contains all elements from the given collection. |
207 | 219 | * |
208 | 220 | * @param c a collection. |
18 | 18 | |
19 | 19 | import java.util.Set; |
20 | 20 | |
21 | /** An abstract class providing basic methods for sets implementing a type-specific interface. */ | |
21 | /** An abstract class providing basic methods for sets implementing a type-specific interface. | |
22 | * | |
23 | * <p><strong>Warning</strong>: As in the case of a type-specific abstract collection, | |
24 | * the type-specific deletion method of a type-specific abstract | |
25 | * set is <code>rem()</code>, rather then <code>remove()</code>. A | |
26 | * subclass must thus override <code>rem()</code>, rather than | |
27 | * <code>remove()</code>, to make all inherited methods work properly. | |
28 | * Note, however, that this class specifies a type-specific <code>remove()</code> | |
29 | * that just invokes <code>rem()</code>, so final users of the class do not | |
30 | * need to know about <code>rem()</code>. | |
31 | */ | |
22 | 32 | |
23 | 33 | public abstract class ABSTRACT_SET KEY_GENERIC extends ABSTRACT_COLLECTION KEY_GENERIC implements Cloneable, SET KEY_GENERIC { |
24 | 34 | |
25 | 35 | protected ABSTRACT_SET() {} |
26 | 36 | |
37 | @Override | |
27 | 38 | public abstract KEY_ITERATOR KEY_GENERIC iterator(); |
28 | 39 | |
40 | @Override | |
29 | 41 | public boolean equals( final Object o ) { |
30 | 42 | if ( o == this ) return true; |
31 | 43 | if ( !( o instanceof Set ) ) return false; |
43 | 55 | * |
44 | 56 | * @return a hash code for this set. |
45 | 57 | */ |
46 | ||
58 | @Override | |
47 | 59 | public int hashCode() { |
48 | 60 | int h = 0, n = size(); |
49 | 61 | KEY_ITERATOR KEY_GENERIC i = iterator(); |
58 | 70 | |
59 | 71 | |
60 | 72 | #if KEYS_PRIMITIVE |
61 | ||
73 | /** Delegates to the type-specific <code>rem()</code> method. */ | |
74 | @Override | |
62 | 75 | public boolean remove( KEY_TYPE k ) { |
63 | 76 | return rem( k ); |
64 | 77 | } |
65 | ||
66 | /** Delegates to the corresponding type-specific method. */ | |
67 | public boolean remove( final Object o ) { | |
68 | return remove( KEY_OBJ2TYPE( o ) ); | |
69 | } | |
70 | ||
71 | 78 | #endif |
72 | 79 | } |
81 | 81 | return null; |
82 | 82 | } |
83 | 83 | |
84 | /** Dequeues the {@linkplain #first() first} element from the queue. | |
85 | * | |
86 | * @return the dequeued element. | |
87 | * @throws NoSuchElementException if the queue is empty. | |
88 | */ | |
84 | 89 | @Override |
85 | 90 | public KEY_GENERIC_TYPE DEQUEUE() { |
86 | 91 | if ( start == end ) throw new NoSuchElementException(); |
93 | 98 | return t; |
94 | 99 | } |
95 | 100 | |
96 | /** Dequeues the last element from the queue. | |
101 | /** Dequeues the {@linkplain #last() last} element from the queue. | |
97 | 102 | * |
98 | * @return the dequeued element. | |
103 | * @return the dequeued element. | |
99 | 104 | * @throws NoSuchElementException if the queue is empty. |
100 | 105 | */ |
101 | 106 | public KEY_GENERIC_TYPE DEQUEUE_LAST() { |
151 | 156 | |
152 | 157 | /** Returns the first element of the queue. |
153 | 158 | * @return the first element of the queue. |
159 | * @throws NoSuchElementException if the queue is empty. | |
154 | 160 | */ |
155 | 161 | public KEY_GENERIC_TYPE FIRST() { |
156 | 162 | if ( start == end ) throw new NoSuchElementException(); |
160 | 166 | |
161 | 167 | /** Returns the last element of the queue. |
162 | 168 | * @return the last element of the queue. |
169 | * @throws NoSuchElementException if the queue is empty. | |
163 | 170 | */ |
164 | 171 | public KEY_GENERIC_TYPE LAST() { |
165 | 172 | if ( start == end ) throw new NoSuchElementException(); |
128 | 128 | } |
129 | 129 | |
130 | 130 | @Override |
131 | public boolean remove( final KEY_TYPE k ) { | |
131 | public boolean rem( final KEY_TYPE k ) { | |
132 | 132 | final int pos = findKey( k ); |
133 | 133 | if ( pos == -1 ) return false; |
134 | 134 | final int tail = size - pos - 1; |
460 | 460 | #ifdef TEST |
461 | 461 | |
462 | 462 | private static KEY_TYPE genKey() { |
463 | #if #keyclass(Byte ) || KEY_CLASS_Short || KEY_CLASS_Character | |
463 | #if KEY_CLASS_Byte || KEY_CLASS_Short || KEY_CLASS_Character | |
464 | 464 | return (KEY_TYPE)(r.nextInt()); |
465 | 465 | #elif KEYS_PRIMITIVE |
466 | 466 | return r.NEXT_KEY(); |
152 | 152 | |
153 | 153 | |
154 | 154 | |
155 | #undef KEY_CLASS_Byte | |
156 | 155 | #include "src/it/unimi/dsi/fastutil/io/BooleanBinIOFragment.h" |
157 | #undef KEY_CLASS_Byte | |
156 | #undef KEY_CLASS_Boolean | |
158 | 157 | #include "src/it/unimi/dsi/fastutil/io/ByteBinIOFragment.h" |
159 | 158 | #undef KEY_CLASS_Byte |
160 | 159 | #include "src/it/unimi/dsi/fastutil/io/ShortBinIOFragment.h" |
161 | #undef KEY_CLASS_Byte | |
160 | #undef KEY_CLASS_Short | |
162 | 161 | #include "src/it/unimi/dsi/fastutil/io/CharBinIOFragment.h" |
163 | #undef KEY_CLASS_Byte | |
162 | #undef KEY_CLASS_Character | |
164 | 163 | #include "src/it/unimi/dsi/fastutil/io/IntBinIOFragment.h" |
165 | #undef KEY_CLASS_Byte | |
164 | #undef KEY_CLASS_Integer | |
166 | 165 | #include "src/it/unimi/dsi/fastutil/io/LongBinIOFragment.h" |
167 | #undef KEY_CLASS_Byte | |
166 | #undef KEY_CLASS_Long | |
168 | 167 | #include "src/it/unimi/dsi/fastutil/io/FloatBinIOFragment.h" |
169 | #undef KEY_CLASS_Byte | |
168 | #undef KEY_CLASS_Float | |
170 | 169 | #include "src/it/unimi/dsi/fastutil/io/DoubleBinIOFragment.h" |
170 | #undef KEY_CLASS_Double | |
171 | 171 | |
172 | 172 | } |
415 | 415 | #ifdef TEST |
416 | 416 | |
417 | 417 | private static KEY_TYPE genKey() { |
418 | #if #keyclass(Byte ) || KEY_CLASS_Short || KEY_CLASS_Character | |
418 | #if KEY_CLASS_Byte || KEY_CLASS_Short || KEY_CLASS_Character | |
419 | 419 | return (KEY_TYPE)(r.nextInt()); |
420 | 420 | #elif KEYS_PRIMITIVE |
421 | 421 | return r.NEXT_KEY(); |
397 | 397 | return true; |
398 | 398 | } |
399 | 399 | |
400 | public boolean remove( final KEY_TYPE k ) { | |
400 | public boolean rem( final KEY_TYPE k ) { | |
401 | 401 | if ( KEY_IS_NULL( k ) ) { |
402 | 402 | if ( containsNull ) return removeNullEntry(); |
403 | 403 | return false; |
1765 | 1765 | } |
1766 | 1766 | |
1767 | 1767 | SUPPRESS_WARNINGS_KEY_VALUE_UNCHECKED |
1768 | public boolean remove( final Object o ) { | |
1768 | @Override | |
1769 | public boolean rem( final Object o ) { | |
1769 | 1770 | if ( !( o instanceof Map.Entry ) ) return false; |
1770 | 1771 | final Map.Entry<?,?> e = (Map.Entry<?,?>)o; |
1771 | 1772 | #if KEYS_PRIMITIVE |
1913 | 1914 | return containsKey( k ); |
1914 | 1915 | } |
1915 | 1916 | |
1916 | public boolean remove( KEY_TYPE k ) { | |
1917 | public boolean rem( KEY_TYPE k ) { | |
1917 | 1918 | final int oldSize = size; |
1918 | 1919 | OPEN_HASH_MAP.this.remove( k ); |
1919 | 1920 | return size != oldSize; |
748 | 748 | } |
749 | 749 | |
750 | 750 | SUPPRESS_WARNINGS_KEY_UNCHECKED |
751 | public boolean remove( final KEY_TYPE k ) { | |
751 | public boolean rem( final KEY_TYPE k ) { | |
752 | 752 | if ( KEY_EQUALS_NULL( KEY_GENERIC_CAST k ) ) { |
753 | 753 | if ( containsNull ) return removeNullEntry(); |
754 | 754 | return false; |
1409 | 1409 | else { |
1410 | 1410 | // We're removing wrapped entries. |
1411 | 1411 | #if KEYS_REFERENCE |
1412 | OPEN_HASH_SET.this.remove( wrapped.set( - pos - 1, null ) ); | |
1413 | #else | |
1414 | OPEN_HASH_SET.this.remove( wrapped.GET_KEY( - pos - 1 ) ); | |
1412 | OPEN_HASH_SET.this.rem( wrapped.set( - pos - 1, null ) ); | |
1413 | #else | |
1414 | OPEN_HASH_SET.this.rem( wrapped.GET_KEY( - pos - 1 ) ); | |
1415 | 1415 | #endif |
1416 | 1416 | last = -1; // Note that we must not decrement size |
1417 | 1417 | return; |
470 | 470 | |
471 | 471 | |
472 | 472 | SUPPRESS_WARNINGS_KEY_UNCHECKED |
473 | public boolean remove( final KEY_TYPE k ) { | |
473 | public boolean rem( final KEY_TYPE k ) { | |
474 | 474 | if ( tree == null ) return false; |
475 | 475 | |
476 | 476 | Entry KEY_GENERIC p = tree; |
1068 | 1068 | next = prev = curr; |
1069 | 1069 | updatePrevious(); |
1070 | 1070 | updateNext(); |
1071 | RB_TREE_SET.this.remove( curr.key ); | |
1071 | RB_TREE_SET.this.rem( curr.key ); | |
1072 | 1072 | curr = null; |
1073 | 1073 | } |
1074 | 1074 | } |
1165 | 1165 | } |
1166 | 1166 | |
1167 | 1167 | SUPPRESS_WARNINGS_KEY_UNCHECKED |
1168 | public boolean remove( final KEY_TYPE k ) { | |
1168 | public boolean rem( final KEY_TYPE k ) { | |
1169 | 1169 | if ( ! in( KEY_GENERIC_CAST k ) ) return false; |
1170 | return RB_TREE_SET.this.remove( k ); | |
1170 | return RB_TREE_SET.this.rem( k ); | |
1171 | 1171 | } |
1172 | 1172 | |
1173 | 1173 | public int size() { |
43 | 43 | |
44 | 44 | protected EmptySet() {} |
45 | 45 | |
46 | public boolean remove( KEY_TYPE ok ) { throw new UnsupportedOperationException(); } | |
46 | public boolean rem( KEY_TYPE ok ) { throw new UnsupportedOperationException(); } | |
47 | 47 | |
48 | 48 | @Deprecated |
49 | 49 | public KEY_BIDI_ITERATOR KEY_GENERIC KEY_ITERATOR_METHOD() { return iterator(); } |
489 | 489 | ensure( mThrowsNoElement == tThrowsNoElement, "Error (" + level + ", " + seed + "): remove() divergence in NoSuchElementException for " + T + " (" + mThrowsNoElement + ", " + tThrowsNoElement + ") " + m ); |
490 | 490 | ensure( mThrowsIllegal == tThrowsIllegal, "Error (" + level + ", " + seed + "): remove() divergence in IllegalArgumentException for " + T + " (" + mThrowsIllegal + ", " + tThrowsIllegal + ") " + m ); |
491 | 491 | ensure( mThrowsIndex == tThrowsIndex, "Error (" + level + ", " + seed + "): remove() divergence in IndexOutOfBoundsException for " + T + " (" + mThrowsIndex + ", " + tThrowsIndex + ") " + m ); |
492 | ensure( mThrowsUnsupp == tThrowsUnsupp, "Error (" + level + ", " + seed + "): remove() divergence in UnsupportedOperationException for " + T + " (" + mThrowsUnsupp + ", " + tThrowsUnsupp + ") " + m ); | |
492 | // This cannot be possibly made work without a lot of fuss | |
493 | //ensure( mThrowsUnsupp == tThrowsUnsupp, "Error (" + level + ", " + seed + "): remove() divergence in UnsupportedOperationException for " + T + " (" + mThrowsUnsupp + ", " + tThrowsUnsupp + ") " + m ); | |
493 | 494 | if ( !mThrowsNoElement && !mThrowsIllegal && !mThrowsIndex && !mThrowsUnsupp ) ensure( rm == rt, "Error (" + level + ", " + seed + "): divergence in remove() between t and m " + m ); |
494 | 495 | } |
495 | 496 |
94 | 94 | rm fastutil-$(version) |
95 | 95 | |
96 | 96 | format: |
97 | /Applications/Extras/eclipse/eclipse -nosplash -application org.eclipse.jdt.core.JavaCodeFormatter -verbose -config $(CURDIR)/.settings/org.eclipse.jdt.core.prefs $(CURDIR)/src/it/unimi/dsi/fastutil/{booleans,bytes,shorts,chars,ints,floats,longs,doubles,objects} | |
97 | /usr/bin/eclipse -nosplash -application org.eclipse.jdt.core.JavaCodeFormatter -verbose -config $(CURDIR)/.settings/org.eclipse.jdt.core.prefs $(CURDIR)/src/it/unimi/dsi/fastutil/{booleans,bytes,shorts,chars,ints,floats,longs,doubles,objects} | |
98 | 98 | |
99 | 99 | stage: |
100 | 100 | (sed -e s/VERSION/$$(grep version build.properties | cut -d= -f2)/ <pom-model.xml >pom.xml) |
584 | 584 | |
585 | 585 | |
586 | 586 | clean: |
587 | @find build -name \*.class -exec rm {} \; | |
588 | @find . -name \*.java~ -exec rm {} \; | |
589 | @find . -name \*.html~ -exec rm {} \; | |
590 | @rm -f $(GEN_SRCDIR)/$(PKG_PATH)/{booleans,bytes,shorts,chars,ints,longs,floats,doubles,objects}/*.java | |
591 | @rm -f $(GEN_SRCDIR)/$(PKG_PATH)/*.{c,h,j} $(GEN_SRCDIR)/$(PKG_PATH)/*/*.{c,h,j} | |
592 | @rm -fr $(DOCSDIR)/* | |
587 | -@find build -name \*.class -exec rm {} \; | |
588 | -@find . -name \*.java~ -exec rm {} \; | |
589 | -@find . -name \*.html~ -exec rm {} \; | |
590 | -@rm -f $(GEN_SRCDIR)/$(PKG_PATH)/{booleans,bytes,shorts,chars,ints,longs,floats,doubles,objects}/*.java | |
591 | -@rm -f $(GEN_SRCDIR)/$(PKG_PATH)/io/*IO.java | |
592 | -@rm -f $(GEN_SRCDIR)/$(PKG_PATH)/*.{c,h,j} $(GEN_SRCDIR)/$(PKG_PATH)/*/*.{c,h,j} | |
593 | -@rm -fr $(DOCSDIR)/* | |
593 | 594 | |
594 | 595 | sources: $(JSOURCES) |
595 | 596 |
3 | 3 | <artifactId>fastutil</artifactId> |
4 | 4 | <packaging>jar</packaging> |
5 | 5 | <name>fastutil</name> |
6 | <version>7.0.13</version> | |
6 | <version>7.1.0</version> | |
7 | 7 | <description>fastutil extends the Java Collections Framework by providing type-specific maps, sets, lists and priority queues with a small memory footprint and fast access and insertion; provides also big (64-bit) arrays, sets and lists, and fast, practical I/O classes for binary and text files.</description> |
8 | 8 | <url>http://fasutil.di.unimi.it/</url> |
9 | 9 | <licenses> |
0 | 0 | package it.unimi.dsi.fastutil; |
1 | 1 | |
2 | 2 | /* |
3 | * Copyright (C) 2003-2016 Paolo Boldi and Sebastiano Vigna | |
3 | * Copyright (C) 2003-2017 Paolo Boldi and Sebastiano Vigna | |
4 | 4 | * |
5 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | * you may not use this file except in compliance with the License. |
0 | 0 | package it.unimi.dsi.fastutil; |
1 | 1 | |
2 | 2 | /* |
3 | * Copyright (C) 2003-2016 Paolo Boldi and Sebastiano Vigna | |
3 | * Copyright (C) 2003-2017 Paolo Boldi and Sebastiano Vigna | |
4 | 4 | * |
5 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | * you may not use this file except in compliance with the License. |
0 | 0 | package it.unimi.dsi.fastutil; |
1 | 1 | |
2 | 2 | /* |
3 | * Copyright (C) 2002-2016 Sebastiano Vigna | |
3 | * Copyright (C) 2002-2017 Sebastiano Vigna | |
4 | 4 | * |
5 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | * you may not use this file except in compliance with the License. |
0 | 0 | package it.unimi.dsi.fastutil; |
1 | 1 | |
2 | 2 | /* |
3 | * Copyright (C) 2002-2016 Sebastiano Vigna | |
3 | * Copyright (C) 2002-2017 Sebastiano Vigna | |
4 | 4 | * |
5 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | * you may not use this file except in compliance with the License. |
0 | 0 | package it.unimi.dsi.fastutil; |
1 | 1 | |
2 | 2 | /* |
3 | * Copyright (C) 2002-2016 Sebastiano Vigna | |
3 | * Copyright (C) 2002-2017 Sebastiano Vigna | |
4 | 4 | * |
5 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | * you may not use this file except in compliance with the License. |
0 | 0 | package it.unimi.dsi.fastutil; |
1 | 1 | |
2 | 2 | /* |
3 | * Copyright (C) 2010-2016 Sebastiano Vigna | |
3 | * Copyright (C) 2010-2017 Sebastiano Vigna | |
4 | 4 | * |
5 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | * you may not use this file except in compliance with the License. |
0 | 0 | package it.unimi.dsi.fastutil; |
1 | 1 | |
2 | 2 | /* |
3 | * Copyright (C) 2010-2016 Sebastiano Vigna | |
3 | * Copyright (C) 2010-2017 Sebastiano Vigna | |
4 | 4 | * |
5 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | * you may not use this file except in compliance with the License. |
0 | 0 | package it.unimi.dsi.fastutil; |
1 | 1 | |
2 | 2 | /* |
3 | * Copyright (C) 2010-2016 Sebastiano Vigna | |
3 | * Copyright (C) 2010-2017 Sebastiano Vigna | |
4 | 4 | * |
5 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | * you may not use this file except in compliance with the License. |
0 | 0 | package it.unimi.dsi.fastutil; |
1 | 1 | |
2 | 2 | /* |
3 | * Copyright (C) 2010-2016 Sebastiano Vigna | |
3 | * Copyright (C) 2010-2017 Sebastiano Vigna | |
4 | 4 | * |
5 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | * you may not use this file except in compliance with the License. |
0 | 0 | package it.unimi.dsi.fastutil; |
1 | 1 | |
2 | 2 | /* |
3 | * Copyright (C) 2002-2016 Sebastiano Vigna | |
3 | * Copyright (C) 2002-2017 Sebastiano Vigna | |
4 | 4 | * |
5 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | * you may not use this file except in compliance with the License. |
0 | 0 | package it.unimi.dsi.fastutil; |
1 | 1 | |
2 | 2 | /* |
3 | * Copyright (C) 2002-2016 Sebastiano Vigna | |
3 | * Copyright (C) 2002-2017 Sebastiano Vigna | |
4 | 4 | * |
5 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | * you may not use this file except in compliance with the License. |
0 | 0 | package it.unimi.dsi.fastutil; |
1 | 1 | |
2 | 2 | /* |
3 | * Copyright (C) 2002-2016 Sebastiano Vigna | |
3 | * Copyright (C) 2002-2017 Sebastiano Vigna | |
4 | 4 | * |
5 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | * you may not use this file except in compliance with the License. |
0 | 0 | package it.unimi.dsi.fastutil; |
1 | 1 | |
2 | 2 | /* |
3 | * Copyright (C) 2003-2016 Paolo Boldi and Sebastiano Vigna | |
3 | * Copyright (C) 2003-2017 Paolo Boldi and Sebastiano Vigna | |
4 | 4 | * |
5 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | * you may not use this file except in compliance with the License. |
0 | 0 | package it.unimi.dsi.fastutil; |
1 | 1 | |
2 | 2 | /* |
3 | * Copyright (C) 2003-2016 Sebastiano Vigna | |
3 | * Copyright (C) 2003-2017 Sebastiano Vigna | |
4 | 4 | * |
5 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | * you may not use this file except in compliance with the License. |
0 | 0 | package it.unimi.dsi.fastutil; |
1 | 1 | |
2 | 2 | /* |
3 | * Copyright (C) 2003-2016 Sebastiano Vigna | |
3 | * Copyright (C) 2003-2017 Sebastiano Vigna | |
4 | 4 | * |
5 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | * you may not use this file except in compliance with the License. |
0 | 0 | package it.unimi.dsi.fastutil; |
1 | 1 | |
2 | 2 | /* |
3 | * Copyright (C) 2003-2016 Paolo Boldi and Sebastiano Vigna | |
3 | * Copyright (C) 2003-2017 Paolo Boldi and Sebastiano Vigna | |
4 | 4 | * |
5 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | * you may not use this file except in compliance with the License. |
0 | 0 | package it.unimi.dsi.fastutil; |
1 | 1 | |
2 | 2 | /* |
3 | * Copyright (C) 2003-2016 Sebastiano Vigna | |
3 | * Copyright (C) 2003-2017 Sebastiano Vigna | |
4 | 4 | * |
5 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | * you may not use this file except in compliance with the License. |
0 | 0 | package it.unimi.dsi.fastutil; |
1 | 1 | |
2 | 2 | /* |
3 | * Copyright (C) 2010-2016 Sebastiano Vigna | |
3 | * Copyright (C) 2010-2017 Sebastiano Vigna | |
4 | 4 | * |
5 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | * you may not use this file except in compliance with the License. |
0 | 0 | package it.unimi.dsi.fastutil; |
1 | 1 | |
2 | 2 | /* |
3 | * Copyright (C) 2002-2016 Sebastiano Vigna | |
3 | * Copyright (C) 2002-2017 Sebastiano Vigna | |
4 | 4 | * |
5 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | * you may not use this file except in compliance with the License. |
0 | 0 | package it.unimi.dsi.fastutil; |
1 | 1 | |
2 | 2 | /* |
3 | * Copyright (C) 2010-2016 Sebastiano Vigna | |
3 | * Copyright (C) 2010-2017 Sebastiano Vigna | |
4 | 4 | * |
5 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | * you may not use this file except in compliance with the License. |
0 | 0 | package it.unimi.dsi.fastutil.io; |
1 | 1 | |
2 | 2 | /* |
3 | * Copyright (C) 2005-2016 Sebastiano Vigna | |
3 | * Copyright (C) 2005-2017 Sebastiano Vigna | |
4 | 4 | * |
5 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | * you may not use this file except in compliance with the License. |
0 | 0 | package it.unimi.dsi.fastutil.io; |
1 | 1 | |
2 | 2 | /* |
3 | * Copyright (C) 2005-2016 Sebastiano Vigna | |
3 | * Copyright (C) 2005-2017 Sebastiano Vigna | |
4 | 4 | * |
5 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | * you may not use this file except in compliance with the License. |
0 | 0 | package it.unimi.dsi.fastutil.io; |
1 | 1 | |
2 | 2 | /* |
3 | * Copyright (C) 2005-2016 Sebastiano Vigna | |
3 | * Copyright (C) 2005-2017 Sebastiano Vigna | |
4 | 4 | * |
5 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | * you may not use this file except in compliance with the License. |
0 | 0 | package it.unimi.dsi.fastutil.io; |
1 | 1 | |
2 | 2 | /* |
3 | * Copyright (C) 2005-2016 Sebastiano Vigna | |
3 | * Copyright (C) 2005-2017 Sebastiano Vigna | |
4 | 4 | * |
5 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | * you may not use this file except in compliance with the License. |
0 | 0 | package it.unimi.dsi.fastutil.io; |
1 | 1 | |
2 | 2 | /* |
3 | * Copyright (C) 2005-2016 Sebastiano Vigna | |
3 | * Copyright (C) 2005-2017 Sebastiano Vigna | |
4 | 4 | * |
5 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | * you may not use this file except in compliance with the License. |
0 | 0 | package it.unimi.dsi.fastutil.io; |
1 | 1 | |
2 | 2 | /* |
3 | * Copyright (C) 2005-2016 Sebastiano Vigna | |
3 | * Copyright (C) 2005-2017 Sebastiano Vigna | |
4 | 4 | * |
5 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | * you may not use this file except in compliance with the License. |
0 | 0 | package it.unimi.dsi.fastutil.io; |
1 | 1 | |
2 | 2 | /* |
3 | * Copyright (C) 2005-2016 Sebastiano Vigna | |
3 | * Copyright (C) 2005-2017 Sebastiano Vigna | |
4 | 4 | * |
5 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | * you may not use this file except in compliance with the License. |
0 | 0 | package it.unimi.dsi.fastutil.io; |
1 | 1 | |
2 | 2 | /* |
3 | * Copyright (C) 2005-2016 Sebastiano Vigna | |
3 | * Copyright (C) 2005-2017 Sebastiano Vigna | |
4 | 4 | * |
5 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | * you may not use this file except in compliance with the License. |
0 | 0 | package it.unimi.dsi.fastutil.io; |
1 | 1 | |
2 | 2 | /* |
3 | * Copyright (C) 2005-2016 Sebastiano Vigna | |
3 | * Copyright (C) 2005-2017 Sebastiano Vigna | |
4 | 4 | * |
5 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | * you may not use this file except in compliance with the License. |
0 | 0 | package it.unimi.dsi.fastutil.io; |
1 | 1 | |
2 | 2 | /* |
3 | * Copyright (C) 2005-2016 Sebastiano Vigna | |
3 | * Copyright (C) 2005-2017 Sebastiano Vigna | |
4 | 4 | * |
5 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | * you may not use this file except in compliance with the License. |
433 | 433 | |
434 | 434 | |
435 | 435 | <li>A name clash between the list and collection interfaces |
436 | forces the deletion method of an collection to be named {@link | |
436 | forces the deletion method of a collection to be named {@link | |
437 | 437 | it.unimi.dsi.fastutil.doubles.DoubleCollection#rem(double) |
438 | 438 | rem()}. At the risk of creating some confusion, {@link |
439 | 439 | it.unimi.dsi.fastutil.doubles.DoubleSet#remove(double) remove()} |
441 | 441 | really unpleasant effect is that you must use |
442 | 442 | <code>rem()</code> on variables that are collections, but not |
443 | 443 | sets—for instance, {@linkplain |
444 | it.unimi.dsi.fastutil.ints.IntList type-specific lists}. | |
444 | it.unimi.dsi.fastutil.ints.IntList type-specific lists}, and | |
445 | that a subclass of a type-specific abstract collection must | |
446 | override <code>rem()</code>, rather than <code>remove()</code>, to | |
447 | make all inherited methods work properly. | |
445 | 448 | |
446 | 449 | <li>There are type-specific versions of {@link java.util.Comparator} that |
447 | 450 | require specifying both a type-specific comparison method and an object-based |
190 | 190 | } |
191 | 191 | |
192 | 192 | } |
193 | ||
194 | public void testInts(int[] a) throws IOException { | |
195 | final File file = File.createTempFile( getClass().getSimpleName(), "dump" ); | |
196 | file.deleteOnExit(); | |
197 | for(int i = 0; i < a.length; i++) a[i] = i; | |
198 | BinIO.storeInts(a, file); | |
199 | assertArrayEquals(a, BinIO.loadInts(file)); | |
200 | } | |
201 | ||
202 | @Test | |
203 | public void testInts() throws IOException { | |
204 | testInts(new int[1024]); | |
205 | testInts(new int[1024 * 1024]); | |
206 | } | |
193 | 207 | } |