本文整理匯總了Java中com.google.common.collect.SortedSetMultimap.get方法的典型用法代碼示例。如果您正苦於以下問題:Java SortedSetMultimap.get方法的具體用法?Java SortedSetMultimap.get怎麽用?Java SortedSetMultimap.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.common.collect.SortedSetMultimap
的用法示例。
在下文中一共展示了SortedSetMultimap.get方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: prettyPrintRequiredGroups
import com.google.common.collect.SortedSetMultimap; //導入方法依賴的package包/類
/**
* Output the requirement groups that the property is a member of, including all properties that
* satisfy the group requirement, breaking up long lines on white space characters and attempting
* to honor a line limit of {@code TERMINAL_WIDTH}.
*/
private static void prettyPrintRequiredGroups(PrintStream out, Required annotation,
SortedSetMultimap<String, String> requiredGroupNameToProperties) {
if (annotation == null || annotation.groups() == null) {
return;
}
for (String group : annotation.groups()) {
SortedSet<String> groupMembers = requiredGroupNameToProperties.get(group);
String requirement;
if (groupMembers.size() == 1) {
requirement = Iterables.getOnlyElement(groupMembers) + " is required.";
} else {
requirement = "At least one of " + groupMembers + " is required";
}
terminalPrettyPrint(out, requirement.split("\\s+"));
}
}
示例2: main
import com.google.common.collect.SortedSetMultimap; //導入方法依賴的package包/類
public static void main(String[] args) throws IOException {
if(args.length == 0) {
System.err.println("Usage: ProcessActionsXml <IntelliJDir1> [<IntelliJDir2] ...");
return;
}
try (final Writer out = new BufferedWriter(new FileWriter("docs/_data/actions.csv"))) {
try (final CSVPrinter printer = CSVFormat.DEFAULT.withHeader("file", "id", "text", "group", "link").print(out)) {
for (String dir : args) {
ActionDirectoryWalker walker = new ActionDirectoryWalker();
final SortedSetMultimap<String, ActionIDDef> ids = walker.walk(new File(dir));
for (String file : ids.keySet()) {
for (ActionIDDef def : ids.get(file)) {
final String fileName = StringUtils.removeStart(StringUtils.removeStart(StringUtils.removeStart(file, dir), "\\"), "/");
System.out.println("File: " + fileName + ": had " + def.getId() + "/" + def.getText() + "/" + def.getGroup() + "/" + def.getLink());
printer.print(fileName);
printer.print(def.getId());
printer.print(def.getText());
printer.print(def.getGroup());
printer.print(def.getLink());
printer.println();
}
}
System.out.println("Found " + ids.size() + " actions in " + ids.keySet().size() + " files");
}
}
}
}
示例3: loadedRegionsAreSortedCorrectly
import com.google.common.collect.SortedSetMultimap; //導入方法依賴的package包/類
@Test
public void loadedRegionsAreSortedCorrectly() throws IOException, EmptyFileException {
final SortedSetMultimap<String, HmfGenomeRegion> geneRegions = HmfGenePanelSupplier.allGeneMap();
for (final String chromosome : geneRegions.keySet()) {
long start = 0;
for (final HmfGenomeRegion hmfGenomeRegion : geneRegions.get(chromosome)) {
assertTrue(hmfGenomeRegion.start() >= start);
start = hmfGenomeRegion.start();
}
}
}
示例4: writePerPackageRDotJava
import com.google.common.collect.SortedSetMultimap; //導入方法依賴的package包/類
@VisibleForTesting
void writePerPackageRDotJava(
SortedSetMultimap<String, RDotTxtEntry> packageToResources,
ProjectFilesystem filesystem) throws IOException {
for (String rDotJavaPackage : packageToResources.keySet()) {
Path outputFile = getPathToRDotJava(rDotJavaPackage);
filesystem.mkdirs(outputFile.getParent());
try (PrintWriter writer = new PrintWriter(filesystem.newFileOutputStream(outputFile))) {
writer.format("package %s;\n\n", rDotJavaPackage);
writer.println("public class R {\n");
RDotTxtEntry.RType lastType = null;
for (RDotTxtEntry res : packageToResources.get(rDotJavaPackage)) {
RDotTxtEntry.RType type = res.type;
if (!type.equals(lastType)) {
// If the previous type needs to be closed, close it.
if (lastType != null) {
writer.println(" }\n");
}
// Now start the block for the new type.
writer.format(" public static class %s {\n", type);
lastType = type;
}
// Write out the resource.
// Write as an int.
writer.format(
" public static%s%s %s=%s;\n",
uberRDotTxt.isPresent() ? " final " : " ",
res.idType,
res.name,
res.idValue);
}
// If some type was written (e.g., the for loop was entered), then the last type needs to be
// closed.
if (lastType != null) {
writer.println(" }\n");
}
// Close the class definition.
writer.println("}");
}
}
}
示例5: testGenerateRDotJavaForMultipleSymbolsFiles
import com.google.common.collect.SortedSetMultimap; //導入方法依賴的package包/類
@Test
public void testGenerateRDotJavaForMultipleSymbolsFiles() throws IOException {
RDotTxtEntryBuilder entriesBuilder = new RDotTxtEntryBuilder();
// Merge everything into the same package space.
String sharedPackageName = "com.facebook.abc";
entriesBuilder.add(new RDotTxtFile(sharedPackageName, "a-R.txt",
ImmutableList.of(
"int id a1 0x7f010001",
"int id a2 0x7f010002",
"int string a1 0x7f020001")));
entriesBuilder.add(new RDotTxtFile(sharedPackageName, "b-R.txt",
ImmutableList.of(
"int id b1 0x7f010001",
"int id b2 0x7f010002")));
entriesBuilder.add(new RDotTxtFile(sharedPackageName, "c-R.txt",
ImmutableList.of(
"int attr c1 0x7f010001",
"int[] styleable c1 { 0x7f010001 }")));
ExecutionContext executionContext = TestExecutionContext.newBuilder()
.setProjectFilesystem(entriesBuilder.getProjectFilesystem())
.build();
SortedSetMultimap<String, RDotTxtEntry> packageNameToResources =
MergeAndroidResourcesStep.sortSymbols(
entriesBuilder.buildFilePathToPackageNameSet(),
Optional.<ImmutableMap<RDotTxtEntry, String>>absent(),
executionContext);
assertEquals(1, packageNameToResources.keySet().size());
SortedSet<RDotTxtEntry> resources = packageNameToResources.get(sharedPackageName);
assertEquals(7, resources.size());
Set<String> uniqueEntries = Sets.newHashSet();
for (RDotTxtEntry resource : resources) {
if (!resource.type.equals(RDotTxtEntry.RType.STYLEABLE)) {
assertFalse("Duplicate ids should be fixed by renumerate=true; duplicate was: " +
resource.idValue, uniqueEntries.contains(resource.idValue));
uniqueEntries.add(resource.idValue);
}
}
assertEquals(6, uniqueEntries.size());
// All good, no need to further test whether we can write the Java file correctly...
}
示例6: writePerPackageRDotJava
import com.google.common.collect.SortedSetMultimap; //導入方法依賴的package包/類
@VisibleForTesting
void writePerPackageRDotJava(
SortedSetMultimap<String, RDotTxtEntry> packageToResources, ProjectFilesystem filesystem)
throws IOException {
for (String rDotJavaPackage : packageToResources.keySet()) {
Path outputFile = getPathToRDotJava(rDotJavaPackage);
filesystem.mkdirs(outputFile.getParent());
try (ThrowingPrintWriter writer =
new ThrowingPrintWriter(filesystem.newFileOutputStream(outputFile))) {
writer.format("package %s;\n\n", rDotJavaPackage);
writer.format("public class %s {\n", rName);
ImmutableList.Builder<String> customDrawablesBuilder = ImmutableList.builder();
ImmutableList.Builder<String> grayscaleImagesBuilder = ImmutableList.builder();
RType lastType = null;
for (RDotTxtEntry res : packageToResources.get(rDotJavaPackage)) {
RType type = res.type;
if (!type.equals(lastType)) {
// If the previous type needs to be closed, close it.
if (lastType != null) {
writer.println(" }\n");
}
// Now start the block for the new type.
writer.format(" public static class %s {\n", type);
lastType = type;
}
// Write out the resource.
// Write as an int.
writer.format(
" public static%s%s %s=%s;\n",
forceFinalResourceIds ? " final " : " ", res.idType, res.name, res.idValue);
if (type == RType.DRAWABLE && res.customType == RDotTxtEntry.CustomDrawableType.CUSTOM) {
customDrawablesBuilder.add(res.idValue);
} else if (type == RType.DRAWABLE
&& res.customType == RDotTxtEntry.CustomDrawableType.GRAYSCALE_IMAGE) {
grayscaleImagesBuilder.add(res.idValue);
}
}
// If some type was written (e.g., the for loop was entered), then the last type needs to be
// closed.
if (lastType != null) {
writer.println(" }\n");
}
ImmutableList<String> customDrawables = customDrawablesBuilder.build();
if (customDrawables.size() > 0) {
// Add a new field for the custom drawables.
writer.format(" public static final int[] custom_drawables = ");
writer.format("{ %s };\n", Joiner.on(",").join(customDrawables));
writer.format("\n");
}
ImmutableList<String> grayscaleImages = grayscaleImagesBuilder.build();
if (grayscaleImages.size() > 0) {
// Add a new field for the custom drawables.
writer.format(" public static final int[] grayscale_images = ");
writer.format("{ %s };\n", Joiner.on(",").join(grayscaleImages));
writer.format("\n");
}
// Close the class definition.
writer.println("}");
}
}
}
示例7: testGenerateRDotJavaForMultipleSymbolsFiles
import com.google.common.collect.SortedSetMultimap; //導入方法依賴的package包/類
@Test
public void testGenerateRDotJavaForMultipleSymbolsFiles()
throws IOException, DuplicateResourceException {
RDotTxtEntryBuilder entriesBuilder = new RDotTxtEntryBuilder();
// Merge everything into the same package space.
String sharedPackageName = "com.facebook.abc";
entriesBuilder.add(
new RDotTxtFile(
sharedPackageName,
"a-R.txt",
ImmutableList.of(
"int id a1 0x7f010001", "int id a2 0x7f010002", "int string a1 0x7f020001")));
entriesBuilder.add(
new RDotTxtFile(
sharedPackageName,
"b-R.txt",
ImmutableList.of(
"int id b1 0x7f010001", "int id b2 0x7f010002", "int string a1 0x7f020001")));
entriesBuilder.add(
new RDotTxtFile(
sharedPackageName,
"c-R.txt",
ImmutableList.of("int attr c1 0x7f010001", "int[] styleable c1 { 0x7f010001 }")));
SortedSetMultimap<String, RDotTxtEntry> packageNameToResources =
MergeAndroidResourcesStep.sortSymbols(
entriesBuilder.buildFilePathToPackageNameSet(),
Optional.empty(),
ImmutableMap.of(),
Optional.empty(),
/* bannedDuplicateResourceTypes */ EnumSet.noneOf(RType.class),
ImmutableSet.of(),
entriesBuilder.getProjectFilesystem(),
false);
assertEquals(1, packageNameToResources.keySet().size());
SortedSet<RDotTxtEntry> resources = packageNameToResources.get(sharedPackageName);
assertEquals(7, resources.size());
Set<String> uniqueEntries = new HashSet<>();
for (RDotTxtEntry resource : resources) {
if (!resource.type.equals(STYLEABLE)) {
assertFalse(
"Duplicate ids should be fixed by renumerate=true; duplicate was: " + resource.idValue,
uniqueEntries.contains(resource.idValue));
uniqueEntries.add(resource.idValue);
}
}
assertEquals(6, uniqueEntries.size());
// All good, no need to further test whether we can write the Java file correctly...
}