项目:apollo-custom
文件:DefaultRolePermissionService.java
/**
* Create permissions,note that permissionType + targetId should be unique
*/
@Transactional
public Set<Permission> createPermissions(Set<Permission> permissions) {
Multimap<String,String> targetIdPermissionTypes = HashMultimap.create();
for (Permission permission : permissions) {
targetIdPermissionTypes.put(permission.getTargetId(),permission.getPermissionType());
}
for (String targetId : targetIdPermissionTypes.keySet()) {
Collection<String> permissionTypes = targetIdPermissionTypes.get(targetId);
List<Permission> current =
permissionRepository.findByPermissionTypeInAndTargetId(permissionTypes,targetId);
Preconditions.checkState(CollectionUtils.isEmpty(current),"Permission with permissionType %s targetId %s already exists!",permissionTypes,targetId);
}
Iterable<Permission> results = permissionRepository.save(permissions);
return FluentIterable.from(results).toSet();
}
/**
* Binarize embeddings as described in "Revisiting Embedding Features for Simple Semi-supervised Learning" (Guo et al. 2014).
* Output is a map of indices,where negative-valued indices are negative,and positive-valued indices are positive. Indices
* start at 1,so as to avoid loss of @R_597_4045@ion on 0.
*
* @param embeddings map from identifiers onto corresponding vectors
* @return map from identifiers onto indices
*/
public static Multimap<String,Integer> binarize(Map<String,float[]> embeddings) {
float[] posMean = filteredMean(embeddings.values(),v -> v >= 0);
float[] negMean = filteredMean(embeddings.values(),v -> v < 0);
Multimap<String,Integer> binarizedEmbeddings = HashMultimap.create();
for (Map.Entry<String,float[]> embedding : embeddings.entrySet()) {
int index = 0;
for (float val : embedding.getValue()) {
if (val > posMean[index]) {
binarizedEmbeddings.put(embedding.getKey(),-(index + 1));
} else if (val < negMean[index]) {
binarizedEmbeddings.put(embedding.getKey(),index + 1);
}
++index;
}
}
return binarizedEmbeddings;
}
项目:n4js
文件:N4HeadlessCompiler.java
private void configureResourceSetContainerState(final List<N4JSProject> allProjects) {
// a container is a project.
List<String> containers = new LinkedList<>();
BiMap<String,N4JSProject> container2project = HashBiMap.create();
// the URIs of all resources directly contained in a project/container.
Multimap<String,URI> container2Uris = HashMultimap.create();
for (N4JSProject project : allProjects) {
String container = FileBasedWorkspace.N4FBPRJ + project.getLocation();
container2project.put(container,project);
containers.add(container);
for (IN4JSSourceContainer sourceContainer : project.getSourceContainers()) {
Iterables.addAll(container2Uris.get(container),sourceContainer);
}
}
// Define the Mapping of Resources (URIs to Container === Projects),rsbAcs.configure(containers,container2Uris);
}
项目:n4js
文件:ProjectLocationAwareWorkingSetManager.java
private Multimap<String,IProject> initProjectLocation() {
final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
final IProject[] projects = root.getProjects();
final Multimap<String,IProject> locations = HashMultimap.create();
// initialize the repository paths
repositoryPaths = repositoriesProvider.getWorkspaceRepositories().stream()
.map(r -> r.getDirectory().getParentFile().toPath()).collect(Collectors.toSet());
for (final IProject project : projects) {
if (isRemoteEditNature(project)) {
continue;
}
final String pair = getWorkingSetId(project);
locations.put(pair,project);
}
return locations;
}
/**
* Builds a map of {@link Segment}s and their edges in the {@link Subgraph} for either the incoming or
* outgoing {@link Edge}s.
* <p>
* {@link DummyEdge}s will not be added but their original edge,for which they are a diversion,will be added.
*
* @param subgraph the {@link Subgraph}
* @param sequenceDirection the {@link SequenceDirection}
* @return map of {@link Edge}s for each {@link Segment}
*/
private Multimap<GfaNode,Edge> buildEdgeMap(final Subgraph subgraph,final SequenceDirection sequenceDirection) {
final Multimap<GfaNode,Edge> edgeMap = HashMultimap.create();
subgraph.getGfaNodes().forEach(segment -> {
final Set<Edge> edges = sequenceDirection.ternary(segment.getIncomingEdges(),segment.getoutgoingEdges());
edges.forEach(edge -> {
if (edge instanceof DummyEdge) {
edgeMap.put(segment,((DummyEdge) edge).getoriginalEdge());
} else {
edgeMap.put(segment,edge);
}
});
});
return edgeMap;
}
项目:athena
文件:DefaultRouter.java
@Activate
public void activate() {
ribTable4 = new ConcurrentInvertedRadixTree<>(
new DefaultByteArrayNodeFactory());
ribTable6 = new ConcurrentInvertedRadixTree<>(
new DefaultByteArrayNodeFactory());
routesWaitingOnArp = Multimaps.synchronizedSetMultimap(
HashMultimap.create());
coreService.registerapplication(ROUTER_APP_ID);
bgpUpdatesExecutor = Executors.newSingleThreadExecutor(
new ThreadFactoryBuilder()
.setNameFormat("rib-updates-%d").build());
}
public static disabledamageModule parse(MapModuleContext context,Logger logger,Document doc) throws InvalidXMLException {
SetMultimap<damageCause,PlayerRelation> causes = HashMultimap.create();
for(Element damageCauseElement : doc.getRootElement().getChildren("disabledamage")) {
for(Element damageEl : damageCauseElement.getChildren("damage")) {
damageCause cause = XMLUtils.parseEnum(damageEl,damageCause.class,"damage type");
for(PlayerRelation damagerType : PlayerRelation.values()) {
// Legacy Syntax used "other" instead of "neutral"
String attrName = damagerType.name().toLowerCase();
Node attr = damagerType == PlayerRelation.NEUTRAL ? Node.fromAttr(damageEl,attrName,"other")
: Node.fromAttr(damageEl,attrName);
if(XMLUtils.parseBoolean(attr,true)) {
causes.put(cause,damagerType);
// Bukkit 1.7.10 changed TNT from BLOCK_EXPLOSION to ENTITY_EXPLOSION,// so we include them both to keep old maps working.
if(cause == damageCause.BLOCK_EXPLOSION) {
causes.put(damageCause.ENTITY_EXPLOSION,damagerType);
}
}
}
}
}
return new disabledamageModule(causes);
}
项目:Backmemed
文件: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
{
SoundSy@R_502_6063@Config.addLibrary(LibraryLWJGLOpenAL.class);
SoundSy@R_502_6063@Config.setCodec("ogg",CodecJOrbis.class);
}
catch (SoundSy@R_502_6063@Exception soundsy@R_502_6063@exception)
{
LOGGER.error(LOG_MARKER,(String)"Error linking with the LibraryJavaSound plug-in",(Throwable)soundsy@R_502_6063@exception);
}
}
项目:dremio-oss
文件:ScanResult.java
/**
* merges this and other together into a new result object
* @param other
* @return the resulting merge
*/
public ScanResult merge(ScanResult other) {
final Multimap<String,ChildClassDescriptor> newImpls = HashMultimap.create();
for (Collection<ParentClassDescriptor> impls : asList(implementations,other.implementations)) {
for (ParentClassDescriptor c : impls) {
newImpls.putAll(c.getName(),c.getChildren());
}
}
List<ParentClassDescriptor> newImplementations = new ArrayList<>();
for (Entry<String,Collection<ChildClassDescriptor>> entry : newImpls.asMap().entrySet()) {
newImplementations.add(new ParentClassDescriptor(entry.getKey(),new ArrayList<>(entry.getValue())));
}
return new ScanResult(
merge(scannedPackages,other.scannedPackages),merge(scannedClasses,other.scannedClasses),merge(scannedAnnotations,other.scannedAnnotations),merge(annotatedClasses,other.annotatedClasses),newImplementations);
}
项目:atlas
文件:NativeSoUtils.java
/**
* Verify the directory of the so file under the abi
*
* @param supportAbis
* @param removeSoFiles
* @param dirs
* @return
*/
public static Map<String,Multimap<String,File>> getAbiSoFiles(Set<String> supportAbis,Set<String> removeSoFiles,List<File> dirs) {
Map<String,File>> result = new HashMap<String,File>>();
IOFileFilter filter = new NativeSoFilter(supportAbis,removeSoFiles);
for (File dir : dirs) {
Collection<File> files = FileUtils.listFiles(dir,filter,TrueFileFilter.TRUE);
for (File file : files) {
File parentFolder = file.getParentFile();
String parentName = parentFolder.getName();
String shortName = getSoShortName(file);
Multimap<String,File> maps = result.get(parentName);
if (null == maps) {
maps = HashMultimap.create(10,3);
}
maps.put(shortName,file);
result.put(parentName,maps);
}
}
return result;
}
项目:BaseClient
文件:SoundManager.java
public SoundManager(SoundHandler p_i45119_1_,GameSettings p_i45119_2_)
{
this.invPlayingSounds = ((BiMap)this.playingSounds).inverse();
this.playingSoundPoolEntries = Maps.<ISound,SoundPoolEntry>newHashMap();
this.categorySounds = HashMultimap.<SoundCategory,Integer>newHashMap();
this.sndHandler = p_i45119_1_;
this.options = p_i45119_2_;
try
{
SoundSy@R_502_6063@Config.addLibrary(LibraryLWJGLOpenAL.class);
SoundSy@R_502_6063@Config.setCodec("ogg",CodecJOrbis.class);
}
catch (SoundSy@R_502_6063@Exception soundsy@R_502_6063@exception)
{
logger.error(LOG_MARKER,(Throwable)soundsy@R_502_6063@exception);
}
}
项目:spring2ts
文件:AnnotationUtils.java
public static Multimap<String,String> getAnnotationAsMap(org.jboss.forge.roaster.model.Annotation<?> annotation,Class<? extends Annotation> type) {
if(annotation == null) return null;
List<Method> methods = getAnnotationAttributes(type);
Multimap<String,String> result = HashMultimap.create();
for (Method method : methods) {
String name = method.getName();
boolean array = method.getReturnType().isArray();
String value = annotation.getLiteralValue(name);
if(StringUtils.isBlank(value)) continue;
String [] values = array
? annotation.getStringArrayValue(name) : new String[]{annotation.getStringValue(name)};
if(allElementsNull(values)) continue;
result.putAll(name,Arrays.asList(values));
}
return result;
}
项目:abhot
文件:SetMultimapDeserializer.java
@Override
public SetMultimap<String,String> deserialize(JsonElement json,Type typeOfT,JsonDeserializationContext context) throws JsonParseException
{
SetMultimap<String,String> map = HashMultimap.create();
JsonObject filters = json.getAsJsonObject();
for (Map.Entry<String,JsonElement> filter : filters.entrySet())
{
String name = filter.getKey();
JsonArray values = ((JsonArray)filter.getValue());
for (JsonElement value : values)
{
map.put(name,value.getAsstring());
}
}
return map;
}
项目:MicroServiceProject
文件:SparseTensor.java
/**
* Construct a sparse tensor with indices and values
*
* @param dims
* dimensions of a tensor
* @param nds
* n-dimensional keys
* @param vals
* entry values
*/
@SuppressWarnings("unchecked")
public SparseTensor(int[] dims,List<Integer>[] nds,List<Double> vals) {
if (dims.length < 3)
throw new Error("The dimension of a tensor cannot be smaller than 3!");
numDimensions = dims.length;
dimensions = new int[numDimensions];
ndKeys = (List<Integer>[]) new List<?>[numDimensions];
keyIndices = (Multimap<Integer,Integer>[]) new Multimap<?,?>[numDimensions];
for (int d = 0; d < numDimensions; d++) {
dimensions[d] = dims[d];
ndKeys[d] = nds == null ? new ArrayList<Integer>() : new ArrayList<Integer>(nds[d]);
keyIndices[d] = HashMultimap.create();
}
values = vals == null ? new ArrayList<Double>() : new ArrayList<>(vals);
indexedDimensions = new ArrayList<>(numDimensions);
}
项目:MicroServiceProject
文件:SparseTensor.java
/**
* retrieve a rating matrix from the tensor. Warning: it assumes there is at most one entry for each (user,item)
* pair.
*
* @return a sparse rating matrix
*/
public SparseMatrix rateMatrix() {
Table<Integer,Integer,Double> dataTable = HashBasedTable.create();
Multimap<Integer,Integer> colMap = HashMultimap.create();
for (TensorEntry te : this) {
int u = te.key(userDimension);
int i = te.key(itemDimension);
dataTable.put(u,i,te.get());
colMap.put(i,u);
}
return new SparseMatrix(dimensions[userDimension],dimensions[itemDimension],dataTable,colMap);
}
/**
* Constructor.
*/
public RemoteConfigLongPollService() {
m_longPollFailSchedulePolicyInSecond = new ExponentialSchedulePolicy(1,120); //in second
m_longPollingStopped = new AtomicBoolean(false);
m_longPollingService = Executors.newSingleThreadExecutor(
ApolloThreadFactory.create("RemoteConfigLongPollService",true));
m_longPollStarted = new AtomicBoolean(false);
m_longPollNamespaces =
Multimaps.synchronizedSetMultimap(HashMultimap.<String,RemoteConfigRepository>create());
m_notifications = Maps.newConcurrentMap();
m_remoteNotificationMessages = Maps.newConcurrentMap();
m_responseType = new Typetoken<List<ApolloConfigNotification>>() {
}.getType();
gson = new Gson();
m_configUtil = ApolloInjector.getInstance(ConfigUtil.class);
m_httpUtil = ApolloInjector.getInstance(HttpUtil.class);
m_serviceLocator = ApolloInjector.getInstance(ConfigServiceLocator.class);
m_longPollRateLimiter = RateLimiter.create(m_configUtil.getLongPollQPS());
}
项目:Leveled-Storage
文件:HashMultimapStorage.java
@Override
public void readGeneric(DataInputStream input,StorageObject... generic) throws IOException {
int size = input.readInt();
setValue(HashMultimap.create());
for(int i = 0; i < size; i++) {
int len = input.readInt();
K key = (K) generic[0].delegate();
key.read(input);
for(int j = 0; j < len; j++) {
V value = (V) generic[1].delegate();
value.read(input);
getValue().put(key,value);
}
}
}
项目:wayf-cloud
文件:DeviceAccessFacadeImpl.java
private Completable inflatePublishers(Iterable<DeviceAccess> deviceAccesss,DeviceAccessQuery query) {
// Return as complete if publisher is not a requested field
if (query.getInflationPolicy() == null || !query.getInflationPolicy().hasChildField(DeviceAccessQuery.PUBLISHER_FIELD)) {
return Completable.complete();
}
Multimap<Long,DeviceAccess> deviceAccesssByPublisherId = HashMultimap.create();
return Observable.fromIterable(deviceAccesss)
// Filter out publisher sessions with no publisher
.filter((deviceAccess) -> deviceAccess.getPublisher() != null && deviceAccess.getPublisher().getId() != null)
// Collect all of the publisher sessions and their publisher IDs into a map
.collectInto(deviceAccesssByPublisherId,(map,deviceAccess) -> map.put(deviceAccess.getPublisher().getId(),deviceAccess))
// Fetch all of the publishers for those publisher IDs
.flatMapObservable((map) -> map.keySet().isEmpty()? Observable.empty() : publisherFacade.filter(new PublisherQuery().ids(map.keySet())))
// For each publisher returned,map it to each publisher session that had its ID
.flatMapCompletable((publisher) ->
Observable.fromIterable(deviceAccesssByPublisherId.get(publisher.getId()))
.flatMapCompletable((deviceAccess) ->
Completable.fromAction(() -> deviceAccess.setPublisher(publisher))
)
);
}
项目:wayf-cloud
文件:DeviceAccessFacadeImpl.java
private Completable inflateIdentityProviders(Iterable<DeviceAccess> deviceAccesss,DeviceAccessQuery query) {
// Return as complete if authenticatedBy is not a requested field
if (query.getInflationPolicy() == null || !query.getInflationPolicy().hasChildField(DeviceAccessQuery.IDENTITY_PROVIDER)) {
return Completable.complete();
}
Multimap<Long,DeviceAccess> deviceAccesssByIdpId = HashMultimap.create();
return Observable.fromIterable(deviceAccesss)
// Filter out publisher sessions with no publisher
.filter((deviceAccess) -> deviceAccess.getIdentityProvider() != null && deviceAccess.getIdentityProvider().getId() != null)
// Collect all of the publisher sessions and their identity provider IDs into a map
.collectInto(deviceAccesssByIdpId,deviceAccess) -> map.put(deviceAccess.getIdentityProvider().getId(),deviceAccess))
// Fetch all of the publishers for those publisher IDs
.flatMapObservable((map) -> map.keySet().isEmpty()? Observable.empty() : identityProviderFacade.filter(new IdentityProviderQuery().ids(map.keySet())))
// For each identity provider returned,map it to each publisher session that had its ID
.flatMapCompletable((identityProvider) ->
Observable.fromIterable(deviceAccesssByIdpId.get(identityProvider.getId()))
.flatMapCompletable((deviceAccess) ->
Completable.fromAction(() -> deviceAccess.setIdentityProvider(identityProvider))
)
);
}
项目:apollo-custom
文件:WatchKeysUtil.java
private Multimap<String,String> findPublicConfigWatchKeys(String applicationId,String clusterName,Set<String> namespaces,String dataCenter) {
Multimap<String,String> watchedKeysMap = HashMultimap.create();
List<AppNamespace> appNamespaces = appNamespaceService.findPublicNamespacesByNames(namespaces);
for (AppNamespace appNamespace : appNamespaces) {
//check whether the namespace's appId equals to current one
if (Objects.equals(applicationId,appNamespace.getAppId())) {
continue;
}
String publicConfigAppId = appNamespace.getAppId();
watchedKeysMap.putAll(appNamespace.getName(),assembleWatchKeys(publicConfigAppId,clusterName,appNamespace.getName(),dataCenter));
}
return watchedKeysMap;
}
项目:OperatieBRP
文件:ActueelBepaling.java
private Multimap<MetaObject,MetaRecord> bepaalActueleRecords(final MetaObject persoonObject) {
final Multimap<MetaObject,MetaRecord> records = HashMultimap.create();
persoonObject.accept(new ParentFirstModelVisitor() {
@Override
protected void doVisit(final MetaRecord record) {
final VerantwoordingCategorie verantwoordingCategorie = record.getParentGroep().getGroepElement().getVerantwoordingCategorie();
final Booleansupplier actueelActieRecord = () -> verantwoordingCategorie == VerantwoordingCategorie.A
&& record.getActieVerval() == null && record.getDatumEindeGeldigheid() == null;
final Booleansupplier actueelDienstRecord = () -> verantwoordingCategorie == VerantwoordingCategorie.D
&& record.getDatumTijdVerval() == null;
if (verantwoordingCategorie == VerantwoordingCategorie.G || actueelActieRecord.getAsBoolean() || actueelDienstRecord.getAsBoolean()) {
records.put(record.getParentGroep().getParentObject(),record);
}
}
});
return records;
}
/**
* Bouwt het MetaObject.
* @param parentObject het parent Meta object
* @return het MetaObject
*/
MetaObject build(final MetaObject parentObject) {
final MetaObject gebouwdobject = new MetaObject();
gebouwdobject.parentObject = parentObject;
gebouwdobject.objectsleutel = objectsleutel;
gebouwdobject.objectElement = objectElement;
final Multimap<ObjectElement,MetaObject> tempObjectenMap = HashMultimap.create();
for (final Builder builder : objectBuilderList) {
final MetaObject object = builder.build(gebouwdobject);
tempObjectenMap.put(object.getobjectElement(),object);
}
gebouwdobject.elementObjectMap = ImmutableMultimap.copyOf(tempObjectenMap);
gebouwdobject.objecten = ImmutableSet.copyOf(tempObjectenMap.values());
final Map<GroepElement,MetaGroep> tempGroepenMap = Maps.newHashMap();
for (final MetaGroep.Builder groepBuilder : groepBuilderList) {
final MetaGroep groep = groepBuilder.build(gebouwdobject);
tempGroepenMap.put(groep.getGroepElement(),groep);
}
gebouwdobject.elementGroepMap = ImmutableMap.copyOf(tempGroepenMap);
gebouwdobject.groepen = ImmutableSet.copyOf(tempGroepenMap.values());
return gebouwdobject;
}
项目:GitHub
文件:HashMultimapTest.java
public void test_for_multimap() throws Exception {
HashMultimap map = HashMultimap.create();
map.put("name","a");
map.put("name","b");
String json = JSON.toJSONString(map);
assertEquals("{\"name\":[\"a\",\"b\"]}",json);
}
项目:GitHub
文件:Gsons.java
public Iterable<TypeAdapterTypes> typeAdapters() {
Map<AbstractDeclaring,GsonMirrors.TypeAdapters> mirrors = Maps.newHashMap();
Multimap<AbstractDeclaring,ValueType> byDeclaring = HashMultimap.create();
for (ValueType value : values().values()) {
Protoclass protoclass = value.constitution.protoclass();
if (protoclass.kind().isValue()) {
Optional<AbstractDeclaring> typeAdaptersProvider = protoclass.typeAdaptersProvider();
if (typeAdaptersProvider.isPresent()) {
AbstractDeclaring key = typeAdaptersProvider.get();
mirrors.put(key,key.typeAdapters().get());
byDeclaring.put(key,value);
} else if (protoclass.gsonTypeAdapters().isPresent()
&& protoclass.declaringType().isPresent()) {
DeclaringType topLevel = protoclass.declaringType().get().associatedTopLevel();
mirrors.put(topLevel,protoclass.gsonTypeAdapters().get());
byDeclaring.put(topLevel,value);
}
}
}
ImmutableList.Builder<TypeAdapterTypes> builder = ImmutableList.builder();
for (Entry<AbstractDeclaring,Collection<ValueType>> entry : byDeclaring.asMap().entrySet()) {
String pack = Iterables.get(entry.getValue(),0).$$package();
builder.add(ImmutableTypeAdapterTypes.builder()
.definedBy(entry.getKey())
.mirror(mirrors.get(entry.getKey()))
.packageGenerated(pack)
.addAllTypes(entry.getValue())
.build());
}
return builder.build();
}
项目:clearwsd
文件:VerbNetExperiment.java
private static List<NlpFocus<DepNode,DepTree>> filterpolysemous(
List<NlpFocus<DepNode,DepTree>> data) {
Multimap<String,String> labelMap = HashMultimap.create();
for (NlpFocus<DepNode,DepTree> instance : data) {
String predicate = instance.focus().feature(FeatureType.Predicate);
labelMap.put(predicate,instance.feature(FeatureType.Gold));
}
return data.stream()
.filter(instance -> labelMap.get(instance.focus().feature(FeatureType.Predicate)).size() > 1)
.collect(Collectors.toList());
}
项目:n4js
文件:TestTreeTransformerTest.java
/***/
@Test
public void testMultipleSuitesWithMultipleTestCases() {
final Multimap<String,String> map = HashMultimap.create();
map.put("suite.name.b","test.case.g");
map.put("suite.name.b","test.case.h");
map.put("suite.name.a","test.case.b");
map.put("suite.name.a","test.case.a");
map.put("suite.name.a","test.case.c");
map.put("suite.name.c","test.case.z");
map.put("suite.name.c","test.case.x");
map.put("suite.name.c","test.case.y");
final String actual = asstring(transformer.apply(createTestTree(map)));
assertContains(actual,"\"endpoint\":\"http://localhost:9415\"");
assertContains(actual,"\"testMethods\":[\"test.case.g\",\"test.case.h\"]");
assertContains(actual,"\"testMethods\":[\"test.case.a\",\"test.case.b\",\"test.case.c\"]");
assertContains(actual,"\"testMethods\":[\"test.case.x\",\"test.case.y\",\"test.case.z\"]");
assertTrue(actual.indexOf("suite.name.a") > 0);
assertTrue(actual.indexOf("suite.name.b") > 0);
assertTrue(actual.indexOf("suite.name.c") > 0);
assertTrue(actual.indexOf("suite.name.a") < actual.indexOf("suite.name.b"));
assertTrue(actual.indexOf("suite.name.b") < actual.indexOf("suite.name.c"));
assertTrue(actual.indexOf("suite.name.a") < actual.indexOf("suite.name.c"));
}
项目:n4js
文件:SelectAllProjectExplorer_PluginUITest.java
@Override
@Before
public void setUp() throws Exception {
super.setUp();
waitForIdleState();
projectExplorer = (ProjectExplorer) showView(ProjectExplorer.VIEW_ID);
waitForUiThread();
assertNotNull("Cannot show Project Explorer.",projectExplorer);
commonViewer = projectExplorer.getCommonViewer();
assertFalse("Expected projects as top level elements in navigator.",broker.isWorkingSetTopLevel());
assertNull(
"Select working set drop down contribution was visible when projects are configured as top level elements.",getWorkingSetDropDownContribution());
final Multimap<ProjectType,String> typeNamesMapping = HashMultimap.create();
typeNamesMapping.putAll(LIBRARY,LIBRARY_PROJECTS);
typeNamesMapping.putAll(TEST,TEST_PROJECTS);
for (final Entry<ProjectType,Collection<String>> entry : typeNamesMapping.asMap().entrySet()) {
for (final String projectName : entry.getValue()) {
createN4JSProject(projectName,entry.getKey());
}
}
// Actually close "Closed*" projects
closeProject("ClosedL2");
closeProject("ClosedT2");
// Wait for workbench to reflect project changes
waitForIdleState();
commonViewer.refresh();
// disable auto-building,as there is no real code to build involved
ResourcesPlugin.getWorkspace().getDescription().setAutoBuilding(false);
}
/**
* Creates a mapping between the container module URI and the actual URIs. Consider cases when the list contains two
* locations URIs from two methods in the same class Then this method will return with multimap where the single key
* is the location to the container module and the value is the two method URIs.
*/
private HashMultimap<URI,URI> createTestLocationMapping(List<URI> testLocations) {
HashMultimap<URI,URI> moduleUris2testUris = HashMultimap.create();
for (final URI testLocation : testLocations) {
moduleUris2testUris.put(testLocation.trimFragment(),testLocation);
}
return moduleUris2testUris;
}
项目:guava-mock
文件:SubscriberRegistry.java
/**
* Returns all subscribers for the given listener grouped by the type of event they subscribe to.
*/
private Multimap<Class<?>,Subscriber> findAllSubscribers(Object listener) {
Multimap<Class<?>,Subscriber> methodsInListener = HashMultimap.create();
Class<?> clazz = listener.getClass();
for (Method method : getAnnotatedMethods(clazz)) {
Class<?>[] parameterTypes = method.getParameterTypes();
Class<?> eventType = parameterTypes[0];
methodsInListener.put(eventType,Subscriber.create(bus,listener,method));
}
return methodsInListener;
}
public Multimap<String,AttributeModifier> getAttributeModifiers()
{
Multimap<String,AttributeModifier> multimap;
if (this.hasTagCompound() && this.stackTagCompound.hasKey("AttributeModifiers",9))
{
multimap = HashMultimap.<String,AttributeModifier>create();
NBTTagList nbttaglist = this.stackTagCompound.getTagList("AttributeModifiers",10);
for (int i = 0; i < nbttaglist.tagCount(); ++i)
{
NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
AttributeModifier attributemodifier = SharedMonsterattributes.readAttributeModifierFromNBT(nbttagcompound);
if (attributemodifier != null && attributemodifier.getID().getLeastSignificantBits() != 0L && attributemodifier.getID().getMostSignificantBits() != 0L)
{
multimap.put(nbttagcompound.getString("AttributeName"),attributemodifier);
}
}
}
else
{
multimap = this.getItem().getItemAttributeModifiers();
}
return multimap;
}
项目:atlas
文件:PostProcessManifestAction.java
private Multimap<String,File> getlibmanifestDepenendyMap() {
Multimap<String,File> maps = HashMultimap.create();
List<? extends AndroidLibrary> libs = getAwbLibraries();
if (libs == null || libs.isEmpty()) {
return maps;
}
for (AndroidLibrary mdi : libs) {
for (AndroidLibrary childLib : mdi.getLibraryDependencies()) {
((HashMultimap<String,File>)maps).put(mdi.getName(),childLib.getManifest());
}
}
return maps;
}
项目:athena
文件:Vpls.java
/**
* Computes the list of configured interfaces with a VLAN Id.
*
* @return the interfaces grouped by vlan id
*/
protected SetMultimap<VlanId,ConnectPoint> getConfigCPoints() {
log.debug("Checking interface configuration");
SetMultimap<VlanId,ConnectPoint> confCPointsByVlan =
HashMultimap.create();
interfaceService.getInterfaces()
.stream()
.filter(intf -> intf.ipAddressesList().isEmpty())
.forEach(intf -> confCPointsByVlan.put(intf.vlan(),intf.connectPoint()));
return confCPointsByVlan;
}
项目:athena
文件:Vpls.java
/**
* Checks if for any ConnectPoint configured there's an host present
* and in case it associate them together.
*
* @param confCPointsByVlan the configured ConnectPoints grouped by vlan id
* @return the configured ConnectPoints with eventual hosts associated.
*/
protected SetMultimap<VlanId,Pair<ConnectPoint,MacAddress>> pairAvailableHosts(
SetMultimap<VlanId,ConnectPoint> confCPointsByVlan) {
log.debug("Binding connected hosts mac addresses");
SetMultimap<VlanId,MacAddress>> confHostPresentCPoint =
HashMultimap.create();
confCPointsByVlan.entries()
.forEach(e -> bindMacAddr(e,confHostPresentCPoint));
return confHostPresentCPoint;
}
项目:hadoop
文件:TestShortCircuitCache.java
static private void checkNumberOfSegmentsAndSlots(final int expectedSegments,final int expectedSlots,ShortCircuitRegistry registry) {
registry.visit(new ShortCircuitRegistry.Visitor() {
@Override
public void accept(HashMap<ShmId,RegisteredShm> segments,HashMultimap<ExtendedBlockId,Slot> slots) {
Assert.assertEquals(expectedSegments,segments.size());
Assert.assertEquals(expectedSlots,slots.size());
}
});
}
项目:Equella
文件:NotificationPreferencesServiceImpl.java
private Multimap<String,String> asMultiMap(Map<String,String> allWatched) {
Multimap<String,String> colMap = HashMultimap.create();
for( Entry<String,String> entry : allWatched.entrySet() )
{
String pref = entry.getValue();
String userId = entry.getKey();
Set<String> colUuids = getCollectionsFromPref(pref);
for( String colUuid : colUuids )
{
colMap.put(colUuid,userId);
}
}
return colMap;
}
项目:Thermionics
文件:BlockPotStill.java
@Override
public Multimap<String,AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot,ItemStack stack) {
Multimap<String,AttributeModifier> modifiers = HashMultimap.create();
if (slot==EntityEquipmentSlot.HEAD) {
modifiers.put(
SharedMonsterattributes.ARMOR.getName(),new AttributeModifier(UUID.fromString("2AD3F246-FEE1-4E67-B886-69FD380BB150"),"Armor modifier",3D,0)
);
}
return modifiers;
}
项目:apollo-custom
文件:GrayReleaseRulesHolder.java
public GrayReleaseRulesHolder() {
loadVersion = new AtomicLong();
grayReleaseRuleCache = Multimaps.synchronizedSetMultimap(HashMultimap.create());
reversedGrayReleaseRuleCache = Multimaps.synchronizedSetMultimap(HashMultimap.create());
executorService = Executors.newScheduledThreadPool(1,ApolloThreadFactory
.create("GrayReleaseRulesHolder",true));
}
项目:BaseClient
文件:ItemStack.java
public Multimap<String,attributemodifier);
}
}
}
else
{
multimap = this.getItem().getItemAttributeModifiers();
}
return multimap;
}
项目:javaide
文件:RemoteSdk.java
/**
* Fetches the remote list of packages.
* <p/>
* This respects the settings from the {@link SettingsController} which
* dictates whether the {@link DownloadCache} is used and whether HTTP
* is enforced over HTTPS.
* <p/>
* The call may block on network access. Callers will likely want to invoke this
* from a thread and make sure the logger is thread-safe with regard to UI updates.
*
* @param sources The sources to download from.
* @param logger A logger to report status & progress.
* @return A non-null map of {@link PkgType} to {@link RemotePkgInfo}
* describing the remote packages available for install/download.
*/
@NonNull
public Multimap<PkgType,RemotePkgInfo> fetch(@NonNull SdkSources sources,@NonNull ILogger logger) {
Multimap<PkgType,RemotePkgInfo> remotes = HashMultimap.create();
boolean forceHttp = mSettingsController.getSettings().getForceHttp();
// Implementation detail: right Now this reuses the SdkSource(s) classes
// from the sdk-repository v2. The problem with that is that the sources are
// mutable and hold the fetch logic and hold the packages array.
// Instead I'd prefer to have the sources be immutable descriptors and move
// the fetch logic here. Eventually my goal is to get rid of them
// and include the logic directly here instead but for right Now lets
// just start with what we have to avoid implementing it all at once.
// It does mean however that this code needs to convert the old Package
// type into the new RemotePkgInfo type.
for (SdkSource source : sources.getAllSources()) {
source.load(getDownloadCache(),new NullTaskMonitor(logger),forceHttp);
Package[] pkgs = source.getPackages();
if (pkgs == null || pkgs.length == 0) {
continue;
}
// Adapt the legacy Package instances into the new RemotePkgInfo
for (Package p : pkgs) {
IPkgDesc d = p.getPkgDesc();
RemotePkgInfo r = new RemotePkgInfo(d,source);
remotes.put(d.getType(),r);
}
}
return remotes;
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。