Package java.util

Examples of java.util.SortedMap.lastKey()


    // adjust line and column counting
    if (isFlagSet(Flags.F_COUNT_LINES)) {
      SortedMap map         = _position2LineMap.headMap(new Integer(position + 1));
     
      if (map != null &&  ! map.isEmpty()) {
        Integer lastLineStart = (Integer)map.lastKey();
       
        _lineNumber   = ((Integer)map.get(lastLineStart)).intValue();
        _columnNumber = position - lastLineStart.intValue();
      } else {
        _lineNumber   = 0;
View Full Code Here


        SortedMap skipMap = getSkipMap();
        synchronized (skipMap) {
            SortedMap head = skipMap.headMap(new Long(time));
            if (!head.isEmpty()) {
                eventBundleBuffer.clear();
                lastRevision = (Long) head.get(head.lastKey());
            }
        }

        try {
            while (hasNext()) {
View Full Code Here

     */
    private void updateIndex(TimeIndex idx) {
        SortedMap headMap = assocCache.headMap(idx);
        idx.time--;
        if (!headMap.isEmpty()) {
            TimeIndex lastIdx = (TimeIndex) headMap.lastKey();
            if (lastIdx.time == idx.time)
                idx.sequence = lastIdx.sequence + 1;
        }
    }
   
View Full Code Here

        SortedMap skipMap = getSkipMap();
        synchronized (skipMap) {
            SortedMap head = skipMap.headMap(new Long(time));
            if (!head.isEmpty()) {
                eventBundleBuffer.clear();
                lastRevision = (Long) head.get(head.lastKey());
            }
        }

        try {
            while (hasNext()) {
View Full Code Here

        SortedMap map = makeTestSortedMap(oneFactory);
        map.put("A""a");
        map.get("B"); // Entry with value "One" created
        map.put("C", "c");
        assertEquals("First key should be A", map.firstKey(), "A");
        assertEquals("Last key should be C", map.lastKey(), "C");
        assertEquals("First key in tail map should be B",
            map.tailMap("B").firstKey(), "B");
        assertEquals("Last key in head map should be B",
            map.headMap("C").lastKey(), "B");
        assertEquals("Last key in submap should be B",
View Full Code Here

            fail("Null value should raise IllegalArgument");
        } catch (IllegalArgumentException e) {
            // expected
        }
        assertEquals("First key should be A", map.firstKey(), "A");
        assertEquals("Last key should be C", map.lastKey(), "C");
        assertEquals("First key in tail map should be B",
            map.tailMap("B").firstKey(), "B");
        assertEquals("Last key in head map should be B",
            map.headMap("C").lastKey(), "B");
        assertEquals("Last key in submap should be B",
View Full Code Here

        SortedMap sm = (SortedMap) makeFullMap();
        Object obj = null;
        for (Iterator it = sm.keySet().iterator(); it.hasNext();) {
            obj = (Object) it.next();
        }
        assertSame(obj, sm.lastKey());
    }
   
    //-----------------------------------------------------------------------   
    public BulkTest bulkTestHeadMap() {
        return new TestHeadMap(this);
View Full Code Here

        SortedMap sm = (SortedMap) maps[0];
        SortedMap hm = sm.headMap(key);
        if (hm.isEmpty()) {
            return null;
        }
        return hm.lastKey();
    }

    //-----------------------------------------------------------------------
    /**
     * Obtains an ordered map iterator.
View Full Code Here

                if (flushAll) {
                    highestFlushLevel =
      envImpl.getDbMapTree().getHighestLevel();
                } else {
                    highestFlushLevel =
                        ((Integer) newDirtyMap.lastKey()).intValue();
                    if (flushExtraLevel) {
                        highestFlushLevel += 1;
                    }
                }
            } else {
View Full Code Here

         Date start2 = (Date)server.getAttribute(name, "RecordingStart");

         assertTrue(start1.equals(start2) || start1.before(start2));
         SortedMap values = (SortedMap)server.getAttribute(name, "Entries");
         PointTime point1 = (PointTime)values.firstKey();
         PointTime point2 = (PointTime)values.lastKey();
         assertTrue(point1.getDate().equals(point2.getDate()) || point1.getDate().before(point2.getDate()));

         // re start it
         server.invoke(name, "stop", null, null);
         server.invoke(name, "start", null, null);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.