List of usage examples for java.util SortedSet size
int size();
From source file:org.codehaus.mojo.license.api.DefaultThirdPartyTool.java
/** * {@inheritDoc}//from ww w . j ava2 s .co m */ public SortedSet<MavenProject> getProjectsWithNoLicense(LicenseMap licenseMap, boolean doLog) { Logger log = getLogger(); // get unsafe dependencies (says with no license) SortedSet<MavenProject> unsafeDependencies = licenseMap.get(LicenseMap.UNKNOWN_LICENSE_MESSAGE); if (doLog) { if (CollectionUtils.isEmpty(unsafeDependencies)) { log.debug("There is no dependency with no license from poms."); } else { log.debug("There is " + unsafeDependencies.size() + " dependencies with no license from poms : "); for (MavenProject dep : unsafeDependencies) { // no license found for the dependency log.debug(" - " + MojoHelper.getArtifactId(dep.getArtifact())); } } } return unsafeDependencies; }
From source file:org.wrml.runtime.DefaultModel.java
private final Keys buildKeys(final URI schemaUri, final Map<String, Object> readOnlySlotMap, final KeysBuilder keysBuilder) { final Context context = getContext(); final SchemaLoader schemaLoader = context.getSchemaLoader(); final Prototype prototype = schemaLoader.getPrototype(schemaUri); final SortedSet<String> keySlotNames = prototype.getDeclaredKeySlotNames(); if (keySlotNames != null && !keySlotNames.isEmpty()) { final Object keyValue; if (keySlotNames.size() == 1) { final String keySlotName = keySlotNames.first(); if (readOnlySlotMap.containsKey(keySlotName)) { keyValue = readOnlySlotMap.get(keySlotName); } else { keyValue = null;/*w w w.ja va 2 s. co m*/ } } else { final SortedMap<String, Object> keySlots = new TreeMap<String, Object>(); for (final String keySlotName : keySlotNames) { final Object keySlotValue = readOnlySlotMap.get(keySlotName); keySlots.put(keySlotName, keySlotValue); } keyValue = new CompositeKey(keySlots); } if (keyValue != null) { keysBuilder.addKey(schemaUri, keyValue); } } final Set<URI> baseSchemaUris = prototype.getAllBaseSchemaUris(); if (baseSchemaUris != null && !baseSchemaUris.isEmpty()) { for (final URI baseSchemaUri : baseSchemaUris) { buildKeys(baseSchemaUri, readOnlySlotMap, keysBuilder); } } return keysBuilder.toKeys(); }
From source file:gov.nih.nci.cabig.caaers.domain.SiteResearchStaff.java
/** * Gets the active date.// w ww. ja v a 2s . c o m * * @return the active date */ @Transient public Date getActiveDate() { SortedSet<Date> dates = new TreeSet<Date>(); if (this.getSiteResearchStaffRoles() == null) return new Date(System.currentTimeMillis()); for (SiteResearchStaffRole srsr : this.getSiteResearchStaffRoles()) { if (srsr.getStartDate() == null) srsr.setStartDate(new Date(System.currentTimeMillis())); dates.add(srsr.getStartDate()); } if (dates.size() > 0) return dates.first(); else return null; }
From source file:de.ailis.xadrian.data.Sector.java
/** * Returns the ore asteroids of this sector. * //from w w w . jav a 2 s. c om * @return The ore asteroids */ public Asteroid[] getOreAsteroids() { final SortedSet<Asteroid> asteroids = new TreeSet<Asteroid>(); for (final Asteroid asteroid : getAsteroids()) { if (asteroid.getWare().isOre()) { asteroids.add(asteroid); } } return asteroids.toArray(new Asteroid[asteroids.size()]); }
From source file:de.ailis.xadrian.data.Sector.java
/** * Returns the ice asteroids of this sector. * //from w w w . j a va2 s . com * @return The ice asteroids */ public Asteroid[] getIceAsteroids() { final SortedSet<Asteroid> asteroids = new TreeSet<Asteroid>(); for (final Asteroid asteroid : getAsteroids()) { if (asteroid.getWare().isIce()) { asteroids.add(asteroid); } } return asteroids.toArray(new Asteroid[asteroids.size()]); }
From source file:de.ailis.xadrian.data.Sector.java
/** * Returns the nividium asteroids of this sector. * /*from w w w . j av a 2 s .c om*/ * @return The nividium asteroids */ public Asteroid[] getNividiumAsteroids() { final SortedSet<Asteroid> asteroids = new TreeSet<Asteroid>(); for (final Asteroid asteroid : getAsteroids()) { if (asteroid.getWare().isNividium()) { asteroids.add(asteroid); } } return asteroids.toArray(new Asteroid[asteroids.size()]); }
From source file:sadl.modellearner.rtiplus.SimplePDRTALearner.java
void complete(PDRTA a, StateColoring sc) { final boolean preExit = (bOp[2] instanceof OrOperator) && distrCheckType.equals(DistributionCheckType.DISABLED); if (mainModel == a && preExit) { logger.info("Pre-Exiting algorithm when number of tails falls below minData"); }/*w w w. j ava 2 s . c o m*/ int counter = 0; Transition t; while ((t = getMostVisitedTrans(a, sc)) != null && !(preExit && t.in.getTails().size() < PDRTA.getMinData())) { if (mainModel == a) { if (directory != null) { draw(a, true, directory, counter); } logger.debug("Automaton contains {} states and {} transitions", a.getStateCount(), a.getSize()); logger.debug("Found most visited transition {} containing {} tails", t.toString(), t.in.getTails().size()); } counter++; if (!distrCheckType.equals(DistributionCheckType.DISABLED)) { if (mainModel == a) { logger.debug("Checking data distribution"); } final List<Interval> idaIns = checkDistribution(t.source, t.symAlphIdx, distrCheckType, sc); if (idaIns.size() > 0) { if (mainModel == a) { logger.debug("#{} DO: Split interval due to IDA into {} intervals", counter, idaIns.size()); // TODO Printing the intervals may be to expensive just for logging final StringBuilder sb = new StringBuilder(); for (final Interval in : idaIns) { sb.append(" "); sb.append(in.toString()); } logger.trace("Resulting intervals are:{}", sb.toString()); } continue; } else { if (mainModel == a) { logger.debug("No splits because of data distributuion were perfomed in: {}", t.in.toString()); } if (bOp[2] instanceof OrOperator && t.in.getTails().size() < PDRTA.getMinData()) { // Shortcut for skipping merges and splits when OR is selected if (mainModel == a) { logger.debug("#{} DO: Color state {} red", counter, t.target.getIndex()); } sc.setRed(t.target); continue; } } } if (mainModel == a) { logger.debug("Testing splits"); } final SortedSet<Refinement> splits = getSplitRefs(t, sc); if (mainModel == a) { logger.debug("Found {} possible splits", splits.size()); } if (splits.size() > 0) { final Refinement r = splits.last(); if (mainModel == a) { logger.debug("#{} DO: {}", counter, r.toString()); } r.refine(); } else { if (mainModel == a) { logger.debug("Testing merges"); } final SortedSet<Refinement> merges = getMergeRefs(t, sc); if (mainModel == a) { logger.debug("Found {} possible merges", merges.size()); } if (merges.size() > 0) { final Refinement r = merges.last(); if (mainModel == a) { logger.debug("#{} DO: {}", counter, r.toString()); } r.refine(); } else { if (mainModel == a) { logger.debug("#{} DO: Color state {} red", counter, t.target.getIndex()); } sc.setRed(t.target); } } if (Settings.isDebug()) { a.checkConsistency(); } } assert (a.getStateCount() == sc.getNumRedStates()); a.checkConsistency(); if (directory != null) { draw(a, true, directory, counter); } }
From source file:de.ailis.xadrian.data.Sector.java
/** * Returns the silicon asteroids of this sector. * //from ww w .ja v a2s . c o m * @return The silicon asteroids */ public Asteroid[] getSiliconAsteroids() { final SortedSet<Asteroid> asteroids = new TreeSet<Asteroid>(); for (final Asteroid asteroid : getAsteroids()) { if (asteroid.getWare().isSiliconWafers()) { asteroids.add(asteroid); } } return asteroids.toArray(new Asteroid[asteroids.size()]); }
From source file:org.jasig.schedassist.model.AvailableBlockBuilderTest.java
/** * Create 2 adjacent blocks with different visitor limits. * Pass them into combine, assert they come out as 2 separate blocks. * /* w ww . java 2 s.co m*/ * @throws Exception */ @Test public void testCombineMismatchedVisitorLimit() throws Exception { AvailableBlock block1 = AvailableBlockBuilder.createBlock("20091007-1200", "20091007-1230", 10); AvailableBlock block2 = AvailableBlockBuilder.createBlock("20091007-1230", "20091007-1300", 9); SortedSet<AvailableBlock> smallBlocks = new TreeSet<AvailableBlock>(); smallBlocks.add(block1); smallBlocks.add(block2); SortedSet<AvailableBlock> resultCombined = AvailableBlockBuilder.combine(smallBlocks); assertEquals(resultCombined.size(), 2); assertTrue(resultCombined.contains(block1)); assertTrue(resultCombined.contains(block2)); }
From source file:org.jasig.schedassist.model.AvailableBlockBuilderTest.java
/** * Create 2 adjacent blocks with different meeting locations. * Pass them into combine, assert they come out as 2 separate blocks. * @throws Exception//from w ww . j av a2 s . co m */ @Test public void testCombineMismatchedMeetingLocation() throws Exception { AvailableBlock block1 = AvailableBlockBuilder.createBlock("20091007-1200", "20091007-1230", 1, "alternate location"); AvailableBlock block2 = AvailableBlockBuilder.createBlock("20091007-1230", "20091007-1300", 1, null); SortedSet<AvailableBlock> smallBlocks = new TreeSet<AvailableBlock>(); smallBlocks.add(block1); smallBlocks.add(block2); SortedSet<AvailableBlock> resultCombined = AvailableBlockBuilder.combine(smallBlocks); assertEquals(resultCombined.size(), 2); assertTrue(resultCombined.contains(block1)); assertTrue(resultCombined.contains(block2)); }