List of usage examples for com.google.common.collect ArrayListMultimap create
public static <K, V> ArrayListMultimap<K, V> create()
From source file:cuchaz.m3l.classTransformation.HookLibrary.java
public HookLibrary() { m_classHooks = ArrayListMultimap.create(); m_behaviorHooks = ArrayListMultimap.create(); }
From source file:org.semanticweb.elk.proofs.adapters.DirectSatEncodingInferenceSetAdapter.java
public static DirectSatEncodingInferenceSetAdapter load(final InputStream assumptions, final InputStream cnf) throws IOException, NumberFormatException { final Set<Integer> axioms = new HashSet<Integer>(); final BufferedReader axiomReader = new BufferedReader(new InputStreamReader(assumptions)); readAxioms(axiomReader, axioms);//from www .j av a 2s.co m // String line; // while ((line = axiomReader.readLine()) != null) { // if (!line.isEmpty()) { // axioms.add(Integer.valueOf(line)); // } // } final ListMultimap<Integer, JustifiedInference<Integer, Integer>> inferences = ArrayListMultimap.create(); final BufferedReader cnfReader = new BufferedReader(new InputStreamReader(cnf)); String line; while ((line = cnfReader.readLine()) != null) { if (line.isEmpty() || line.startsWith("c") || line.startsWith("p")) { continue; } final String[] literals = line.split("\\s"); final List<Integer> premises = new ArrayList<Integer>(literals.length - 2); final List<Integer> justifications = new ArrayList<Integer>(literals.length - 2); Integer conclusion = null; boolean terminated = false; for (int i = 0; i < literals.length; i++) { final int l = Integer.valueOf(literals[i]); if (l < 0) { final int premise = -l; if (axioms.contains(premise)) { justifications.add(premise); } else { premises.add(premise); } } else if (l > 0) { if (conclusion != null) { throw new IOException("Non-Horn clause! \"" + line + "\""); } else { conclusion = l; } } else { // l == 0 if (i != literals.length - 1) { throw new IOException("Clause terminated before the end of line! \"" + line + "\""); } else { terminated = true; } } } if (conclusion == null) { throw new IOException("Clause has no positive literal! \"" + line + "\""); } if (!terminated) { throw new IOException("Clause not terminated at the end of line! \"" + line + "\""); } inferences.put(conclusion, new DirectSatEncodingInference(conclusion, premises, new HashSet<Integer>(justifications))); } return new DirectSatEncodingInferenceSetAdapter(inferences); }
From source file:com.mycompany.swapriori.ConvertToObjectInfo.java
public Map<String, Multimap> convert(List<Triple> listOfTriples) { Map<String, Multimap> ObjectInfo = new LinkedHashMap(100); Map<String, Multimap> ObjectInfo1 = new LinkedHashMap(100); //List<Triple> listOfTriples = new ArrayList<>(100); Set<String> objectSet = new LinkedHashSet(100); for (Triple t : listOfTriples) { objectSet.add(t.object);// w w w . ja va 2 s. c o m } //System.out.println(objectSet); List<Triple> pullOut = null; //Multimap<String, String> multiMap = ArrayListMultimap.create(); //remove all triples with some object for (String iterObject : objectSet) { Multimap<String, String> multiMap = ArrayListMultimap.create(); Multimap<String, String> multiMap1 = ArrayListMultimap.create(); for (Triple t1 : listOfTriples) { if (t1.getObject().equals(iterObject)) { multiMap.put(t1.getPredicate(), t1.getSubject()); multiMap1.put(t1.getPredicate(), t1.getSubject()); } //System.out.println(multiMap); } //System.out.println(multiMap); ObjectInfo.put(iterObject, multiMap1); ObjectInfo1 = new LinkedHashMap(ObjectInfo); //System.out.println(ObjectInfo); //System.out.println("Clearing"); multiMap.clear(); } //System.out.println(multiMap + " " + "final"); //System.out.println(ObjectInfo1 + "Final"); return ObjectInfo1; }
From source file:org.wso2.carbon.uuf.api.config.Bindings.java
/** * Creates a new instance. */ public Bindings() { this.bindings = ArrayListMultimap.create(); }
From source file:ninja.leaping.permissionsex.util.command.CommandContext.java
public CommandContext(CommandSpec spec, String rawInput) { this.spec = spec; this.rawInput = rawInput; this.parsedArgs = ArrayListMultimap.create(); }
From source file:org.sonar.server.search.FacetValue.java
public FacetValue(String key, Integer value) { this.key = key; this.value = value; this.subFacets = ArrayListMultimap.create(); }
From source file:org.opennms.core.wsman.utils.ResponseHandlingUtils.java
public static ListMultimap<String, String> toMultiMap(Node node) { ListMultimap<String, String> elementValues = ArrayListMultimap.create(); // Parse the values from the child nodes NodeList children = node.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if (child.getLocalName() == null || child.getTextContent() == null) { continue; }/*from ww w . j a va 2 s .c om*/ elementValues.put(child.getLocalName(), child.getTextContent()); } return elementValues; }
From source file:org.opentestsystem.shared.security.domain.ProgmanPermissionsResolver.java
private Multimap<String, SbacPermission> getPermissions(final String componentName) { if (permissions.isEmpty()) { Multimap<String, SbacPermission> tempPers = ArrayListMultimap.create(); //Administrator Role for (String permString : Permissions.getPermissionStrings()) { SbacPermission perm = new SbacPermission(); perm.setName(permString);//from w w w . j av a 2s . c om perm.setComponentName(componentName); tempPers.put("Administrator", perm); tempPers.put("Program Management Admin", perm); } //Program Management Read SbacPermission perm = new SbacPermission(); perm.setName(Permissions.PROGMAN_READ.getTitle()); perm.setComponentName(componentName); tempPers.put("Program Management Read", perm); //wait till the end to avoid parial load with sync calls permissions.putAll(tempPers); } return permissions; }
From source file:org.rf.ide.core.testdata.mapping.collect.RobotTokensCollector.java
public ListMultimap<RobotTokenType, RobotToken> extractRobotTokens(final RobotFileOutput tokensHolder) { final ListMultimap<RobotTokenType, RobotToken> tokensPerType = ArrayListMultimap.create(); for (final ITableTokensCollector collector : tokenCollectors) { final List<RobotToken> tokens = collector.collect(tokensHolder); update(tokens, tokensPerType);/*from w ww. j ava2s.co m*/ tokens.clear(); } return tokensPerType; }
From source file:com.github.drbookings.ui.controller.BookingEntryMonthBins.java
@Override public Collection<BookingEntryBin<YearMonth>> getBins() { Multimap<YearMonth, BookingEntry> result = ArrayListMultimap.create(); elements.forEach(e -> result.put(YearMonth.from(e.getDate()), e)); Collection<BookingEntryBin<YearMonth>> result2 = new ArrayList<>(); result.asMap().forEach((k, v) -> result2.add(new BookingEntryBin<>(k, v))); return result2; }