当前位置: 首页>>代码示例>>Java>>正文


Java Maps类代码示例

本文整理汇总了Java中org.eclipse.collections.impl.factory.Maps的典型用法代码示例。如果您正苦于以下问题:Java Maps类的具体用法?Java Maps怎么用?Java Maps使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Maps类属于org.eclipse.collections.impl.factory包,在下文中一共展示了Maps类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ignoreTables

import org.eclipse.collections.impl.factory.Maps; //导入依赖的package包/类
@Test
public void ignoreTables() throws IOException
{
    VerifiableTable tableA = TableTestUtils.createTable(1, "Col 1", "A");
    VerifiableTable tableX = TableTestUtils.createTable(1, "Col 1", "X");
    this.tableVerifier.withIgnoreTables("table1", "table3").verify(
            Maps.fixedSize.of("table1", tableA, "table2", tableA, "table3", tableX),
            Maps.fixedSize.of("table1", tableX, "table2", tableA, "table3", tableA));

    Assert.assertEquals(
            "<body>\n" +
            "<div class=\"metadata\"/>\n" +
            "<h1>ignoreTables</h1>\n" +
            "<div id=\"ignoreTables.table2\">\n" +
            "<h2>table2</h2>\n" +
            "<table border=\"1\" cellspacing=\"0\">\n" +
            "<tr>\n" +
            "<th class=\"pass\">Col 1</th>\n" +
            "</tr>\n" +
            "<tr>\n" +
            "<td class=\"pass\">A</td>\n" +
            "</tr>\n" +
            "</table>\n" +
            "</div>\n" +
            "</body>", TableTestUtils.getHtml(this.tableVerifier, "body"));
}
 
开发者ID:goldmansachs,项目名称:tablasco,代码行数:27,代码来源:IgnoreTablesTest.java

示例2: convertToParamList

import org.eclipse.collections.impl.factory.Maps; //导入依赖的package包/类
private ImmutableList<ImmutableMap<String, String>> convertToParamList(String templateParamAttr) {
    if (templateParamAttr == null) {
        return Lists.immutable.of(Maps.immutable.<String, String>empty());
    }

    ImmutableList<String> paramGroups = ArrayAdapter.adapt(templateParamAttr.split(";")).toImmutable();
    return paramGroups.collect(new Function<String, ImmutableMap<String, String>>() {
        @Override
        public ImmutableMap<String, String> valueOf(String paramGroup) {
            String[] paramStrs = paramGroup.split(",");
            MutableMap<String, String> params = Maps.mutable.empty();
            for (String paramStr : paramStrs) {
                String[] paramParts = paramStr.split("=");
                params.put(paramParts[0], paramParts[1]);
            }

            return params.toImmutable();
        }
    });
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:21,代码来源:TableChangeParser.java

示例3: prepare

import org.eclipse.collections.impl.factory.Maps; //导入依赖的package包/类
@Override
public String prepare(String content, Change change, DbEnvironment env) {
    MutableMap<String, String> tokens = Maps.mutable.<String, String>empty()
            .withKeyValue("dbSchemaSuffix", env.getDbSchemaSuffix())
            .withKeyValue("dbSchemaPrefix", env.getDbSchemaPrefix());

    for (Schema schema : env.getSchemas()) {
        PhysicalSchema physicalSchema = env.getPhysicalSchema(schema.getName());
        tokens.put(schema.getName() + "_physicalName", physicalSchema.getPhysicalName());
        if (env.getPlatform() != null) {
            tokens.put(schema.getName() + "_schemaSuffixed", env.getPlatform().getSchemaPrefix(physicalSchema));
            tokens.put(schema.getName() + "_subschemaSuffixed", env.getPlatform().getSubschemaPrefix(physicalSchema));
        }
    }

    if (env.getDefaultTablespace() != null) {
        tokens.put("defaultTablespace", env.getDefaultTablespace());
    }

    tokens.putAll(env.getTokens().castToMap());  // allow clients to override these values if needed

    return new Tokenizer(tokens, env.getTokenPrefix(), env.getTokenSuffix()).tokenizeString(content);
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:24,代码来源:PrepareDbChangeForDb.java

示例4: initPatternMap

import org.eclipse.collections.impl.factory.Maps; //导入依赖的package包/类
private ImmutableMap<ChangeType, Pattern> initPatternMap(Platform platform) {
    MutableMap<String, Pattern> params = Maps.mutable.<String, Pattern>with()
            .withKeyValue(ChangeType.SP_STR, Pattern.compile("(?i)create\\s+proc(?:edure)?\\s+(\\w+)", Pattern.DOTALL))
            .withKeyValue(ChangeType.FUNCTION_STR, Pattern.compile("(?i)create\\s+func(?:tion)?\\s+(\\w+)", Pattern.DOTALL))
            .withKeyValue(ChangeType.VIEW_STR, Pattern.compile("(?i)create\\s+view\\s+(\\w+)", Pattern.DOTALL))
            .withKeyValue(ChangeType.SEQUENCE_STR, Pattern.compile("(?i)create\\s+seq(?:uence)?\\s+(\\w+)", Pattern.DOTALL))
            .withKeyValue(ChangeType.TABLE_STR, Pattern.compile("(?i)create\\s+table\\s+(\\w+)", Pattern.DOTALL))
            .withKeyValue(ChangeType.DEFAULT_STR, Pattern.compile("(?i)create\\s+default\\s+(\\w+)", Pattern.DOTALL))
            .withKeyValue(ChangeType.RULE_STR, Pattern.compile("(?i)create\\s+rule\\s+(\\w+)", Pattern.DOTALL))
            .withKeyValue(ChangeType.USERTYPE_STR, Pattern.compile("(?i)^\\s*sp_addtype\\s+", Pattern.DOTALL))
            .withKeyValue(ChangeType.INDEX_STR, Pattern.compile("(?i)create\\s+(?:unique\\s+)?(?:\\w+\\s+)?index\\s+\\w+\\s+on\\s+(\\w+)", Pattern.DOTALL))
    ;

    MutableMap<ChangeType, Pattern> patternMap = Maps.mutable.<ChangeType, Pattern>with();
    for (String changeTypeName : params.keysView()) {
        if (platform.hasChangeType(changeTypeName)) {
            ChangeType changeType = platform.getChangeType(changeTypeName);
            patternMap.put(changeType, params.get(changeTypeName));
        }
    }

    return patternMap.toImmutable();
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:24,代码来源:AquaRevengMain.java

示例5: testQuotedSplitWithEqualSign

import org.eclipse.collections.impl.factory.Maps; //导入依赖的package包/类
@Test
public void testQuotedSplitWithEqualSign() {
    String input = "attr=1234 attr2=\"56=78\" mytog1";
    if (legacyMode) {
        try {
            textMarkupDocumentReader.parseAttrsAndToggles(input);
            fail("Should have failed here");
        } catch (IllegalArgumentException e) {
            assertThat(e.getMessage(), containsString("Cannot mark = multiple times"));
        }
    } else {
        Pair<ImmutableMap<String, String>, ImmutableSet<String>> results = textMarkupDocumentReader.parseAttrsAndToggles(input);

        assertEquals(Maps.mutable.of("attr", "1234", "attr2", "56=78"), results.getOne());
        assertEquals(Sets.mutable.of("mytog1"), results.getTwo());
    }
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:18,代码来源:TextMarkupDocumentReaderTest.java

示例6: testQuotedSplitWithEqualSignAndSpace

import org.eclipse.collections.impl.factory.Maps; //导入依赖的package包/类
@Test
public void testQuotedSplitWithEqualSignAndSpace() {
    String input = "attr=1234 attr2=\"56 = 78\" mytog1";
    if (legacyMode) {
        try {
            textMarkupDocumentReader.parseAttrsAndToggles(input);
            fail("Should have failed here");
        } catch (ArrayIndexOutOfBoundsException e) {
            assertThat(e.getMessage(), notNullValue());
        }
    } else {
        Pair<ImmutableMap<String, String>, ImmutableSet<String>> results = textMarkupDocumentReader.parseAttrsAndToggles(input);

        assertEquals(Maps.mutable.of("attr", "1234", "attr2", "56 = 78"), results.getOne());
        assertEquals(Sets.mutable.of("mytog1"), results.getTwo());
    }
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:18,代码来源:TextMarkupDocumentReaderTest.java

示例7: testWordEndingInEqualSignWillFailInLegacy

import org.eclipse.collections.impl.factory.Maps; //导入依赖的package包/类
@Test
public void testWordEndingInEqualSignWillFailInLegacy() {
    String input = "   attr= abc";
    if (legacyMode) {
        try {
            textMarkupDocumentReader.parseAttrsAndToggles(input);
            fail("Should have failed here");
        } catch (ArrayIndexOutOfBoundsException expected) {
        }
    } else {
        Pair<ImmutableMap<String, String>, ImmutableSet<String>> results = textMarkupDocumentReader.parseAttrsAndToggles(input);

        assertEquals(Maps.mutable.of("attr", ""), results.getOne());
        assertEquals(Sets.mutable.of("abc"), results.getTwo());
    }
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:17,代码来源:TextMarkupDocumentReaderTest.java

示例8: testIncludeEnvsExcludePlatforms

import org.eclipse.collections.impl.factory.Maps; //导入依赖的package包/类
@Test
public void testIncludeEnvsExcludePlatforms() {
    ImmutableList<ArtifactRestrictions> restrictions = this.restrictionsReader.valueOf(
            this.doc(TextMarkupDocumentReader.TAG_METADATA, null,
                    Maps.immutable.with(
                            "includeEnvs", "dev1,dev3",
                            "excludePlatforms", "HSQL,HIVE"))
    );
    assertEquals(2, restrictions.size());

    assertThat(restrictions.getFirst(), instanceOf(ArtifactEnvironmentRestrictions.class));
    assertEquals(UnifiedSet.newSetWith("dev1", "dev3"), restrictions.getFirst().getIncludes());
    assertTrue(restrictions.getFirst().getExcludes().isEmpty());

    assertThat(restrictions.getLast(), instanceOf(ArtifactPlatformRestrictions.class));
    assertTrue(restrictions.getLast().getIncludes().isEmpty());
    assertEquals(UnifiedSet.newSetWith("HSQL", "HIVE"), restrictions.getLast().getExcludes());
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:19,代码来源:ChangeRestrictionsReaderTest.java

示例9: testPackageMetadataWithProperties

import org.eclipse.collections.impl.factory.Maps; //导入依赖的package包/类
@Test
public void testPackageMetadataWithProperties() {
    PackageMetadataReader packageMetadataReader = new PackageMetadataReader(new TextMarkupDocumentReader(false));

    PackageMetadata packageMetadata = packageMetadataReader.getPackageMetadata("\n\n  \n  \n" +
            "sourceEncodings.UTF-8=a1,a2,a3\n" +
            "sourceEncodings.UTF-16=a4\n" +
            "otherProps=abc\n" +
            "\n");

    assertNull(packageMetadata.getMetadataSection());

    assertEquals(Maps.immutable.of(
            "a1", "UTF-8",
            "a2", "UTF-8",
            "a3", "UTF-8",
            "a4", "UTF-16"
            )
            , packageMetadata.getFileToEncodingMap());
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:21,代码来源:PackageMetadataReaderTest.java

示例10: testPackageMetadataWithMetadataAndProperties

import org.eclipse.collections.impl.factory.Maps; //导入依赖的package包/类
@Test
public void testPackageMetadataWithMetadataAndProperties() {
    PackageMetadataReader packageMetadataReader = new PackageMetadataReader(new TextMarkupDocumentReader(false));

    PackageMetadata packageMetadata = packageMetadataReader.getPackageMetadata("\n\n  \n  \n" +
            "//// METADATA k1=v1 k2=v2 toggle1 toggle2\n" +
            "sourceEncodings.UTF-8=a1,a2,a3\n" +
            "sourceEncodings.UTF-16=a4\n" +
            "otherProps=abc\n" +
            "\n");

    assertEquals(Maps.immutable.of("k1", "v1", "k2", "v2"), packageMetadata.getMetadataSection().getAttrs());
    assertEquals(Sets.immutable.of("toggle1", "toggle2"), packageMetadata.getMetadataSection().getToggles());

    assertEquals(Maps.mutable.of(
            "a1", "UTF-8",
            "a2", "UTF-8",
            "a3", "UTF-8",
            "a4", "UTF-16"
            )
            , packageMetadata.getFileToEncodingMap());
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:23,代码来源:PackageMetadataReaderTest.java

示例11: assist

import org.eclipse.collections.impl.factory.Maps; //导入依赖的package包/类
public List<Object> assist(String levelName, InvestigationLevel nextLevel, int drilldownLimit)
{
    Twin<VerifiableTable> queryResults = execute(nextLevel);
    VerifiableTable actualResults = new KeyedVerifiableTableAdapter(queryResults.getOne(), queryResults.getOne().getColumnCount() - 1);
    VerifiableTable expectedResults = new KeyedVerifiableTableAdapter(queryResults.getTwo(), queryResults.getTwo().getColumnCount() - 1);

    List<String> actualColumns = getColumns(actualResults);
    List<String> expectedColumns = getColumns(expectedResults);
    if (!Iterate.getLast(actualColumns).equals(Iterate.getLast(expectedColumns)))
    {
        throw new IllegalArgumentException(String.format("Key columns must match at each investigation level [actual: %s, expected: %s]", Iterate.getLast(actualColumns), Iterate.getLast(expectedColumns)));
    }
    Set<String> commonColumns = UnifiedSet.newSet(actualColumns);
    commonColumns.retainAll(expectedColumns);
    if (Math.min(actualColumns.size(), expectedColumns.size()) > 1 && commonColumns.size() < 2)
    {
        throw new IllegalArgumentException(String.format("There must be at least 2 matching columns at each investigation level [actual: %s, expected: %s]", Iterate.getLast(actualColumns), Iterate.getLast(expectedColumns)));
    }

    String levelDescription = nextLevel.getLevelDescription();
    ResultTable results = this.findBreaks(levelDescription, actualResults, expectedResults);
    HtmlFormatter htmlFormatter = new HtmlFormatter(outputFile, new HtmlOptions(false, HtmlFormatter.DEFAULT_ROW_LIMIT, false, true, false, Collections.<String>emptySet()));
    htmlFormatter.appendResults(levelName, Maps.fixedSize.of(levelDescription, results), Metadata.newEmpty());
    return getRowKeys(results, drilldownLimit);
}
 
开发者ID:goldmansachs,项目名称:tablasco,代码行数:26,代码来源:Watson.java

示例12: succeeded

import org.eclipse.collections.impl.factory.Maps; //导入依赖的package包/类
@Override
public final void succeeded(Description description)
{
    try
    {
        if (MapIterate.notEmpty(this.expectedTables))
        {
            this.verifyTables(this.expectedTables, Maps.fixedSize.<String, VerifiableTable>of(), this.expectedMetadata);
        }
    }
    catch (AssertionError assertionError)
    {
        this.failed(assertionError, description);
        throw assertionError;
    }
    this.lifecycleEventHandler.onSucceeded(description);
    if (this.isRebasing)
    {
        Assert.fail("REBASE SUCCESSFUL - failing test in case rebase flag is set by mistake");
    }
}
 
开发者ID:goldmansachs,项目名称:tablasco,代码行数:22,代码来源:TableVerifier.java

示例13: allRowsMatch

import org.eclipse.collections.impl.factory.Maps; //导入依赖的package包/类
@Test
public void allRowsMatch() throws IOException
{
    VerifiableTable table = TableTestUtils.createTable(2, "Col 1", "Col 2", "A1", "A2", "B1", "B2");
    this.tableVerifier.verify(Maps.fixedSize.of("name", table), Maps.fixedSize.of("name", table));
    Assert.assertEquals(
            "<table border=\"1\" cellspacing=\"0\">\n" +
            "<tr>\n" +
            "<th class=\"pass\">Col 1</th>\n" +
            "<th class=\"pass\">Col 2</th>\n" +
            "</tr>\n" +
            "<tr>\n" +
            "<td class=\"pass multi\" colspan=\"2\">2 matched rows...</td>\n" +
            "</tr>\n" +
            "</table>", TableTestUtils.getHtml(this.tableVerifier, "table"));
}
 
开发者ID:goldmansachs,项目名称:tablasco,代码行数:17,代码来源:HideMatchedRowsTest.java

示例14: ignoreColumns

import org.eclipse.collections.impl.factory.Maps; //导入依赖的package包/类
@Test
public void ignoreColumns() throws IOException
{
    VerifiableTable table1 = TableTestUtils.createTable(4, "Col 1", "Col 2", "Col 3", "Col 4", "A1", "A2", "A3", "A4");
    VerifiableTable table2 = TableTestUtils.createTable(4, "Col 1", "Col 2", "Col 3", "Col 4", "A1", "XX", "A3", "XX");
    this.tableVerifier.withIgnoreColumns("Col 2", "Col 4").verify(Maps.fixedSize.of("name", table1), Maps.fixedSize.of("name", table2));

    Assert.assertEquals(
            "<table border=\"1\" cellspacing=\"0\">\n" +
            "<tr>\n" +
            "<th class=\"pass\">Col 1</th>\n" +
            "<th class=\"pass\">Col 3</th>\n" +
            "</tr>\n" +
            "<tr>\n" +
            "<td class=\"pass\">A1</td>\n" +
            "<td class=\"pass\">A3</td>\n" +
            "</tr>\n" +
            "</table>", TableTestUtils.getHtml(this.tableVerifier, "table"));
}
 
开发者ID:goldmansachs,项目名称:tablasco,代码行数:20,代码来源:IgnoreColumnsTest.java

示例15: allRowsMatch

import org.eclipse.collections.impl.factory.Maps; //导入依赖的package包/类
@Test
public void allRowsMatch() throws IOException
{
    VerifiableTable table = TableTestUtils.createTable(2, "Col 1", "Col 2", "A1", "A2", "B1", "B2");
    this.tableVerifier.withIgnoreMissingRows().withIgnoreSurplusRows().verify(Maps.fixedSize.of("name", table), Maps.fixedSize.of("name", table));
    Assert.assertEquals(
            "<table border=\"1\" cellspacing=\"0\">\n" +
            "<tr>\n" +
            "<th class=\"pass\">Col 1</th>\n" +
            "<th class=\"pass\">Col 2</th>\n" +
            "</tr>\n" +
            "<tr>\n" +
            "<td class=\"pass\">A1</td>\n" +
            "<td class=\"pass\">A2</td>\n" +
            "</tr>\n" +
            "<tr>\n" +
            "<td class=\"pass\">B1</td>\n" +
            "<td class=\"pass\">B2</td>\n" +
            "</tr>\n" +
            "</table>", TableTestUtils.getHtml(this.tableVerifier, "table"));
}
 
开发者ID:goldmansachs,项目名称:tablasco,代码行数:22,代码来源:IgnoreMissingAndSurplusTest.java


注:本文中的org.eclipse.collections.impl.factory.Maps类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。