List of usage examples for java.util SortedSet size
int size();
From source file:org.geoserver.security.web.group.ConfirmRemovalGroupPanel.java
@Override protected String getConfirmationMessage(GeoServerUserGroup object) throws Exception { StringBuffer buffer = new StringBuffer(BeanUtils.getProperty(object, "groupname")); if ((Boolean) getDefaultModelObject()) { SortedSet<GeoServerRole> roles = GeoServerApplication.get().getSecurityManager().getActiveRoleService() .getRolesForGroup(object.getGroupname()); buffer.append(" ["); for (GeoServerRole role : roles) { buffer.append(role.getAuthority()).append(" "); }//from w ww .j av a 2s. c o m if (roles.size() > 0) { // remove last delimiter buffer.setLength(buffer.length() - 1); } buffer.append("]"); } return buffer.toString(); }
From source file:com.jxt.web.controller.ScatterChartController.java
private ModelAndView selectFilterScatterData(String applicationName, Range range, int xGroupUnit, int yGroupUnit, int limit, boolean backwardDirection, String filterText, int version) { final LimitedScanResult<List<TransactionId>> limitedScanResult = flow .selectTraceIdsFromApplicationTraceIndex(applicationName, range, limit, backwardDirection); final List<TransactionId> traceIdList = limitedScanResult.getScanData(); logger.trace("submitted transactionId count={}", traceIdList.size()); boolean requestComplete = traceIdList.size() < limit; // TODO just need sorted? we need range check with tree-based structure. SortedSet<TransactionId> traceIdSet = new TreeSet<>(traceIdList); logger.debug("unified traceIdSet size={}", traceIdSet.size()); Filter filter = filterBuilder.build(filterText); ModelAndView mv;// ww w . java 2 s. com if (version == 1) { ScatterData scatterData = scatter.selectScatterData(traceIdSet, applicationName, range, xGroupUnit, yGroupUnit, filter); if (logger.isDebugEnabled()) { logger.debug( "getScatterData range scan(limited:{}, backwardDirection:{}) from ~ to:{} ~ {}, limited:{}, filterDataSize:{}", limit, backwardDirection, DateUtils.longToDateStr(range.getFrom()), DateUtils.longToDateStr(range.getTo()), DateUtils.longToDateStr(limitedScanResult.getLimitedTime()), traceIdList.size()); } mv = createScatterDataV1(scatterData, requestComplete); } else { mv = new ModelAndView(); } mv.addObject("currentServerTime", new ServerTime().getCurrentServerTime()); mv.addObject("from", range.getFrom()); mv.addObject("to", range.getTo()); return mv; }
From source file:de.shadowhunt.sonar.plugins.ignorecode.model.CoveragePatternTest.java
@Test public void testParseLineRangeAllLines() throws Exception { final CoveragePattern pattern = CoveragePattern.parseLine("resourcePattern;*"); Assert.assertEquals("resourcePattern name must match", "resourcePattern", pattern.getResourcePattern()); final SortedSet<Integer> full = pattern.getLines(); Assert.assertNotNull("SortedSet must not be null", full); Assert.assertEquals("SortedSet must contain the exact number of entries", 0, full.size()); }
From source file:de.shadowhunt.sonar.plugins.ignorecode.model.CoveragePatternTest.java
@Test public void testParseLineSingle() throws Exception { final CoveragePattern pattern = CoveragePattern.parseLine("resourcePattern;[2]"); Assert.assertEquals("resourcePattern name must match", "resourcePattern", pattern.getResourcePattern()); final SortedSet<Integer> full = pattern.getLines(); Assert.assertNotNull("SortedSet must not be null", full); Assert.assertEquals("SortedSet must contain the exact number of entries", 1, full.size()); Assert.assertTrue("SortedSet must contain line 2", full.contains(2)); }
From source file:de.shadowhunt.sonar.plugins.ignorecode.model.IssuePatternTest.java
@Test public void testEmpty() throws Exception { final IssuePattern pattern = new IssuePattern("resourcePattern", "rulePattern", new TreeSet<Integer>()); final SortedSet<Integer> empty = pattern.getLines(); Assert.assertNotNull("SortedSet must not be null", empty); Assert.assertEquals("SortedSet must not contain any entries", 0, empty.size()); }
From source file:de.shadowhunt.sonar.plugins.ignorecode.model.CoveragePatternTest.java
@Test public void testParseLineMixed() throws Exception { final CoveragePattern pattern = CoveragePattern.parseLine("resourcePattern;[2,4-6]"); Assert.assertEquals("resourcePattern name must match", "resourcePattern", pattern.getResourcePattern()); final SortedSet<Integer> full = pattern.getLines(); Assert.assertNotNull("SortedSet must not be null", full); Assert.assertEquals("SortedSet must contain the exact number of entries", 4, full.size()); Assert.assertTrue("SortedSet must contain line 2", full.contains(2)); Assert.assertTrue("SortedSet must contain line 4", full.contains(4)); Assert.assertTrue("SortedSet must contain line 5", full.contains(5)); Assert.assertTrue("SortedSet must contain line 6", full.contains(6)); }
From source file:de.shadowhunt.sonar.plugins.ignorecode.model.CoveragePatternTest.java
@Test public void testParseLineRange() throws Exception { final CoveragePattern pattern = CoveragePattern.parseLine("resourcePattern;[2-6]"); Assert.assertEquals("resourcePattern name must match", "resourcePattern", pattern.getResourcePattern()); final SortedSet<Integer> full = pattern.getLines(); Assert.assertNotNull("SortedSet must not be null", full); Assert.assertEquals("SortedSet must contain the exact number of entries", 5, full.size()); Assert.assertTrue("SortedSet must contain line 2", full.contains(2)); Assert.assertTrue("SortedSet must contain line 3", full.contains(3)); Assert.assertTrue("SortedSet must contain line 4", full.contains(4)); Assert.assertTrue("SortedSet must contain line 5", full.contains(5)); Assert.assertTrue("SortedSet must contain line 6", full.contains(6)); }
From source file:de.shadowhunt.sonar.plugins.ignorecode.model.CoveragePatternTest.java
@Test public void testAddLine() throws Exception { final SortedSet<Integer> lines = new TreeSet<>(); lines.add(1);//ww w. j ava 2s . c om lines.add(3); lines.add(5); final CoveragePattern pattern = new CoveragePattern("resourcePattern", lines); final SortedSet<Integer> full = pattern.getLines(); Assert.assertNotNull("SortedSet must not be null", full); Assert.assertEquals("SortedSet must contain the exact number of entries", 3, full.size()); Assert.assertTrue("SortedSet must contain line 1", full.contains(1)); Assert.assertTrue("SortedSet must contain line 3", full.contains(3)); Assert.assertTrue("SortedSet must contain line 5", full.contains(5)); }
From source file:de.shadowhunt.sonar.plugins.ignorecode.model.CoveragePatternTest.java
@Test public void testAddLines() throws Exception { final SortedSet<Integer> lines = new TreeSet<>(); CoveragePattern.addLines(lines, 2, 2); CoveragePattern.addLines(lines, 4, 6); final CoveragePattern pattern = new CoveragePattern("resourcePattern", lines); final SortedSet<Integer> full = pattern.getLines(); Assert.assertNotNull("SortedSet must not be null", full); Assert.assertEquals("SortedSet must contain the exact number of entries", 4, full.size()); Assert.assertTrue("SortedSet must contain line 2", full.contains(2)); Assert.assertTrue("SortedSet must contain line 4", full.contains(4)); Assert.assertTrue("SortedSet must contain line 5", full.contains(5)); Assert.assertTrue("SortedSet must contain line 6", full.contains(6)); }
From source file:org.bibsonomy.recommender.tags.multiplexer.RecommendedTagResultManager.java
/** * cache result for given query - if this query is still active * ONLY NON-EMPTY RESULTS ARE STORED//from w w w . j a v a 2 s .c om * @param qid */ public void addResult(Long qid, Long sid, SortedSet<RecommendedTag> result) { if (isActive(qid)) { ConcurrentHashMap<Long, SortedSet<RecommendedTag>> queryStore = resultStore.get(qid); if ((queryStore != null) && (result != null && result.size() > 0)) queryStore.put(sid, result); } }