Java 类gnu.trove.iterator.TIntIterator 实例源码

项目:metanome-algorithms    文件:StrippedPartition.java   
@Override
    public String toString() {
        StringBuilder outputBuilder = new StringBuilder();
        outputBuilder.append("{");

        for(TEquivalence entry : this) {
            outputBuilder.append("{");
            for (TIntIterator valueIt=entry.iterator(); valueIt.hasNext(); ) {
//          for (TIntIteratorInteger value : entry) {
                outputBuilder.append(valueIt.next());
                outputBuilder.append(",");
            }
            outputBuilder.append("}");
        }
        outputBuilder.append("}");

        return outputBuilder.toString();
    }
项目:metanome-algorithms    文件:Partition.java   
@Override
public String toString() {
    StringBuilder outputBuilder = new StringBuilder();
    outputBuilder.append(String.format("[%s]{", this.indices));

    for(TEquivalence equivalenceGroup : this) {
        outputBuilder.append("{");
        for (TIntIterator valueIt=equivalenceGroup.iterator(); valueIt.hasNext(); ) {
            outputBuilder.append(valueIt.next());
            outputBuilder.append(",");
        }
        outputBuilder.append("}");
    }
    outputBuilder.append("}");

    return outputBuilder.toString();
}
项目:metanome-algorithms    文件:Partition.java   
public Collection<Partition> refineBy(int target) {
    HashMap<Cluster, Partition> map = new HashMap<Cluster, Partition>();
    for(TIntIterator iter = array.iterator(); iter.hasNext();) {
        int next = iter.next();
        Cluster c = StrippedPartition.clusters.get(next)[target];
        if(c == null) {
            continue;
        }
        if(map.containsKey(c)) {
            map.get(c).add(next);
        } else {
            Partition p = new Partition();
            p.add(next);
            map.put(c, p);
        }
    }
    return map.values();
}
项目:ProjectAres    文件:MaterialCounter.java   
public Iterable<MaterialData> materials() {
    return new Iterable<MaterialData>() {
        @Override
        public Iterator<MaterialData> iterator() {
            return new Iterator<MaterialData>() {
                final TIntIterator iter = counts.keySet().iterator();

                @Override
                public boolean hasNext() {
                    return iter.hasNext();
                }

                @Override
                public MaterialData next() {
                    return decodeMaterial(iter.next());
                }

                @Override
                public void remove() {
                    iter.remove();
                }
            };
        }
    };
}
项目:xcc    文件:TObjectIntHashMap.java   
/** {@inheritDoc} */
public boolean removeAll( TIntCollection collection ) {
    if ( this == collection ) {
        clear();
        return true;
    }
    boolean changed = false;
    TIntIterator iter = collection.iterator();
    while ( iter.hasNext() ) {
        int element = iter.next();
        if ( remove( element ) ) {
            changed = true;
        }
    }
    return changed;
}
项目:xcc    文件:TIntObjectHashMap.java   
/** {@inheritDoc} */
public boolean removeAll( TIntCollection collection ) {
    if ( collection == this ) {
        clear();
        return true;
    }
    boolean changed = false;
    TIntIterator iter = collection.iterator();
    while ( iter.hasNext() ) {
        int element = iter.next();
        if ( remove( element ) ) {
            changed = true;
        }
    }
    return changed;
}
项目:HCFCore    文件:TObjectIntHashMap.java   
/** {@inheritDoc} */
public boolean removeAll( TIntCollection collection ) {
    if ( this == collection ) {
        clear();
        return true;
    }
    boolean changed = false;
    TIntIterator iter = collection.iterator();
    while ( iter.hasNext() ) {
        int element = iter.next();
        if ( remove( element ) ) {
            changed = true;
        }
    }
    return changed;
}
项目:xcc    文件:TIntLinkedList.java   
@Override
public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    TIntLinkedList that = (TIntLinkedList) o;

    if (no_entry_value != that.no_entry_value) return false;
    if (size != that.size) return false;

    TIntIterator iterator = iterator();
    TIntIterator thatIterator = that.iterator();
    while (iterator.hasNext()) {
        if (!thatIterator.hasNext())
            return false;

        if (iterator.next() != thatIterator.next())
            return false;
    }

    return true;
}
项目:HCFCore    文件:TObjectIntHashMap.java   
/** {@inheritDoc} */
public boolean removeAll( TIntCollection collection ) {
    if ( this == collection ) {
        clear();
        return true;
    }
    boolean changed = false;
    TIntIterator iter = collection.iterator();
    while ( iter.hasNext() ) {
        int element = iter.next();
        if ( remove( element ) ) {
            changed = true;
        }
    }
    return changed;
}
项目:HCFCore    文件:TIntSetDecorator.java   
/**
 * Creates an iterator over the values of the set.
 *
 * @return an iterator with support for removals in the underlying set
 */
public Iterator<Integer> iterator() {
    return new Iterator<Integer>() {
        private final TIntIterator it = _set.iterator();

        public Integer next() {
            return Integer.valueOf( it.next() );
        }

        public boolean hasNext() {
            return it.hasNext();
        }

        public void remove() {
            it.remove();
        }
    };
}
项目:HCFCore    文件:TObjectIntCustomHashMap.java   
/** {@inheritDoc} */
public boolean removeAll( TIntCollection collection ) {
    if ( this == collection ) {
        clear();
        return true;
    }
    boolean changed = false;
    TIntIterator iter = collection.iterator();
    while ( iter.hasNext() ) {
        int element = iter.next();
        if ( remove( element ) ) {
            changed = true;
        }
    }
    return changed;
}
项目:HCFCore    文件:TIntArrayList.java   
/** {@inheritDoc} */
public boolean removeAll( TIntCollection collection ) {
    if ( collection == this ) {
        clear();
        return true;
    }
    boolean changed = false;
    TIntIterator iter = collection.iterator();
    while ( iter.hasNext() ) {
        int element = iter.next();
        if ( remove( element ) ) {
            changed = true;
        }
    }
    return changed;
}
项目:HCFCore    文件:TIntArrayList.java   
/** {@inheritDoc} */
public boolean removeAll( TIntCollection collection ) {
    if ( collection == this ) {
        clear();
        return true;
    }
    boolean changed = false;
    TIntIterator iter = collection.iterator();
    while ( iter.hasNext() ) {
        int element = iter.next();
        if ( remove( element ) ) {
            changed = true;
        }
    }
    return changed;
}
项目:metanome-algorithms    文件:ProbeTable.java   
public ProbeTable(Partition partition) {
        // set the no entry key and no entry value to something recognizable
        super(partition.size(), 2, -1, -1);
        // The probe table maps each tuple index to the index of the equivalence class it belongs to
        for (TEquivalence equivalenceGroup : partition) {
            int groupIdentifier = equivalenceGroup.getIdentifier();
            for (TIntIterator groupValueIt=equivalenceGroup.iterator(); groupValueIt.hasNext(); ) {
//          for (Integer groupValue : equivalenceGroup) {
                this.put(groupValueIt.next(), groupIdentifier);
            }
        }
    }
项目:HCFCore    文件:TIntObjectHashMap.java   
public boolean retainAll( TIntCollection collection ) {
    if ( this == collection ) {
        return false;
    }
    boolean modified = false;
    TIntIterator iter = iterator();
    while ( iter.hasNext() ) {
        if ( ! collection.contains( iter.next() ) ) {
            iter.remove();
            modified = true;
        }
    }
    return modified;
}
项目:HCFCore    文件:TIntLinkedList.java   
/** {@inheritDoc} */
public boolean removeAll(int[] array) {
    Arrays.sort(array);

    boolean modified = false;
    TIntIterator iter = iterator();
    while (iter.hasNext()) {
        if (Arrays.binarySearch(array, iter.next()) >= 0) {
            iter.remove();
            modified = true;
        }
    }
    return modified;
}
项目:HCFCore    文件:TObjectIntHashMap.java   
/** {@inheritDoc} */
public boolean containsAll( TIntCollection collection ) {
    TIntIterator iter = collection.iterator();
    while ( iter.hasNext() ) {
        if ( ! TObjectIntHashMap.this.containsValue( iter.next() ) ) {
            return false;
        }
    }
    return true;
}
项目:xcc    文件:RegAllocPBQP.java   
private PBQPMatrix buildCoalscingEdgeCosts(
        TIntArrayList allowedReg1,
        TIntArrayList allowedReg2, double cost)
{
    PBQPMatrix m = new PBQPMatrix(allowedReg1.size()+1, allowedReg2.size()+1);
    boolean isAllZero = true;

    int i = 1;
    for (TIntIterator itr = allowedReg1.iterator(); itr.hasNext(); )
    {
        int j = 1;
        int reg1 = itr.next();
        for (TIntIterator itr2 = allowedReg2.iterator(); itr2.hasNext(); )
        {
            if (reg1 == itr2.next())
            {
                m.set(i, j, -cost);
                isAllZero = false;
            }
            j++;
        }
        i++;
    }
    if (isAllZero)
        return null;
    return m;
}
项目:xcc    文件:RegAllocPBQP.java   
private PBQPMatrix buildInterferenceEdgeCosts(
        TIntArrayList allowedReg1,
        TIntArrayList allowedReg2)
{
    PBQPMatrix m = new PBQPMatrix(allowedReg1.size()+1, allowedReg2.size()+1);
    boolean isAllZero = true;

    int i = 1;
    for (TIntIterator itr = allowedReg1.iterator(); itr.hasNext(); )
    {
        int j = 1;
        int reg1 = itr.next();
        for (TIntIterator itr2 = allowedReg2.iterator(); itr2.hasNext(); )
        {
            // If the row/column regs are identical or alias insert an infinity.
            int reg2 = itr2.next();
            if (tri.regsOverlap(reg1, reg2))
            {
                m.set(i, j, Double.MAX_VALUE);
                isAllZero = false;
            }
            j++;
        }
        i++;
    }
    if (isAllZero)
        return null;
    return m;
}
项目:xcc    文件:TObjectIntHashMap.java   
/** {@inheritDoc} */
@SuppressWarnings({"SuspiciousMethodCalls"})
public boolean retainAll( Collection<?> collection ) {
    boolean modified = false;
    TIntIterator iter = iterator();
    while ( iter.hasNext() ) {
        if ( ! collection.contains( Integer.valueOf ( iter.next() ) ) ) {
            iter.remove();
            modified = true;
        }
    }
    return modified;
}
项目:xcc    文件:TIntObjectHashMap.java   
/** {@inheritDoc} */
public boolean containsAll( TIntCollection collection ) {
    if ( collection == this ) {
        return true;
    }
    TIntIterator iter = collection.iterator();
    while ( iter.hasNext() ) {
        if ( ! TIntObjectHashMap.this.containsKey( iter.next() ) ) {
            return false;
        }
    }
    return true;
}
项目:xcc    文件:TIntObjectHashMap.java   
/** {@inheritDoc} */
public boolean retainAll( Collection<?> collection ) {
    boolean modified = false;
    TIntIterator iter = iterator();
    while ( iter.hasNext() ) {
        //noinspection SuspiciousMethodCalls
        if ( ! collection.contains( Integer.valueOf ( iter.next() ) ) ) {
            iter.remove();
            modified = true;
        }
    }
    return modified;
}
项目:HCFCore    文件:TIntLinkedList.java   
/** {@inheritDoc} */
public boolean removeAll(TIntCollection collection) {
    boolean modified = false;
    TIntIterator iter = iterator();
    while (iter.hasNext()) {
        if (collection.contains(iter.next())) {
            iter.remove();
            modified = true;
        }
    }
    return modified;
}
项目:HCFCore    文件:TIntLinkedList.java   
/** {@inheritDoc} */
public void writeExternal(ObjectOutput out) throws IOException {
    // VERSION
    out.writeByte(0);

    // NO_ENTRY_VALUE
    out.writeInt(no_entry_value);

    // ENTRIES
    out.writeInt(size);
    for (TIntIterator iterator = iterator(); iterator.hasNext();) {
        int next = iterator.next();
        out.writeInt(next);
    }
}
项目:xcc    文件:TObjectIntCustomHashMap.java   
/** {@inheritDoc} */
@SuppressWarnings({"SuspiciousMethodCalls"})
public boolean retainAll( Collection<?> collection ) {
    boolean modified = false;
    TIntIterator iter = iterator();
    while ( iter.hasNext() ) {
        if ( ! collection.contains( Integer.valueOf ( iter.next() ) ) ) {
            iter.remove();
            modified = true;
        }
    }
    return modified;
}
项目:xcc    文件:TObjectIntCustomHashMap.java   
/** {@inheritDoc} */
public boolean retainAll( TIntCollection collection ) {
    if ( this == collection ) {
        return false;
    }
    boolean modified = false;
    TIntIterator iter = iterator();
    while ( iter.hasNext() ) {
        if ( ! collection.contains( iter.next() ) ) {
            iter.remove();
            modified = true;
        }
    }
    return modified;
}
项目:xcc    文件:TLinkedHashSet.java   
/**
 * Expands the set to accommodate new values.
 *
 * @param newCapacity an <code>int</code> value
 */
@Override
protected void rehash(int newCapacity) {
    TIntLinkedList oldOrder = new TIntLinkedList(order);
    int oldSize = size();

    Object oldSet[] = _set;

    order.clear();
    _set = new Object[newCapacity];
    Arrays.fill(_set, FREE);

    for (TIntIterator iterator = oldOrder.iterator(); iterator.hasNext();) {
        int i = iterator.next();
        E o = (E) oldSet[i];
        if (o == FREE || o == REMOVED) {
            throw new IllegalStateException("Iterating over empty location while rehashing");
        }

        if (o != FREE && o != REMOVED) {
            int index = insertKey(o);
            if (index < 0) { // everyone pays for this because some people can't RTFM
                throwObjectContractViolation(_set[(-index - 1)], o, size(), oldSize, oldSet);
            }

            if (!order.add(index))
                throw new IllegalStateException("Order not changed after insert");
        }
    }

}
项目:xcc    文件:TIntHashSet.java   
/** {@inheritDoc} */
public boolean containsAll( TIntCollection collection ) {
    TIntIterator iter = collection.iterator();
    while ( iter.hasNext() ) {
        int element = iter.next();
        if ( ! contains( element ) ) {
            return false;
        }
    }
    return true;
}
项目:xcc    文件:TIntHashSet.java   
/** {@inheritDoc} */
@SuppressWarnings({"SuspiciousMethodCalls"})
public boolean retainAll( Collection<?> collection ) {
    boolean modified = false;
 TIntIterator iter = iterator();
 while ( iter.hasNext() ) {
     if ( ! collection.contains( Integer.valueOf ( iter.next() ) ) ) {
      iter.remove();
      modified = true;
     }
 }
 return modified;
}
项目:xcc    文件:TIntHashSet.java   
/** {@inheritDoc} */
public boolean retainAll( TIntCollection collection ) {
    if ( this == collection ) {
        return false;
    }
    boolean modified = false;
 TIntIterator iter = iterator();
 while ( iter.hasNext() ) {
     if ( ! collection.contains( iter.next() ) ) {
      iter.remove();
      modified = true;
     }
 }
 return modified;
}
项目:HCFCore    文件:TIntObjectHashMap.java   
public boolean retainAll( Collection<?> collection ) {
    boolean modified = false;
    TIntIterator iter = iterator();
    while ( iter.hasNext() ) {
        //noinspection SuspiciousMethodCalls
        if ( ! collection.contains( Integer.valueOf ( iter.next() ) ) ) {
            iter.remove();
            modified = true;
        }
    }
    return modified;
}
项目:xcc    文件:TIntArrayList.java   
/** {@inheritDoc} */
public boolean containsAll( TIntCollection collection ) {
    if ( this == collection ) {
        return true;
    }
    TIntIterator iter = collection.iterator();
    while ( iter.hasNext() ) {
        int element = iter.next();
        if ( ! contains( element ) ) {
            return false;
        }
    }
    return true;
}
项目:xcc    文件:TIntArrayList.java   
/** {@inheritDoc} */
public boolean addAll( TIntCollection collection ) {
    boolean changed = false;
    TIntIterator iter = collection.iterator();
    while ( iter.hasNext() ) {
        int element = iter.next();
        if ( add( element ) ) {
            changed = true;
        }
    }
    return changed;
}
项目:xcc    文件:TIntArrayList.java   
/** {@inheritDoc} */
@SuppressWarnings({"SuspiciousMethodCalls"})
public boolean retainAll( Collection<?> collection ) {
    boolean modified = false;
 TIntIterator iter = iterator();
 while ( iter.hasNext() ) {
     if ( ! collection.contains( Integer.valueOf ( iter.next() ) ) ) {
      iter.remove();
      modified = true;
     }
 }
 return modified;
}
项目:xcc    文件:TIntArrayList.java   
/** {@inheritDoc} */
public boolean retainAll( TIntCollection collection ) {
    if ( this == collection ) {
        return false;
    }
    boolean modified = false;
 TIntIterator iter = iterator();
 while ( iter.hasNext() ) {
     if ( ! collection.contains( iter.next() ) ) {
      iter.remove();
      modified = true;
     }
 }
 return modified;
}
项目:HCFCore    文件:TIntArrayList.java   
/** {@inheritDoc} */
public boolean retainAll( TIntCollection collection ) {
    if ( this == collection ) {
        return false;
    }
    boolean modified = false;
 TIntIterator iter = iterator();
 while ( iter.hasNext() ) {
     if ( ! collection.contains( iter.next() ) ) {
      iter.remove();
      modified = true;
     }
 }
 return modified;
}
项目:HCFCore    文件:TIntLinkedList.java   
/** {@inheritDoc} */
public TIntIterator iterator() {
    return new TIntIterator() {
        TIntLink l = head;
        TIntLink current;

        public int next() {
            if (no(l))
                throw new NoSuchElementException();

            int ret = l.getValue();
            current = l;
            l = l.getNext();

            return ret;
        }

        public boolean hasNext() {
            return got(l);
        }

        public void remove() {
            if (current == null)
                throw new IllegalStateException();

            removeLink(current);
            current = null;
        }
    };
}
项目:HCFCore    文件:TIntHashSet.java   
/** {@inheritDoc} */
public boolean containsAll( TIntCollection collection ) {
    TIntIterator iter = collection.iterator();
    while ( iter.hasNext() ) {
        int element = iter.next();
        if ( ! contains( element ) ) {
            return false;
        }
    }
    return true;
}
项目:xcc    文件:TIntLinkedList.java   
/** {@inheritDoc} */
public boolean addAll(TIntCollection collection) {
    boolean ret = false;
    for (TIntIterator it = collection.iterator(); it.hasNext();) {
        int i = it.next();
        if (add(i))
            ret = true;
    }

    return ret;
}
项目:HCFCore    文件:TObjectIntHashMap.java   
/** {@inheritDoc} */
public boolean retainAll( TIntCollection collection ) {
    if ( this == collection ) {
        return false;
    }
    boolean modified = false;
    TIntIterator iter = iterator();
    while ( iter.hasNext() ) {
        if ( ! collection.contains( iter.next() ) ) {
            iter.remove();
            modified = true;
        }
    }
    return modified;
}