本文整理汇总了Java中org.apache.commons.collections4.map.MultiValueMap类的典型用法代码示例。如果您正苦于以下问题:Java MultiValueMap类的具体用法?Java MultiValueMap怎么用?Java MultiValueMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MultiValueMap类属于org.apache.commons.collections4.map包,在下文中一共展示了MultiValueMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkType
import org.apache.commons.collections4.map.MultiValueMap; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected int checkType(String string, MultiValueMap stringTreeMap)
{
Collection<StringTree> values = stringTreeMap.values();
int errors = 0;
for (StringTree tree : values)
{
if ((string.equals("MOD") && tree.isAuxtree())
|| (string.equals("ARG") && !tree.isAuxtree()))
{
//ok
}
else
{
System.err.println("wrong tree type: " + string + tree.getStructure(tree.getRoot(), opts.useSemantics));
errors++;
}
}
return errors;
}
示例2: updateEntryWithRolesMap
import org.apache.commons.collections4.map.MultiValueMap; //导入依赖的package包/类
private void updateEntryWithRolesMap(MultiValueMap<String, LexiconEntryWithRoles> map, String key, LexiconEntryWithRoles entry, String unlexEntryWithSemantics)
{
Collection<LexiconEntryWithRoles> col = map.getCollection(key);
if(col != null && col.contains(entry))
{
for(LexiconEntryWithRoles e : col)
{
if(entry.equals(e)) // syntactically same tree with (potentially) different role assignments
{
e.addEntry(entry, unlexEntryWithSemantics);
break;
}
} // for
} // if
else
{
map.put(key, entry);
}
}
示例3: SemanticsPerformance
import org.apache.commons.collections4.map.MultiValueMap; //导入依赖的package包/类
public SemanticsPerformance(Indexer<String> roleIndexer, Map<Integer, Integer> roleFreqs)
{
evalb = new EvalbImpl("Evalb LP/LR", true);
TreebankLangParserParams tlpp = Languages.getLanguageParams(Languages.Language.English);
tlpp.setInputEncoding("UTF-8");
treeCollinizer = tlpp.collinizer();
conllRoleIndexer = roleIndexer;
numOfRoles = roleIndexer.size();
this.roleFreqs = roleFreqs;
counts = new int[numOfRoles + 1][numOfRoles + 1];
correctCounts = new int[numOfRoles];
goldCounts = new int[numOfRoles];
srlResult = new EvalResult();
predResult = new EvalResult();
argsResult = new EvalResult();
errorsMap = new MultiValueMap<String, String>();
}
示例4: getRolesPerNode
import org.apache.commons.collections4.map.MultiValueMap; //导入依赖的package包/类
/**
* Create a map of nodes that have a role. Note, we split role signatures into
* individual nodes with roles; this might potentially result in combinations of roles
* in trees not existing in the training set.
* @param tree an ElementaryStringTree with potential roles attached to it
* @param offset the node id offset. This is the highest node id of the prefix tree.
* @return
*/
private MultiValueMap<Integer, Role> getRolesPerNode(ElementaryStringTree tree, short offset)
{
MultiValueMap<Integer, Role> roleMap = new MultiValueMap();
for(RoleSignature sig : tree.getRoleSignatures())
{
for(Role role : sig.getRoles().values()) // wrong! It might result in combination of roles in trees not existing in the training set
{
int newId = role.getNodeId() + offset;
Collection<Role> rolesPerNode = roleMap.getCollection(newId);
if(rolesPerNode == null || !rolesPerNode.contains(role)) // if the collection is empty and doesn't contain the same role
roleMap.put(newId, role);
if(role.secondRoleNameId != null) // make sure we treat roles with multiple argument labels separately (e.g., @ARG1;@ARG0)
{
Role secondRole = new Role(role.roleIndexer, role.secondRoleNameId, role.nodeId);
if(!roleMap.getCollection(newId).contains(secondRole))
roleMap.put(newId, secondRole);
}
}
}
return roleMap;
}
示例5: copyPred
import org.apache.commons.collections4.map.MultiValueMap; //导入依赖的package包/类
public PredictionStringTree copyPred(){
PredictionStringTree copy = new PredictionStringTree(this.arraysize, useSemantics);
copy.fullcategories = this.fullcategories.clone();
copy.categories = this.categories.clone();
copy.roles = this.roles.clone();
copy.nodeTypes = this.nodeTypes.clone();
copy.parent = this.parent.clone();
copy.isHeadChild = this.isHeadChild.clone();
copy.children = (HashMap<Integer, ArrayList<Integer>>) this.children.clone();
copy.origin = new MultiValueMap();
copy.origin.putAll(this.origin);
copy.originDown = new MultiValueMap();
copy.originDown.putAll(this.originDown);
copy.originUp = new MultiValueMap();
copy.originUp.putAll(this.originUp);
//copy.indexUp = this.indexUp.clone();
copy.root = this.root;
copy.foot = this.foot;
copy.auxtree = this.auxtree;
copy.arraysize = this.arraysize;
//copy.adjPossible = this.adjPossible.clone();
return copy;
}
示例6: makeMapping
import org.apache.commons.collections4.map.MultiValueMap; //导入依赖的package包/类
private void makeMapping(MultiValueMap<Integer, Integer> origin) {
Iterator valuit = origin.values().iterator();
HashMap<Integer, Boolean> singlevals = new HashMap<Integer, Boolean>();
int maxval = -1;
while (valuit.hasNext()){
Integer val = (Integer) valuit.next();
singlevals.put(val, true);
if (val > maxval){maxval = val;}
// if (Integer.parseInt(val) > maxval){maxval = Integer.parseInt(val);}
}
Boolean[] v = new Boolean[maxval+1];
for (Integer key : singlevals.keySet()){
// for (String key : singlevals.keySet()){
// int intkey= Integer.parseInt(intkey);
v[key]= true;
}
mapping = new int[maxval+1];
int j=1;
for (int i = 0; i < v.length; i++){
if (v[i] != null){
mapping[i] = j;
// mapping[i] = j+"";
j++;
}
}
}
示例7: testPopulateMultiMap_add2677
import org.apache.commons.collections4.map.MultiValueMap; //导入依赖的package包/类
@org.junit.Test(timeout = 1000)
public void testPopulateMultiMap_add2677() {
fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testPopulateMultiMap_add2677");
final List<X> list = new ArrayList<X>();
list.add(new X(1 , "x1"));
list.add(new X(1 , "x1"));
list.add(new X(2 , "x2"));
list.add(new X(2 , "x3"));
list.add(new X(5 , "x4"));
list.add(new X(5 , "x5"));
final MultiValueMap<java.lang.Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<java.lang.Integer, java.util.Collection<X>>());
org.apache.commons.collections4.MapUtils.populateMap(map, list, new Transformer<X, java.lang.Integer>() {
public Integer transform(X input) {
return input.key;
}
}, org.apache.commons.collections4.TransformerUtils.<X>nopTransformer());
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7893,list,7892,list.size());
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7895,map,7894,map.totalSize());
for (int i = 0 ; i < (list.size()) ; i++) {
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7897,map,7896,map.containsKey(list.get(i).key));
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7899,map,7898,map.containsValue(list.get(i)));
}
fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
示例8: testPopulateMultiMap_add2678
import org.apache.commons.collections4.map.MultiValueMap; //导入依赖的package包/类
@org.junit.Test(timeout = 1000)
public void testPopulateMultiMap_add2678() {
fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testPopulateMultiMap_add2678");
final List<X> list = new ArrayList<X>();
list.add(new X(1 , "x1"));
list.add(new X(2 , "x2"));
list.add(new X(2 , "x2"));
list.add(new X(2 , "x3"));
list.add(new X(5 , "x4"));
list.add(new X(5 , "x5"));
final MultiValueMap<java.lang.Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<java.lang.Integer, java.util.Collection<X>>());
org.apache.commons.collections4.MapUtils.populateMap(map, list, new Transformer<X, java.lang.Integer>() {
public Integer transform(X input) {
return input.key;
}
}, org.apache.commons.collections4.TransformerUtils.<X>nopTransformer());
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7893,list,7892,list.size());
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7895,map,7894,map.totalSize());
for (int i = 0 ; i < (list.size()) ; i++) {
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7897,map,7896,map.containsKey(list.get(i).key));
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7899,map,7898,map.containsValue(list.get(i)));
}
fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
示例9: testPopulateMultiMap_add2679
import org.apache.commons.collections4.map.MultiValueMap; //导入依赖的package包/类
@org.junit.Test(timeout = 1000)
public void testPopulateMultiMap_add2679() {
fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testPopulateMultiMap_add2679");
final List<X> list = new ArrayList<X>();
list.add(new X(1 , "x1"));
list.add(new X(2 , "x2"));
list.add(new X(2 , "x3"));
list.add(new X(2 , "x3"));
list.add(new X(5 , "x4"));
list.add(new X(5 , "x5"));
final MultiValueMap<java.lang.Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<java.lang.Integer, java.util.Collection<X>>());
org.apache.commons.collections4.MapUtils.populateMap(map, list, new Transformer<X, java.lang.Integer>() {
public Integer transform(X input) {
return input.key;
}
}, org.apache.commons.collections4.TransformerUtils.<X>nopTransformer());
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7893,list,7892,list.size());
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7895,map,7894,map.totalSize());
for (int i = 0 ; i < (list.size()) ; i++) {
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7897,map,7896,map.containsKey(list.get(i).key));
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7899,map,7898,map.containsValue(list.get(i)));
}
fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
示例10: testPopulateMultiMap_add2680
import org.apache.commons.collections4.map.MultiValueMap; //导入依赖的package包/类
@org.junit.Test(timeout = 1000)
public void testPopulateMultiMap_add2680() {
fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testPopulateMultiMap_add2680");
final List<X> list = new ArrayList<X>();
list.add(new X(1 , "x1"));
list.add(new X(2 , "x2"));
list.add(new X(2 , "x3"));
list.add(new X(5 , "x4"));
list.add(new X(5 , "x4"));
list.add(new X(5 , "x5"));
final MultiValueMap<java.lang.Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<java.lang.Integer, java.util.Collection<X>>());
org.apache.commons.collections4.MapUtils.populateMap(map, list, new Transformer<X, java.lang.Integer>() {
public Integer transform(X input) {
return input.key;
}
}, org.apache.commons.collections4.TransformerUtils.<X>nopTransformer());
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7893,list,7892,list.size());
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7895,map,7894,map.totalSize());
for (int i = 0 ; i < (list.size()) ; i++) {
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7897,map,7896,map.containsKey(list.get(i).key));
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7899,map,7898,map.containsValue(list.get(i)));
}
fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
示例11: testPopulateMultiMap_add2681
import org.apache.commons.collections4.map.MultiValueMap; //导入依赖的package包/类
@org.junit.Test(timeout = 1000)
public void testPopulateMultiMap_add2681() {
fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testPopulateMultiMap_add2681");
final List<X> list = new ArrayList<X>();
list.add(new X(1 , "x1"));
list.add(new X(2 , "x2"));
list.add(new X(2 , "x3"));
list.add(new X(5 , "x4"));
list.add(new X(5 , "x5"));
list.add(new X(5 , "x5"));
final MultiValueMap<java.lang.Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<java.lang.Integer, java.util.Collection<X>>());
org.apache.commons.collections4.MapUtils.populateMap(map, list, new Transformer<X, java.lang.Integer>() {
public Integer transform(X input) {
return input.key;
}
}, org.apache.commons.collections4.TransformerUtils.<X>nopTransformer());
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7893,list,7892,list.size());
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7895,map,7894,map.totalSize());
for (int i = 0 ; i < (list.size()) ; i++) {
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7897,map,7896,map.containsKey(list.get(i).key));
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7899,map,7898,map.containsValue(list.get(i)));
}
fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
示例12: testPopulateMultiMap_add2683
import org.apache.commons.collections4.map.MultiValueMap; //导入依赖的package包/类
@org.junit.Test(timeout = 1000)
public void testPopulateMultiMap_add2683() {
fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testPopulateMultiMap_add2683");
final List<X> list = new ArrayList<X>();
list.add(new X(1 , "x1"));
list.add(new X(2 , "x2"));
list.add(new X(2 , "x3"));
list.add(new X(5 , "x4"));
list.add(new X(5 , "x5"));
final MultiValueMap<java.lang.Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<java.lang.Integer, java.util.Collection<X>>());
org.apache.commons.collections4.MapUtils.populateMap(map, list, new Transformer<X, java.lang.Integer>() {
public Integer transform(X input) {
return input.key;
}
}, org.apache.commons.collections4.TransformerUtils.<X>nopTransformer());
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7893,list,7892,list.size());
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7895,map,7894,map.totalSize());
for (int i = 0 ; i < (list.size()) ; i++) {
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7897,map,7896,map.containsKey(list.get(i).key));
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7899,map,7898,map.containsValue(list.get(i)));
}
fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
示例13: testPopulateMultiMap
import org.apache.commons.collections4.map.MultiValueMap; //导入依赖的package包/类
public void testPopulateMultiMap() {
fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testPopulateMultiMap");
final List<X> list = new ArrayList<X>();
list.add(new X(0 , "x1"));
list.add(new X(2 , "x2"));
list.add(new X(2 , "x3"));
list.add(new X(5 , "x4"));
list.add(new X(5 , "x5"));
final MultiValueMap<java.lang.Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<java.lang.Integer, java.util.Collection<X>>());
org.apache.commons.collections4.MapUtils.populateMap(map, list, new Transformer<X, java.lang.Integer>() {
public Integer transform(X input) {
return input.key;
}
}, org.apache.commons.collections4.TransformerUtils.<X>nopTransformer());
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7893,list,7892,list.size());
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7895,map,7894,map.totalSize());
for (int i = 0 ; i < (list.size()) ; i++) {
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7897,map,7896,map.containsKey(list.get(i).key));
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7899,map,7898,map.containsValue(list.get(i)));
}
fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
示例14: testPopulateMultiMap_literalMutation2796
import org.apache.commons.collections4.map.MultiValueMap; //导入依赖的package包/类
public void testPopulateMultiMap_literalMutation2796() {
fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testPopulateMultiMap_literalMutation2796");
final List<X> list = new ArrayList<X>();
list.add(new X(1 , "foo"));
list.add(new X(2 , "x2"));
list.add(new X(2 , "x3"));
list.add(new X(5 , "x4"));
list.add(new X(5 , "x5"));
final MultiValueMap<java.lang.Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<java.lang.Integer, java.util.Collection<X>>());
org.apache.commons.collections4.MapUtils.populateMap(map, list, new Transformer<X, java.lang.Integer>() {
public Integer transform(X input) {
return input.key;
}
}, org.apache.commons.collections4.TransformerUtils.<X>nopTransformer());
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7893,list,7892,list.size());
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7895,map,7894,map.totalSize());
for (int i = 0 ; i < (list.size()) ; i++) {
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7897,map,7896,map.containsKey(list.get(i).key));
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7899,map,7898,map.containsValue(list.get(i)));
}
fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
示例15: testPopulateMultiMap_literalMutation2797
import org.apache.commons.collections4.map.MultiValueMap; //导入依赖的package包/类
public void testPopulateMultiMap_literalMutation2797() {
fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testPopulateMultiMap_literalMutation2797");
final List<X> list = new ArrayList<X>();
list.add(new X(1 , "x1"));
list.add(new X(1 , "x2"));
list.add(new X(2 , "x3"));
list.add(new X(5 , "x4"));
list.add(new X(5 , "x5"));
final MultiValueMap<java.lang.Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<java.lang.Integer, java.util.Collection<X>>());
org.apache.commons.collections4.MapUtils.populateMap(map, list, new Transformer<X, java.lang.Integer>() {
public Integer transform(X input) {
return input.key;
}
}, org.apache.commons.collections4.TransformerUtils.<X>nopTransformer());
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7893,list,7892,list.size());
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7895,map,7894,map.totalSize());
for (int i = 0 ; i < (list.size()) ; i++) {
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7897,map,7896,map.containsKey(list.get(i).key));
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7899,map,7898,map.containsValue(list.get(i)));
}
fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}