List of usage examples for java.util EnumMap EnumMap
public EnumMap(Map<K, ? extends V> m)
From source file:com.espertech.esper.schedule.TestScheduleSpec.java
public void testCompress() { EnumMap<ScheduleUnit, SortedSet<Integer>> unitValues = new EnumMap<ScheduleUnit, SortedSet<Integer>>( ScheduleUnit.class); unitValues = (new ScheduleSpec()).getUnitValues(); // Populate Month with all valid values SortedSet<Integer> monthValues = new TreeSet<Integer>(); for (int i = ScheduleUnit.MONTHS.min(); i <= ScheduleUnit.MONTHS.max(); i++) { monthValues.add(i);//w w w . jav a 2 s. co m } unitValues.put(ScheduleUnit.MONTHS, monthValues); // Construct spec, test that month was replaced with wildcards ScheduleSpec spec = new ScheduleSpec(unitValues, null, null, null); assertTrue(spec.getUnitValues().get(ScheduleUnit.MONTHS) == null); }
From source file:io.lavagna.service.importexport.ImportEventProcessor.java
@Autowired public ImportEventProcessor(CardRepository cardRepository, UserRepository userRepository, CardDataService cardDataService, CardService cardService, EventRepository eventRepository, LabelService labelService, CardLabelRepository cardLabelRepository, BoardRepository boardRepository) { this.userRepository = userRepository; Map<EventType, AbstractProcessEvent> mapping = new EnumMap<>(EventType.class); ///*w w w . j a v a2s .c om*/ mapping.put(EventType.CARD_CREATE, new CardCreate(cardRepository, userRepository, cardDataService, cardService)); mapping.put(EventType.CARD_UPDATE, new CardUpdate(cardRepository, userRepository, cardDataService, cardService)); mapping.put(EventType.CARD_MOVE, new CardMove(cardRepository, userRepository, cardDataService, cardService)); AbstractProcessEvent abtProcessor = new CardArchiveBacklogTrash(cardRepository, userRepository, cardDataService, cardService, eventRepository); mapping.put(EventType.CARD_ARCHIVE, abtProcessor); mapping.put(EventType.CARD_BACKLOG, abtProcessor); mapping.put(EventType.CARD_TRASH, abtProcessor); AbstractProcessEvent descProcessor = new DescriptionCreateUpdate(cardRepository, userRepository, cardDataService); mapping.put(EventType.DESCRIPTION_CREATE, descProcessor); mapping.put(EventType.DESCRIPTION_UPDATE, descProcessor); mapping.put(EventType.COMMENT_CREATE, new CommentCreate(cardRepository, userRepository, cardDataService)); mapping.put(EventType.COMMENT_UPDATE, new CommentUpdate(cardRepository, userRepository, cardDataService)); mapping.put(EventType.COMMENT_DELETE, new CommentDelete(cardRepository, userRepository, cardDataService)); mapping.put(EventType.ACTION_LIST_CREATE, new ActionListCreate(cardRepository, userRepository, cardDataService)); mapping.put(EventType.ACTION_LIST_DELETE, new ActionListDelete(cardRepository, userRepository, cardDataService)); mapping.put(EventType.ACTION_ITEM_CREATE, new ActionItemCreate(cardRepository, userRepository, cardDataService)); mapping.put(EventType.ACTION_ITEM_DELETE, new ActionItemDelete(cardRepository, userRepository, cardDataService)); mapping.put(EventType.ACTION_ITEM_MOVE, new ActionItemMove(cardRepository, userRepository, cardDataService)); AbstractProcessEvent actionItemCheckUncheck = new ActionItemCheckUncheck(cardRepository, userRepository, cardDataService); mapping.put(EventType.ACTION_ITEM_CHECK, actionItemCheckUncheck); mapping.put(EventType.ACTION_ITEM_UNCHECK, actionItemCheckUncheck); mapping.put(EventType.LABEL_CREATE, new LabelCreate(cardRepository, userRepository, cardDataService, labelService, cardLabelRepository, boardRepository, eventRepository)); mapping.put(EventType.LABEL_DELETE, new LabelDelete(cardRepository, userRepository, cardDataService, labelService, cardLabelRepository, boardRepository, eventRepository)); mapping.put(EventType.FILE_UPLOAD, new FileUpload(cardRepository, userRepository, cardDataService)); mapping.put(EventType.FILE_DELETE, new FileDelete(cardRepository, userRepository, cardDataService)); // eventProcessors = Collections.unmodifiableMap(mapping); }
From source file:de.metanome.backend.result_receiver.ResultPrinter.java
public ResultPrinter(String algorithmExecutionIdentifier) throws FileNotFoundException { super(algorithmExecutionIdentifier); this.openStreams = new EnumMap<>(ResultType.class); }
From source file:org.libreplan.web.planner.tabs.TabOnModeType.java
public TabOnModeType(Mode mode, EnumMap<ModeType, ITab> tabs) { Validate.notNull(mode);/*from w ww . j a v a2 s.c om*/ Validate.isTrue(handleAtLeatOneCase(tabs), "must handle at least one ModeType"); this.mode = mode; this.tabs = new EnumMap<>(tabs); this.mode.addListener((oldType, newType) -> { if (beingShown) { changeTab(oldType, newType); } }); }
From source file:io.lavagna.service.StatisticsService.java
private Map<Long, Map<ColumnDefinition, Long>> toStatusByDay(List<StatisticsResult> results) { Map<Long, Map<ColumnDefinition, Long>> statusByDay = new HashMap<>(); for (StatisticsResult result : results) { if (!statusByDay.containsKey(result.getDay())) { statusByDay.put(result.getDay(), new EnumMap<ColumnDefinition, Long>(ColumnDefinition.class)); }//from ww w. j a v a2 s. c o m Map<ColumnDefinition, Long> day = statusByDay.get(result.getDay()); day.put(result.getColumnDefinition(), result.getCount()); } return statusByDay; }
From source file:ch.systemsx.cisd.openbis.generic.server.util.PropertyValidator.java
private final static Map<EntityDataType, IDataTypeValidator> createDataTypeValidators() { final Map<EntityDataType, IDataTypeValidator> map = new EnumMap<EntityDataType, IDataTypeValidator>( EntityDataType.class); map.put(EntityDataType.BOOLEAN, new BooleanValidator()); map.put(EntityDataType.VARCHAR, new VarcharValidator()); map.put(EntityDataType.TIMESTAMP, new TimestampValidator()); map.put(EntityDataType.INTEGER, new IntegerValidator()); map.put(EntityDataType.REAL, new RealValidator()); map.put(EntityDataType.CONTROLLEDVOCABULARY, new ControlledVocabularyValidator()); map.put(EntityDataType.MATERIAL, new MaterialValidator()); map.put(EntityDataType.HYPERLINK, new HyperlinkValidator()); map.put(EntityDataType.MULTILINE_VARCHAR, new VarcharValidator()); return map;//from w ww . j a v a 2 s. c o m }
From source file:com.moviejukebox.model.artwork.Artwork.java
/** * Create an Artwork object with a set of sizes * * @param type The type of the artwork/*from www .jav a2s . c om*/ * @param sourceSite The source site the artwork came from * @param url The URL of the artwork * @param sizes A list of the artwork files to add */ public Artwork(ArtworkType type, String sourceSite, String url, Collection<ArtworkFile> sizes) { this.type = type; this.sourceSite = sourceSite; this.url = url; this.sizes = new EnumMap<>(ArtworkSize.class); for (ArtworkFile artworkFile : sizes) { this.addSize(artworkFile); } }
From source file:org.apache.asterix.common.config.ConfigUsageTest.java
@Test public void generateUsage() { final EnumMap<Column, Boolean> align = new EnumMap<>(Column.class); align.put(Column.SECTION, true);// ww w .ja v a 2s . c o m align.put(Column.PARAMETER, true); System.err.println(); generateUsage("| ", " | ", " |", align, System.err); }
From source file:com.att.aro.ui.view.diagnostictab.plot.NetworkTypePlot.java
@Override public void populate(XYPlot plot, AROTraceData analysis) { plot.setDataset(new XYIntervalSeriesCollection()); if (analysis == null) { logger.info("no trace data here"); } else {/*from w w w.j a v a 2 s . c om*/ if (analysis.getAnalyzerResult().getTraceresult().getTraceResultType() == TraceResultType.TRACE_FILE) { logger.info("no trace folder data here"); } else { TraceDirectoryResult traceresult = (TraceDirectoryResult) analysis.getAnalyzerResult() .getTraceresult(); final XYIntervalSeriesCollection networkDataSeries = new XYIntervalSeriesCollection(); final Map<NetworkType, XYIntervalSeries> seriesMap = new EnumMap<NetworkType, XYIntervalSeries>( NetworkType.class); createDataSeriesForAllNetworkTypes(seriesMap, networkDataSeries); Iterator<NetworkBearerTypeInfo> iter = traceresult.getNetworkTypeInfos().iterator(); if (iter.hasNext()) { while (iter.hasNext()) { NetworkBearerTypeInfo networkInfo = iter.next(); if (networkInfo.getNetworkType() != NetworkType.none) { seriesMap.get(networkInfo.getNetworkType()).add(networkInfo.getBeginTimestamp(), networkInfo.getBeginTimestamp(), networkInfo.getEndTimestamp(), 0.5, 0, 1); } } } else { NetworkType nt = traceresult.getNetworkType(); if (nt != null && nt != NetworkType.none) { seriesMap.get(nt).add(0, 0, traceresult.getTraceDuration(), 0.5, 0, 1); } } XYItemRenderer renderer = plot.getRenderer(); setRenderingColorForDataSeries(renderer, networkDataSeries); // Assign ToolTip to renderer renderer.setBaseToolTipGenerator(new XYToolTipGenerator() { @Override public String generateToolTip(XYDataset dataset, int series, int item) { NetworkType networkType = (NetworkType) networkDataSeries.getSeries(series).getKey(); return MessageFormat.format(ResourceBundleHelper.getMessageString("network.tooltip"), dataset.getX(series, item), ResourceBundleHelper.getEnumString(networkType)); } }); plot.setDataset(networkDataSeries); } } // return plot; }
From source file:de.metanome.backend.result_receiver.ResultPrinter.java
protected ResultPrinter(String algorithmExecutionIdentifier, Boolean test) throws FileNotFoundException { super(algorithmExecutionIdentifier, test); this.openStreams = new EnumMap<>(ResultType.class); }