本文整理汇总了Java中it.unimi.dsi.fastutil.ints.IntIterator.remove方法的典型用法代码示例。如果您正苦于以下问题:Java IntIterator.remove方法的具体用法?Java IntIterator.remove怎么用?Java IntIterator.remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类it.unimi.dsi.fastutil.ints.IntIterator
的用法示例。
在下文中一共展示了IntIterator.remove方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: intersectionPE
import it.unimi.dsi.fastutil.ints.IntIterator; //导入方法依赖的package包/类
public boolean intersectionPE(CustomHashMap other){
boolean modified = false;
IntIterator itr = this.keySet().iterator();
while(itr.hasNext()){
int key = itr.nextInt();
int keyInv = 0 - key;
if(!other.containsKey(key) && !other.containsKey(keyInv)){
itr.remove();
modified = true;
}
}
for(int otherKey : other.keySet()){
int otherKeyInv = 0-otherKey;
boolean intst = this.containsKey(otherKey); //does this contain otherKey?
boolean intstPrime = this.containsKey(otherKeyInv); //does this contain -(otherkey)?
if(!intst && intstPrime){
this.put(otherKey, other.get(otherKey));
modified = true;
}
}
return modified;
}
示例2: acquire0
import it.unimi.dsi.fastutil.ints.IntIterator; //导入方法依赖的package包/类
private int acquire0() {
final int id;
final IntIterator it = allocatorReusableIds.iterator();
if (it.hasNext()) {
try {
id = it.nextInt();
} finally {
it.remove();
}
} else {
id = allocatorIdCounter++;
}
if (this.entityProtocol != null) {
this.entityProtocol.entityProtocolManager.idToEntityProtocolMap.put(id, this.entityProtocol);
}
return id;
}
示例3: intersectReferenced
import it.unimi.dsi.fastutil.ints.IntIterator; //导入方法依赖的package包/类
void intersectReferenced(final IntSet attributes, final Attribute[] attributeIndex) {
final IntIterator referencedIterator = referenced.iterator();
while (referencedIterator.hasNext()) {
final int ref = referencedIterator.nextInt();
if (attributes.contains(ref)) {
continue;
}
referencedIterator.remove();
attributeIndex[ref].removeDependent(id);
}
}
示例4: intersection
import it.unimi.dsi.fastutil.ints.IntIterator; //导入方法依赖的package包/类
public boolean intersection(CustomHashMap other){
boolean modified = false;
IntIterator itr = this.keySet().iterator();
while(itr.hasNext()){
int curInt = itr.nextInt();
if(!other.containsKey(curInt)){
itr.remove();
modified = false;
}
}
return modified;
}
示例5: acquireRow
import it.unimi.dsi.fastutil.ints.IntIterator; //导入方法依赖的package包/类
@Override
public int[] acquireRow(int[] array) {
checkNotNull(array, "array");
final long stamp = allocatorLock.writeLock();
try {
IntIterator it = allocatorReusableIds.iterator();
boolean fail = false;
for (int i = 0; i < array.length; i++) {
if (!it.hasNext()) {
fail = true;
break;
}
array[i] = it.nextInt();
if (i != 0 && array[i - 1] != array[i] - 1) {
fail = true;
break;
}
}
if (fail) {
for (int i = 0; i < array.length; i++) {
array[i] = allocatorIdCounter++;
if (this.entityProtocol != null) {
this.entityProtocol.entityProtocolManager.idToEntityProtocolMap.put(array[i], this.entityProtocol);
}
}
} else {
it = allocatorReusableIds.iterator();
for (int id : array) {
it.nextInt();
it.remove();
if (this.entityProtocol != null) {
this.entityProtocol.entityProtocolManager.idToEntityProtocolMap.put(id, this.entityProtocol);
}
}
}
} finally {
allocatorLock.unlockWrite(stamp);
}
return array;
}
示例6: cutBelow
import it.unimi.dsi.fastutil.ints.IntIterator; //导入方法依赖的package包/类
public void cutBelow(int k) {
IntIterator iter = values().iterator();
while (iter.hasNext()) {
if (iter.nextInt() < k) {
iter.remove();
}
}
}
示例7: cutAbove
import it.unimi.dsi.fastutil.ints.IntIterator; //导入方法依赖的package包/类
public void cutAbove(int k) {
IntIterator iter = values().iterator();
while (iter.hasNext()) {
if (iter.nextInt() > k) {
iter.remove();
}
}
}
示例8: cutAbove
import it.unimi.dsi.fastutil.ints.IntIterator; //导入方法依赖的package包/类
public void cutAbove(double k) {
IntIterator iter = values().iterator();
while (iter.hasNext()) {
if (iter.nextInt() > k) {
iter.remove();
}
}
}
示例9: writeRepetitions
import it.unimi.dsi.fastutil.ints.IntIterator; //导入方法依赖的package包/类
/**
* Writes the succinct representation of the repetitions extracted from sorted <code>list</code>.
* <ul>
* <li>Number of repetitions intervals.</li>
* <li>
* For each interval:
* <ul>
* <li>
* Store the index of the repeated element minus the previous index minus 1, given that the
* difference between the indexes is at least one. The first index is stored raw given there is no
* previous index.
* </li>
* <li>
* Store the number of repetitions minus 2, given that repetitions must be at least two, to be an
* actual repetition.
* </li>
* </ul>
* </li>
* </ul>
*
* Each number is stored using delta encoding. Given than some values can be zero, is added one to each
* before apply delta encoding.
* For the example, <code>list</code>:
* <pre> {1, 1, 2, 3, 3, 3, 5, 6, 6, 7, 10, 11, 11, 12, 12, 12, 16, 19, 19}</pre>
* , it will generate the following encoding:
* <pre>
* 6 0 2 2 3 4 2 7 2 8 3 10 2 Repetitions Intervals.
* 6 0 0 1 1 1 0 2 0 0 1 1 0 Delta representation.
* 7 1 1 2 2 2 1 3 1 1 2 2 1 Add 1 to ensure non zeros.
* 111 1 1 01 01 01 1 11 1 1 01 01 1 Binary representation.
* 00111 1 1 010 010 010 1 011 1 1 010 010 1 Delta encoding.
* </pre>
*
* @param list from which extract the repetitions to encode. List must be incremental with positives
* (including zero) values.
* @return number of written bits.
* @throws IOException when there is an exception writing into <code>out</code>.
*/
protected int writeRepetitions(final IntList list) throws IOException {
int offset = 0;
int value = -1;
int lastValue;
int index = -1;
int repetitionStartIndex = -1;
int lastRepetitionStartIndex;
int numberOfRepetitions = 0;
final IntIterator listIterator = list.iterator();
repeatsBuffer.clear();
while (listIterator.hasNext()) {
lastValue = value;
value = listIterator.nextInt();
if (lastValue == value) {
if (numberOfRepetitions == 0) {
repetitionStartIndex = index;
}
numberOfRepetitions++;
listIterator.remove();
} else {
if (numberOfRepetitions > 0) {
repeatsBuffer.add(repetitionStartIndex);
repeatsBuffer.add(numberOfRepetitions);
numberOfRepetitions = 0;
}
index++;
}
}
if (numberOfRepetitions > 0) {
repeatsBuffer.add(repetitionStartIndex);
repeatsBuffer.add(numberOfRepetitions);
}
final IntIterator repeatsIterator = repeatsBuffer.iterator();
lastRepetitionStartIndex = -1;
offset += writeDelta(repeatsBuffer.size() / 2);
while (repeatsIterator.hasNext()) {
repetitionStartIndex = repeatsIterator.nextInt();
offset += writeDelta(repetitionStartIndex - lastRepetitionStartIndex - 1);
offset += writeDelta(repeatsIterator.nextInt() - 1);
lastRepetitionStartIndex = repetitionStartIndex;
}
return offset;
}
示例10: getWriteIntervalsOffset
import it.unimi.dsi.fastutil.ints.IntIterator; //导入方法依赖的package包/类
/**
* Estimates the number of bits required for the succinct intervals representation from strictly incremental
* <code>list</code>. For details of the representation (see
* {@link org.pebble.core.encoding.OutputSuccinctStream#writeIntervals(it.unimi.dsi.fastutil.ints.IntList, int) writeIntervals}).
* @param list from which it will extracts the intervals to encode. List must be strictly incremental with
* positives (including zero) values.
* @param valueBitSize fixed number of bits used to represent value in list to be encoded. It can be any value
* between 1bit and 31 bits.
* @return number of representation bits.
*/
public int getWriteIntervalsOffset(final IntList list, final int valueBitSize) {
int offset = 0;
intervalsBuffer.clear();
if (list.size() >= minIntervalSize) {
IntIterator listIterator = list.iterator();
int intervalInitialIndex = 0;
int index = 1;
int lastValue = listIterator.nextInt();
int value;
int deltaValue;
intervalsBuffer.clear();
while (listIterator.hasNext()) {
value = listIterator.nextInt();
deltaValue = value - lastValue;
if (deltaValue > 1) {
if (index - intervalInitialIndex >= minIntervalSize) {
intervalsBuffer.add(intervalInitialIndex);
intervalsBuffer.add(index - intervalInitialIndex);
}
intervalInitialIndex = index;
}
lastValue = value;
index++;
}
if (index - intervalInitialIndex >= minIntervalSize) {
intervalsBuffer.add(intervalInitialIndex);
intervalsBuffer.add(index - intervalInitialIndex);
}
offset += getWriteDeltaOffset(intervalsBuffer.size() / 2);
if (!intervalsBuffer.isEmpty()) {
IntIterator intervalIterator = intervalsBuffer.iterator();
intervalInitialIndex = intervalIterator.nextInt();
index = 0;
listIterator = list.iterator();
boolean firstWrite = true;
while(true) {
value = listIterator.nextInt();
if (index == intervalInitialIndex) {
listIterator.remove();
if (firstWrite) {
offset += writeIntOffset(value, valueBitSize);
firstWrite = false;
} else {
deltaValue = value - lastValue - 2;
offset += getWriteDeltaOffset(deltaValue);
}
intervalInitialIndex = intervalIterator.nextInt();
offset += getWriteDeltaOffset(intervalInitialIndex - minIntervalSize);
while (--intervalInitialIndex > 0) {
value = listIterator.nextInt();
listIterator.remove();
index++;
}
lastValue = value;
if (!intervalIterator.hasNext()) {
break;
}
intervalInitialIndex = intervalIterator.nextInt();
}
index++;
}
}
} else {
offset += getWriteDeltaOffset(0);
}
return offset;
}