List of usage examples for com.google.common.collect Maps newEnumMap
public static <K extends Enum<K>, V> EnumMap<K, V> newEnumMap(Map<K, ? extends V> map)
From source file:hudson.plugins.openid.OpenIdTestCase.java
Map<IdProperty, String> getProps() { Map<IdProperty, String> props = Maps.newEnumMap(IdProperty.class); props.put(IdProperty.email, "alice@Net"); props.put(IdProperty.nick, "aliceW"); props.put(IdProperty.fullName, "Alice Wonderland"); props.put(IdProperty.firstName, "alice"); props.put(IdProperty.lastName, "wonderland"); props.put(IdProperty.derivedFullName, "alice wonderland"); return props; }
From source file:com.techcavern.pircbotz.UserChannelDao.java
public UserChannelDao(PircBotZ bot, Configuration.BotFactory botFactory) { this.bot = bot; this.botFactory = botFactory; this.locale = bot.getConfiguration().getLocale(); this.mainMap = new UserChannelMap<U, C>(); this.userNickMap = HashBiMap.create(); this.channelNameMap = HashBiMap.create(); this.privateUsers = new HashSet<U>(); //Initialize levels map with a UserChannelMap for each level this.levelsMap = Maps.newEnumMap(UserLevel.class); for (UserLevel level : UserLevel.values()) levelsMap.put(level, new UserChannelMap<U, C>()); }
From source file:com.eucalyptus.vm.VmInstanceAvailabilityEventListener.java
@Override public void fireEvent(final ClockTick event) { if (Bootstrap.isFinished() && Hosts.isCoordinator()) { final List<ResourceAvailabilityEvent> resourceAvailabilityEvents = Lists.newArrayList(); final Map<ResourceAvailabilityEvent.ResourceType, AvailabilityAccumulator> availabilities = Maps .newEnumMap(ResourceAvailabilityEvent.ResourceType.class); final Iterable<VmType> vmTypes = Lists.newArrayList(VmTypes.list()); for (final Cluster cluster : Clusters.getInstance().listValues()) { availabilities.put(Core, new AvailabilityAccumulator(VmType.SizeProperties.Cpu)); availabilities.put(Disk, new AvailabilityAccumulator(VmType.SizeProperties.Disk)); availabilities.put(Memory, new AvailabilityAccumulator(VmType.SizeProperties.Memory)); for (final VmType vmType : vmTypes) { final ResourceState.VmTypeAvailability va = cluster.getNodeState() .getAvailability(vmType.getName()); resourceAvailabilityEvents.add(new ResourceAvailabilityEvent(Instance, new ResourceAvailabilityEvent.Availability(va.getMax(), va.getAvailable(), Lists.<ResourceAvailabilityEvent.Tag>newArrayList( new ResourceAvailabilityEvent.Dimension("availabilityZone", cluster.getPartition()), new ResourceAvailabilityEvent.Dimension("cluster", cluster.getName()), new ResourceAvailabilityEvent.Type("vm-type", vmType.getName()))))); for (final AvailabilityAccumulator availability : availabilities.values()) { availability.total = Math.max(availability.total, va.getMax() * availability.valueExtractor.apply(vmType)); availability.available = Math.max(availability.available, va.getAvailable() * availability.valueExtractor.apply(vmType)); }//from ww w. ja v a 2s. c o m } for (final AvailabilityAccumulator availability : availabilities.values()) { availability.rollUp(Lists.<ResourceAvailabilityEvent.Tag>newArrayList( new ResourceAvailabilityEvent.Dimension("availabilityZone", cluster.getPartition()), new ResourceAvailabilityEvent.Dimension("cluster", cluster.getName()))); } } for (final Map.Entry<ResourceAvailabilityEvent.ResourceType, AvailabilityAccumulator> entry : availabilities .entrySet()) { resourceAvailabilityEvents .add(new ResourceAvailabilityEvent(entry.getKey(), entry.getValue().availabilities)); } for (final ResourceAvailabilityEvent resourceAvailabilityEvent : resourceAvailabilityEvents) try { ListenerRegistry.getInstance().fireEvent(resourceAvailabilityEvent); } catch (Exception ex) { logger.error(ex, ex); } } }
From source file:com.vmware.photon.controller.api.frontend.clients.StatusFeClient.java
/** * Creating StatusFeClient with component server sets to iterate through individual servers to get their status. * * @param photonControllerServerSet//from w ww .j a v a 2 s .c om * @param statusConfig */ @Inject public StatusFeClient(@BackendTaskExecutor ExecutorService executor, @ScheduledTaskExecutor ScheduledExecutorService scheduledExecutorService, @PhotonControllerServerSet ServerSet photonControllerServerSet, StatusConfig statusConfig) { this.executor = executor; this.components = statusConfig.getComponents(); statusProviderFactories = Maps.newEnumMap(Component.class); statusProviderFactories.put(Component.PHOTON_CONTROLLER, new XenonStatusProviderFactory(photonControllerServerSet, this.executor, scheduledExecutorService)); }
From source file:com.notifier.desktop.notification.broadcast.growl.GrowlNotificationBroadcaster.java
@Override public void doStart() throws Exception { if (OperatingSystems.CURRENT_FAMILY == OperatingSystems.Family.MAC) { macGrowl = new GrowlPatched(); macGrowl.addGrowlHost("localhost", null); GrowlRegistrations registrations = macGrowl.getRegistrations(Application.NAME); registrations.registerNotification(Notification.Type.RING.toString(), true); registrations.registerNotification(Notification.Type.SMS.toString(), true); registrations.registerNotification(Notification.Type.MMS.toString(), true); registrations.registerNotification(Notification.Type.BATTERY.toString(), true); registrations.registerNotification(Notification.Type.VOICEMAIL.toString(), true); registrations.registerNotification(Notification.Type.PING.toString(), true); registrations.registerNotification(Notification.Type.USER.toString(), true); macGrowl.sendRegistrations();/*from w ww . j av a 2 s . c om*/ } else { GntpApplicationInfo appInfo = Gntp.appInfo(Application.NAME).icon(getIcon(APPLICATION_ICON)).build(); notificationInfos = Maps.newEnumMap(Notification.Type.class); notificationInfos.put(Notification.Type.RING, infoForType(appInfo, Notification.Type.RING)); notificationInfos.put(Notification.Type.SMS, infoForType(appInfo, Notification.Type.SMS)); notificationInfos.put(Notification.Type.MMS, infoForType(appInfo, Notification.Type.MMS)); notificationInfos.put(Notification.Type.BATTERY, infoForType(appInfo, Notification.Type.BATTERY)); notificationInfos.put(Notification.Type.VOICEMAIL, infoForType(appInfo, Notification.Type.VOICEMAIL)); notificationInfos.put(Notification.Type.PING, infoForType(appInfo, Notification.Type.PING)); notificationInfos.put(Notification.Type.USER, infoForType(appInfo, Notification.Type.USER)); gntpClient = Gntp.client(appInfo).listener(new Listener()).build(); gntpClient.register(); } }
From source file:org.geosdi.geoplatform.gml.impl.v311.jts.parameter.JTSParametersRepo.java
private JTSParametersRepo() { parameters = Maps.newEnumMap(JTSParameterEnum.class); }
From source file:com.torodb.torod.db.postgresql.converters.array.ValueToArrayConverterProvider.java
private ValueToArrayConverterProvider() { arrayConverter = new ArrayValueToJsonbConverter(); booleanConverter = new BooleanValueToJsonbConverter(); dateConverter = new DateValueToJsonbConverter(); dateTimeConverter = new DateTimeValueToJsonbConverter(); doubleConverter = new DoubleValueToJsonbConverter(); integerConverter = new IntegerValueToJsonbConverter(); longConverter = new LongValueToJsonbConverter(); nullConverter = new NullValueToJsonbConverter(); stringConverter = new StringValueToJsonbConverter(); timeConverter = new TimeValueToJsonbConverter(); twelveBytesConverter = new TwelveBytesToArrayConverter(); converters = Maps.newEnumMap(BasicType.class); converters.put(BasicType.ARRAY, arrayConverter); converters.put(BasicType.BOOLEAN, booleanConverter); converters.put(BasicType.DATE, dateConverter); converters.put(BasicType.DATETIME, dateTimeConverter); converters.put(BasicType.DOUBLE, doubleConverter); converters.put(BasicType.INTEGER, integerConverter); converters.put(BasicType.LONG, longConverter); converters.put(BasicType.NULL, nullConverter); converters.put(BasicType.STRING, stringConverter); converters.put(BasicType.TIME, timeConverter); converters.put(BasicType.TWELVE_BYTES, twelveBytesConverter); }
From source file:org.terasology.world.block.loader.SectionDefinitionData.java
public SectionDefinitionData(SectionDefinitionData other) { this.displayName = other.displayName; this.liquid = other.liquid; this.hardness = other.hardness; this.attachmentAllowed = other.attachmentAllowed; this.replacementAllowed = other.replacementAllowed; this.supportRequired = other.supportRequired; this.penetrable = other.penetrable; this.targetable = other.targetable; this.climbable = other.climbable; this.invisible = other.invisible; this.translucent = other.translucent; this.doubleSided = other.doubleSided; this.shadowCasting = other.shadowCasting; this.waving = other.waving; this.sounds = other.sounds; this.luminance = other.luminance; this.tint = new Vector3f(other.tint); this.blockTiles = new EnumMap<>(other.blockTiles); this.colorSources = Maps.newEnumMap(other.colorSources); this.colorOffsets = Maps.newEnumMap(other.colorOffsets); this.mass = other.mass; this.debrisOnDestroy = other.debrisOnDestroy; this.entity = new EntityData(other.entity); this.inventory = new InventoryData(other.inventory); this.shape = other.shape; this.water = other.water; this.lava = other.lava; this.grass = other.grass; this.ice = other.ice; }
From source file:org.n52.sos.ogc.sos.SosResultEncoding.java
private String encodeResultEncoding() throws OwsExceptionReport { Map<HelperValues, String> map = Maps.newEnumMap(HelperValues.class); map.put(HelperValues.DOCUMENT, null); return CodingHelper.encodeObjectToXmlText(SweConstants.NS_SWE_20, getEncoding(), map); }
From source file:org.n52.sos.ogc.sos.SosResultStructure.java
private String encodeResultStructure() throws OwsExceptionReport { Map<HelperValues, String> map = Maps.newEnumMap(HelperValues.class); map.put(HelperValues.DOCUMENT, null); return CodingHelper.encodeObjectToXmlText(SweConstants.NS_SWE_20, getResultStructure(), map); }