List of usage examples for java.util LinkedList addAll
public boolean addAll(Collection<? extends E> c)
From source file:es.emergya.ui.gis.popups.ConsultaHistoricos.java
public static List<Object> getCurrentIncidencias() { synchronized (incidenciasMostradas) { LinkedList<Object> res = new LinkedList<Object>(); res.addAll(incidenciasMostradas); return res; }/* www.j av a 2 s .c o m*/ }
From source file:org.shept.org.springframework.web.servlet.mvc.delegation.SubmitActionResolver.java
public WebActionToken getAction(HttpServletRequest request, Set<String> componentPathName, Map<String, List<WebComponent>> handlersForPath) { if (componentPathName == null) { componentPathName = new HashSet<String>(); }//from w ww. j a v a 2 s .com LinkedList<String> pathNames = new LinkedList<String>(); pathNames.addAll(componentPathName); // sort longest strings to be searched first ! Collections.sort(pathNames, new Comparator<String>() { public int compare(String o1, String o2) { return Integer.valueOf(o2.length()).compareTo(o1.length()); } }); for (String pathCandidate : pathNames) { Map<String, Object> params = WebUtils.getParametersStartingWith(request, pathCandidate); if (params.size() > 0) { List<WebComponent> handlers = handlersForPath.get(pathCandidate); if (handlers != null) { for (WebComponent handler : handlers) { Map<String, String> mappings = handler.getMappings(); if (mappings == null) { throw new IllegalStateException("Configuration error for component " + handler.getClass() + " Submission parameters are not mapped to Handlers action (excecution) methods"); } for (String candidate : mappings.keySet()) { String parameterValue = WebUtils.findParameterValue(params, candidate); if (parameterValue != null) { WebActionToken token = new WebActionToken(); token.setHandler(handler); token.setPathName(pathCandidate); token.setMethod(getMappings(handler).get(candidate)); token.setValue(parameterValue); if (logger.isDebugEnabled()) { logger.debug("Determined token: " + token); } return token; } } } } } } return null; // no action found - it's not a form submission }
From source file:com.falcon.orca.data.readers.impl.JsonFileReader.java
public JsonFileReader(final String dataFilePath, final String templateFilePath) throws IOException { if (!StringUtils.isBlank(templateFilePath)) { this.template = Files.readAllBytes(Paths.get(templateFilePath)); } else {//w w w . ja v a 2 s .co m this.template = new byte[0]; } DynJsonData dynData = objectMapper.readValue(new File(dataFilePath), DynJsonData.class); dynData.getBodyParams().forEach((k, v) -> { switch (v.getType()) { case USE_ONCE: { LinkedList<Object> data = new LinkedList<>(); data.addAll(v.getValues()); bodyData.put(k, data); bodyVarUseType.put(k, DynVarUseType.USE_ONCE); break; } case USE_MULTIPLE: { ArrayList<Object> data = new ArrayList<>(); data.addAll(v.getValues()); bodyData.put(k, data); bodyVarUseType.put(k, DynVarUseType.USE_MULTIPLE); break; } } }); dynData.getUrlParams().forEach((k, v) -> { switch (v.getType()) { case USE_ONCE: { LinkedList<Object> data = new LinkedList<>(); data.addAll(v.getValues()); urlData.put(k, data); urlVarUseType.put(k, DynVarUseType.USE_ONCE); break; } case USE_MULTIPLE: { ArrayList<Object> data = new ArrayList<>(); data.addAll(v.getValues()); urlData.put(k, data); urlVarUseType.put(k, DynVarUseType.USE_MULTIPLE); break; } } }); generators = dynData.getGenerators(); }
From source file:it.cnr.istc.iloc.gui.TimelinesChart.java
@Override public void currentNode(Solver.Node n) { final CombinedDomainXYPlot combined_plot = new CombinedDomainXYPlot(new DateAxis("Time")); combined_plot.setGap(3.0);/*from www .ja v a 2 s. c o m*/ combined_plot.setOrientation(PlotOrientation.VERTICAL); Set<Type> c_types = new HashSet<>(); LinkedList<Type> queue = new LinkedList<>(); queue.addAll(solver.getTypes()); while (!queue.isEmpty()) { Type c_type = queue.pollFirst(); if (!c_types.contains(c_type)) { c_types.add(c_type); queue.addAll(c_type.getTypes()); } } for (Type type : c_types) { if (visualizers.containsKey(type.getClass())) { for (XYPlot plot : visualizers.get(type.getClass()).getPlots(type)) { TextTitle title = new TextTitle(type.name, new Font("SansSerif", Font.PLAIN, 11), Color.BLACK, RectangleEdge.TOP, HorizontalAlignment.CENTER, VerticalAlignment.BOTTOM, new RectangleInsets(4, 4, 4, 4)); XYTitleAnnotation titleAnn = new XYTitleAnnotation(0.01, 1, title, RectangleAnchor.TOP_LEFT); plot.addAnnotation(titleAnn); combined_plot.add(plot, 1); } } } setChart(new JFreeChart("", new Font("SansSerif", Font.BOLD, 14), combined_plot, false)); setBorder(BorderFactory.createEtchedBorder()); }
From source file:net.sourceforge.jabm.report.CombiSeriesReportVariables.java
@Override public List<Object> getyVariableNames() { LinkedList<Object> result = new LinkedList<Object>(); for (Timeseries series : seriesList) { result.addAll(series.getyVariableNames()); }//ww w. j a v a 2 s. c o m return result; }
From source file:net.sourceforge.jabm.view.JFrameReportVariables.java
@Override public Object getValueAt(int rowIndex, int columnIndex) { LinkedList<Object> variables = new LinkedList<Object>(); variables.addAll(variableBindings.keySet()); Object variable = variables.get(rowIndex); if (columnIndex == 0) { return variable.toString(); } else {// w w w . java 2s .c o m return format.format(variableBindings.get(variable).doubleValue()); } }
From source file:org.bibsonomy.scraper.CompositeScraper.java
/** * Returns the collection of all the scrapers contained in the Composite Scraper * // w w w . j a va 2 s . c om */ public Collection<Scraper> getScraper() { final LinkedList<Scraper> scrapers = new LinkedList<Scraper>(); for (final S scraper : _scrapers) { scrapers.addAll(scraper.getScraper()); } return scrapers; }
From source file:org.epsilonlabs.workflow.execution.example.GraphOutput.java
@Override public void onNext(Object o) { // update graph Entry<?, ?> entry = (Entry<?, ?>) o; String key = entry.getKey().toString(); String value = entry.getValue().toString(); if (key.startsWith("[") && key.endsWith("]")) { String[] keys = key.split(","); for (String key1 : keys) { onNext(createEntry(key1, value)); }/*from w w w. j av a2 s . co m*/ return; } if (data.containsKey(key)) { data.get(key).add(value); // dataset.addValue(data.get(key).size(), "null", key); } else { HashSet<String> ret = new HashSet<>(); ret.add(value); data.put(key, ret); // dataset.addValue(data.get(key).size(), "null", key); } // sort every 100 iterations to avoid flicker if (current % 100 == 0) dataset.clear(); LinkedList<Entry<String, HashSet<String>>> list = new LinkedList<>(); list.addAll(data.entrySet()); list.sort(new Comparator<Entry<String, HashSet<String>>>() { @Override public int compare(Entry<String, HashSet<String>> o1, Entry<String, HashSet<String>> o2) { return new Integer(o2.getValue().size()).compareTo(o1.getValue().size()); } }); for (Entry<String, HashSet<String>> e : list) dataset.addValue(e.getValue().size(), "null", e.getKey()); // // current++; if (current % period == 0) notifyObserversOfStatusChange("processed " + current + " elements"); }
From source file:org.codice.ddf.security.filter.delegate.DelegateServletFilter.java
@Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest httpRequest = (HttpServletRequest) servletRequest; if (contextPolicyManager != null) { String contextPath = !StringUtils.isBlank(httpRequest.getContextPath()) ? httpRequest.getContextPath() : httpRequest.getServletPath() + httpRequest.getPathInfo(); if (contextPolicyManager.isWhiteListed(contextPath)) { LOGGER.debug(// w ww. j a v a 2 s . c o m "Current Context path {} has been white listed by the local policy, no authentication or authorization filters will be applied.", contextPath); filterChain.doFilter(servletRequest, servletResponse); return; } } LinkedList<ServiceReference<Filter>> serviceRefs = new LinkedList<ServiceReference<Filter>>(); try { serviceRefs.addAll(ctx.getServiceReferences(Filter.class, null)); } catch (InvalidSyntaxException e) { LOGGER.warn("Could not lookup service references.", e); } if (!serviceRefs.isEmpty()) { LOGGER.debug("Found {} filter, now filtering...", serviceRefs.size()); ProxyFilterChain chain = new ProxyFilterChain(filterChain); Iterator<ServiceReference<Filter>> reverseIterator = serviceRefs.descendingIterator(); while (reverseIterator.hasNext()) { ServiceReference<Filter> curReference = reverseIterator.next(); Filter curFilter = ctx.getService(curReference); if (!curFilter.getClass().toString().equals(this.getClass().toString())) { chain.addFilter(curFilter); } reverseIterator.remove(); } chain.doFilter(servletRequest, servletResponse); } else { LOGGER.debug("Did not find any filters"); filterChain.doFilter(servletRequest, servletResponse); } }
From source file:org.alfresco.solr.tracker.CascadeTracker.java
private void processCascades() throws IOException { //System.out.println("######### processCascades()"); int num = 50; List<Transaction> txBatch = null; do {//from w w w. j a v a 2 s. c o m try { getWriteLock().acquire(); txBatch = infoSrv.getCascades(num); if (txBatch.size() == 0) { //No transactions to process for cascades. return; } ArrayList<Long> txIds = new ArrayList<Long>(); Set<Long> txIdSet = new HashSet<Long>(); for (Transaction tx : txBatch) { txIds.add(tx.getId()); txIdSet.add(tx.getId()); } List<NodeMetaData> nodeMetaDatas = infoSrv.getCascadeNodes(txIds); //System.out.println("########### Cascade node meta datas:"+nodeMetaDatas.size()); if (nodeMetaDatas.size() > 0) { LinkedList<NodeMetaData> stack = new LinkedList<NodeMetaData>(); stack.addAll(nodeMetaDatas); int batchSize = 10; do { List<NodeMetaData> batch = new ArrayList<NodeMetaData>(); while (batch.size() < batchSize && stack.size() > 0) { batch.add(stack.removeFirst()); } CascadeIndexWorkerRunnable worker = new CascadeIndexWorkerRunnable(this.threadHandler, batch, infoSrv); this.threadHandler.scheduleTask(worker); } while (stack.size() > 0); } //Update the transaction records. updateTransactionsAfterAsynchronous(txBatch); //System.out.println("######################: Finished Cascade Run #########"); } catch (AuthenticationException e) { throw new IOException(e); } catch (JSONException e) { throw new IOException(e); } catch (InterruptedException e) { throw new IOException(e); } finally { //System.out.println("###################: Releasing Cascade write lock"); getWriteLock().release(); } } while (txBatch.size() > 0); }