Package gnu.trove.iterator

Examples of gnu.trove.iterator.TIntIterator


        @Override
        public void submit(TIntSet removed, TIntSet added) {
            insureInitialized();
            TIntSet parentRemoved = null, parentAdded;
            //Calculating really removed indices set
            TIntIterator iterator = removed.iterator();
            int iIndex, index;
            while (iterator.hasNext()) {
                iIndex = Arrays.binarySearch(allDummyIndices, index = iterator.next());
                usedArrays[iIndex].clear(position.currentIndex());

                if (usedArrays[iIndex].bitCount() == 0) {
                    if (parentRemoved == null)
                        parentRemoved = new TIntHashSet(removed.size());
                    parentRemoved.add(index);
                }
            }
            if (parentRemoved == null)
                parentRemoved = EMPTY_INT_SET;

            //Processing added indices and calculating added set to
            //propagate to position.
            parentAdded = new TIntHashSet(added);
            iterator = parentAdded.iterator();
            while (iterator.hasNext()) {
                //Searching index in initial dummy indices set
                iIndex = Arrays.binarySearch(allDummyIndices, iterator.next());

                //If this index is new for this sum it will never be removed,
                //so we don't need to store information about it.
                if (iIndex < 0)
                    continue;

                //If this index was already somewhere in the sum,
                //we don't have to propagate it to position
                if (!usedArrays[iIndex].isEmpty())
                    iterator.remove();

                //Marking this index as added to current summand
                usedArrays[iIndex].set(position.currentIndex());
            }
View Full Code Here


                if (maxDummiesPosition == -1 || dummies[maxDummiesPosition].size() < dummies[i].size())
                    maxDummiesPosition = i;
            }

            TIntHashSet temp;
            TIntIterator iterator;
            int count, index;
            for (int i = oldData.length - 1; i >= 0; --i) {
                if (i == maxDummiesPosition)
                    continue;

                iterator = dummies[i].iterator();
                count = 0;
                while (iterator.hasNext())
                    if (!dummies[maxDummiesPosition].contains(iterator.next()))
                        ++count;

                if (count == 0)
                    continue;

                int[] from = new int[count], to = new int[count];

                temp = new TIntHashSet(dummies[maxDummiesPosition]);
                iterator = dummies[i].iterator();
                while (iterator.hasNext())
                    if (!temp.remove(index = iterator.next()))
                        from[--count] = index;

                assert count == 0;
                iterator = temp.iterator();
                count = to.length;
                while (iterator.hasNext() && count > 0)
                    to[--count] = iterator.next();

                if (newData == null)
                    newData = oldData.clone();

                Arrays.sort(from);
View Full Code Here

            return true;
        }

        /** {@inheritDoc} */
        public boolean containsAll( TIntCollection collection ) {
            TIntIterator iter = collection.iterator();
            while ( iter.hasNext() ) {
                if ( ! TObjectIntHashMap.this.containsValue( iter.next() ) ) {
                    return false;
                }
            }
            return true;
        }
View Full Code Here

        /** {@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;
        }
View Full Code Here

        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;
        }
View Full Code Here

            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;
View Full Code Here

    /** {@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;
View Full Code Here


    /** {@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;
View Full Code Here

    /** {@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;
    }
View Full Code Here

    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;
    }
View Full Code Here

TOP

Related Classes of gnu.trove.iterator.TIntIterator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.