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


Java MutableMap.put方法代码示例

本文整理汇总了Java中org.eclipse.collections.api.map.MutableMap.put方法的典型用法代码示例。如果您正苦于以下问题:Java MutableMap.put方法的具体用法?Java MutableMap.put怎么用?Java MutableMap.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.collections.api.map.MutableMap的用法示例。


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

示例1: prepare

import org.eclipse.collections.api.map.MutableMap; //导入方法依赖的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

示例2: getSourceEncodings

import org.eclipse.collections.api.map.MutableMap; //导入方法依赖的package包/类
private ImmutableMap<String, String> getSourceEncodings(Config metadataConfig) {
    if (metadataConfig.hasPath("sourceEncodings")) {
        Config sourceEncodings = metadataConfig.getConfig("sourceEncodings");

        MutableMap<String, String> encodingsMap = Maps.mutable.empty();
        for (String encoding : sourceEncodings.root().keySet()) {
            String fileList = sourceEncodings.getString(encoding);
            for (String file : fileList.split(",")) {
                encodingsMap.put(file, encoding);
            }
        }

        return encodingsMap.toImmutable();
    }
    return Maps.immutable.empty();
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:17,代码来源:PackageMetadataReader.java

示例3: initPatternMap

import org.eclipse.collections.api.map.MutableMap; //导入方法依赖的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

示例4: IqDataSource

import org.eclipse.collections.api.map.MutableMap; //导入方法依赖的package包/类
public IqDataSource(DbEnvironment env, Credential userCredential, int numThreads, IqDataSourceFactory subDataSourceFactory) {
    this.env = env;
    this.subDataSourceFactory = subDataSourceFactory;

    MutableMap<PhysicalSchema, DataSource> dsMap = Maps.mutable.empty();
    for (PhysicalSchema physicalSchema : env.getPhysicalSchemas()) {
        String schema = physicalSchema.getPhysicalName();
        LOG.info("Creating datasource against schema {}", schema);
        DataSource ds = subDataSourceFactory.createDataSource(env,
                userCredential,
                schema,
                numThreads
        );

        dsMap.put(physicalSchema, ds);
    }

    this.dsMap = dsMap.toImmutable();
    this.setCurrentSchema(this.env.getPhysicalSchemas().getFirst());  // set one arbitrarily as the default
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:21,代码来源:IqDataSource.java

示例5: getPeopleByLastName

import org.eclipse.collections.api.map.MutableMap; //导入方法依赖的package包/类
@Test
public void getPeopleByLastName()
{
    // Do you recognize this pattern?
    MutableMap<String, MutableList<Person>> lastNamesToPeople = Maps.mutable.empty();
    for (Person person : this.people)
    {
        String lastName = person.getLastName();
        MutableList<Person> peopleWithLastName = lastNamesToPeople.get(lastName);
        if (peopleWithLastName == null)
        {
            peopleWithLastName = Lists.mutable.empty();
            lastNamesToPeople.put(lastName, peopleWithLastName);
        }
        peopleWithLastName.add(person);
    }
    Verify.assertIterableSize(3, lastNamesToPeople.get("Smith"));

    // Hint: use the appropriate method on this.people to create a Multimap<String, Person>
    Multimap<String, Person> byLastNameMultimap = null;

    Verify.assertIterableSize(3, byLastNameMultimap.get("Smith"));
}
 
开发者ID:eclipse,项目名称:eclipse-collections-kata,代码行数:24,代码来源:Exercise3Test.java

示例6: getDbPlatformMap

import org.eclipse.collections.api.map.MutableMap; //导入方法依赖的package包/类
/**
 * Returns the default name-to-platform mappings. We put this in a separate protected method to allow external
 * distributions to override these values as needed.
 */
protected ImmutableMap<String, String> getDbPlatformMap() {
    MutableMap<String, String> platformByName = Maps.mutable.empty();

    for (String platformName : platformConfigs.root().keySet()) {
        String platformClass = getPlatformConfig(platformName).getString("class");
        platformByName.put(platformName, platformClass);
        LOG.debug("Registering platform {} at class {}", platformName, platformClass);
    }

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

示例7: populateConfig

import org.eclipse.collections.api.map.MutableMap; //导入方法依赖的package包/类
private static void populateConfig(Config config, MutableMap<String, Object> params, String attr) {
    if (config.hasPath(attr)) {
        Config attrs = config.getConfig(attr);
        MutableMap<String, String> attrsMap = Maps.mutable.empty();
        for (String key : attrs.root().keySet()) {
            attrsMap.put(key, config.getString(attr + "." + key));
        }
        params.put(attr, attrsMap);
    }
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:11,代码来源:ParamReader.java

示例8: getChangeTypeBehaviors

import org.eclipse.collections.api.map.MutableMap; //导入方法依赖的package包/类
@Override
protected MutableMap<String, ChangeTypeBehavior> getChangeTypeBehaviors() {
    MutableMap<String, ChangeTypeBehavior> changeTypeBehaviors = super.getChangeTypeBehaviors();

    ChangeType routineChangeType = platform().getChangeTypes().detect(Predicates.attributeEqual(ChangeType.TO_NAME, ChangeType.FUNCTION_STR));
    changeTypeBehaviors.put(ChangeType.FUNCTION_STR, new PostgreSqlFunctionChangeTypeBehavior(env, (DbChangeType) routineChangeType, getSqlExecutor(), simpleArtifactDeployer(), grantChangeParser(), graphEnricher(), platform(), getDbMetadataManager()));

    return changeTypeBehaviors;
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:10,代码来源:PostgreSqlAppContext.java

示例9: getChangeTypeBehaviors

import org.eclipse.collections.api.map.MutableMap; //导入方法依赖的package包/类
@Override
protected MutableMap<String, ChangeTypeBehavior> getChangeTypeBehaviors() {
    MutableMap<String, ChangeTypeBehavior> changeTypeBehaviors = super.getChangeTypeBehaviors();
    changeTypeBehaviors.put(ChangeType.SP_STR, updateRoutineType(ChangeType.SP_STR));
    changeTypeBehaviors.put(ChangeType.FUNCTION_STR, updateRoutineType(ChangeType.FUNCTION_STR));
    return changeTypeBehaviors;
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:8,代码来源:Db2AppContext.java

示例10: generate

import org.eclipse.collections.api.map.MutableMap; //导入方法依赖的package包/类
public void generate(String schema) {
    MutableSet<MyInput> inputs = Sets.mutable.empty();

    inputs.withAll(getUserTypes(numTypes));
    inputs.withAll(getTables());
    inputs.withAll(getViews());
    inputs.withAll(getSps());


    MutableSet<String> types = Sets.mutable.of("table", "view", "sp", "usertype");
    File outputDir = new File("./target/testoutput");
    FileUtils.deleteQuietly(outputDir);
    outputDir.mkdirs();
    for (MyInput input : inputs) {
        MutableMap<String, Object> params = Maps.mutable.<String, Object>empty().withKeyValue(
                "name", input.getName()
        );
        for (String type : types) {
            params.put("dependent" + type + "s", input.getDependenciesByType().get(type));
        }

        File outputFile = new File(outputDir, schema + "/" + input.getType() + "/" + input.getName() + ".sql");
        outputFile.getParentFile().mkdirs();
        TestTemplateUtil.getInstance().writeTemplate("schemagen/" + input.getType() + ".sql.ftl", params, outputFile);
    }

}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:28,代码来源:SchemaGenerator.java

示例11: getCountsByPetType

import org.eclipse.collections.api.map.MutableMap; //导入方法依赖的package包/类
@Test
public void getCountsByPetType()
{
    MutableList<PetType> petTypes = this.people.flatCollect(Person::getPets).collect(Pet::getType);

    // Do you recognize this pattern?
    MutableMap<PetType, Integer> petTypeCounts = Maps.mutable.empty();
    for (PetType petType : petTypes)
    {
        Integer count = petTypeCounts.get(petType);
        if (count == null)
        {
            count = 0;
        }
        petTypeCounts.put(petType, count + 1);
    }

    Assert.assertEquals(Integer.valueOf(2), petTypeCounts.get(PetType.CAT));
    Assert.assertEquals(Integer.valueOf(2), petTypeCounts.get(PetType.DOG));
    Assert.assertEquals(Integer.valueOf(2), petTypeCounts.get(PetType.HAMSTER));
    Assert.assertEquals(Integer.valueOf(1), petTypeCounts.get(PetType.SNAKE));
    Assert.assertEquals(Integer.valueOf(1), petTypeCounts.get(PetType.TURTLE));
    Assert.assertEquals(Integer.valueOf(1), petTypeCounts.get(PetType.BIRD));

    // Hint: use the appropriate method on this.people to create a Bag<PetType>
    Bag<PetType> counts = null;
    Assert.assertEquals(2, counts.occurrencesOf(PetType.CAT));
    Assert.assertEquals(2, counts.occurrencesOf(PetType.DOG));
    Assert.assertEquals(2, counts.occurrencesOf(PetType.HAMSTER));
    Assert.assertEquals(1, counts.occurrencesOf(PetType.SNAKE));
    Assert.assertEquals(1, counts.occurrencesOf(PetType.TURTLE));
    Assert.assertEquals(1, counts.occurrencesOf(PetType.BIRD));
}
 
开发者ID:eclipse,项目名称:eclipse-collections-kata,代码行数:34,代码来源:Exercise3Test.java

示例12: getPeopleByTheirPets

import org.eclipse.collections.api.map.MutableMap; //导入方法依赖的package包/类
@Test
public void getPeopleByTheirPets()
{
    // Do you recognize this pattern?
    MutableMap<PetType, MutableSet<Person>> peopleByPetType = Maps.mutable.empty();

    for (Person person : this.people)
    {
        MutableList<Pet> pets = person.getPets();
        for (Pet pet : pets)
        {
            PetType petType = pet.getType();
            MutableSet<Person> peopleWithPetType = peopleByPetType.get(petType);
            if (peopleWithPetType == null)
            {
                peopleWithPetType = Sets.mutable.empty();
                peopleByPetType.put(petType, peopleWithPetType);
            }
            peopleWithPetType.add(person);
        }
    }

    Verify.assertIterableSize(2, peopleByPetType.get(PetType.CAT));
    Verify.assertIterableSize(2, peopleByPetType.get(PetType.DOG));
    Verify.assertIterableSize(1, peopleByPetType.get(PetType.HAMSTER));
    Verify.assertIterableSize(1, peopleByPetType.get(PetType.TURTLE));
    Verify.assertIterableSize(1, peopleByPetType.get(PetType.BIRD));
    Verify.assertIterableSize(1, peopleByPetType.get(PetType.SNAKE));

    // Hint: use the appropriate method on this.people with a target collection to create a MutableSetMultimap<String, Person>
    // Hint: this.people is a MutableList, so it will return a MutableListMultimap without a target collection
    MutableSetMultimap<PetType, Person> multimap = null;

    Verify.assertIterableSize(2, multimap.get(PetType.CAT));
    Verify.assertIterableSize(2, multimap.get(PetType.DOG));
    Verify.assertIterableSize(1, multimap.get(PetType.HAMSTER));
    Verify.assertIterableSize(1, multimap.get(PetType.TURTLE));
    Verify.assertIterableSize(1, multimap.get(PetType.BIRD));
    Verify.assertIterableSize(1, multimap.get(PetType.SNAKE));
}
 
开发者ID:eclipse,项目名称:eclipse-collections-kata,代码行数:41,代码来源:Exercise3Test.java

示例13: examineLocation

import org.eclipse.collections.api.map.MutableMap; //导入方法依赖的package包/类
private static void examineLocation(SubAnalyzer sa, @NonNull SequenceLocation location,
		MutableMap<SubAnalyzer, LocationExaminationResults> resultsMap) {
	LocationExaminationResults results = sa.examineLocation(location);
	if (NONTRIVIAL_ASSERTIONS) {
		for (CandidateSequence c: results.analyzedCandidateSequences) {
			//noinspection ObjectEquality
			Assert.isTrue(c.getOwningAnalyzer() == sa.analyzer);
		}
	}
	resultsMap.put(sa, results);
}
 
开发者ID:cinquin,项目名称:mutinack,代码行数:12,代码来源:SubAnalyzerPhaser.java

示例14: parseString

import org.eclipse.collections.api.map.MutableMap; //导入方法依赖的package包/类
private ImmutableList<TextMarkupDocumentSection> parseString(String text, MutableList<String> elementsToCheck, boolean recurse,
        String elementPrefix) {
    MutableList<TextMarkupDocumentSection> sections = Lists.mutable.empty();
    while (true) {
        int earliestIndex = Integer.MAX_VALUE;

        for (String firstLevelElement : elementsToCheck) {
            int index = text.indexOf(elementPrefix + " " + firstLevelElement, 1);
            if (index != -1 && index < earliestIndex) {
                earliestIndex = index;
            }
        }

        if (earliestIndex == Integer.MAX_VALUE) {
            sections.add(new TextMarkupDocumentSection(null, text));
            break;
        } else {
            sections.add(new TextMarkupDocumentSection(null, text.substring(0, earliestIndex)));
            text = text.substring(earliestIndex);
        }
    }
    for (TextMarkupDocumentSection section : sections) {
        MutableMap<String, String> attrs = Maps.mutable.empty();
        MutableSet<String> toggles = Sets.mutable.empty();
        String content = StringUtils.chomp(section.getContent());

        String[] contents = content.split("\\r?\\n", 2);
        String firstLine = contents[0];

        for (String elementToCheck : elementsToCheck) {
            if (firstLine.startsWith(elementPrefix + " " + elementToCheck)) {
                section.setName(elementToCheck);
                String[] args = StringUtils.splitByWholeSeparator(firstLine, " ");
                for (String arg : args) {
                    if (arg.contains("=")) {
                        String[] attr = arg.split("=");
                        if (attr.length > 2) {
                            throw new IllegalArgumentException("Cannot mark = multiple times in a parameter - "
                                    + firstLine);
                        }
                        String attrVal = attr[1];
                        if (attrVal.startsWith("\"") && attrVal.endsWith("\"")) {
                            attrVal = attrVal.substring(1, attrVal.length() - 1);
                        }
                        attrs.put(attr[0], attrVal);
                    } else {
                        toggles.add(arg);
                    }
                }
                if (contents.length > 1) {
                    content = contents[1];
                } else {
                    content = null;
                }
            }
        }
        section.setAttrs(attrs.toImmutable());
        section.setToggles(toggles.toImmutable());

        if (!recurse) {
            section.setContent(content);
        } else if (content != null) {
            ImmutableList<TextMarkupDocumentSection> subsections = this.parseString(content, this.secondLevelElements, false, "//");
            if (subsections.size() == 1) {
                section.setContent(content);
            } else {
                section.setContent(subsections.get(0).getContent());
                section.setSubsections(subsections.subList(1, subsections.size()));
            }
        } else {
            section.setContent(null);
        }
    }

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

示例15: parseAttrsAndToggles

import org.eclipse.collections.api.map.MutableMap; //导入方法依赖的package包/类
Pair<ImmutableMap<String, String>, ImmutableSet<String>> parseAttrsAndToggles(String line) {
    MutableMap<String, String> attrs = Maps.mutable.empty();
    MutableSet<String> toggles = Sets.mutable.empty();

    if (!legacyMode) {
        List<Token> tokens = TextMarkupParser.parseTokens(line);
        Token curToken = !tokens.isEmpty() ? tokens.get(0) : null;
        while (curToken != null && curToken.kind != TextMarkupLineSyntaxParserConstants.EOF) {
            switch (curToken.kind) {
            case TextMarkupLineSyntaxParserConstants.WHITESPACE:
                // skip whitespace if encountered
                break;
            case TextMarkupLineSyntaxParserConstants.QUOTED_LITERAL:
            case TextMarkupLineSyntaxParserConstants.STRING_LITERAL:
                // let's check if this is a toggle or an attribute
                if (curToken.next.kind == TextMarkupLineSyntaxParserConstants.ASSIGN) {
                    Token keyToken = curToken;
                    curToken = curToken.next;  // to ASSIGN
                    curToken = curToken.next;  // to the following token
                    switch (curToken.kind) {
                    case TextMarkupLineSyntaxParserConstants.QUOTED_LITERAL:
                    case TextMarkupLineSyntaxParserConstants.STRING_LITERAL:
                        // in this case, we have an attribute value
                        String value = curToken.image;
                        if (value.charAt(0) == '"' && value.charAt(value.length() - 1) == '"') {
                            value = curToken.image.substring(1, curToken.image.length() - 1);
                        }
                        value = value.replaceAll("\\\\\"", "\"");
                        attrs.put(keyToken.image, value);
                        break;
                    case TextMarkupLineSyntaxParserConstants.WHITESPACE:
                    case TextMarkupLineSyntaxParserConstants.EOF:
                        // in this case, we will assume a blank value
                        attrs.put(keyToken.image, "");
                        break;
                    case TextMarkupLineSyntaxParserConstants.ASSIGN:
                    default:
                        throw new IllegalStateException("Not allowed here");
                    }
                } else {
                    toggles.add(curToken.image);
                }
                break;
            case TextMarkupLineSyntaxParserConstants.ASSIGN:
                toggles.add(curToken.image);
                break;
            case TextMarkupLineSyntaxParserConstants.EOF:
            default:
                throw new IllegalStateException("Should not arise");
            }

            curToken = curToken.next;
        }
    } else {
        // keeping this mode for backwards-compatibility until we can guarantee all clients are fine without it
        // This way cannot handle spaces in quotes
        String[] args = StringUtils.splitByWholeSeparator(line, " ");

        for (String arg : args) {
            if (arg.contains("=")) {
                String[] attr = arg.split("=");
                if (attr.length > 2) {
                    throw new IllegalArgumentException("Cannot mark = multiple times in a parameter - " + line);
                }
                String attrVal = attr[1];
                if (attrVal.startsWith("\"") && attrVal.endsWith("\"")) {
                    attrVal = attrVal.substring(1, attrVal.length() - 1);
                }
                attrs.put(attr[0], attrVal);
            } else if (StringUtils.isNotBlank(arg)) {
                toggles.add(arg);
            }
        }
    }

    return Tuples.pair(attrs.toImmutable(), toggles.toImmutable());
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:78,代码来源:TextMarkupDocumentReader.java


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