public ColumnFilter build()
{
boolean isFetchAll = Metadata != null;
PartitionColumns queried = queriedBuilder == null ? null : queriedBuilder.build();
// It's only ok to have queried == null in ColumnFilter if isFetchAll. So deal with the case of a selectionBuilder
// with nothing selected (we can at least happen on some backward compatible queries - CASSANDRA-10471).
if (!isFetchAll && queried == null)
queried = PartitionColumns.NONE;
SortedSetMultimap<ColumnIdentifier,ColumnSubselection> s = null;
if (subSelections != null)
{
s = TreeMultimap.create(Comparator.<ColumnIdentifier>naturalOrder(),Comparator.<ColumnSubselection>naturalOrder());
for (ColumnSubselection subSelection : subSelections)
s.put(subSelection.column().name,subSelection);
}
return new ColumnFilter(isFetchAll,Metadata,queried,s);
}
项目:Reer
文件:AggregateMultiProjectTaskReportModel.java
public void build() {
groups = TreeMultimap.create(new Comparator<String>() {
public int compare(String string1,String string2) {
return string1.comparetoIgnoreCase(string2);
}
},new Comparator<TaskDetails>() {
public int compare(TaskDetails task1,TaskDetails task2) {
return task1.getPath().compareto(task2.getPath());
}
});
for (TaskReportModel project : projects) {
for (String group : project.getGroups()) {
if (isVisible(group)) {
for (final TaskDetails task : project.getTasksForGroup(group)) {
groups.put(group,mergeTasksWithSameName ? new MergedTaskDetails(task) : task);
}
}
}
}
}
项目:tifoon
文件:PortScannerStatsServiceImpl.java
private static Map<String,Map<String,Multimap<Protocol,Integer>>> mapOpenPorts(@NonNull final List<PropertyChange> _propertyChanges,@NonNull final PortScannerResult _portScannerResult) {
final Map<String,Integer>>> result = new TreeMap<>();
for(final PropertyChange propertyChange : _propertyChanges) {
final String networkId = getNetworkId(propertyChange,_portScannerResult);
final Pair<String,OpenHost> openHost = getopenHost(propertyChange,_portScannerResult);
final Port port = openHost.getValue().getopenPorts().get(Integer.parseInt(propertyChange.getKey()));
result.putIfAbsent(networkId,new TreeMap<>());
final Map<String,Integer>> openHostToOpenPortsMultimap = result.get(networkId);
openHostToOpenPortsMultimap.putIfAbsent(openHost.getKey(),TreeMultimap.create());
final Multimap<Protocol,Integer> openPortsMultimap = openHostToOpenPortsMultimap.get(openHost.getKey());
openPortsMultimap.put(port.getProtocol(),port.getPortNumber());
}
return result;
}
项目:fpm
文件:Geonames.java
private static TreeMultimap<Integer,AlternateName> alternateNames(String path) {
Stopwatch stopwatch = Stopwatch.createStarted();
TreeMultimap<Integer,AlternateName> multimap = TreeMultimap.create();
try (BufferedReader br = new BufferedReader(new FileReader(path))) {
for (String line = br.readLine(); line != null; line = br.readLine()) {
List<String> list = Splitter.on('\t').splitToList(line);
if ("fr".equals(list.get(2))) {
AlternateName name = new AlternateName(list.get(3),"1".equals(list.get(4)),"1".equals(list.get(5)),"1".equals(list.get(6)),"1".equals(list.get(7)));
multimap.put(parseInt(list.get(1)),name);
}
}
}
catch (IOException e) {
throw propagate(e);
}
log.info("Alternate names loaded: {}s",stopwatch.elapsed(SECONDS));
return multimap;
}
项目:fpm
文件:SignPosts.java
private static Multimap<Long,SignPostPath> spFile(TomtomFolder folder) {
File file = new File(folder.getFile("sp.dbf"));
Multimap<Long,SignPostPath> result = TreeMultimap.create();
if (!file.exists()) {
return result;
}
log.info("Reading SP {}",file);
try (DbfReader reader = new DbfReader(file)) {
DbfRow row;
while ((row = reader.nextRow()) != null) {
SignPostPath path = SignPostPath.fromrow(row);
result.put(path.getId(),path);
}
}
log.info("Loaded {} sign paths",result.size());
return result;
}
项目:fpm
文件:TdDbf.java
private Multimap<Long,TimeDomains> loadTimeDomains(String filename) {
Multimap<Long,TimeDomains> times = TreeMultimap.create();
File file = new File(filename);
if (!file.exists()) {
log.info("File not found : {}",file.getAbsolutePath());
return times;
}
log.info("Reading TD {}",file);
processDbf(file,row -> {
TimeDomains restriction = new TimeDomains(((Double)row[0]).longValue(),new String((byte[]) row[3]).trim());
times.put(restriction.getId(),restriction);
});
log.info("Loaded {} times domains",times.size());
return times;
}
项目:fpm
文件:HsprDbf.java
private static Map<Integer,PrecomputeSpeedProfile> loadSpeedProfiles(String filename) {
File file = new File(filename);
if (!file.exists()) {
log.info("File not found : {}",file.getAbsolutePath());
return newHashMap();
}
TreeMultimap<Integer,SpeedProfile> profilesMap = TreeMultimap.create();
log.info("Reading HSPR {}",file);
try (DbfReader reader = new DbfReader(file)) {
DbfRow row;
while ((row = reader.nextRow()) != null) {
SpeedProfile profile = new SpeedProfile(row.getInt("PROFILE_ID"),row.getInt("TIME_SLOT"),row.getDouble("REL_SP"));
profilesMap.put(profile.getId(),profile);
}
}
log.info("Loaded {} hspr",profilesMap.size());
return profilesMap.asMap().entrySet().stream().collect(toMap(Entry::getKey,e -> precomputeProfile(e.getValue())));
}
项目: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;
}
项目:Elasticsearch
文件:ExpressionFormatter.java
@Override
public String visitObjectLiteral(ObjectLiteral node,Void context) {
StringBuilder builder = new StringBuilder("{");
boolean first = true;
TreeMultimap<String,Expression> sorted = TreeMultimap.create(
Ordering.natural().nullsLast(),Ordering.usingToString().nullsLast()
);
sorted.putAll(node.values());
for (Map.Entry<String,Expression> entry : sorted.entries()) {
if (!first) {
builder.append(",");
} else {
first = false;
}
builder.append(formatIdentifier(entry.getKey()))
.append("= ")
.append(entry.getValue().accept(this,context));
}
return builder.append("}").toString();
}
项目:SubgraphIsomorphismIndex
文件:IsoUtils.java
/**
* Repartition subsequent partitions while the predicate is true
*
* This unifies three common use cases:
* - k = 0 : Do not repartition at all
* - k = 1 : Repartition the next largest equivalence class
* - k = null: Repartition all equivalence classes
*
*/
// public static <N,M> Entry<? extends Collection<M>,? extends Collection<M>>
// nextEquivClassRepartitionK(TreeMultimap<K,V> equivClasses,BiPredicate<Integer,Entry<? extends Collection<M>,? extends Collection<M>>>) {
// return null;
// }
//
public static <S> TreeMultimap<Long,Problem<S>> indexSolutionGeneratorsOld(Collection<Problem<S>> solGens) {
TreeMultimap<Long,Problem<S>> result = TreeMultimap.create();
for(Problem<S> solutionGenerator : solGens) {
long size = solutionGenerator.getEstimatedcost();
result.put(size,solutionGenerator);
}
return result;
}
项目:cakes
文件:TreeMultimapDemo.java
/**
* 基本数据类型的排序
*/
@Test
public void testCreate() {
TreeMultimap<String,Integer> treeMultimap = TreeMultimap.create();
treeMultimap.put("list_1",1);
treeMultimap.put("list_1",2);
treeMultimap.put("list_1",9);
treeMultimap.put("list_1",7);
treeMultimap.put("list_1",3);
treeMultimap.put("list_2",9);
treeMultimap.put("list_2",7);
// {list_1=[1,2,3,7,9],list_2=[7,9]}
System.out.println(treeMultimap);
}
项目:cakes
文件:TreeMultimapDemo.java
/**
* 测试 TreeMultimap,自定义数据结构的排序
*/
@Test
public void testSelfDataOrdered() {
// 创建TreeMultimap,使用Ordering.natural()指定自然排序,Ordering.from指定排序规则
// Order4TreeMultimap::compareto 是lambda的简写形式
TreeMultimap<String,Order4TreeMultimap> treeMultimap = TreeMultimap
.create(Ordering.natural(),Ordering.from(Order4TreeMultimap::compareto));
// 列表2
treeMultimap.put("order_list1",new Order4TreeMultimap(1,"haha1"));
treeMultimap.put("order_list1",new Order4TreeMultimap(5,"haha2"));
treeMultimap.put("order_list1",new Order4TreeMultimap(9,"haha3"));
treeMultimap.put("order_list1",new Order4TreeMultimap(10,new Order4TreeMultimap(22,"haha4"));
treeMultimap.put("order_list1",new Order4TreeMultimap(444,"haha5"));
// 列表2
treeMultimap.put("order_list2","haha3"));
treeMultimap.put("order_list2",new Order4TreeMultimap(3,"haha4"));
treeMultimap.put("order_list3",new Order4TreeMultimap(2,"haha5"));
// 输出
treeMultimap.forEach((key,order) -> System.out.println("key=" + key + ",order=" + order));
}
项目:CustomWorldGen
文件:Loader.java
private void identifyDuplicates(List<ModContainer> mods)
{
TreeMultimap<ModContainer,File> dupsearch = TreeMultimap.create(new ModIdComparator(),Ordering.arbitrary());
for (ModContainer mc : mods)
{
if (mc.getSource() != null)
{
dupsearch.put(mc,mc.getSource());
}
}
ImmutableMultiset<ModContainer> duplist = Multisets.copyHighestCountFirst(dupsearch.keys());
SetMultimap<ModContainer,File> dupes = LinkedHashMultimap.create();
for (Entry<ModContainer> e : duplist.entrySet())
{
if (e.getCount() > 1)
{
FMLLog.severe("Found a duplicate mod %s at %s",e.getElement().getModId(),dupsearch.get(e.getElement()));
dupes.putAll(e.getElement(),dupsearch.get(e.getElement()));
}
}
if (!dupes.isEmpty())
{
throw new DuplicateModsFoundException(dupes);
}
}
/**
* Generates a coverage multimap from split key to Regions that start with the
* split key.
*
* @return coverage multimap
*/
public Multimap<byte[],R> calcCoverage() {
// This needs to be sorted to force the use of the comparator on the values,// otherwise byte array comparison isn't used
Multimap<byte[],R> regions = TreeMultimap.create(BYTES_COMParaTOR,rangeCmp);
// march through all splits from the start points
for (Entry<byte[],Collection<R>> start : starts.asMap().entrySet()) {
byte[] key = start.getKey();
for (R r : start.getValue()) {
regions.put(key,r);
for (byte[] coveredSplit : splits.subSet(r.getStartKey(),specialEndKey(r))) {
regions.put(coveredSplit,r);
}
}
}
return regions;
}
项目:TRHS_Club_Mod_2016
文件:Loader.java
private void identifyDuplicates(List<ModContainer> mods)
{
TreeMultimap<ModContainer,dupsearch.get(e.getElement()));
}
}
if (!dupes.isEmpty())
{
throw new DuplicateModsFoundException(dupes);
}
}
项目:carrier
文件:MailResolverService.java
/**
* Chooses the best SMTP server,given a list of MX records.
* Todo: Actually choose the best record!
*
* @param records The MX records.
* @return An optional,possibly containing an SMTP server address.
*/
private Optional<String> chooseBestRecord(List<Record> records) {
TreeMultimap<Integer,String> recordMap = decodeRecords(records);
if(!recordMap.isEmpty()) {
List<String> topRecords = new LinkedList<>(recordMap.asMap().firstEntry().getValue());
if(!topRecords.isEmpty()) {
String record = topRecords.get(0);
return Optional.of(record.substring(0,record.length() - 1));
}
}
return Optional.empty();
}
项目:carrier
文件:MailResolverService.java
/**
* Decodes a list of MX records into a tree map,ranking them automatically.
*
* @param records The list of MX records.
* @return The tree map containing ranked MX records.
*/
private TreeMultimap<Integer,String> decodeRecords(List<Record> records) {
TreeMultimap<Integer,String> recordMap = TreeMultimap.create(Ordering.natural(),Ordering.natural());
records.forEach(record -> {
String[] split = record.rdataToString().split(" ");
if (split.length >= 2) {
try {
int rank = Integer.parseInt(split[0]);
String domain = split[1];
recordMap.put(rank,domain);
} catch (NumberFormatException ex) {
ex.printstacktrace();
}
}
});
return recordMap;
}
项目:beam
文件:PipelineOptionsFactory.java
/**
* Validates that a given class conforms to the following properties:
* <ul>
* <li>Only getters may be annotated with {@link JsonIgnore @JsonIgnore}.
* <li>If any getter is annotated with {@link JsonIgnore @JsonIgnore},then all getters for
* this property must be annotated with {@link JsonIgnore @JsonIgnore}.
* </ul>
*
* @param allInterfaceMethods All interface methods that derive from {@link PipelineOptions}.
* @param descriptors The list of {@link PropertyDescriptor}s representing all valid bean
* properties of {@code iface}.
*/
private static void validateMethodAnnotations(
SortedSet<Method> allInterfaceMethods,List<PropertyDescriptor> descriptors) {
SortedSetMultimap<Method,Method> methodNametoAllMethodMap =
TreeMultimap.create(MethodNameComparator.INSTANCE,MethodComparator.INSTANCE);
for (Method method : allInterfaceMethods) {
methodNametoAllMethodMap.put(method,method);
}
// Verify that there is no getter with a mixed @JsonIgnore annotation.
validateGettersHaveConsistentAnnotation(
methodNametoAllMethodMap,descriptors,AnnotationPredicates.JSON_IGnorE);
// Verify that there is no getter with a mixed @Default annotation.
validateGettersHaveConsistentAnnotation(
methodNametoAllMethodMap,AnnotationPredicates.DEFAULT_VALUE);
// Verify that no setter has @JsonIgnore.
validatesettersDoNotHaveAnnotation(
methodNametoAllMethodMap,AnnotationPredicates.JSON_IGnorE);
// Verify that no setter has @Default.
validatesettersDoNotHaveAnnotation(
methodNametoAllMethodMap,AnnotationPredicates.DEFAULT_VALUE);
}
项目:yoctodb
文件:BitSetIndexToIndexMultiMapTest.java
private IndexToIndexMultiMap build() throws IOException {
final TreeMultimap<Integer,Integer> elements = TreeMultimap.create();
for (int i = 0; i < DOCS; i++) {
elements.put(i / 2,i);
}
final com.yandex.yoctodb.util.mutable.IndexToIndexMultiMap mutable =
new com.yandex.yoctodb.util.mutable.impl.BitSetIndexToIndexMultiMap(
elements.asMap().values(),DOCS);
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
mutable.writeto(baos);
final Buffer buf = Buffer.from(baos.toByteArray());
assertEquals(
V1DatabaseFormat.MultiMapType.LONG_ARRAY_BIT_SET_BASED.getCode(),buf.getInt());
final IndexToIndexMultiMap result =
BitSetIndexToIndexMultiMap.from(buf);
assertEquals(DOCS / 2,result.getKeysCount());
return result;
}
项目:yoctodb
文件:IndexToIndexMultiMapReaderTest.java
@Test
public void buildInt() throws IOException {
final TreeMultimap<Integer,i);
}
final com.yandex.yoctodb.util.mutable.IndexToIndexMultiMap mutable =
new com.yandex.yoctodb.util.mutable.impl.IntIndexToIndexMultiMap(
elements.asMap().values());
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
mutable.writeto(baos);
final Buffer buf = Buffer.from(baos.toByteArray());
final IndexToIndexMultiMap result =
IndexToIndexMultiMapReader.from(buf);
assertTrue(result instanceof IntIndexToIndexMultiMap);
}
项目:yoctodb
文件:IndexToIndexMultiMapReaderTest.java
@Test
public void buildBitSet() throws IOException {
final TreeMultimap<Integer,DOCS);
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
mutable.writeto(baos);
final Buffer buf = Buffer.from(baos.toByteArray());
final IndexToIndexMultiMap result =
IndexToIndexMultiMapReader.from(buf);
assertTrue(result instanceof BitSetIndexToIndexMultiMap);
}
项目:yoctodb
文件:IntIndexToIndexMultiMapTest.java
private IndexToIndexMultiMap build() throws IOException {
final TreeMultimap<Integer,Integer> elements = TreeMultimap.create();
for (int i = 0; i < VALUES; i++) {
elements.put(i / 2,i);
}
final com.yandex.yoctodb.util.mutable.IndexToIndexMultiMap mutable =
new com.yandex.yoctodb.util.mutable.impl.IntIndexToIndexMultiMap(
elements.asMap().values());
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
mutable.writeto(baos);
final Buffer buf = Buffer.from(baos.toByteArray());
assertEquals(
V1DatabaseFormat.MultiMapType.LIST_BASED.getCode(),buf.getInt());
final IndexToIndexMultiMap result =
IntIndexToIndexMultiMap.from(buf);
assertEquals(VALUES / 2,result.getKeysCount());
return result;
}
项目:yoctodb
文件:IntIndexToIndexMultiMapTest.java
private Buffer prepareData(
final int keys,final int values) throws IOException {
final TreeMultimap<Integer,Integer> elements = TreeMultimap.create();
for (int i = 0; i < keys; i++) {
//same elements
elements.put(i,(keys - i) % values);
elements.put(i,(keys - i) % values);
elements.put(i,(2 * keys - i) % values);
elements.put(i,(3 * keys - i) % values);
}
final com.yandex.yoctodb.util.mutable.IndexToIndexMultiMap indexToIndexMultiMap =
new com.yandex.yoctodb.util.mutable.impl.IntIndexToIndexMultiMap(
elements.asMap().values());
final ByteArrayOutputStream os = new ByteArrayOutputStream();
indexToIndexMultiMap.writeto(os);
Assert.assertEquals(os.size(),indexToIndexMultiMap.getSizeInBytes());
return Buffer.from(os.toByteArray());
}
项目:yoctodb
文件:BitSetIndexToIndexMultiMapTest.java
@Test
public void string() {
final TreeMultimap<Integer,Integer> elements = TreeMultimap.create();
final int documents = 10;
for (int i = 0; i < documents; i++)
elements.put(i / 2,i);
final IndexToIndexMultiMap set =
new BitSetIndexToIndexMultiMap(
elements.asMap().values(),documents);
final String text = set.toString();
assertTrue(text.contains(Integer.toString(documents / 2)));
assertTrue(text.contains(Integer.toString(documents)));
set.getSizeInBytes();
assertTrue(text.contains(Integer.toString(documents / 2)));
assertTrue(text.contains(Integer.toString(documents)));
}
项目:nomulus
文件:GenerateAuctionDataCommand.java
/** Return a map of all fully-qualified domain names mapped to the applications for that name. */
private static Multimap<String,DomainApplication> getDomainApplicationMap(final String tld) {
DateTime Now = DateTime.Now(UTC);
Multimap<String,DomainApplication> domainApplicationMap =
TreeMultimap.create(Ordering.natural(),comparing(DomainApplication::getForeignKey));
Iterable<DomainApplication> domainApplications =
ofy().load().type(DomainApplication.class).filter("tld",tld);
for (DomainApplication domainApplication : domainApplications) {
// Ignore deleted and rejected applications. They aren't under consideration.
ApplicationStatus applicationStatus = domainApplication.getApplicationStatus();
DateTime deletionTime = domainApplication.getDeletionTime();
if (applicationStatus == REJECTED || isAtOrAfter(Now,deletionTime)) {
continue;
}
boolean result = domainApplicationMap.put(
domainApplication.getFullyQualifiedDomainName(),domainApplication);
checkState(result,"Domain application not added to map: %s",domainApplication);
}
return domainApplicationMap;
}
/**
* Generates a coverage multimap from split key to Regions that start with the
* split key.
*
* @return coverage multimap
*/
public Multimap<byte[],r);
}
}
}
return regions;
}
项目:FinanceAnalytics
文件:DataComponentServerResource.java
@GET
@Produces(value = MediaType.TEXT_HTML)
public String getComponentInfosHtml(@Context ServletContext servletContext,@Context UriInfo uriInfo) {
ComponentServer server = createServerInfo();
server.setUri(uriInfo.getBaseUri());
Multimap<Class<?>,ComponentInfo> byType = TreeMultimap.create(ORDER_CLASS,ORDER_CLASSIFIER);
for (ComponentInfo info : server.getComponentInfos()) {
byType.put(info.getType(),info);
}
FreemarkerOutputter freemarker = new FreemarkerOutputter(servletContext);
FlexiBean out = FreemarkerOutputter.createRootData(uriInfo);
out.put("componentServer",server);
out.put("infosByType",byType);
out.put("uris",new WebHomeUris(uriInfo));
return freemarker.build("data/componentserver.ftl",out);
}
private Map<String,Collection<String>> scanValueRequirementBySecType(UniqueId portfolioId,ToolContext toolContext) {
AvailableOutputsProvider availableOutputsProvider = toolContext.getAvaliableOutputsProvider();
if (availableOutputsProvider == null) {
throw new OpenGammaRuntimeException("AvailableOutputsProvider missing from ToolContext");
}
final SetMultimap<String,String> valueNamesBySecurityType = TreeMultimap.create();
AvailableOutputs portfolioOutputs = availableOutputsProvider.getPortfolioOutputs(portfolioId,null);
Set<String> securityTypes = portfolioOutputs.getSecurityTypes();
for (String securityType : securityTypes) {
Set<AvailableOutput> positionOutputs = portfolioOutputs.getPositionOutputs(securityType);
for (AvailableOutput availableOutput : positionOutputs) {
valueNamesBySecurityType.put(securityType,availableOutput.getValueName());
}
}
return valueNamesBySecurityType.asMap();
}
private int publishArtifacts(String repoUrl,String groupId,List<Artifact> artifacts)
throws IOException {
initGitDirectory(repoUrl);
StringBuilder commitMessage = new StringBuilder();
commitMessage.append("Publish Javadoc\n"
+ "\n"
+ "Artifacts published:");
Multimap<String,Artifact> published = TreeMultimap.create();
for (Artifact artifact : artifacts) {
if (fetchJavadoc(artifact)) {
published.put(majorVersion(artifact.latestVersion),artifact);
commitMessage.append("\n").append(artifact);
}
}
writeIndexFiles(groupId,published);
if (!published.isEmpty()) {
gitCommitAndPush(commitMessage.toString());
}
return published.size();
}
项目:ICQExport
文件:ICQExport.java
private static File writeIndexFile(
Map<String,String>> userData,TreeMultimap<String,Message> msgs) throws IOException {
File outDir = new File("html");
outDir.mkdirs();
File indexFile = new File(outDir,"index.html");
BufferedWriter bw = new BufferedWriter(new FileWriter(indexFile));
bw.write("<html><body><table><tr><th>UIN</th><th>Nickname</th><th>Last seen online</th><th># Messages</tr>");
for (String UIN : userData.keySet()) {
Map<String,String> props = userData.get(UIN);
String lastOnlinestr = "UnkNown";
if (props.containsKey("LastOnlineTime")) {
Date lastOnline = new Date(
new Long(props.get("LastOnlineTime")).longValue() * 1000L);
lastOnlinestr = lastOnline.toString();
}
bw.write("<tr><td><a href=\"" + UIN + ".html\">" + UIN
+ "</TD>+<TD>" + props.get("NickName") + "</TD><TD>"
+ lastOnlinestr + "</TD><TD>" + msgs.get(UIN).size()
+ "</TD></TR>");
}
bw.write("</table><hr><i>exported by ICQExport</i></body></html>");
bw.close();
return indexFile;
}
项目:CauldronGit
文件:Loader.java
private void identifyDuplicates(List<ModContainer> mods)
{
TreeMultimap<ModContainer,dupsearch.get(e.getElement()));
}
}
if (!dupes.isEmpty())
{
throw new DuplicateModsFoundException(dupes);
}
}
项目:Pushjet-Android
文件:AggregateMultiProjectTaskReportModel.java
public void build() {
groups = TreeMultimap.create(new Comparator<String>() {
public int compare(String string1,TaskDetails task2) {
return task1.getPath().compareto(task2.getPath());
}
});
for (TaskReportModel project : projects) {
for (String group : project.getGroups()) {
for (final TaskDetails task : project.getTasksForGroup(group)) {
groups.put(group,mergeTasksWithSameName ? new MergedTaskDetails(task) : task);
}
}
}
}
/**
* Generates a coverage multimap from split key to Regions that start with the
* split key.
*
* @return coverage multimap
*/
public Multimap<byte[],r);
}
}
}
return regions;
}
项目:scheduling
文件:ManageUsers.java
private static Multimap<String,String> loadGroups(String groupFilePath) throws ManageUsersException {
Multimap<String,String> groupsMap = TreeMultimap.create();
String line = null;
try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(groupFilePath)))) {
while ((line = reader.readLine()) != null) {
if (!line.trim().isEmpty()) {
String[] u2g = line.split(":");
if (u2g.length == 2) {
groupsMap.put(u2g[0].trim(),u2g[1].trim());
}
}
}
} catch (IOException e) {
exitWithErrorMessage("Could not read group file : " + groupFilePath,null,e);
}
return groupsMap;
}
项目:artifactory
文件:IntegrationCleanupServiceImpl.java
/**
* The integration cleanup deletes artifacts according to the snapshot and the classifier,* unlike the prevIoUs approach that was to deletes artifacts according to the snapshot only,* See issue RTFACT-6675
*/
private void conditionalCleanup(RepoPath repoPath) {
LocalRepo repo = repositoryService.localRepositoryByKey(repoPath.getRepoKey());
if (repo == null) {
return;
}
SnapshotVersionsRetriever retriever = new SnapshotVersionsRetriever(false);
ModuleInfo deployedModuleInfo = repositoryService.getItemmoduleInfo(repoPath);
ModuleInfo baseRevisionModule = getBaseRevisionModuleInfo(deployedModuleInfo);
TreeMultimap<Calendar,ItemInfo> cleanupCandidates = retriever.collectVersionsItems(repo,baseRevisionModule,false);
Map<String,TreeMultimap<Calendar,ItemInfo>> cleanupCandidatesByClassifier=forkByClassifier(cleanupCandidates);
for (TreeMultimap<Calendar,ItemInfo> calendarItemInfoTreeMultimap : cleanupCandidatesByClassifier.values()) {
while (calendarItemInfoTreeMultimap.keySet().size() > repo.getMaxUniqueSnapshots()) {
performCleanup(calendarItemInfoTreeMultimap);
}
}
}
项目:artifactory
文件:IntegrationCleanupServiceImpl.java
private Map<String,ItemInfo>> forkByClassifier(
TreeMultimap<Calendar,ItemInfo> cleanupCandidates) {
Map<String,ItemInfo>> result= Maps.newHashMap();
for (Calendar calendar : cleanupCandidates.keySet()) {
NavigableSet<ItemInfo> itemInfos = cleanupCandidates.get(calendar);
for (ItemInfo itemInfo : itemInfos) {
String classifier=resolveClassifier(itemInfo);
TreeMultimap<Calendar,ItemInfo> classifierMap = result.get(classifier);
if(classifierMap==null){
//classifierMap= TreeMultimap.create(Ordering.natural().reverse(),Ordering.natural().reverse());
classifierMap= TreeMultimap.create(Ordering.natural(),Ordering.natural());;
result.put(classifier,classifierMap);
}
classifierMap.put(calendar,itemInfo);
}
}
return result;
}
项目:artifactory
文件:IntegrationCleanupServiceImpl.java
private void performCleanup(TreeMultimap<Calendar,ItemInfo> cleanupCandidates) {
Calendar first = cleanupCandidates.keySet().first();
Set<RepoPath> parents = Sets.newHashSet();
SortedSet<ItemInfo> itemsToRemove = cleanupCandidates.removeAll(first);
for (ItemInfo itemToRemove : itemsToRemove) {
RepoPath repoPath = itemToRemove.getRepoPath();
repositoryService.undeploy(repoPath,false,false);
parents.add(repoPath.getParent());
log.info("Removed old unique snapshot '{}'.",itemToRemove.getRelPath());
}
// May need to prune the parents of deleted files
for (RepoPath parent : parents) {
pruningService.prune(parent);
}
}
项目:artifactory
文件:VersionsRetriever.java
/**
* Collects versions items under the given node for the given repo
*
* @param repo The repo to search in
* @param baseRevisionModule Base module info to search under,we try both artifact and desriptor path if it's distinctive
* @param pathHasversionTokens If we should search with version tokens,this applies for release artifacts as the user
* may provide release/integration tokens to search for latest version
*/
public TreeMultimap<Calendar,ItemInfo> collectVersionsItems(StoringRepo repo,ModuleInfo baseRevisionModule,boolean pathHasversionTokens) {
RepoLayout repoLayout = repo.getDescriptor().getRepoLayout();
String baseArtifactPath = ModuleInfoUtils.constructArtifactPath(baseRevisionModule,repoLayout,false);
ItemNode artifactSearchNode = getTreeNode(repo,baseArtifactPath,pathHasversionTokens);
if (artifactSearchNode != null) {
internalCollectVersionsItems(repo,artifactSearchNode);
}
if (repoLayout.isdistinctiveDescriptorPathPattern()) {
String baseDescriptorPath = ModuleInfoUtils.constructDescriptorPath(baseRevisionModule,false);
if (!baseDescriptorPath.equals(baseArtifactPath)) {
ItemNode descriptorSearchNode = getTreeNode(repo,baseDescriptorPath,pathHasversionTokens);
if (descriptorSearchNode != null) {
internalCollectVersionsItems(repo,descriptorSearchNode);
}
}
}
return versionsItems;
}
项目:artifactory
文件:LocalLatestVersionResolver.java
private InternalRequestContext getLatestVersionRequestContext(InternalRequestContext requestContext,StoringRepo repo,ModuleInfo originalModuleInfo,boolean searchForReleaseVersion) {
VersionsRetriever retriever =
searchForReleaseVersion ? new ReleaseVersionsRetriever(true) : new SnapshotVersionsRetriever(true);
ModuleInfo baseRevisionModule = getBaseRevisionModuleInfo(originalModuleInfo);
TreeMultimap<Calendar,ItemInfo> versionsItems = retriever.collectVersionsItems(repo,true);
if (versionsItems != null) {
if (searchForReleaseVersion && !ConstantValues.requestSearchLatestReleaseByDateCreated.getBoolean()) {
return getRequestContentForReleaseByVersion(versionsItems.values(),repo,requestContext,originalModuleInfo);
} else {
return getRequestContextFromMap(versionsItems,originalModuleInfo,searchForReleaseVersion);
}
} else {
return requestContext;
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。