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);
}
java类com.google.common.collect.TreeMultimap的实例源码
ColumnFilter.java 文件源码
项目:sstable-adaptor
阅读 30
收藏 0
点赞 0
评论 0
AggregateMultiProjectTaskReportModel.java 文件源码
项目:Reer
阅读 20
收藏 0
点赞 0
评论 0
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);
}
}
}
}
}
PortScannerStatsServiceImpl.java 文件源码
项目:tifoon
阅读 17
收藏 0
点赞 0
评论 0
private static Map<String, Map<String, Multimap<Protocol, Integer>>> mapOpenPorts(@NonNull final List<PropertyChange> _propertyChanges,
@NonNull final PortScannerResult _portScannerResult) {
final Map<String, Map<String, Multimap<Protocol, 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, Multimap<Protocol, 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;
}
Geonames.java 文件源码
项目:fpm
阅读 32
收藏 0
点赞 0
评论 0
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;
}
SignPosts.java 文件源码
项目:fpm
阅读 24
收藏 0
点赞 0
评论 0
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;
}
TdDbf.java 文件源码
项目:fpm
阅读 26
收藏 0
点赞 0
评论 0
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;
}
HsprDbf.java 文件源码
项目:fpm
阅读 23
收藏 0
点赞 0
评论 0
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())));
}
SpeedRestrictionTagger.java 文件源码
项目:fpm
阅读 21
收藏 0
点赞 0
评论 0
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;
}
ExpressionFormatter.java 文件源码
项目:Elasticsearch
阅读 26
收藏 0
点赞 0
评论 0
@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();
}
IsoUtils.java 文件源码
项目:SubgraphIsomorphismIndex
阅读 23
收藏 0
点赞 0
评论 0
/**
* 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;
}
TreeMultimapDemo.java 文件源码
项目:cakes
阅读 68
收藏 0
点赞 0
评论 0
/**
* 基本数据类型的排序
*/
@Test
public void testCreate() {
TreeMultimap<String, Integer> treeMultimap = TreeMultimap.create();
treeMultimap.put("list_1", 1);
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);
}
TreeMultimapDemo.java 文件源码
项目:cakes
阅读 24
收藏 0
点赞 0
评论 0
/**
* 测试 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, "haha3"));
treeMultimap.put("order_list1", new Order4TreeMultimap(22, "haha4"));
treeMultimap.put("order_list1", new Order4TreeMultimap(444, "haha5"));
// 列表2
treeMultimap.put("order_list2", new Order4TreeMultimap(1, "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));
}
Loader.java 文件源码
项目:CustomWorldGen
阅读 27
收藏 0
点赞 0
评论 0
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);
}
}
RegionSplitCalculator.java 文件源码
项目:ditb
阅读 19
收藏 0
点赞 0
评论 0
/**
* 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;
}
Loader.java 文件源码
项目:TRHS_Club_Mod_2016
阅读 32
收藏 0
点赞 0
评论 0
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);
}
}
MailResolverService.java 文件源码
项目:carrier
阅读 23
收藏 0
点赞 0
评论 0
/**
* 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();
}
MailResolverService.java 文件源码
项目:carrier
阅读 32
收藏 0
点赞 0
评论 0
/**
* 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;
}
PipelineOptionsFactory.java 文件源码
项目:beam
阅读 27
收藏 0
点赞 0
评论 0
/**
* 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, descriptors, AnnotationPredicates.DEFAULT_VALUE);
// Verify that no setter has @JsonIgnore.
validateSettersDoNotHaveAnnotation(
methodNameToAllMethodMap, descriptors, AnnotationPredicates.JSON_IGNORE);
// Verify that no setter has @Default.
validateSettersDoNotHaveAnnotation(
methodNameToAllMethodMap, descriptors, AnnotationPredicates.DEFAULT_VALUE);
}
BitSetIndexToIndexMultiMapTest.java 文件源码
项目:yoctodb
阅读 26
收藏 0
点赞 0
评论 0
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;
}
IndexToIndexMultiMapReaderTest.java 文件源码
项目:yoctodb
阅读 25
收藏 0
点赞 0
评论 0
@Test
public void buildInt() 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.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);
}
IndexToIndexMultiMapReaderTest.java 文件源码
项目:yoctodb
阅读 19
收藏 0
点赞 0
评论 0
@Test
public void buildBitSet() 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());
final IndexToIndexMultiMap result =
IndexToIndexMultiMapReader.from(buf);
assertTrue(result instanceof BitSetIndexToIndexMultiMap);
}
IntIndexToIndexMultiMapTest.java 文件源码
项目:yoctodb
阅读 25
收藏 0
点赞 0
评论 0
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;
}
IntIndexToIndexMultiMapTest.java 文件源码
项目:yoctodb
阅读 22
收藏 0
点赞 0
评论 0
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, (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());
}
BitSetIndexToIndexMultiMapTest.java 文件源码
项目:yoctodb
阅读 74
收藏 0
点赞 0
评论 0
@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)));
}
GenerateAuctionDataCommand.java 文件源码
项目:nomulus
阅读 24
收藏 0
点赞 0
评论 0
/** 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;
}
RegionSplitCalculator.java 文件源码
项目:LCIndex-HBase-0.94.16
阅读 30
收藏 0
点赞 0
评论 0
/**
* 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;
}
DataComponentServerResource.java 文件源码
项目:FinanceAnalytics
阅读 26
收藏 0
点赞 0
评论 0
@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);
}
ViewStatusCalculationWorker.java 文件源码
项目:FinanceAnalytics
阅读 19
收藏 0
点赞 0
评论 0
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();
}
JavadocPublisher.java 文件源码
项目:osstrich
阅读 25
收藏 0
点赞 0
评论 0
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.java 文件源码
项目:ICQExport
阅读 21
收藏 0
点赞 0
评论 0
private static File writeIndexFile(
Map<String, 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;
}