Java 类org.apache.commons.collections4.OrderedMapIterator 实例源码

项目:sosiefier    文件:AbstractOrderedMapIteratorTest.java   
/** 
     * Test that the empty list iterator contract is correct.
     */
@Override
    public void testEmptyMapIterator() {
        fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testEmptyMapIterator");
        if (!(supportsEmptyIterator())) {
            return ;
        } 
        super.testEmptyMapIterator();
        final OrderedMapIterator<K, V> it = makeEmptyIterator();
        fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2694,it,2693,it.hasPrevious());
        try {
            it.previous();
        } catch (final NoSuchElementException ex) {
        }
        fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
    }
项目:sosiefier    文件:AbstractOrderedMapIteratorTest.java   
/** 
     * Test that the empty list iterator contract is correct.
     */
@Test(timeout = 1000)
    public void testEmptyMapIterator_add949() {
        fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testEmptyMapIterator_add949");
        if (!(supportsEmptyIterator())) {
            return ;
        } 
        super.testEmptyMapIterator();
        super.testEmptyMapIterator();
        final OrderedMapIterator<K, V> it = makeEmptyIterator();
        fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2694,it,2693,it.hasPrevious());
        try {
            it.previous();
        } catch (final NoSuchElementException ex) {
        }
        fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
    }
项目:sosiefier    文件:AbstractOrderedMapIteratorTest.java   
/** 
     * Test that the empty list iterator contract is correct.
     */
@Test(timeout = 1000)
    public void testEmptyMapIterator_add950() {
        fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testEmptyMapIterator_add950");
        if (!(supportsEmptyIterator())) {
            return ;
        } 
        super.testEmptyMapIterator();
        final OrderedMapIterator<K, V> it = makeEmptyIterator();
        fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2694,it,2693,it.hasPrevious());
        try {
            it.previous();
            it.previous();
        } catch (final NoSuchElementException ex) {
        }
        fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
    }
项目:HCFCore    文件:AbstractLinkedMap.java   
/**
 * {@inheritDoc}
 */
@Override
public OrderedMapIterator<K, V> mapIterator() {
    if (size == 0) {
        return EmptyOrderedMapIterator.<K, V>emptyOrderedMapIterator();
    }
    return new LinkMapIterator<K, V>(this);
}
项目:HCFCore    文件:UnmodifiableOrderedMapIterator.java   
/**
 * Decorates the specified iterator such that it cannot be modified.
 *
 * @param <K>  the key type
 * @param <V>  the value type
 * @param iterator  the iterator to decorate
 * @return a new unmodifiable ordered map iterator
 * @throws NullPointerException if the iterator is null
 */
public static <K, V> OrderedMapIterator<K, V> unmodifiableOrderedMapIterator(
        final OrderedMapIterator<K, ? extends V> iterator) {

    if (iterator == null) {
        throw new NullPointerException("OrderedMapIterator must not be null");
    }
    if (iterator instanceof Unmodifiable) {
        @SuppressWarnings("unchecked") // safe to upcast
        final OrderedMapIterator<K, V> tmpIterator = (OrderedMapIterator<K, V>) iterator;
        return tmpIterator;
    }
    return new UnmodifiableOrderedMapIterator<K, V>(iterator);
}
项目:HCFCore    文件:AbstractOrderedMapIteratorDecorator.java   
/**
 * Constructor that decorates the specified iterator.
 *
 * @param iterator  the iterator to decorate, must not be null
 * @throws NullPointerException if the iterator is null
 */
public AbstractOrderedMapIteratorDecorator(final OrderedMapIterator<K, V> iterator) {
    super();
    if (iterator == null) {
        throw new NullPointerException("OrderedMapIterator must not be null");
    }
    this.iterator = iterator;
}
项目:HCFCore    文件:TreeBidiMap.java   
@Override
public OrderedMapIterator<K, V> mapIterator() {
    if (isEmpty()) {
        return EmptyOrderedMapIterator.<K, V>emptyOrderedMapIterator();
    }
    return new ViewMapIterator(KEY);
}
项目:HCFCore    文件:TreeBidiMap.java   
@Override
public OrderedMapIterator<V, K> mapIterator() {
    if (isEmpty()) {
        return EmptyOrderedMapIterator.<V, K>emptyOrderedMapIterator();
    }
    return new InverseViewMapIterator(VALUE);
}
项目:HCFCore    文件:AbstractLinkedMap.java   
/**
 * {@inheritDoc}
 */
@Override
public OrderedMapIterator<K, V> mapIterator() {
    if (size == 0) {
        return EmptyOrderedMapIterator.<K, V>emptyOrderedMapIterator();
    }
    return new LinkMapIterator<K, V>(this);
}
项目:HCFCore    文件:UnmodifiableOrderedMapIterator.java   
/**
 * Decorates the specified iterator such that it cannot be modified.
 *
 * @param <K>  the key type
 * @param <V>  the value type
 * @param iterator  the iterator to decorate
 * @return a new unmodifiable ordered map iterator
 * @throws NullPointerException if the iterator is null
 */
public static <K, V> OrderedMapIterator<K, V> unmodifiableOrderedMapIterator(
        final OrderedMapIterator<K, ? extends V> iterator) {

    if (iterator == null) {
        throw new NullPointerException("OrderedMapIterator must not be null");
    }
    if (iterator instanceof Unmodifiable) {
        @SuppressWarnings("unchecked") // safe to upcast
        final OrderedMapIterator<K, V> tmpIterator = (OrderedMapIterator<K, V>) iterator;
        return tmpIterator;
    }
    return new UnmodifiableOrderedMapIterator<K, V>(iterator);
}
项目:HCFCore    文件:AbstractOrderedMapIteratorDecorator.java   
/**
 * Constructor that decorates the specified iterator.
 *
 * @param iterator  the iterator to decorate, must not be null
 * @throws NullPointerException if the iterator is null
 */
public AbstractOrderedMapIteratorDecorator(final OrderedMapIterator<K, V> iterator) {
    super();
    if (iterator == null) {
        throw new NullPointerException("OrderedMapIterator must not be null");
    }
    this.iterator = iterator;
}
项目:HCFCore    文件:TreeBidiMap.java   
@Override
public OrderedMapIterator<K, V> mapIterator() {
    if (isEmpty()) {
        return EmptyOrderedMapIterator.<K, V>emptyOrderedMapIterator();
    }
    return new ViewMapIterator(KEY);
}
项目:HCFCore    文件:TreeBidiMap.java   
@Override
public OrderedMapIterator<V, K> mapIterator() {
    if (isEmpty()) {
        return EmptyOrderedMapIterator.<V, K>emptyOrderedMapIterator();
    }
    return new InverseViewMapIterator(VALUE);
}
项目:beaconradar    文件:Scanner.java   
/**
 * Call only on main thread
 * @param now Timestamp to calculate if beacon qualifies for removal.
 * @return Removed beacons count.
 */
@DebugLog
private int removeOldBeacons(long now) {
    OrderedMapIterator<ID, Beacon> itr = mPublished.mapIterator();
    int dead = 0;
    //Iterates from LRU to MRU.
    while (itr.hasNext()) {
        ID id = itr.next();
        Beacon beacon = itr.getValue();
        if(now - beacon.getLastSeen() > REMOVE) {                                               //TODO force REMOVE > INTERVAL + DURATION ?
            itr.remove();
            mBeacons.remove(id);
            if(id.getType() == ID.T_TLM) cFramesTLM--;
            if(cFramesTLM < 0) cFramesTLM = 0;  //TODO this should not occur, but did while switching eq_modes
            updateBeaconDB(id, beacon);
            mDB.delete("nearby", "_id = ?", new String[]{String.valueOf(beacon.getDbId())});
            if(mLogging) {
                ContentValues cv = beacon.getLogCV(mAppContext);
                cv.put("event", EVENT_REMOVED_INACTIVE);
                cv.put("time", now);
                mDB.insert("log_entries", null, cv);
            }
            if(beacon.getOnDisappeared()) sendBroadcast(Const.INTENT_DISAPPEARED, beacon, null);
            dead++;
        } else break;   //Beacons are sorted LRU to MRU so we can stop at first non-removable beacon.
    }
    return dead;
}
项目:sosiefier    文件:AbstractOrderedMapIteratorTest.java   
/** 
     * Test that the empty list iterator contract is correct.
     */
@Test(timeout = 1000)
    public void testEmptyMapIterator_remove721() {
        fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testEmptyMapIterator_remove721");
        if (!(supportsEmptyIterator())) {
            return ;
        } 
        final OrderedMapIterator<K, V> it = makeEmptyIterator();
        fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2694,it,2693,it.hasPrevious());
        try {
            it.previous();
        } catch (final NoSuchElementException ex) {
        }
        fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
    }
项目:sosiefier    文件:UnmodifiableOrderedMapIteratorTest.java   
public void testDecorateFactory() {
    fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testDecorateFactory");
    OrderedMapIterator<K, V> it = makeObject();
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),4397,it);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),4399,null,4398,org.apache.commons.collections4.iterators.UnmodifiableOrderedMapIterator.unmodifiableOrderedMapIterator(it));
    it = getMap().mapIterator();
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),4400,(it != (org.apache.commons.collections4.iterators.UnmodifiableOrderedMapIterator.unmodifiableOrderedMapIterator(it))));
    try {
        org.apache.commons.collections4.iterators.UnmodifiableOrderedMapIterator.unmodifiableOrderedMapIterator(null);
    } catch (final IllegalArgumentException ex) {
    }
    fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
项目:sosiefier    文件:UnmodifiableOrderedMapIteratorTest.java   
@Test(timeout = 1000)
public void testDecorateFactory_add1217() {
    fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testDecorateFactory_add1217");
    OrderedMapIterator<K, V> it = makeObject();
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),4397,it);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),4399,null,4398,org.apache.commons.collections4.iterators.UnmodifiableOrderedMapIterator.unmodifiableOrderedMapIterator(it));
    it = getMap().mapIterator();
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),4400,(it != (org.apache.commons.collections4.iterators.UnmodifiableOrderedMapIterator.unmodifiableOrderedMapIterator(it))));
    try {
        org.apache.commons.collections4.iterators.UnmodifiableOrderedMapIterator.unmodifiableOrderedMapIterator(null);
        org.apache.commons.collections4.iterators.UnmodifiableOrderedMapIterator.unmodifiableOrderedMapIterator(null);
    } catch (final IllegalArgumentException ex) {
    }
    fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
项目:mesos-plugin    文件:JenkinsScheduler.java   
/**
 * Makes sure that it gives priority to recent mesos slaves
 * (LRU algorithm) if its present in offers list.
 * This will help in reducing build time since all the required
 * artifacts will be present already.
 * @param offers
 */
private void reArrangeOffersBasedOnAffinity(List<Offer> offers) {
  if(recentlyAcceptedOffers.size() > 0) {
    //Iterates from least to most recently used.
    OrderedMapIterator<String, Object> mapIterator = recentlyAcceptedOffers.mapIterator();
    while (mapIterator.hasNext()) {
      String recentSlaveId = mapIterator.next();
      reArrangeOffersBasedOnAffinity(offers, recentSlaveId);
    }
  }
}
项目:HCFCore    文件:SingletonMap.java   
/**
 * {@inheritDoc}
 */
public OrderedMapIterator<K, V> mapIterator() {
    return new SingletonMapIterator<K, V>(this);
}
项目:HCFCore    文件:AbstractOrderedMapDecorator.java   
@Override
public OrderedMapIterator<K, V> mapIterator() {
    return decorated().mapIterator();
}
项目:HCFCore    文件:ListOrderedMap.java   
@Override
public OrderedMapIterator<K, V> mapIterator() {
    return new ListOrderedMapIterator<K, V>(this);
}
项目:HCFCore    文件:AbstractSortedMapDecorator.java   
/**
 * {@inheritDoc}
 */
@Override
public OrderedMapIterator<K, V> mapIterator() {
    return new SortedMapIterator<K, V>(entrySet());
}
项目:HCFCore    文件:UnmodifiableOrderedMap.java   
@Override
public OrderedMapIterator<K, V> mapIterator() {
    final OrderedMapIterator<K, V> it = decorated().mapIterator();
    return UnmodifiableOrderedMapIterator.unmodifiableOrderedMapIterator(it);
}
项目:HCFCore    文件:AbstractPatriciaTrie.java   
public OrderedMapIterator<K, V> mapIterator() {
    return new TrieMapIterator();
}
项目:HCFCore    文件:UnmodifiableTrie.java   
public OrderedMapIterator<K, V> mapIterator() {
    final OrderedMapIterator<K, V> it = delegate.mapIterator();
    return UnmodifiableOrderedMapIterator.unmodifiableOrderedMapIterator(it);
}
项目:HCFCore    文件:UnmodifiableOrderedBidiMap.java   
@Override
public OrderedMapIterator<K, V> mapIterator() {
    final OrderedMapIterator<K, V> it = decorated().mapIterator();
    return UnmodifiableOrderedMapIterator.unmodifiableOrderedMapIterator(it);
}
项目:HCFCore    文件:AbstractOrderedBidiMapDecorator.java   
@Override
public OrderedMapIterator<K, V> mapIterator() {
    return decorated().mapIterator();
}
项目:HCFCore    文件:UnmodifiableSortedBidiMap.java   
@Override
public OrderedMapIterator<K, V> mapIterator() {
    final OrderedMapIterator<K, V> it = decorated().mapIterator();
    return UnmodifiableOrderedMapIterator.unmodifiableOrderedMapIterator(it);
}
项目:HCFCore    文件:SingletonMap.java   
/**
 * {@inheritDoc}
 */
public OrderedMapIterator<K, V> mapIterator() {
    return new SingletonMapIterator<K, V>(this);
}
项目:HCFCore    文件:AbstractOrderedMapDecorator.java   
@Override
public OrderedMapIterator<K, V> mapIterator() {
    return decorated().mapIterator();
}
项目:HCFCore    文件:ListOrderedMap.java   
@Override
public OrderedMapIterator<K, V> mapIterator() {
    return new ListOrderedMapIterator<K, V>(this);
}
项目:HCFCore    文件:AbstractSortedMapDecorator.java   
/**
 * {@inheritDoc}
 */
@Override
public OrderedMapIterator<K, V> mapIterator() {
    return new SortedMapIterator<K, V>(entrySet());
}
项目:HCFCore    文件:UnmodifiableOrderedMap.java   
@Override
public OrderedMapIterator<K, V> mapIterator() {
    final OrderedMapIterator<K, V> it = decorated().mapIterator();
    return UnmodifiableOrderedMapIterator.unmodifiableOrderedMapIterator(it);
}
项目:HCFCore    文件:AbstractPatriciaTrie.java   
public OrderedMapIterator<K, V> mapIterator() {
    return new TrieMapIterator();
}
项目:HCFCore    文件:UnmodifiableTrie.java   
public OrderedMapIterator<K, V> mapIterator() {
    final OrderedMapIterator<K, V> it = delegate.mapIterator();
    return UnmodifiableOrderedMapIterator.unmodifiableOrderedMapIterator(it);
}
项目:HCFCore    文件:UnmodifiableOrderedBidiMap.java   
@Override
public OrderedMapIterator<K, V> mapIterator() {
    final OrderedMapIterator<K, V> it = decorated().mapIterator();
    return UnmodifiableOrderedMapIterator.unmodifiableOrderedMapIterator(it);
}
项目:HCFCore    文件:AbstractOrderedBidiMapDecorator.java   
@Override
public OrderedMapIterator<K, V> mapIterator() {
    return decorated().mapIterator();
}
项目:HCFCore    文件:UnmodifiableSortedBidiMap.java   
@Override
public OrderedMapIterator<K, V> mapIterator() {
    final OrderedMapIterator<K, V> it = decorated().mapIterator();
    return UnmodifiableOrderedMapIterator.unmodifiableOrderedMapIterator(it);
}
项目:sosiefier    文件:AbstractOrderedMapTest.java   
@Override
public OrderedMapIterator<K, V> makeEmptyIterator() {
    resetEmpty();
    return org.apache.commons.collections4.map.AbstractOrderedMapTest.this.getMap().mapIterator();
}
项目:sosiefier    文件:AbstractOrderedMapTest.java   
@Override
public OrderedMapIterator<K, V> makeObject() {
    resetFull();
    return org.apache.commons.collections4.map.AbstractOrderedMapTest.this.getMap().mapIterator();
}