Java Code Examples for java.util.NavigableSet#floor()
The following examples show how to use
java.util.NavigableSet#floor() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ThreadStatusDataProvider.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
private static @NonNull ITimeGraphState createTimeGraphState(ITmfStateInterval interval, NavigableSet<ITmfStateInterval> syscalls) { long startTime = interval.getStartTime(); long duration = interval.getEndTime() - startTime + 1; Object status = interval.getValue(); if (status instanceof Integer) { int s = (int) status; if (s == StateValues.PROCESS_STATUS_RUN_SYSCALL) { // intervals are sorted by start time ITmfStateInterval syscall = syscalls.floor(new TmfStateInterval(startTime, startTime + 1, 0, 0)); if (syscall != null) { Object value = syscall.getValue(); if (value instanceof String) { return new TimeGraphState(startTime, duration, String.valueOf(value), getElementStyle(s)); } } } return new TimeGraphState(startTime, duration, null, getElementStyle(s)); } return new TimeGraphState(startTime, duration, Integer.MIN_VALUE); }
Example 2
Source File: SessionWindowAssigner.java From flink with Apache License 2.0 | 6 votes |
@Override public void mergeWindows(TimeWindow newWindow, NavigableSet<TimeWindow> sortedWindows, MergeCallback<TimeWindow> callback) { TimeWindow ceiling = sortedWindows.ceiling(newWindow); TimeWindow floor = sortedWindows.floor(newWindow); Collection<TimeWindow> mergedWindows = new HashSet<>(); TimeWindow mergeResult = newWindow; if (ceiling != null) { mergeResult = mergeWindow(mergeResult, ceiling, mergedWindows); } if (floor != null) { mergeResult = mergeWindow(mergeResult, floor, mergedWindows); } if (!mergedWindows.isEmpty()) { // merge happens, add newWindow into the collection as well. mergedWindows.add(newWindow); callback.merge(mergeResult, mergedWindows); } }
Example 3
Source File: BadQueryHistoryManagerTest.java From kylin with Apache License 2.0 | 6 votes |
@Test public void testUpdateEntryToProject() throws IOException { KylinConfig kylinConfig = getTestConfig(); BadQueryHistoryManager manager = BadQueryHistoryManager.getInstance(kylinConfig); String queryId = RandomUtil.randomUUID().toString(); manager.upsertEntryToProject( new BadQueryEntry("sql", "adj", 1459362239000L, 100, "server", "t-0", "user", queryId, "cube"), "default"); BadQueryHistory history = manager.upsertEntryToProject( new BadQueryEntry("sql", "adj2", 1459362239000L, 120, "server2", "t-1", "user", queryId, "cube"), "default"); NavigableSet<BadQueryEntry> entries = history.getEntries(); BadQueryEntry newEntry = entries .floor(new BadQueryEntry("sql", "adj2", 1459362239000L, 120, "server2", "t-1", "user", queryId, "cube")); System.out.println(newEntry); assertEquals("adj2", newEntry.getAdj()); assertEquals("server2", newEntry.getServer()); assertEquals("t-1", newEntry.getThread()); assertEquals("user", newEntry.getUser()); assertEquals(120, (int) newEntry.getRunningSec()); }
Example 4
Source File: SessionWindowAssigner.java From flink with Apache License 2.0 | 6 votes |
@Override public void mergeWindows(TimeWindow newWindow, NavigableSet<TimeWindow> sortedWindows, MergeCallback<TimeWindow> callback) { TimeWindow ceiling = sortedWindows.ceiling(newWindow); TimeWindow floor = sortedWindows.floor(newWindow); Collection<TimeWindow> mergedWindows = new HashSet<>(); TimeWindow mergeResult = newWindow; if (ceiling != null) { mergeResult = mergeWindow(mergeResult, ceiling, mergedWindows); } if (floor != null) { mergeResult = mergeWindow(mergeResult, floor, mergedWindows); } if (!mergedWindows.isEmpty()) { // merge happens, add newWindow into the collection as well. mergedWindows.add(newWindow); callback.merge(mergeResult, mergedWindows); } }
Example 5
Source File: BadQueryHistoryManagerTest.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
@Test public void testUpdateEntryToProject() throws IOException { KylinConfig kylinConfig = getTestConfig(); BadQueryHistoryManager manager = BadQueryHistoryManager.getInstance(kylinConfig); String queryId = RandomUtil.randomUUID().toString(); manager.upsertEntryToProject( new BadQueryEntry("sql", "adj", 1459362239000L, 100, "server", "t-0", "user", queryId, "cube"), "default"); BadQueryHistory history = manager.upsertEntryToProject( new BadQueryEntry("sql", "adj2", 1459362239000L, 120, "server2", "t-1", "user", queryId, "cube"), "default"); NavigableSet<BadQueryEntry> entries = history.getEntries(); BadQueryEntry newEntry = entries .floor(new BadQueryEntry("sql", "adj2", 1459362239000L, 120, "server2", "t-1", "user", queryId, "cube")); System.out.println(newEntry); assertEquals("adj2", newEntry.getAdj()); assertEquals("server2", newEntry.getServer()); assertEquals("t-1", newEntry.getThread()); assertEquals("user", newEntry.getUser()); assertEquals(120, (int) newEntry.getRunningSec()); }
Example 6
Source File: ConcurrentSkipListSubSetTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * floor returns preceding element */ public void testFloor() { NavigableSet q = set5(); Object e1 = q.floor(three); assertEquals(three, e1); Object e2 = q.floor(six); assertEquals(five, e2); Object e3 = q.floor(one); assertEquals(one, e3); Object e4 = q.floor(zero); assertNull(e4); }
Example 7
Source File: ConcurrentSkipListSubSetTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * floor returns preceding element */ public void testDescendingFloor() { NavigableSet q = dset5(); Object e1 = q.floor(m3); assertEquals(m3, e1); Object e2 = q.floor(m6); assertEquals(m5, e2); Object e3 = q.floor(m1); assertEquals(m1, e3); Object e4 = q.floor(zero); assertNull(e4); }
Example 8
Source File: BTreeSet2Test.java From scava with Eclipse Public License 2.0 | 5 votes |
/** * floor returns preceding element */ public void testFloor() { NavigableSet q = set5(); Object e1 = q.floor(three); assertEquals(three, e1); Object e2 = q.floor(six); assertEquals(five, e2); Object e3 = q.floor(one); assertEquals(one, e3); Object e4 = q.floor(zero); assertNull(e4); }
Example 9
Source File: BTreeMapSubSetTest.java From scava with Eclipse Public License 2.0 | 5 votes |
/** * floor returns preceding element */ public void testFloor() { NavigableSet q = set5(); Object e1 = q.floor(three); assertEquals(three, e1); Object e2 = q.floor(six); assertEquals(five, e2); Object e3 = q.floor(one); assertEquals(one, e3); Object e4 = q.floor(zero); assertNull(e4); }
Example 10
Source File: ConcurrentSkipListSubSetJUnitTest.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
/** * floor returns preceding element */ public void testFloor() { NavigableSet q = set5(); Object e1 = q.floor(three); assertEquals(three, e1); Object e2 = q.floor(six); assertEquals(five, e2); Object e3 = q.floor(one); assertEquals(one, e3); Object e4 = q.floor(zero); assertNull(e4); }
Example 11
Source File: ConcurrentSkipListSubSetJUnitTest.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
/** * floor returns preceding element */ public void testDescendingFloor() { NavigableSet q = dset5(); Object e1 = q.floor(m3); assertEquals(m3, e1); Object e2 = q.floor(m6); assertEquals(m5, e2); Object e3 = q.floor(m1); assertEquals(m1, e3); Object e4 = q.floor(zero); assertNull(e4); }
Example 12
Source File: TreeSubSetTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * floor returns preceding element */ public void testDescendingFloor() { NavigableSet q = dset5(); Object e1 = q.floor(m3); assertEquals(m3, e1); Object e2 = q.floor(m6); assertEquals(m5, e2); Object e3 = q.floor(m1); assertEquals(m1, e3); Object e4 = q.floor(zero); assertNull(e4); }
Example 13
Source File: ConcurrentSkipListSubSetJUnitTest.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
/** * floor returns preceding element */ public void testFloor() { NavigableSet q = set5(); Object e1 = q.floor(three); assertEquals(three, e1); Object e2 = q.floor(six); assertEquals(five, e2); Object e3 = q.floor(one); assertEquals(one, e3); Object e4 = q.floor(zero); assertNull(e4); }
Example 14
Source File: ConcurrentSkipListSubSetJUnitTest.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
/** * floor returns preceding element */ public void testDescendingFloor() { NavigableSet q = dset5(); Object e1 = q.floor(m3); assertEquals(m3, e1); Object e2 = q.floor(m6); assertEquals(m5, e2); Object e3 = q.floor(m1); assertEquals(m1, e3); Object e4 = q.floor(zero); assertNull(e4); }
Example 15
Source File: PopulationVariantGenerator.java From rtg-tools with BSD 2-Clause "Simplified" License | 5 votes |
private static boolean validPos(PopulationVariant var, NavigableSet<PopulationVariant> set) { final int candStart = var.getStart(); final int candEnd = var.getEnd(); final PopulationVariant floor = set.floor(var); final PopulationVariant higher = set.higher(var); if (floor != null && var.getSequenceId() == floor.getSequenceId() && floor.getEnd() > candStart) { return false; } if (higher != null && var.getSequenceId() == higher.getSequenceId() && candEnd > higher.getStart()) { return false; } return true; }
Example 16
Source File: TreeSubSetTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * floor returns preceding element */ public void testFloor() { NavigableSet q = set5(); Object e1 = q.floor(three); assertEquals(three, e1); Object e2 = q.floor(six); assertEquals(five, e2); Object e3 = q.floor(one); assertEquals(one, e3); Object e4 = q.floor(zero); assertNull(e4); }
Example 17
Source File: TreeSubSetTest.java From j2objc with Apache License 2.0 | 5 votes |
/** * floor returns preceding element */ public void testFloor() { NavigableSet q = set5(); Object e1 = q.floor(three); assertEquals(three, e1); Object e2 = q.floor(six); assertEquals(five, e2); Object e3 = q.floor(one); assertEquals(one, e3); Object e4 = q.floor(zero); assertNull(e4); }
Example 18
Source File: TreeSubSetTest.java From j2objc with Apache License 2.0 | 5 votes |
/** * floor returns preceding element */ public void testDescendingFloor() { NavigableSet q = dset5(); Object e1 = q.floor(m3); assertEquals(m3, e1); Object e2 = q.floor(m6); assertEquals(m5, e2); Object e3 = q.floor(m1); assertEquals(m1, e3); Object e4 = q.floor(zero); assertNull(e4); }
Example 19
Source File: ConcurrentSkipListSubSetTest.java From j2objc with Apache License 2.0 | 5 votes |
/** * floor returns preceding element */ public void testFloor() { NavigableSet q = set5(); Object e1 = q.floor(three); assertEquals(three, e1); Object e2 = q.floor(six); assertEquals(five, e2); Object e3 = q.floor(one); assertEquals(one, e3); Object e4 = q.floor(zero); assertNull(e4); }
Example 20
Source File: ConcurrentSkipListSubSetTest.java From j2objc with Apache License 2.0 | 5 votes |
/** * floor returns preceding element */ public void testDescendingFloor() { NavigableSet q = dset5(); Object e1 = q.floor(m3); assertEquals(m3, e1); Object e2 = q.floor(m6); assertEquals(m5, e2); Object e3 = q.floor(m1); assertEquals(m1, e3); Object e4 = q.floor(zero); assertNull(e4); }