List of usage examples for java.util LinkedList get
public E get(int index)
From source file:com.commander4j.sys.JHostList.java
public void addHosts(LinkedList<JHost> hsts) { int s = hsts.size(); hosts.clear();//w w w . j a v a2 s . c om if (s > 0) { for (int x = 1; x <= s; x++) { hosts.put(hsts.get(x - 1).getSiteNumber(), hsts.get(x - 1)); // numberOfHosts++; } } }
From source file:rs.fon.whibo.GDT.component.removeInsignificantAttributes.FTestNumerical.java
/** * Gets the arrays of numerical attribute values for each class label * separately.//from w ww . j av a 2 s . com * * @param exampleSet * the example set * @param attribute * the numerical attribute * * @return the arrays of values for each label */ private List<double[]> getArraysByLabel(ExampleSet exampleSet, Attribute attribute) { Attribute label = exampleSet.getAttributes().getLabel(); LinkedList<double[]> arrays = new LinkedList<double[]>(); LinkedList<String> labelList = Tools.getAllCategories(exampleSet, label); int size = labelList.size(); for (int i = 0; i < size; i++) { String nLabel = labelList.get(i); double[] arrayForF = new double[getClassLabelCount(exampleSet, nLabel)]; Iterator<Example> reader = exampleSet.iterator(); int k = 0; while (reader.hasNext()) { Example example = reader.next(); String currentValue = example.getValueAsString(label); if (currentValue.equals(nLabel)) { Double value = Double.parseDouble(example.getValueAsString(attribute)); arrayForF[k] = value.doubleValue(); k++; } } arrays.add(arrayForF); } return arrays; }
From source file:de.uniwue.info6.misc.StringTools.java
/** * * * @param queryText/*from www . j av a2s . c om*/ * @param tables * @param user * @return */ public static String addUserPrefix(String queryText, List<String> tables, User user) { LinkedList<Integer> substrings = new LinkedList<Integer>(); int start = 0, end = queryText.length(); for (String tab : tables) { // q&d fix Matcher matcher = Pattern.compile(tab.trim(), Pattern.CASE_INSENSITIVE).matcher(queryText); while (matcher.find()) { start = matcher.start(0); end = matcher.end(0); // String group = matcher.group(); boolean leftCharacterValid = StringTools.trailingCharacter(queryText, start, true); boolean rightCharacterValid = StringTools.trailingCharacter(queryText, end, false); if (leftCharacterValid && rightCharacterValid) { substrings.add(start); } } } Collections.sort(substrings); for (int i = substrings.size() - 1; i >= 0; i--) { Integer sub = substrings.get(i); queryText = queryText.substring(0, sub) + user.getId() + "_" + queryText.substring(sub, queryText.length()); } return queryText; }
From source file:indrora.atomic.adapter.ConversationPagerAdapter.java
/** * Get an item by the channel's name//from ww w. ja v a 2s .co m * * @param channel * @return The item */ public int getPositionByName(String name) { // Optimization - cache field lookups int mSize = conversations.size(); LinkedList<ConversationInfo> mItems = this.conversations; for (int i = 0; i < mSize; i++) { if (mItems.get(i).conv.getName().equalsIgnoreCase(name)) { return i; } } return -1; }
From source file:in.sc.main.CategoryController.java
@RequestMapping(value = { "{category:[a-zA-Z0-9-]+}/", "{category:[a-zA-Z0-9-]+}" }) public String getParseCat(Model model, @PathVariable String category, HttpServletRequest request, @RequestParam(required = false) String filterQ) { String unique_id = null;/*from www . j a v a 2 s.co m*/ String page = "error-404"; int found = 0; HashMap inputMap = new HashMap(); HashMap catPatternMap = daoutils.getCatPatternMap(); try { if (catPatternMap.containsKey(category)) { LinkedList pList = (LinkedList) catPatternMap.get(category); inputMap.put(ProductHelper.category, pList.get(0)); inputMap.put("filterQ", filterQ); page = productList(unique_id, model, inputMap); } if (request.getParameter("isAdmin") == null && page.equals("category_1")) { page = "category_2"; } return page; } catch (Exception e) { e.printStackTrace(); throw new CategoryController.ResourceNotFoundException(); } }
From source file:com.commander4j.sys.JHostList.java
public void disconnectAll() { LinkedList<JHost> hl = new LinkedList<JHost>(); hl = getHosts();//from ww w .j av a 2 s. c o m if (hl.size() > 0) { for (int x = 0; x < hl.size(); x++) { String siteID = hl.get(x).getSiteNumber(); if (Common.hostList.getHost(siteID).getConnectionCount() > 0) { Common.hostList.getHost(siteID).disconnectAll(); } } } }
From source file:it.redturtle.mobile.apparpav.MeteogramAdapter.java
public View getView(int position, View convertView, ViewGroup parent) { Slot slot = listOfSlot.get(position); convertView = inflater.inflate(R.layout.meteogram_layout, null); LinearLayout linear = (LinearLayout) convertView.findViewById(R.id.meteogram); LinkedList<Row> rows = slot.getListOfRows(); for (int i = 0; i < rows.size(); i++) linear = getRow(rows.get(i), linear); return convertView; }
From source file:AndroidUninstallStock.java
public static String getDeviceStatus(String adb, String select) throws Exception { LinkedList<String> devices = run(adb, "devices"); if (devices.size() < 2) { return "Error: No devices!"; }//from ww w .j a v a 2 s .com int devindex = -1; String devselect = (select == null || select.isEmpty()) ? lastdevice : select; if (devselect.isEmpty()) { if (devices.size() == 2) { devindex = 1; } else { return "Error: Devices > 1. Disconnect excess devices or use --dev"; } } else { for (int x = devices.size() - 1; x > 0 && devindex == -1; x--) { if (devices.get(x).indexOf(devselect) == 0) devindex = x; } } if (devindex > -1) { String[] devtemp = devices.get(devindex).split("\\t"); if (devtemp.length != 2) { throw new Exception("Error: Parsing list devices"); } devselect = lastdevice = devtemp[0].trim(); if (devtemp[1].trim().equals("unauthorized")) { return "Error: Need authorization on device " + devselect; } } else { return "Error: Device " + devselect + " not found ADB!"; } return ""; }
From source file:com.mchp.android.PIC32_BTSK.TemperatureFragment.java
void setGraphViewData(LinkedList<Integer> l) { int i;/*from w w w . j a v a2 s . c o m*/ for (i = 0; i < l.size(); i++) { graphViewData[i] = new GraphViewData(i, l.get(i)); } }
From source file:calculators.Calculator.java
/** * Creates the HashMap that states which sample belongs to which sample * group. It can be done on index because the order of the samples in the * group file is the same as the order of the samples in the intensity file. * The group file does not contain the sample names so this is also the only * way to do it//from w w w. j a va 2 s . c o m * * @param group_file the group file * @param control the control group * @param target the target group * @throws FileNotFoundException * @throws IOException */ private void createGroupMap(final File group_file, final String control, final String target) throws FileNotFoundException, IOException { BufferedReader br = new BufferedReader(new FileReader(group_file.getAbsolutePath())); String line; LinkedList<String> temporaryMap = new LinkedList<>(); while ((line = br.readLine()) != null) { temporaryMap.add(line.split("\\s+")[1]); } Integer index = 0; for (String key : groupMap.keySet()) { groupMap.replace(key, temporaryMap.get(index)); index++; } controlSize = Collections.frequency(new ArrayList<>(groupMap.values()), control); targetSize = Collections.frequency(new ArrayList<>(groupMap.values()), target); }