List of usage examples for java.util EnumMap EnumMap
public EnumMap(Map<K, ? extends V> m)
From source file:net.sourceforge.seqware.pipeline.plugins.BatchMetadataInjectionTest.java
private void getData() { Map<FileProvenanceParam, List<String>> fileProvenanceParams = new EnumMap<FileProvenanceParam, List<String>>( FileProvenanceParam.class); fileProvenanceParams.put(FileProvenanceParam.ius, iusSwids); metadata.fileProvenanceReportTrigger(); fileReport = metadata.fileProvenanceReport(fileProvenanceParams); }
From source file:gov.nih.nci.firebird.service.registration.ProtocolRegistrationServiceBean.java
@Override public FirebirdMessage getCoordinatorCompletedRegistrationEmailMessage(FirebirdUser coordinator, AbstractProtocolRegistration registration) { Map<FirebirdTemplateParameter, Object> parameterValues = new EnumMap<FirebirdTemplateParameter, Object>( FirebirdTemplateParameter.class); parameterValues.put(FirebirdTemplateParameter.REGISTRATION, registration); parameterValues.put(FirebirdTemplateParameter.FIREBIRD_LINK, generateRegistrationLink(registration)); parameterValues.put(FirebirdTemplateParameter.REGISTRATION_COORDINATOR, coordinator.getPerson()); return getTemplateService() .generateMessage(FirebirdMessageTemplate.COORDINATOR_COMPLETED_REGISTRATION_EMAIL, parameterValues); }
From source file:org.lwes.ArrayEvent.java
public static Map<ArrayEventStats, Integer> getStatsSnapshot() { final Map<ArrayEventStats, Integer> statsCopy = new EnumMap<ArrayEventStats, Integer>( ArrayEventStats.class); for (Entry<ArrayEventStats, MutableInt> entry : STATS.entrySet()) { statsCopy.put(entry.getKey(), entry.getValue().intValue()); }/*from ww w . j ava 2 s . c o m*/ return statsCopy; }
From source file:org.codehaus.mojo.license.UpdateFileHeaderMojo.java
@Override public void doAction() throws Exception { long t0 = System.nanoTime(); clear();//from ww w. jav a 2s .c o m processedFiles = new HashSet<File>(); result = new EnumMap<FileState, Set<File>>(FileState.class); try { for (Map.Entry<String, List<File>> commentStyleFiles : getFilesToTreateByCommentStyle().entrySet()) { String commentStyle = commentStyleFiles.getKey(); List<File> files = commentStyleFiles.getValue(); processCommentStyle(commentStyle, files); } } finally { int nbFiles = getProcessedFiles().size(); if (nbFiles == 0) { getLog().warn("No file to scan."); } else { String delay = MojoHelper.convertTime(System.nanoTime() - t0); String message = String.format("Scan %s file%s header done in %s.", nbFiles, nbFiles > 1 ? "s" : "", delay); getLog().info(message); } Set<FileState> states = result.keySet(); if (states.size() == 1 && states.contains(FileState.uptodate)) { // all files where up to date getLog().info("All files are up-to-date."); } else { StringBuilder buffer = new StringBuilder(); for (FileState state : FileState.values()) { reportType(state, buffer); } getLog().info(buffer.toString()); } // clean internal states if (isClearAfterOperation()) { clear(); } } }
From source file:it.unibo.alchemist.model.implementations.environments.OSMEnvironment.java
private void initAll(final String fileName) throws IOException { Objects.requireNonNull(fileName, "define the file with the map: " + fileName); final Optional<URL> file = Optional.of(new File(fileName)).filter(File::exists).map(File::toURI) .map(Unchecked.function(URI::toURL)); final URL resource = Optional.ofNullable(OSMEnvironment.class.getResource(fileName)) .orElseGet(Unchecked.supplier(() -> file.orElseThrow( () -> new FileNotFoundException("No file or resource with name " + fileName)))); final String dir = initDir(resource).intern(); final File workdir = new File(dir); mkdirsIfNeeded(workdir);/* ww w . j ava 2 s . co m*/ final File mapFile = new File(dir + SLASH + MAPNAME); try (RandomAccessFile fileAccess = new RandomAccessFile(workdir + SLASH + "lock", "rw")) { try (FileLock lock = fileAccess.getChannel().lock()) { if (!mapFile.exists()) { Files.copy(resource.openStream(), mapFile.toPath()); } } } navigators = new EnumMap<>(Vehicle.class); mapLock = new FastReadWriteLock(); final Optional<Exception> error = Arrays.stream(Vehicle.values()).parallel().<Optional<Exception>>map(v -> { try { final String internalWorkdir = workdir + SLASH + v; final File iwdf = new File(internalWorkdir); if (mkdirsIfNeeded(iwdf)) { final GraphHopperAPI gh = initNavigationSystem(mapFile, internalWorkdir, v); mapLock.write(); navigators.put(v, gh); mapLock.release(); } return Optional.empty(); } catch (Exception e) { return Optional.of(e); } }).filter(Optional::isPresent).map(Optional::get).findFirst(); if (error.isPresent()) { throw new IllegalStateException("A error occurred during initialization.", error.get()); } }
From source file:org.squashtest.tm.service.internal.customfield.PrivateCustomFieldValueServiceImpl.java
private Map<BindableEntity, List<Long>> breakEntitiesIntoCompositeIds( Collection<? extends BoundEntity> boundEntities) { Map<BindableEntity, List<Long>> segregatedEntities = new EnumMap<>(BindableEntity.class); for (BoundEntity entity : boundEntities) { List<Long> idList = segregatedEntities.get(entity.getBoundEntityType()); if (idList == null) { idList = new ArrayList<>(); segregatedEntities.put(entity.getBoundEntityType(), idList); }// w ww .ja v a 2s .c om idList.add(entity.getBoundEntityId()); } return segregatedEntities; }
From source file:gov.nih.nci.firebird.service.sponsor.SponsorServiceBean.java
private FirebirdMessage getDelegateRemovalNotificationEmailMessage(SponsorRole sponsorDelegateRole) { Map<FirebirdTemplateParameter, Object> parameterValues = new EnumMap<FirebirdTemplateParameter, Object>( FirebirdTemplateParameter.class); parameterValues.put(SPONSOR_ROLE, sponsorDelegateRole); parameterValues.put(SPONSOR_EMAIL_ADDRESS, getSponsorEmailAddress(sponsorDelegateRole.getSponsor())); return templateService.generateMessage(FirebirdMessageTemplate.DELEGATE_REMOVAL_NOTIFICATION_EMAIL, parameterValues);//from w w w . j av a2 s . c o m }
From source file:org.yccheok.jstock.gui.JStockOptions.java
public void insensitiveCopy(JStockOptions jStockOptions) { this.singleIndicatorAlert = jStockOptions.singleIndicatorAlert; this.popupMessage = jStockOptions.popupMessage; //this.sendEmail = jStockOptions.sendEmail; //this.email = jStockOptions.email; //this.CCEmail = jStockOptions.CCEmail; //this.emailPassword = jStockOptions.emailPassword; //this.googleCalendarUsername = jStockOptions.googleCalendarUsername; //this.googleCalendarPassword = jStockOptions.googleCalendarPassword; // Don't store proxy. Home and office proxy environment are most probably different. //this.proxyServer = jStockOptions.proxyServer; //this.proxyPort = jStockOptions.proxyPort; this.scanningSpeed = jStockOptions.scanningSpeed; this.alertSpeed = jStockOptions.alertSpeed; this.looknFeel = jStockOptions.looknFeel; this.alwaysOnTop = jStockOptions.alwaysOnTop; this.normalTextForegroundColor = jStockOptions.normalTextForegroundColor; this.lowerNumericalValueForegroundColor = jStockOptions.lowerNumericalValueForegroundColor; this.higherNumericalValueForegroundColor = jStockOptions.higherNumericalValueForegroundColor; this.firstRowBackgroundColor = jStockOptions.firstRowBackgroundColor; this.secondRowBackgroundColor = jStockOptions.secondRowBackgroundColor; this.autoUpdateForegroundColor = jStockOptions.autoUpdateForegroundColor; this.autoUpdateBackgroundColor = jStockOptions.autoUpdateBackgroundColor; this.fallBelowAlertForegroundColor = jStockOptions.fallBelowAlertForegroundColor; this.fallBelowAlertBackgroundColor = jStockOptions.fallBelowAlertBackgroundColor; this.riseAboveAlertForegroundColor = jStockOptions.riseAboveAlertForegroundColor; this.riseAboveAlertBackgroundColor = jStockOptions.riseAboveAlertBackgroundColor; this.enableColorChange = jStockOptions.enableColorChange; this.enableColorAlert = jStockOptions.enableColorAlert; this.brokingFirms = jStockOptions.brokingFirms; this.selectedBrokingFirmIndex = jStockOptions.selectedBrokingFirmIndex; this.expectedProfitPercentage = jStockOptions.expectedProfitPercentage; this.country = jStockOptions.country; this.isAutoUpdateNewsEnabled = jStockOptions.isAutoUpdateNewsEnabled; //this.newsID = jStockOptions.newsID; this.historyDuration = jStockOptions.historyDuration; //this.isChatEnabled = jStockOptions.isChatEnabled; //this.chatUsername = jStockOptions.chatUsername; //this.chatPassword = jStockOptions.chatPassword; this.isChatSoundNotificationEnabled = jStockOptions.isChatSoundNotificationEnabled; this.isChatFlashNotificationEnabled = jStockOptions.isChatFlashNotificationEnabled; this.chatSystemMessageColor = jStockOptions.chatSystemMessageColor; this.chatOwnMessageColor = jStockOptions.chatOwnMessageColor; this.chatOtherMessageColor = jStockOptions.chatOtherMessageColor; // Don't store proxy. Home and office proxy environment are most probably different. ////from ww w .ja v a2 s . c om // We want to avoid from having too frequent credentials creation during // runtime. We will immediately contruct credentials, once we load the // JStockOptions from disk. //this.credentials = jStockOptions.credentials; //this.proxyAuthPassword = jStockOptions.proxyAuthPassword; //this.proxyAuthUserName = jStockOptions.proxyAuthUserName; //this.isProxyAuthEnabled = jStockOptions.isProxyAuthEnabled; /* For UK client. */ //this.penceToPoundConversionEnabled = jStockOptions.penceToPoundConversionEnabled; this.decimalPlaces = jStockOptions.decimalPlaces; //this.rememberGoogleAccountEnabled = jStockOptions.rememberGoogleAccountEnabled; //this.googleUsername = jStockOptions.googleUsername; //this.googlePassword = jStockOptions.googlePassword; // Don't save file location. Different machines may have different file location. // // Remember where we save/open the last file. //this.lastFileIODirectory = jStockOptions.lastFileIODirectory; //this.lastFileNameExtensionDescription = jStockOptions.lastFileNameExtensionDescription; // Remember the last view page. this.lastSelectedPageIndex = jStockOptions.lastSelectedPageIndex; this.lastSelectedSellPortfolioChartIndex = jStockOptions.lastSelectedSellPortfolioChartIndex; this.lastSelectedBuyPortfolioChartIndex = jStockOptions.lastSelectedBuyPortfolioChartIndex; this.portfolioNames = new EnumMap<Country, String>(jStockOptions.portfolioNames); this.watchlistNames = new EnumMap<Country, String>(jStockOptions.watchlistNames); this.yellowInformationBoxOption = jStockOptions.yellowInformationBoxOption; this.stockInputSuggestionListOption = jStockOptions.stockInputSuggestionListOption; // We won't save locale into cloud. As to have effect on new locale, // restarting the entire application is required. We do not want user // to restart the application after loading from cloud. //this.locale = jStockOptions.locale; // We are not interested in transfering MainFrame size from cloud to // local. //this.boundsEx = jStockOptions.boundsEx; this.priceSources = new EnumMap<Country, PriceSource>(jStockOptions.priceSources); this.currencies = new EnumMap<Country, String>(jStockOptions.currencies); this.currencyExchangeEnable = new EnumMap<Country, Boolean>(jStockOptions.currencyExchangeEnable); this.localCurrencyCountries = new EnumMap<Country, Country>(jStockOptions.localCurrencyCountries); //this.penceToPoundConversionEnabled = new EnumMap<Country, Boolean>(jStockOptions.penceToPoundConversionEnabled); this.decimalPlaces = new EnumMap<Country, DecimalPlace>(jStockOptions.decimalPlaces); this.chartTheme = jStockOptions.getChartTheme(); this.isFeeCalculationEnabled = jStockOptions.isFeeCalculationEnabled; this.useLargeFont = jStockOptions.useLargeFont; this.isDynamicChartVisible = jStockOptions.isDynamicChartVisible; }
From source file:gov.nih.nci.firebird.service.account.AccountConfigurationHelper.java
void notifyOfRegistrationCoordinatorRequest(ManagedInvestigator managedInvestigator) { Map<FirebirdTemplateParameter, Object> parameterValues = new EnumMap<FirebirdTemplateParameter, Object>( FirebirdTemplateParameter.class); parameterValues.put(FirebirdTemplateParameter.REGISTRATION_COORDINATOR, managedInvestigator.getUser().getPerson()); FirebirdMessage message = templateService .generateMessage(FirebirdMessageTemplate.REGISTRATION_COORDINATOR_REQUEST_EMAIL, parameterValues); String investigatorEmail = managedInvestigator.getInvestigatorProfile().getPerson().getEmail(); emailService.sendMessage(investigatorEmail, null, null, message); }
From source file:org.helios.netty.jmx.MetricCollector.java
/** * Collects the number of threads in each thread state * @return an EnumMap with Thread states as the key and the number of threads in that state as the value *//*from w ww. j a v a2 s . co m*/ public EnumMap<Thread.State, AtomicInteger> getThreadStates() { EnumMap<Thread.State, AtomicInteger> map = new EnumMap<State, AtomicInteger>(Thread.State.class); for (ThreadInfo ti : threadMxBean.getThreadInfo(threadMxBean.getAllThreadIds())) { State st = ti.getThreadState(); AtomicInteger ai = map.get(st); if (ai == null) { ai = new AtomicInteger(0); map.put(st, ai); } ai.incrementAndGet(); } return map; }