List of usage examples for java.util LinkedList add
public boolean add(E e)
From source file:edu.uci.ics.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpression.java
private final static void getFDsAndEquivClassesForColumnEq(VariableReferenceExpression v1, VariableReferenceExpression v2, Collection<FunctionalDependency> fds, Map<LogicalVariable, EquivalenceClass> equivClasses) { LogicalVariable var1 = v1.getVariableReference(); LogicalVariable var2 = v2.getVariableReference(); LinkedList<LogicalVariable> set1 = new LinkedList<LogicalVariable>(); set1.add(var1); LinkedList<LogicalVariable> set2 = new LinkedList<LogicalVariable>(); set2.add(var2); FunctionalDependency fd1 = new FunctionalDependency(set1, set2); FunctionalDependency fd2 = new FunctionalDependency(set2, set1); fds.add(fd1);/* ww w. j a v a 2 s. com*/ fds.add(fd2); EquivalenceClass ec1 = equivClasses.get(var1); EquivalenceClass ec2 = equivClasses.get(var2); if (ec1 == null && ec2 == null) { LinkedList<LogicalVariable> members = new LinkedList<LogicalVariable>(); members.add(var1); members.add(var2); EquivalenceClass ec = new EquivalenceClass(members, var1); equivClasses.put(var1, ec); equivClasses.put(var2, ec); } else if (ec1 == null && ec2 != null) { ec2.addMember(var1); equivClasses.put(var1, ec2); } else if (ec2 == null && ec1 != null) { ec1.addMember(var2); equivClasses.put(var2, ec1); } else { ec1.merge(ec2); for (LogicalVariable w : equivClasses.keySet()) { if (ec2.getMembers().contains(w)) { equivClasses.put(w, ec1); } } } }
From source file:exm.stc.ic.ICUtil.java
public static LinkedList<Statement> cloneStatements(List<Statement> stmts) { LinkedList<Statement> output = new LinkedList<Statement>(); for (Statement stmt : stmts) { output.add(stmt.cloneStatement()); }/*from w ww . j a v a2s. c om*/ return output; }
From source file:com.allinfinance.startup.init.MenuInfoUtil.java
/** * ????//from www .j a v a2 s .c om * @param menuBean */ @SuppressWarnings("unchecked") private static void addLvl2Menu(Map<String, Object> menuBean) { List<Object> menuLvl1List = allMenuBean.getDataList(); for (int i = 0, n = menuLvl1List.size(); i < n; i++) { Map<String, Object> tmpMenuBean = (Map<String, Object>) menuLvl1List.get(i); //?????????? if (tmpMenuBean.get(Constants.MENU_ID).toString().trim() .equals(menuBean.get(Constants.MENU_PARENT_ID).toString().trim())) { if (!tmpMenuBean.containsKey(Constants.MENU_CHILDREN)) { LinkedList<Object> menuLvl2List = new LinkedList<Object>(); menuLvl2List.add(menuBean); tmpMenuBean.put(Constants.MENU_CHILDREN, menuLvl2List); } else { LinkedList<Object> menuLvl2List = (LinkedList<Object>) tmpMenuBean.get(Constants.MENU_CHILDREN); menuLvl2List.add(menuBean); tmpMenuBean.put(Constants.MENU_CHILDREN, menuLvl2List); } menuLvl1List.set(i, tmpMenuBean); } } allMenuBean.setDataList(menuLvl1List); }
From source file:minghai.nisesakura.SimpleBottleHelper.java
/** * Pull the raw text content of the given URL. This call blocks until the * operation has completed, and is synchronized because it uses a shared * buffer {@link #sBuffer}./*from w w w . ja v a 2s. co m*/ * * @param url The exact URL to request. * @return The raw content returned by the server. * @throws ApiException If any connection or server error occurs. */ protected static synchronized LinkedList<String> getUrlContent(String url) throws ApiException { if (sUserAgent == null) { throw new ApiException("User-Agent string must be prepared"); } Log.d(TAG, "getUrlContent: url = " + url); // Create client and set our specific user-agent string HttpClient client = new DefaultHttpClient(); HttpGet request = new HttpGet(url); request.setHeader("User-Agent", sUserAgent); try { HttpResponse response = client.execute(request); // Check if server response is valid StatusLine status = response.getStatusLine(); if (status.getStatusCode() != HTTP_STATUS_OK) { throw new ApiException("Invalid response from server: " + status.toString()); } // Pull content stream from response HttpEntity entity = response.getEntity(); BufferedReader br = new BufferedReader(new InputStreamReader(entity.getContent(), "Shift_JIS")); while (true) { if (br.readLine().equals("")) break; } LinkedList<String> results = new LinkedList<String>(); for (String line = br.readLine(); line != null; line = br.readLine()) { String[] column = line.split("\t"); Log.d(TAG, "column[7] = " + column[7]); results.add(column[7]); } br.close(); // Return result from buffered stream return results; } catch (IOException e) { throw new ApiException("Problem communicating with API", e); } }
From source file:com.allinfinance.startup.init.MenuInfoUtil.java
/** * ????//from www . j a va 2 s . c o m * @param menuBean */ @SuppressWarnings("unchecked") private static void addLvl3Menu(Map<String, Object> menuBean) { List<Object> menuLvl1List = allMenuBean.getDataList(); for (int i = 0, n = menuLvl1List.size(); i < n; i++) { Map<String, Object> tmpMenuBeanLvl1 = (Map<String, Object>) menuLvl1List.get(i); LinkedList<Object> menuLvl2List = (LinkedList<Object>) tmpMenuBeanLvl1.get(Constants.MENU_CHILDREN); if (menuLvl2List == null) { continue; } for (int j = 0, m = menuLvl2List.size(); j < m; j++) { Map<String, Object> tmpMenuBeanLvl2 = (Map<String, Object>) menuLvl2List.get(j); //????? ????? if (tmpMenuBeanLvl2.get(Constants.MENU_ID).toString().trim() .equals(menuBean.get(Constants.MENU_PARENT_ID).toString().trim())) { if (!tmpMenuBeanLvl2.containsKey(Constants.MENU_CHILDREN)) { LinkedList<Object> menuLvl3List = new LinkedList<Object>(); menuLvl3List.add(menuBean); tmpMenuBeanLvl2.put(Constants.MENU_CHILDREN, menuLvl3List); } else { LinkedList<Object> menuLvl3List = (LinkedList<Object>) tmpMenuBeanLvl2 .get(Constants.MENU_CHILDREN); menuLvl3List.add(menuBean); tmpMenuBeanLvl2.put(Constants.MENU_CHILDREN, menuLvl3List); } menuLvl2List.set(j, tmpMenuBeanLvl2); } } tmpMenuBeanLvl1.put(Constants.MENU_CHILDREN, menuLvl2List); menuLvl1List.set(i, tmpMenuBeanLvl1); } allMenuBean.setDataList(menuLvl1List); }
From source file:fr.univlorraine.mondossierweb.utils.PropertyUtils.java
/** Retourne la liste des groupes ldap autoriss */ public static List<String> getListeGroupesLdapAutorises() { LinkedList<String> values = new LinkedList<String>(); String value = System.getProperty("context.listeGroupesLdap"); if (!StringUtils.hasText(value)) return values; for (String s : value.split(";")) { values.add(s); }// www . j a v a 2 s .c o m return values; }
From source file:Main.java
public static LinkedList<String> uc_unserialize(String input) { LinkedList result = new LinkedList(); DOMParser parser = new DOMParser(); try {//from w ww.ja v a 2s .com parser.parse(new InputSource(new StringReader(input))); Document doc = parser.getDocument(); NodeList nl = doc.getChildNodes().item(0).getChildNodes(); int length = nl.getLength(); for (int i = 0; i < length; i++) if (nl.item(i).getNodeType() == 1) result.add(nl.item(i).getTextContent()); } catch (SAXException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return result; }
From source file:Main.java
public static LinkedList<String> uc_unserialize(String input) { LinkedList result = new LinkedList(); DOMParser parser = new DOMParser(); try {//w w w .j a v a 2s .c o m parser.parse(new InputSource(new StringReader(input))); Document doc = parser.getDocument(); NodeList nl = doc.getChildNodes().item(0).getChildNodes(); int length = nl.getLength(); for (int i = 0; i < length; ++i) if (nl.item(i).getNodeType() == 1) result.add(nl.item(i).getTextContent()); } catch (SAXException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return result; }
From source file:fr.univlorraine.mondossierweb.utils.PropertyUtils.java
/** Retourne la liste des groupes ldap autoriss */ public static List<String> getListeErreursAIgnorer() { LinkedList<String> values = new LinkedList<String>(); String value = System.getProperty("context.liste.erreur.a.ignorer"); if (!StringUtils.hasText(value)) return values; for (String s : value.split(";")) { values.add(s); }//from w w w. j av a 2 s. com return values; }
From source file:fr.univlorraine.mondossierweb.utils.PropertyUtils.java
/** Retourne la liste des groupes uportal autoriss */ public static List<String> getListeGroupesUportalAutorises() { LinkedList<String> values = new LinkedList<String>(); String value = System.getProperty("context.uportal.groupes.autorises"); if (!StringUtils.hasText(value)) return null; for (String s : value.split(";")) { values.add(s); }/* www. j av a2 s .c om*/ return values; }