public static void addtoMinheap() {

    for (RankedDoc i : R) {
      lminheap.put(i.novelty, Integer.toString(i.DOC));
    }

    lminheap = lminheap.descendingMap();
  }
Ejemplo n.º 2
0
 @CollectionSize.Require(SEVERAL)
 public void testDescendingNavigation() {
   List<Entry<K, V>> descending = new ArrayList<Entry<K, V>>();
   for (Entry<K, V> entry : navigableMap.descendingMap().entrySet()) {
     descending.add(entry);
   }
   Collections.reverse(descending);
   assertEquals(entries, descending);
 }
Ejemplo n.º 3
0
 private NavigableMap<Number640, Data> filterCopyOrig(
     final NavigableMap<Number640, Data> tmp, int limit, boolean ascending) {
   NavigableMap<Number640, Data> retVal = new TreeMap<Number640, Data>();
   int counter = 0;
   for (Map.Entry<Number640, Data> entry :
       ascending ? tmp.entrySet() : tmp.descendingMap().entrySet()) {
     if (!entry.getValue().hasPrepareFlag()) {
       if (limit >= 0 && counter++ >= limit) {
         break;
       }
       retVal.put(entry.getKey(), entry.getValue());
     }
   }
   return retVal;
 }
Ejemplo n.º 4
0
  private static AffinityLock acquireCore(boolean bind, int cpuId, AffinityStrategy... strategies) {
    synchronized (AffinityLock.class) {
      for (AffinityStrategy strategy : strategies) {
        LOOP:
        for (AffinityLock[] als : CORES.descendingMap().values()) {
          for (AffinityLock al : als)
            if (!al.canReserve() || !strategy.matches(cpuId, al.cpuId)) continue LOOP;

          final AffinityLock al = als[0];
          al.assignCurrentThread(bind, true);
          return al;
        }
      }
    }
    if (LOGGER.isLoggable(Level.WARNING))
      LOGGER.warning("No reservable Core for " + Thread.currentThread());
    return acquireLock(bind, cpuId, strategies);
  }
 public void testDescendingMap() {
   NavigableMap<String, Integer> map = create();
   NavigableMap<String, Integer> descendingMap = map.descendingMap();
   assertTrue(descendingMap instanceof SynchronizedNavigableMap);
   assertSame(mutex, ((SynchronizedNavigableMap<String, Integer>) descendingMap).mutex);
 }
 @Override
 public NavigableMap<K, V> create(Object... entries) {
   NavigableMap<K, V> map = (NavigableMap<K, V>) delegate.create(entries);
   return map.descendingMap();
 }