项目:DecompiledMinecraft
文件:StatisticsFile.java
public void func_150876_a(EntityPlayerMP p_150876_1_)
{
int i = this.mcServer.getTickCounter();
Map<StatBase,Integer> map = Maps.<StatBase,Integer>newHashMap();
if (this.field_150886_g || i - this.field_150885_f > 300)
{
this.field_150885_f = i;
for (StatBase statbase : this.func_150878_c())
{
map.put(statbase,Integer.valueOf(this.readStat(statbase)));
}
}
p_150876_1_.playerNetServerHandler.sendPacket(new S37PacketStatistics(map));
}
项目:Equella
文件:ReplicatedUserPlugin.java
@Override
public Map<String,RoleBean> getInformationForRoles(final Collection<String> roleIds)
{
String sql = config.getRoleInfo();
if( Check.isEmpty(sql) )
{
return null;
}
final Map<String,RoleBean> roles = Maps.newHashMapWithExpectedSize(roleIds.size());
handleIn(sql,roleIds,new RowCallbackHandler()
{
@Override
public void processRow(ResultSet set) throws SQLException
{
String id = set.getString(1);
String name = set.getString(2);
roles.put(id,new DefaultRoleBean(id,name));
}
});
return roles;
}
项目:session-cloud
文件:TokenEnhancerChainFilter.java
/**
* Loop over the {@link #setTokenEnhancers(List) delegates} passing the result into the next member of the chain.
*
* @see org.springframework.security.oauth2.provider.token.TokenEnhancer#enhance(org.springframework.security.oauth2.common.OAuth2AccessToken,* org.springframework.security.oauth2.provider.OAuth2Authentication)
*/
public OAuth2AccessToken enhance(OAuth2AccessToken accessToken,OAuth2Authentication authentication) {
DefaultOAuth2AccessToken tempResult = (DefaultOAuth2AccessToken) accessToken;
final Map<String,Object> additionalInformation = new HashMap<String,Object>();
Map<String,String> details = Maps.newHashMap();
Object userDetails = authentication.getUserAuthentication().getDetails();
if (userDetails != null) {
details = (Map<String,String>) userDetails;
}
//you can do extra functions from authentication details
OAuth2AccessToken result = tempResult;
for (TokenEnhancer enhancer : delegates) {
result = enhancer.enhance(result,authentication);
}
return result;
}
项目:ProjectAres
文件:GlobalItemParser.java
public Map<Enchantment,Integer> parseEnchantments(Element el,String name) throws InvalidXMLException {
Map<Enchantment,Integer> enchantments = Maps.newHashMap();
Node attr = Node.fromAttr(el,name,StringUtils.pluralize(name));
if(attr != null) {
Iterable<String> enchantmentTexts = Splitter.on(";").split(attr.getValue());
for(String enchantmentText : enchantmentTexts) {
int level = 1;
List<String> parts = Lists.newArrayList(Splitter.on(":").limit(2).split(enchantmentText));
Enchantment enchant = XMLUtils.parseEnchantment(attr,parts.get(0));
if(parts.size() > 1) {
level = XMLUtils.parseNumber(attr,parts.get(1),Integer.class);
}
enchantments.put(enchant,level);
}
}
for(Element elEnchantment : el.getChildren(name)) {
Pair<Enchantment,Integer> entry = parseEnchantment(elEnchantment);
enchantments.put(entry.first,entry.second);
}
return enchantments;
}
项目:DecompiledMinecraft
文件:Chunk.java
public Chunk(World worldIn,int x,int z)
{
this.storageArrays = new ExtendedBlockStorage[16];
this.blockBiomeArray = new byte[256];
this.precipitationHeightMap = new int[256];
this.updateSkylightColumns = new boolean[256];
this.chunkTileEntityMap = Maps.<BlockPos,TileEntity>newHashMap();
this.queuedLightChecks = 4096;
this.tileEntityPosQueue = Queues.<BlockPos>newConcurrentLinkedQueue();
this.entityLists = (ClassInheritanceMultiMap[])(new ClassInheritanceMultiMap[16]);
this.worldObj = worldIn;
this.xPosition = x;
this.zPosition = z;
this.heightMap = new int[256];
for (int i = 0; i < this.entityLists.length; ++i)
{
this.entityLists[i] = new ClassInheritanceMultiMap(Entity.class);
}
Arrays.fill((int[])this.precipitationHeightMap,(int) - 999);
Arrays.fill(this.blockBiomeArray,(byte) - 1);
}
项目:BaseClient
文件:GuiFlatPresets.java
private static void func_175354_a(String p_175354_0_,Item p_175354_1_,int p_175354_2_,BiomeGenBase p_175354_3_,List<String> p_175354_4_,FlatLayerInfo... p_175354_5_)
{
FlatGeneratorInfo flatgeneratorinfo = new FlatGeneratorInfo();
for (int i = p_175354_5_.length - 1; i >= 0; --i)
{
flatgeneratorinfo.getFlatLayers().add(p_175354_5_[i]);
}
flatgeneratorinfo.setBiome(p_175354_3_.biomeID);
flatgeneratorinfo.func_82645_d();
if (p_175354_4_ != null)
{
for (String s : p_175354_4_)
{
flatgeneratorinfo.getWorldFeatures().put(s,Maps.<String,String>newHashMap());
}
}
FLAT_WORLD_PRESETS.add(new GuiFlatPresets.LayerItem(p_175354_1_,p_175354_2_,p_175354_0_,flatgeneratorinfo.toString()));
}
项目:hashsdn-controller
文件:InstanceRuntimeRpc.java
public Map<String,AttributeConfigElement> fromXml(final XmlElement configRootNode) throws DocumentedException {
Map<String,AttributeConfigElement> retVal = Maps.newHashMap();
// FIXME add identity map to runtime data
Map<String,AttributeReadingStrategy> strats = new ObjectXmlReader().prepareReading(yangToAttrConfig,Collections.<String,Map<Date,IdentityMapping>>emptyMap());
for (Entry<String,AttributeReadingStrategy> readStratEntry : strats.entrySet()) {
List<XmlElement> configNodes = configRootNode.getChildElements(readStratEntry.getKey());
AttributeConfigElement readElement = readStratEntry.getValue().readElement(configNodes);
retVal.put(readStratEntry.getKey(),readElement);
}
resolveConfiguration(retVal);
return retVal;
}
项目:avro-diff
文件:AvroDiffMap.java
private static void applyMapDiff(Schema.Field field,GenericRecord avroObj,GenericRecord fieldsValue,Map<Object,Object> modifiedObj,Object key) throws IOException {
Map<String,Object> changedKeys = ((MapDiff) fieldsValue).getChangedKeys();
for (String changedKey : changedKeys.keySet()) {
Class<?> clazz = changedKeys.get(changedKey).getClass();
if (clazz.isAssignableFrom(PrimitiveDiff.class)) {
AvroDiffPrimitive.applyPrimitiveDiff(field,avroObj,changedKeys.get(changedKey),changedKeys,changedKey);
modifiedObj.put(key,changedKeys);
} else if (clazz.isAssignableFrom(MapDiff.class)) {
AvroDiffMap.applyMapDiff(field,(GenericRecord) changedKeys.get(changedKey),Maps.newHashMap(changedKeys),changedKey);
} else if (clazz.isAssignableFrom(ArrayDiff.class)) {
AvroDiffArray.applyArrayDiff(field,null);
} else if (clazz.isAssignableFrom(RecordDiff.class)) {
Object avroField = ((Map) avroObj.get(field.pos())).get(key);
GenericRecord genericRecord = AvroDiff.applyDiff((GenericRecord) ((Map) avroField).get(changedKey),(RecordDiff) changedKeys.get(changedKey),((GenericRecord) ((Map) avroField).get(changedKey)).getSchema());
((Map) avroField).put(changedKey,genericRecord);
modifiedObj.put(key,avroField);
}
}
}
项目:Equella
文件:ItemResourceImpl.java
/**
* Similar operation in the ItemLockResource
*
* @see com.tle.web.api.item.interfaces.ItemLockResource#get(UriInfo,* String,int)
* @param uuid
* @param version
* @return
*/
private ItemLockBean getItemLock(EquellaItemBean equellaBean)
{
Item item = itemService.get(new ItemId(equellaBean.getUuid(),equellaBean.getVersion()));
final ItemLock lock = lockingService.get(item);
if( lock == null )
{
return null;
}
final URI loc = urlLinkService.getMethodUriBuilder(ItemLockResource.class,"get").build(item.getUuid(),item.getVersion());
final ItemLockBean lockBean = new ItemLockBean();
final Map<String,String> linkMap = Maps.newHashMap();
linkMap.put("self",loc.toString());
lockBean.setOwner(new UserBean(lock.getUserID()));
lockBean.setUuid(lock.getUserSession());
lockBean.set("links",linkMap);
return lockBean;
}
项目:Reer
文件:DefaultJarSnapshotter.java
JarSnapshot createSnapshot(HashCode hash,FileTree classes,final ClassFilesAnalyzer analyzer) {
final Map<String,HashCode> hashes = Maps.newHashMap();
classes.visit(new FileVisitor() {
public void visitDir(FileVisitDetails dirDetails) {
}
public void visitFile(FileVisitDetails fileDetails) {
analyzer.visitFile(fileDetails);
String className = fileDetails.getPath().replaceAll("/",".").replaceAll("\\.class$","");
HashCode classHash = hasher.hash(fileDetails.getFile());
hashes.put(className,classHash);
}
});
return new JarSnapshot(new JarSnapshotData(hash,hashes,analyzer.getAnalysis()));
}
项目:Backmemed
文件:StateMap.java
protected ModelResourceLocation getModelResourceLocation(IBlockState state)
{
Map < IProperty<?>,Comparable<? >> map = Maps. < IProperty<?>,Comparable<? >> newLinkedHashMap(state.getProperties());
String s;
if (this.name == null)
{
s = ((ResourceLocation)Block.REGISTRY.getNameForObject(state.getBlock())).toString();
}
else
{
s = this.removeName(this.name,map);
}
if (this.suffix != null)
{
s = s + this.suffix;
}
for (IProperty<?> iproperty : this.ignored)
{
map.remove(iproperty);
}
return new ModelResourceLocation(s,this.getPropertyString(map));
}
项目:pact-spring-mvc
文件:ReturnExpect.java
private void assertRequestHeaders(HttpHeaders actualHeaders,Object requestObject,Map<String,Matcher<? super List<String>>> additionalExpectedHeaders) {
Map<String,Matcher<? super List<String>>> expectedHeaders = new HashMap<>();
if (requestObject != null && requestObject instanceof HttpEntity) {
HttpEntity httpEntity = (HttpEntity) requestObject;
HttpHeaders headers = httpEntity.getHeaders();
Map<String,Matcher<List<String>>> stringMatcherMap = Maps.transformValues(headers,new Function<List<String>,Matcher<List<String>>>() {
@Override
public Matcher<List<String>> apply(List<String> input) {
return is(input);
}
});
expectedHeaders.putAll(stringMatcherMap);
}
expectedHeaders.putAll(additionalExpectedHeaders);
Set<String> headerNames = expectedHeaders.keySet();
for (String headerName : headerNames) {
Matcher<? super List<String>> headerValuesMatcher = expectedHeaders.get(headerName);
assertThat(format("Contains header %s",headerName),actualHeaders.containsKey(headerName),is(true));
assertThat(format("'%s' header value fails assertion",actualHeaders.get(headerName),headerValuesMatcher);
}
}
项目:hadoop-oss
文件:Token.java
private static Class<? extends TokenIdentifier>
getClassForIdentifier(Text kind) {
Class<? extends TokenIdentifier> cls = null;
synchronized (Token.class) {
if (tokenKindMap == null) {
tokenKindMap = Maps.newHashMap();
for (TokenIdentifier id : ServiceLoader.load(TokenIdentifier.class)) {
tokenKindMap.put(id.getKind(),id.getClass());
}
}
cls = tokenKindMap.get(kind);
}
if (cls == null) {
LOG.warn("Cannot find class for token kind " + kind);
return null;
}
return cls;
}
项目:OperatieBRP
文件:SelectieTaakVerwerkerImpl.java
private Set<Integer> filter(final List<SelectieAutorisatiebundel> autorisatiebundels,final Collection<Persoonslijst> lijstMetPersonen) {
final Set<Integer> ongeldigeSelectietaken = Sets.newHashSet();
final Map<Long,ZonedDateTime> gbaSystematiekMap = Maps.newHashMap();
for (Persoonslijst persoonslijst : lijstMetPersonen) {
//we berekenen dit nu altijd. We zouden ook kunnen detecteren dat peilmoment formeel niet is gezet vanuit beheer maar op 'nu' is gezet in
// selectie run voor alle taken.
final ZonedDateTime laatsteWijzigingGBASystematiek = persoonslijst.bepaalTijdstipLaatsteWijzigingGBASystematiek();
gbaSystematiekMap.put(persoonslijst.getId(),laatsteWijzigingGBASystematiek);
}
for (SelectieAutorisatiebundel autorisatiebundel : autorisatiebundels) {
//alleen voor standaard selectie relevant en als peilmoment formeel gezet
if (isStandaardSelectie(autorisatiebundel.getAutorisatiebundel().getDienst())
&& autorisatiebundel.getSelectieAutorisatieBericht().getPeilmomentFormeel() != null) {
bepaalOngeldigeSelectietaak(lijstMetPersonen,ongeldigeSelectietaken,gbaSystematiekMap,autorisatiebundel);
}
}
return ongeldigeSelectietaken;
}
项目:de.flapdoodle.solid
文件:PebbleTheme.java
private String render(Renderable renderable,PebbleTemplate template) {
try {
StringWriter writer=new StringWriter();
PebbleWrapper it = PebbleWrapper.builder()
.markupRenderFactory(markupRenderFactory)
.context(renderable.context())
.addAllAllBlobs(renderable.blobs())
.build();
template.evaluate(writer,Maps.newLinkedHashMap(ImmutableMap.of("it",it)));
return writer.toString();
} catch (PebbleException | IOException | RuntimePebbleException px) {
throw new RuntimeException("rendering fails for "+template.getName(),px);
}
}
项目:easyweb
文件:LoginUtil.java
/**
* 是否是验证码登录
* @param useruame 用户名
* @param isFail 计数加1
* @param clean 计数清零
* @return
*/
@SuppressWarnings("unchecked")
public static boolean isValidateCodeLogin(String useruame,boolean isFail,boolean clean){
Map<String,Integer> loginFailMap = (Map<String,Integer>) CacheUtils.get("loginFailMap");
if (loginFailMap==null){
loginFailMap = Maps.newHashMap();
CacheUtils.put("loginFailMap",loginFailMap);
}
Integer loginFailNum = loginFailMap.get(useruame);
if (loginFailNum==null){
loginFailNum = 0;
}
if (isFail){
loginFailNum++;
loginFailMap.put(useruame,loginFailNum);
}
if (clean){
loginFailMap.remove(useruame);
}
return loginFailNum >= 3;
}
项目:hadoop
文件:MetricsConfig.java
/**
* Return sub configs for instance specified in the config.
* Assuming format specified as follows:<pre>
* [type].[instance].[option] = [value]</pre>
* Note,'*' is a special default instance,which is excluded in the result.
* @param type of the instance
* @return a map with [instance] as key and config object as value
*/
Map<String,MetricsConfig> getInstanceConfigs(String type) {
Map<String,MetricsConfig> map = Maps.newHashMap();
MetricsConfig sub = subset(type);
for (String key : sub.keys()) {
Matcher matcher = INSTANCE_REGEX.matcher(key);
if (matcher.matches()) {
String instance = matcher.group(1);
if (!map.containsKey(instance)) {
map.put(instance,sub.subset(instance));
}
}
}
return map;
}
项目:OperatieBRP
文件:ElementHelper.java
private void mapSorteerAttributen() {
final Map<Integer,GroepElement> objectSorteerGroepTemp = Maps.newHashMap();
final ArrayListMultimap<GroepElement,AttribuutElement> sorteerElementenVoorGroep = ArrayListMultimap.create();
for (final AttribuutElement attribuutElement : idAttribuutMap.values()) {
if (attribuutElement.getElement().getElementWaarde().getSorteervolgorde() != null) {
objectSorteerGroepTemp.put(attribuutElement.getObjectType(),idGroepMap.get(attribuutElement.getGroepId()));
sorteerElementenVoorGroep.put(idGroepMap.get(attribuutElement.getGroepId()),attribuutElement);
}
}
objectSorteerGroepMap = ImmutableMap.copyOf(objectSorteerGroepTemp);
final Map<GroepElement,List<AttribuutElement>> gesorteerdeElementenVoorGroepTemp = new HashMap<>();
for (GroepElement groepElement : sorteerElementenVoorGroep.keySet()) {
final List<AttribuutElement> sorteerAttributen = sorteerElementenVoorGroep.get(groepElement);
sorteerAttributen.sort(
Comparator.comparing(o -> o.getElement().getElementWaarde().getSorteervolgorde()));
gesorteerdeElementenVoorGroepTemp.put(groepElement,sorteerAttributen);
}
sorteerAttributenVoorGroep = ImmutableMap.copyOf(gesorteerdeElementenVoorGroepTemp);
}
项目:guava-mock
文件:PopulatedCachesTest.java
public void testValues_populated() {
for (LoadingCache<Object,Object> cache : caches()) {
Collection<Object> values = cache.asMap().values();
List<Entry<Object,Object>> warmed = warmUp(cache);
Collection<Object> expected = Maps.newHashMap(cache.asMap()).values();
assertThat(values).containsExactlyElementsIn(expected);
assertThat(values.toArray()).asList().containsExactlyElementsIn(expected);
assertThat(values.toArray(new Object[0])).asList().containsExactlyElementsIn(expected);
assertEquals(WARMUP_SIZE,values.size());
for (int i = WARMUP_MIN; i < WARMUP_MAX; i++) {
Object value = warmed.get(i - WARMUP_MIN).getValue();
assertTrue(values.contains(value));
assertTrue(values.remove(value));
assertFalse(values.remove(value));
assertFalse(values.contains(value));
}
checkEmpty(values);
checkEmpty(cache);
}
}
项目:uavstack
文件:DefaultLogFilterAndRule.java
@SuppressWarnings("rawtypes")
@Override
public Map doAnalysis(Map<String,String> header,String log) {
List<String> logfields = Lists.newArrayList(separator.split(log));
Map<String,String> resultMap = Maps.newHashMap();
int i = 0;
// collection specified fields
for (int point : SpecifiedFields) {
// add irregular process
if (logfields.size() >= point)
resultMap.put(fieldsName[i++],logfields.get(point - 1));
}
// add line number
resultMap.put("_lnum",header.get(READ_LINE_NUMBER));
// add timestamp
if (timeStampField == TIMESTAMP_NEED) {
resultMap.put("_timestamp",header.get(READ_TIMESTAMP));
}
else if (timeStampField > TIMESTAMP_NEED) {
resultMap.put("_timestamp",logfields.get(timeStampField - 1));
}
this.getMainlogs().add(resultMap);
return resultMap;
}
项目:fpm
文件:SpeedRestrictionTagger.java
public Map<String,String> tag(Feature feature) {
TreeMultimap<String,Integer> speeds = TreeMultimap.create();
List<SpeedRestriction> restrictions = dbf.getSpeedRestrictions(feature.getLong("ID"));
boolean reversed = isReversed(feature);
for (SpeedRestriction restriction : restrictions) {
switch (restriction.getValidity()) {
case positive:
speeds.put(reversed ? "maxspeed:backward" : "maxspeed:forward",restriction.getSpeed());
break;
case negative:
speeds.put(reversed ? "maxspeed:forward" : "maxspeed:backward",restriction.getSpeed());
break;
case both:
speeds.put("maxspeed",restriction.getSpeed());
break;
}
}
Map<String,String> result = Maps.newHashMap();
for (String key : speeds.keySet()) {
result.put(key,String.valueOf(speeds.get(key).iterator().next()));
}
return result;
}
项目:storm-dynamic-spout
文件:FailedMsgRetryManagerPerformanceTest.java
/**
* Run a bunch of retries.
*
* Disabled for now.
*/
public void runTest() throws InterruptedException {
// Create instance with default settings
RetryManager retryManager = new DefaultRetryManager();
retryManager.open(Maps.newHashMap());
// Do warm up
logger.info("WARMING UP");
doTest2(retryManager);
// Now start test
logger.info("STARTING TEST");
retryManager = new DefaultRetryManager();
retryManager.open(Maps.newHashMap());
doTest2(retryManager);
}
项目:hashsdn-controller
文件:UnionCompositeAttributeResolvingStrategy.java
@Override
protected Map<String,Object> preprocessValueMap(final Map<?,?> valueMap) {
CompositeType openType = getOpenType();
Preconditions.checkArgument(
valueMap.size() == 1 && valueMap.containsKey(JavaAttribute.DESCRIPTION_OF_VALUE_ATTRIBUTE_FOR_UNION),"Unexpected structure of incoming map,expecting one element under %s,but was %s",JavaAttribute.DESCRIPTION_OF_VALUE_ATTRIBUTE_FOR_UNION,valueMap);
Map<String,Object> newMap = Maps.newHashMap();
for (String key : openType.keySet()) {
if (openType.getDescription(key).equals(JavaAttribute.DESCRIPTION_OF_VALUE_ATTRIBUTE_FOR_UNION)) {
newMap.put(key,valueMap.get(JavaAttribute.DESCRIPTION_OF_VALUE_ATTRIBUTE_FOR_UNION));
} else {
newMap.put(key,null);
}
}
return newMap;
}
项目:athena
文件:VirtualPortWebResource.java
/**
* Returns a Object of the currently known infrastructure virtualPort.
*
* @param allowedAddressPairs the allowedAddressPairs json node
* @return a collection of allowedAddressPair
*/
public Collection<AllowedAddressPair> jsonNodeToAllowedAddressPair(JsonNode allowedAddressPairs) {
checkNotNull(allowedAddressPairs,JSON_NOT_NULL);
ConcurrentMap<Integer,AllowedAddressPair> allowMaps = Maps
.newConcurrentMap();
int i = 0;
for (JsonNode node : allowedAddressPairs) {
IpAddress ip = IpAddress.valueOf(node.get("ip_address").asText());
MacAddress mac = MacAddress.valueOf(node.get("mac_address")
.asText());
AllowedAddressPair allows = AllowedAddressPair
.allowedAddressPair(ip,mac);
allowMaps.put(i,allows);
i++;
}
log.debug("The jsonNode of allowedAddressPairallow is {}"
+ allowedAddressPairs.toString());
return Collections.unmodifiableCollection(allowMaps.values());
}
项目:CustomWorldGen
文件:SoundManager.java
public SoundManager(SoundHandler p_i45119_1_,GameSettings p_i45119_2_)
{
this.invPlayingSounds = ((BiMap)this.playingSounds).inverse();
this.categorySounds = HashMultimap.<SoundCategory,String>create();
this.tickableSounds = Lists.<ITickableSound>newArrayList();
this.delayedSounds = Maps.<ISound,Integer>newHashMap();
this.playingSoundsStopTime = Maps.<String,Integer>newHashMap();
this.listeners = Lists.<ISoundEventListener>newArrayList();
this.pausedChannels = Lists.<String>newArrayList();
this.sndHandler = p_i45119_1_;
this.options = p_i45119_2_;
try
{
SoundSystemConfig.addLibrary(LibraryLWJGLOpenAL.class);
SoundSystemConfig.setCodec("ogg",CodecJOrbis.class);
net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.SoundSetupEvent(this));
}
catch (SoundSystemException soundsystemexception)
{
LOGGER.error(LOG_MARKER,(String)"Error linking with the LibraryJavaSound plug-in",(Throwable)soundsystemexception);
}
}
项目:Juice
文件:Kills.java
@Override
@SuppressWarnings("unchecked")
public TaskKill handle(String requestUrl) {
Result<TaskKill> result = null;
try {
Map<String,String> map = Maps.newHashMap();
map.put("taskId",String.valueOf(taskId));
String url = requestUrl + URL_KILL;
result = Restty.create(url,map)
.addMediaType(Restty.jsonBody())
.post(new ParameterTypeReference<Result<TaskKill>>() {
});
} catch (IOException e) {
throw new JuiceClientException(ErrorCode.HTTP_REQUEST_ERROR.getCode(),e.getMessage());
}
return result != null ? result.getData() : null;
}
项目:aws-codecommit-trigger-plugin
文件:SQSTrigger.java
private void initQueueMap() {
if (this.sqsQueues == null) {
return;
}
for (SQSTriggerQueue sqsQueue : this.sqsQueues) {
String version = sqsQueue.getVersion();
boolean compatible = com.ribose.jenkins.plugin.awscodecommittrigger.utils.StringUtils.checkCompatibility(version,com.ribose.jenkins.plugin.awscodecommittrigger.PluginInfo.compatibleSinceVersion);
sqsQueue.setCompatible(compatible);
}
this.sqsQueueMap = Maps.newHashMapWithExpectedSize(this.sqsQueues.size());
for (final SQSTriggerQueue queue : this.sqsQueues) {
this.sqsQueueMap.put(queue.getUuid(),queue);
}
}
项目:TranslateUtils
文件:GoogleDispatch.java
@Override
protected Map<String,String> initParamsMap(String from,String targ,String query) {
Map<String,String> paramsMap = Maps.newHashMap();
paramsMap.put("client","t");
paramsMap.put("sl",from);
paramsMap.put("t1",targ);
paramsMap.put("h1","zh_CH");
paramsMap.put("dt","at");
//paramsMap.put("")
return null;
}
项目:googles-monorepo-demo
文件:PopulatedCachesTest.java
@SuppressWarnings("unchecked") // generic array creation
public void testEntrySet_populated() {
for (LoadingCache<Object,Object> cache : caches()) {
Set<Entry<Object,Object>> entries = cache.asMap().entrySet();
List<Entry<Object,Object>> warmed = warmUp(cache,WARMUP_MIN,WARMUP_MAX);
Set<?> expected = Maps.newHashMap(cache.asMap()).entrySet();
assertThat(entries).containsExactlyElementsIn((Collection<Entry<Object,Object>>) expected);
assertThat(entries.toArray())
.asList()
.containsExactlyElementsIn((Collection<Object>) expected);
assertThat(entries.toArray(new Entry[0]))
.asList()
.containsExactlyElementsIn((Collection<Entry>) expected);
new EqualsTester()
.addEqualityGroup(cache.asMap().entrySet(),entries)
.addEqualityGroup(ImmutableSet.of())
.testEquals();
assertEquals(WARMUP_SIZE,entries.size());
for (int i = WARMUP_MIN; i < WARMUP_MAX; i++) {
Entry<Object,Object> newEntry = warmed.get(i - WARMUP_MIN);
assertTrue(entries.contains(newEntry));
assertTrue(entries.remove(newEntry));
assertFalse(entries.remove(newEntry));
assertFalse(entries.contains(newEntry));
}
checkEmpty(entries);
checkEmpty(cache);
}
}
项目:EndermanEvolution
文件:TileBlockSkull.java
private static Map<String,ModelSkullBase> getModels() {
Map<String,ModelSkullBase> modelMap = Maps.newHashMap();
modelMap.put("enderman_skull",ModelSkullBase.Enderman.getInstance());
modelMap.put("frienderman_skull",ModelSkullBase.Frienderman.getInstance());
modelMap.put("enderman_evolved_skull",ModelSkullBase.Enderman2.getInstance());
return modelMap;
}
项目:saluki
文件:PrintMessageFile.java
private Map<String,Pair<DescriptorProto,List<FieldDescriptorProto>>> transform(
DescriptorProto sourceMessageDesc) {
Map<String,List<FieldDescriptorProto>>> nestedFieldMap =
Maps.newHashMap();
sourceMessageDesc.getNestedTypeList().forEach(new Consumer<DescriptorProto>() {
@Override
public void accept(DescriptorProto t) {
nestedFieldMap.put(t.getName(),new ImmutablePair<DescriptorProto,List<FieldDescriptorProto>>(t,t.getFieldList()));
}
});
return nestedFieldMap;
}
项目:Equella
文件:UserServiceImpl.java
@Override
public Map<String,String[]> getAdditionalLogonState(HttpServletRequest request)
{
Map<String,String[]> extraState = Maps.newHashMap();
Collection<UserManagementLogonFilter> filters = getCurrentState().filters;
for( UserManagementLogonFilter filter : filters )
{
filter.addStateParameters(request,extraState);
}
return extraState;
}
项目:dremio-oss
文件:HiveTestDataGenerator.java
private HiveTestDataGenerator(final String dbDir,final String whDir) {
this.dbDir = dbDir;
this.whDir = whDir;
config = Maps.newHashMap();
config.put("hive.metastore.uris","");
config.put("javax.jdo.option.ConnectionURL",String.format("jdbc:derby:;databaseName=%s;create=true",dbDir));
config.put("hive.metastore.warehouse.dir",whDir);
config.put(FileSystem.FS_DEFAULT_NAME_KEY,"file:///");
}
项目:flume-release-1.7.0
文件:TestFileChannelFormatRegression.java
/**
* This is regression test with files generated by a file channel
* with the FLUME-1432 patch.
*/
@Test
public void testFileFormatV2postFLUME1432()
throws Exception {
TestUtils.copyDecompressed("fileformat-v2-checkpoint.gz",new File(checkpointDir,"checkpoint"));
for (int i = 0; i < dataDirs.length; i++) {
int fileIndex = i + 1;
TestUtils.copyDecompressed("fileformat-v2-log-" + fileIndex + ".gz",new File(dataDirs[i],"log-" + fileIndex));
}
Map<String,String> overrides = Maps.newHashMap();
overrides.put(FileChannelConfiguration.CAPACITY,String.valueOf(10));
overrides.put(FileChannelConfiguration.TRANSACTION_CAPACITY,String.valueOf(10));
channel = createFileChannel(overrides);
channel.start();
Assert.assertTrue(channel.isOpen());
Set<String> events = takeEvents(channel,1);
Set<String> expected = new HashSet<String>();
expected.addAll(Arrays.asList(
(new String[]{
"2684","2685","2686","2687","2688","2689","2690","2691"
})));
compareInputAndOut(expected,events);
}
项目:dremio-oss
文件:BackupRestoreUtil.java
private static Map<String,BackupFileInfo> scanInfoFiles(FileSystem fs,Path backupDir) throws IOException {
final Map<String,BackupFileInfo> tableToInfo = Maps.newHashMap();
final FileStatus[] backupFiles = fs.listStatus(backupDir,BACKUP_INFO_FILES_GLOB);
for (FileStatus backupFile : backupFiles) {
final String tableName = getTableName(backupFile.getPath().getName(),BACKUP_INFO_FILE_SUFFIX);
// read backup info file
final byte[] headerBytes = new byte[(int) backupFile.getLen()];
IOUtils.readFully(fs.open(backupFile.getPath()),headerBytes,headerBytes.length);
final BackupFileInfo backupFileInfo = new BackupFileInfo();
ProtostuffUtil.fromJSON(headerBytes,backupFileInfo,BackupFileInfo.getSchema(),false);
tableToInfo.put(tableName,backupFileInfo);
}
return tableToInfo;
}
项目:Equella
文件:LtiConsumerUserStateHook.java
/**
* The workaround for Moodle and Canvas OAuth.<br>
* If we have a duplicate,and it came from Moodle,it's worth presuming a
* different reality applies. Hopefully by version moodle-3 they'll have
* fixed this. ext_lms for moodle 2.3,2.4,2.5 was literally "moodle-2".
* Use startsWith in case future moodle 2.x has an extended string. Read:
* Dodgical hax
*
* @param request
* @return
*/
@Override
protected OAuthMessage getOAuthMessage(HttpServletRequest request)
{
boolean dupe = false;
String extlms = request.getParameter(ExternalToolConstants.EXT_LMS);
String product = request.getParameter(ExternalToolConstants.TOOL_CONSUMER_INFO_PRODUCT_FAMILY_CODE);
Set<Entry<String,String[]>> params = request.getParameterMap().entrySet();
Map<String,String> newParams = Maps.newHashMap();
if( "canvas".equalsIgnoreCase(product)
|| (extlms != null && extlms.startsWith("moodle-2") && "moodle".equalsIgnoreCase(product))
//hack for canvas ContentItemPlacements
|| (request.getParameter("lti_message_type") != null
&& request.getParameter("lti_message_type").equals("ContentItemSelectionRequest")) )
{
for( Entry<String,String[]> p : params )
{
String[] values = p.getValue();
if( values.length == 2 && Objects.equal(values[0],values[1]) )
{
dupe = true;
}
newParams.put(p.getKey(),values[0]);
}
if( dupe )
{
return new OAuthMessage(request.getMethod(),urlService.getUriForRequest(request,null).toString(),newParams.entrySet());
}
}
return OAuthServlet.getMessage(request,null).toString());
}
项目:hadoop
文件:ClientDatanodeProtocolTranslatorPB.java
@Override
public ReconfigurationTaskStatus getReconfigurationStatus() throws IOException {
GetReconfigurationStatusResponseProto response;
Map<PropertyChange,Optional<String>> statusMap = null;
long startTime;
long endTime = 0;
try {
response = rpcProxy.getReconfigurationStatus(NULL_CONTROLLER,VOID_GET_RECONFIG_STATUS);
startTime = response.getStartTime();
if (response.hasEndTime()) {
endTime = response.getEndTime();
}
if (response.getChangesCount() > 0) {
statusMap = Maps.newHashMap();
for (GetReconfigurationStatusConfigChangeProto change :
response.getChangesList()) {
PropertyChange pc = new PropertyChange(
change.getName(),change.getNewValue(),change.getOldValue());
String errorMessage = null;
if (change.hasErrorMessage()) {
errorMessage = change.getErrorMessage();
}
statusMap.put(pc,Optional.fromNullable(errorMessage));
}
}
} catch (ServiceException e) {
throw ProtobufHelper.getRemoteException(e);
}
return new ReconfigurationTaskStatus(startTime,endTime,statusMap);
}
项目:dremio-oss
文件:TestStorageBasedHiveAuthorization.java
private static Map<String,String> getHivePluginConfig() {
final Map<String,String> hiveConfig = Maps.newHashMap();
hiveConfig.put(METASTOREURIS.varname,hiveConf.get(METASTOREURIS.varname));
hiveConfig.put(FS_DEFAULT_NAME_KEY,dfsConf.get(FS_DEFAULT_NAME_KEY));
hiveConfig.put(HIVE_SERVER2_ENABLE_DOAS.varname,hiveConf.get(HIVE_SERVER2_ENABLE_DOAS.varname));
hiveConfig.put(METASTORE_EXECUTE_SET_UGI.varname,hiveConf.get(METASTORE_EXECUTE_SET_UGI.varname));
return hiveConfig;
}
项目:CustomWorldGen
文件:ItemOverride.java
protected Map<ResourceLocation,Float> makeMapResourceValues(JsonObject p_188025_1_)
{
Map<ResourceLocation,Float> map = Maps.<ResourceLocation,Float>newLinkedHashMap();
JsonObject jsonobject = JsonUtils.getJsonObject(p_188025_1_,"predicate");
for (Entry<String,JsonElement> entry : jsonobject.entrySet())
{
map.put(new ResourceLocation((String)entry.getKey()),Float.valueOf(JsonUtils.getFloat((JsonElement)entry.getValue(),(String)entry.getKey())));
}
return map;
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。