List of usage examples for java.util ArrayList addAll
public boolean addAll(Collection<? extends E> c)
From source file:fNIRs.FNIRsStats.java
private static <T> ArrayList<T> combineArrayLists(ArrayList<ArrayList<T>> lst_of_lsts) { ArrayList<T> output = new ArrayList<T>(); for (ArrayList<T> lst : lst_of_lsts) { output.addAll(lst); }/*from w ww . ja v a 2 s .c om*/ return output; }
From source file:com.spleefleague.superspleef.game.TeamSpleefBattle.java
@Override public ArrayList<SpleefPlayer> getAlivePlayers() { ArrayList<SpleefPlayer> pls = new ArrayList(); for (Team t : this.teams) { pls.addAll(t.getAlivePlayers()); }/*from w ww . j av a2 s . c o m*/ return pls; }
From source file:blue.orchestra.blueSynthBuilder.BSBGraphicInterface.java
public ArrayList<String> getNames() { ArrayList<String> names = new ArrayList<String>(); for (int i = 0; i < size(); i++) { BSBObject bsbObj = getBSBObject(i); String[] replacementKeys = bsbObj.getReplacementKeys(); if (replacementKeys != null) { names.addAll(Arrays.asList(replacementKeys)); }//from ww w . jav a 2 s.co m } return names; }
From source file:com.ibm.bi.dml.hops.rewrite.ProgramRewriter.java
/** * /*from w w w . ja v a 2 s.co m*/ * @param sb * @return * @throws HopsException */ private ArrayList<StatementBlock> rewriteStatementBlock(StatementBlock sb, ProgramRewriteStatus status) throws HopsException { ArrayList<StatementBlock> ret = new ArrayList<StatementBlock>(); ret.add(sb); //recursive invocation if (sb instanceof FunctionStatementBlock) { FunctionStatementBlock fsb = (FunctionStatementBlock) sb; FunctionStatement fstmt = (FunctionStatement) fsb.getStatement(0); fstmt.setBody(rewriteStatementBlocks(fstmt.getBody(), status)); } else if (sb instanceof WhileStatementBlock) { WhileStatementBlock wsb = (WhileStatementBlock) sb; WhileStatement wstmt = (WhileStatement) wsb.getStatement(0); wstmt.setBody(rewriteStatementBlocks(wstmt.getBody(), status)); } else if (sb instanceof IfStatementBlock) { IfStatementBlock isb = (IfStatementBlock) sb; IfStatement istmt = (IfStatement) isb.getStatement(0); istmt.setIfBody(rewriteStatementBlocks(istmt.getIfBody(), status)); istmt.setElseBody(rewriteStatementBlocks(istmt.getElseBody(), status)); } else if (sb instanceof ForStatementBlock) //incl parfor { //maintain parfor context information (e.g., for checkpointing) boolean prestatus = status.isInParforContext(); if (sb instanceof ParForStatementBlock) status.setInParforContext(true); ForStatementBlock fsb = (ForStatementBlock) sb; ForStatement fstmt = (ForStatement) fsb.getStatement(0); fstmt.setBody(rewriteStatementBlocks(fstmt.getBody(), status)); status.setInParforContext(prestatus); } //apply rewrite rules for (StatementBlockRewriteRule r : _sbRuleSet) { ArrayList<StatementBlock> tmp = new ArrayList<StatementBlock>(); for (StatementBlock sbc : ret) tmp.addAll(r.rewriteStatementBlock(sbc, status)); //take over set of rewritten sbs ret.clear(); ret.addAll(tmp); } return ret; }
From source file:com.iternox.piggate.samples.PiggateLogin.Activity_Logged.java
public ArrayList<PiggateOffers> getOffers() { Lock l = rwLock2.readLock();/*from ww w. jav a2 s . c om*/ ArrayList<PiggateOffers> result = new ArrayList<PiggateOffers>(); l.lock(); try { result.addAll(this.internal_offers); } catch (Exception ex) { } finally { l.unlock(); } return result; }
From source file:ca.sfu.federation.model.InputTable.java
/** * Get dep for a particular named input. * @param InputName The input name./*from w w w . j a v a 2 s . co m*/ */ public List getDependancies(String InputName) { ArrayList deps = new ArrayList(); LinkedHashMap index = this.getInputIndex(); Input input = (Input) index.get(InputName); if (input != null) { deps.addAll(input.getDependancies()); } return (List) deps; }
From source file:com.iternox.piggate.samples.PiggateLogin.Activity_Logged.java
public ArrayList<PiggateBeacon> getPendingBeacons() { Lock l = rwLock.readLock();// w w w .ja v a 2 s .c o m ArrayList<PiggateBeacon> result = new ArrayList<PiggateBeacon>(); l.lock(); try { result.addAll(this.pending); this.pending.clear(); } catch (Exception ex) { } finally { l.unlock(); } return result; }
From source file:org.jahia.modules.bootstrap.rules.BootstrapCompiler.java
public void compile(final JahiaTemplatesPackage templateSet) throws RepositoryException { JCRTemplate.getInstance().doExecuteWithSystemSession(new JCRCallback<Object>() { @Override/*from ww w .j a v a 2s . c om*/ public Object doInJCR(JCRSessionWrapper session) throws RepositoryException { Resource[] templatesSetLessResources = templateSet.getResources(LESS_RESOURCES_FOLDER); if (templatesSetLessResources.length == 0) { // no need to compile bootstrap.css if the templatesSet doesn't contain any less files, just copy it from bootstrap module copyBootstrapCSS( module.getRootFolderPath() + "/" + module.getVersion().toString() + "/" + CSS_FOLDER_PATH + "/" + BOOTSTRAP_CSS, session.getNode( templateSet.getRootFolderPath() + "/" + templateSet.getVersion().toString()), session); } else { ArrayList<Resource> lessResources = new ArrayList<Resource>( Arrays.asList(templatesSetLessResources)); lessResources.addAll(Arrays.asList(module.getResources(LESS_RESOURCES_FOLDER))); try { compileBootstrap(session.getNode( templateSet.getRootFolderPath() + "/" + templateSet.getVersion().toString()), lessResources, null); } catch (IOException e) { log.error(e.getMessage(), e); } catch (LessException e) { log.error(e.getMessage(), e); } } // copy on all sites using this templateSet, that don't have any custom variables QueryManager qm = session.getWorkspace().getQueryManager(); QueryResult result = qm.createQuery( "SELECT * FROM [jnt:virtualsite] WHERE [j:templatesSet] = '" + templateSet.getId() + "'", Query.JCR_SQL2).execute(); NodeIterator sites = result.getNodes(); while (sites.hasNext()) { JCRSiteNode site = (JCRSiteNode) sites.nextNode(); if (!site.getAllInstalledModules().contains("bootstrap") || !site.hasNode(CustomizeBootstrapAction.BOOTSTRAP_VARIABLES)) { copyBootstrapCSS(templateSet.getRootFolderPath() + "/" + templateSet.getVersion().toString() + "/" + CSS_FOLDER_PATH + "/" + BOOTSTRAP_CSS, site, session); } } if (sites.getSize() > 0) { session.save(); } return null; } }); }
From source file:ca.brood.softlogger.Softlogger.java
@Override public boolean configure(Node rootNode) { NodeList loggerConfigNodes = rootNode.getChildNodes(); log.debug("Configuring Logger..."); for (int i = 0; i < loggerConfigNodes.getLength(); i++) { Node configNode = loggerConfigNodes.item(i); if ("name".compareToIgnoreCase(configNode.getNodeName()) == 0) { //log.debug("Logger Name: "+configNode.getFirstChild().getNodeValue()); this.loggerName = configNode.getFirstChild().getNodeValue(); } else if ("defaultScanRate".compareToIgnoreCase(configNode.getNodeName()) == 0) { //log.debug("Default scan rate: "+configNode.getFirstChild().getNodeValue()); try { this.defaultScanRate = Integer.parseInt(configNode.getFirstChild().getNodeValue()); } catch (NumberFormatException e) { log.error("Invalid scan rate: " + configNode.getFirstChild().getNodeValue()); this.defaultScanRate = 0; }/*from w ww .jav a2 s. c o m*/ } else if (("server".compareToIgnoreCase(configNode.getNodeName()) == 0) || ("channel".compareToIgnoreCase(configNode.getNodeName()) == 0) || ("outputModule".compareToIgnoreCase(configNode.getNodeName()) == 0) || ("#comment".compareToIgnoreCase(configNode.getNodeName()) == 0) || ("#text".compareToIgnoreCase(configNode.getNodeName()) == 0)) { continue; } else { log.warn("Got unknown node in config: " + configNode.getNodeName()); } } if (loggerName.equals("")) { log.warn("Softlogger name is blank"); } if (defaultScanRate <= 0) { log.warn("Softlogger default scan rate is invalid. Using default of 5000."); defaultScanRate = 5000; } //Load the data server loggerConfigNodes = rootNode.getOwnerDocument().getElementsByTagName("server"); if (loggerConfigNodes.getLength() == 0) { log.fatal("Could not find a server defined in the config file."); return false; } if (loggerConfigNodes.getLength() > 1) { log.fatal("Too many servers are defined in the config file"); return false; } Node currentConfigNode = loggerConfigNodes.item(0); server = new DataServer(); if (!server.configure(currentConfigNode)) { return false; } //Load the softloggerChannels loggerConfigNodes = rootNode.getOwnerDocument().getElementsByTagName("channel"); boolean workingChannel = false; for (int i = 0; i < loggerConfigNodes.getLength(); i++) { currentConfigNode = loggerConfigNodes.item(i); SoftloggerChannel mc = new SoftloggerChannel(); if (mc.configure(currentConfigNode)) { workingChannel = true; softloggerChannels.add(mc); } } if (!workingChannel) { log.fatal("No usable softloggerChannels configured"); return false; } for (int i = 0; i < softloggerChannels.size(); i++) { softloggerChannels.get(i).setDefaultScanRate(this.defaultScanRate); } ArrayList<Device> devices = new ArrayList<Device>(); for (SoftloggerChannel channel : softloggerChannels) { devices.addAll(channel.getDevices()); } //Load the global output modules currentConfigNode = rootNode.getOwnerDocument().getDocumentElement(); loggerConfigNodes = currentConfigNode.getChildNodes(); for (int i = 0; i < loggerConfigNodes.getLength(); i++) { currentConfigNode = loggerConfigNodes.item(i); if ("outputModule".compareToIgnoreCase(currentConfigNode.getNodeName()) != 0) { continue; } try { @SuppressWarnings("unchecked") Class<? extends OutputModule> outputClass = (Class<? extends OutputModule>) Class .forName(currentConfigNode.getAttributes().getNamedItem("class").getNodeValue()); OutputModule outputModule = outputClass.newInstance(); if (outputModule.configure(currentConfigNode)) { for (Device d : devices) { d.addOutputModule(outputModule.clone()); } } } catch (Exception e) { log.error("Got exception while loading output module: ", e); } } this.printAll(); return true; }
From source file:com.glluch.profilesparser.ProfileHtmlReader.java
private ArrayList<ECFMap> foundLevels(ArrayList<String> limits, String allTxt) { ArrayList<ECFMap> res = new ArrayList<>(); String posterior = null;/*from w ww . j a v a 2s . co m*/ for (String f : limits) { if (posterior != null) { //System.out.println("Now="+f); res.addAll(this.getLevel(allTxt, posterior, f)); } posterior = f; } res.addAll(this.getLevel(allTxt, posterior, null)); return res; }