List of usage examples for java.util Vector get
public synchronized E get(int index)
From source file:com.ah.be.cloudauth.HmCloudAuthCertMgmtImpl.java
@SuppressWarnings("rawtypes") private void verifyCSRContent(BeRadSecCertCreationResultEvent result, String commonName) throws HmCloudAuthException { String methodName = "verifyCSRContent"; if (result.isCreateError()) { throw new HmCloudAuthException(methodName, UpdateCAStatus.CSR_CREATE_ERR); }/* w w w .j a v a 2s.c o m*/ if (result.isNeedCreate()) { byte[] csrContent = result.getCsrContent(); final List pemItems = org.apache.commons.ssl.PEMUtil.decode(csrContent); if (pemItems.isEmpty()) { throw new HmCloudAuthException(methodName, UpdateCAStatus.CSR_DECODE_ERR); } final PEMItem csrPemItem = (PEMItem) pemItems.get(0); if (csrPemItem.pemType.startsWith(CERTIFICATE_REQUEST)) { final PKCS10CertificationRequest csr = new PKCS10CertificationRequest(csrPemItem.getDerBytes()); CertificationRequestInfo requestInfo = csr.getCertificationRequestInfo(); X509Name subject = requestInfo.getSubject(); Vector commondNameVector = subject.getValues(X509Name.CN); Vector countryVector = subject.getValues(X509Name.C); Vector organizationVector = subject.getValues(X509Name.O); if (commondNameVector.isEmpty() || countryVector.isEmpty() || organizationVector.isEmpty()) { throw new HmCloudAuthException(methodName, UpdateCAStatus.CSR_FORMAT_ERR); } if (!commonName.equalsIgnoreCase(commondNameVector.get(0).toString()) || !ORGANIZATION.equals(organizationVector.get(0).toString()) || !COUNTRY.equals(countryVector.get(0).toString())) { throw new HmCloudAuthException(methodName, UpdateCAStatus.CSR_VERIFY_ERR); } } else { throw new HmCloudAuthException(methodName, UpdateCAStatus.CSR_DECODE_ERR); } } else { throw new HmCloudAuthException(methodName, UpdateCAStatus.CSR_STATUS_ERR); } return; }
From source file:edu.ku.brc.af.core.SpecialMsgNotifier.java
/** * @param item//from ww w . j av a 2s. com * @throws Exception */ protected String send(final String url, final String id) throws Exception { // check the website for the info about the latest version HttpClient httpClient = new HttpClient(); httpClient.getParams().setParameter("http.useragent", getClass().getName()); //$NON-NLS-1$ httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(15000); PostMethod postMethod = new PostMethod(url); Vector<NameValuePair> postParams = new Vector<NameValuePair>(); postParams.add(new NameValuePair("id", id)); //$NON-NLS-1$ String resAppVersion = UIRegistry.getAppVersion(); resAppVersion = StringUtils.isEmpty(resAppVersion) ? "Unknown" : resAppVersion; // get the OS name and version postParams.add(new NameValuePair("os_name", System.getProperty("os.name"))); //$NON-NLS-1$ postParams.add(new NameValuePair("os_version", System.getProperty("os.version"))); //$NON-NLS-1$ postParams.add(new NameValuePair("java_version", System.getProperty("java.version"))); //$NON-NLS-1$ postParams.add(new NameValuePair("java_vendor", System.getProperty("java.vendor"))); //$NON-NLS-1$ postParams.add(new NameValuePair("app_version", UIRegistry.getAppVersion())); //$NON-NLS-1$ // create an array from the params NameValuePair[] paramArray = new NameValuePair[postParams.size()]; for (int i = 0; i < paramArray.length; ++i) { paramArray[i] = postParams.get(i); } postMethod.setRequestBody(paramArray); // connect to the server try { httpClient.executeMethod(postMethod); int status = postMethod.getStatusCode(); if (status == 200) { // get the server response String responseString = postMethod.getResponseBodyAsString(); if (StringUtils.isNotEmpty(responseString)) { return responseString; } } } catch (java.net.UnknownHostException ex) { log.debug("Couldn't reach host."); } catch (Exception e) { e.printStackTrace(); // die silently } return null; }
From source file:edu.stanford.cfuller.imageanalysistools.filter.ConvexHullByLabelFilter.java
/** * Applies the convex hull filter to the supplied mask. * @param im The Image to process-- a mask whose regions will be replaced by their filled convex hulls. *///from ww w .j a v a 2 s . co m @Override public void apply(WritableImage im) { RelabelFilter RLF = new RelabelFilter(); RLF.apply(im); Histogram h = new Histogram(im); java.util.Hashtable<Integer, java.util.Vector<Integer>> xLists = new java.util.Hashtable<Integer, java.util.Vector<Integer>>(); java.util.Hashtable<Integer, java.util.Vector<Integer>> yLists = new java.util.Hashtable<Integer, java.util.Vector<Integer>>(); java.util.Vector<Integer> minValues = new java.util.Vector<Integer>(h.getMaxValue() + 1); java.util.Vector<Integer> minIndices = new java.util.Vector<Integer>(h.getMaxValue() + 1); for (int i = 0; i < h.getMaxValue() + 1; i++) { minValues.add(im.getDimensionSizes().get(ImageCoordinate.X)); minIndices.add(0); } for (ImageCoordinate i : im) { int value = (int) im.getValue(i); if (value == 0) continue; if (!xLists.containsKey(value)) { xLists.put(value, new java.util.Vector<Integer>()); yLists.put(value, new java.util.Vector<Integer>()); } xLists.get(value).add(i.get(ImageCoordinate.X)); yLists.get(value).add(i.get(ImageCoordinate.Y)); if (i.get(ImageCoordinate.X) < minValues.get(value)) { minValues.set(value, i.get(ImageCoordinate.X)); minIndices.set(value, xLists.get(value).size() - 1); } } java.util.Vector<Integer> hullPointsX = new java.util.Vector<Integer>(); java.util.Vector<Integer> hullPointsY = new java.util.Vector<Integer>(); ImageCoordinate ic = ImageCoordinate.createCoordXYZCT(0, 0, 0, 0, 0); for (int k = 1; k < h.getMaxValue() + 1; k++) { hullPointsX.clear(); hullPointsY.clear(); java.util.Vector<Integer> xList = xLists.get(k); java.util.Vector<Integer> yList = yLists.get(k); int minIndex = (int) minIndices.get(k); //start at the leftmost point int currentIndex = minIndex; int currentX = xList.get(currentIndex); int currentY = yList.get(currentIndex); hullPointsX.add(currentX); hullPointsY.add(currentY); org.apache.commons.math3.linear.RealVector angles = new org.apache.commons.math3.linear.ArrayRealVector( xList.size()); Vector3D currentVector = new Vector3D(0, -1, 0); java.util.HashSet<Integer> visited = new java.util.HashSet<Integer>(); do { visited.add(currentIndex); int maxIndex = 0; double maxAngle = -2 * Math.PI; double dist = Double.MAX_VALUE; for (int i = 0; i < xList.size(); i++) { if (i == currentIndex) continue; Vector3D next = new Vector3D(xList.get(i) - xList.get(currentIndex), yList.get(i) - yList.get(currentIndex), 0); double angle = Vector3D.angle(currentVector, next); angles.setEntry(i, angle); if (angle > maxAngle) { maxAngle = angle; maxIndex = i; dist = next.getNorm(); } else if (angle == maxAngle) { double tempDist = next.getNorm(); if (tempDist < dist) { dist = tempDist; maxAngle = angle; maxIndex = i; } } } currentX = xList.get(maxIndex); currentY = yList.get(maxIndex); currentVector = new Vector3D(xList.get(currentIndex) - currentX, yList.get(currentIndex) - currentY, 0); hullPointsX.add(currentX); hullPointsY.add(currentY); currentIndex = maxIndex; } while (!visited.contains(currentIndex)); //hull vertices have now been determined .. need to fill in the lines //between them so I can apply a fill filter //approach: x1, y1 to x0, y0: //start at min x, min y, go to max x, max y // if x_i, y_i = x0, y0 + slope to within 0.5 * sqrt(2), then add to hull double eps = Math.sqrt(2); for (int i = 0; i < hullPointsX.size() - 1; i++) { int x0 = hullPointsX.get(i); int y0 = hullPointsY.get(i); int x1 = hullPointsX.get(i + 1); int y1 = hullPointsY.get(i + 1); int xmin = (x0 < x1) ? x0 : x1; int ymin = (y0 < y1) ? y0 : y1; int xmax = (x0 > x1) ? x0 : x1; int ymax = (y0 > y1) ? y0 : y1; x1 -= x0; y1 -= y0; double denom = (x1 * x1 + y1 * y1); for (int x = xmin; x <= xmax; x++) { for (int y = ymin; y <= ymax; y++) { int rel_x = x - x0; int rel_y = y - y0; double projLength = (x1 * rel_x + y1 * rel_y) / denom; double projPoint_x = x1 * projLength; double projPoint_y = y1 * projLength; if (Math.hypot(rel_x - projPoint_x, rel_y - projPoint_y) < eps) { ic.set(ImageCoordinate.X, x); ic.set(ImageCoordinate.Y, y); im.setValue(ic, k); } } } } } ic.recycle(); FillFilter ff = new FillFilter(); ff.apply(im); }
From source file:edu.cornell.med.icb.geo.tools.Affy2InsightfulMiner.java
private void readInputList(final String inputListFilename) throws IOException { final Vector<String> names = new Vector<String>(); final Vector<String> ids = new Vector<String>(); String line;// w w w. j a va 2s. c o m final BufferedReader br = new BufferedReader(new FileReader(inputListFilename)); while ((line = br.readLine()) != null) { final String[] tokens = line.split("\t"); names.add(tokens[0]); ids.add(tokens[1]); } if (names.size() != ids.size()) { System.err.println("Error reading input file list (" + inputListFilename + "): the number of identifiers does not match the number of filenames."); System.exit(1); } final int datasetSize = ids.size(); filenames = new String[datasetSize]; sampleIdentifiers = new String[ids.size()]; for (int i = 0; i < filenames.length; i++) { filenames[i] = names.get(i); sampleIdentifiers[i] = ids.get(i); } }
From source file:edu.ku.brc.specify.toycode.mexconabio.MexConvToSQL.java
/** * @param fmpInfo/*ww w.j a v a2 s .c om*/ * @param srcFileName * @throws UnsupportedEncodingException * @throws FileNotFoundException * @throws IOException */ private void processFieldSizes(final FMPCreateTable fmpInfo, final String srcFileName) throws UnsupportedEncodingException, FileNotFoundException, IOException { Vector<FieldDef> fieldDefs = fmpInfo.getFields(); BufferedReader in = new BufferedReader( new InputStreamReader(new FileInputStream(new File(srcFileName)), "UTF8")); String str = in.readLine(); // header row int recNumber = 41477000; str = in.readLine(); int rowCnt = 0; while (str != null) { String line = str; char sep = '`'; String sepStr = ""; for (char c : seps) { if (line.indexOf(c) == -1) { sepStr += c; sep = c; break; } } /*if (rowCnt >= recNumber) { System.out.println("Num Commas: "+StringUtils.countMatches(str, ",")); System.out.println(line); }*/ str = StringUtils.replace(str.substring(1, str.length() - 1), "\",\"", sepStr); /*if (rowCnt >= recNumber) { System.out.println("Num pipe: "+StringUtils.countMatches(str, "|")); System.out.println(str); }*/ if (rowCnt >= recNumber) { Vector<String> fields = split(str, '|'); Vector<String> fields2 = new Vector<String>(split(str, sep)); for (int x = 0; x < fields.size(); x++) { if ((StringUtils.isNotEmpty(fields.get(x)) && StringUtils.isNotEmpty(fields2.get(x))) || (x > 39 && x < 51)) { System.out.println(x + " [" + fields.get(x) + "][" + fields2.get(x) + "]"); } } System.out.println(line); System.out.println(str); } Vector<String> fields = split(str, sep); if (fields.size() != fieldDefs.size() - 1) { System.out.println(rowCnt + " - " + fields.size() + " != " + (fieldDefs.size() - 1)); int i = 0; for (String value : fields) { System.out.println(i + " [" + value + "]"); i++; } System.out.println(line); } int inx = 1; for (String value : fields) { FieldDef fd = fieldDefs.get(inx); int len = value.length() + 1; fd.setMaxSize(len); if (fd.getType() == DataType.eNumber) { if (value.contains(".")) { fd.setDouble(true); } } inx++; } rowCnt++; if (rowCnt % 1000 == 0) System.out.println(rowCnt); str = in.readLine(); } in.close(); }
From source file:com.ibm.xsp.webdav.resource.DAVResourceDomino.java
/** * Retrieves the current associations with roles and groups * // w w w. ja v a 2 s . c o m * @param s * NotesSession * @param doc * NotesDocument * @return List of Names and Groups */ @SuppressWarnings("unchecked") protected Vector<String> getUsernamesList(Document doc) { Vector<String> retVector; Name nName = null; Session s = DominoProxy.getUserSession(); try { nName = s.createName(s.getEffectiveUserName()); } catch (NotesException e1) { LOGGER.error("getEffectiveUsernamesList Name resolution failed", e1); } try { retVector = s.evaluate("@Usernameslist", doc); } catch (NotesException e) { LOGGER.error("@Usernameslist failed", e); retVector = new Vector<String>(); retVector.add(""); } try { // Eventually retvector has only an empty value, which we consider // an error if (retVector.get(0).equals("")) { LOGGER.equals("@Usernameslist for " + nName.getAbbreviated() + " failed"); } } catch (NotesException e) { LOGGER.error("getEffectiveUsername() failed", e); } try { retVector.add(s.getEffectiveUserName()); retVector.add(nName.getAbbreviated()); } catch (NotesException e) { LOGGER.error("getUsername() failed", e); } return retVector; }
From source file:edu.ku.brc.specify.toycode.mexconabio.MexConvToSQL.java
/** * @param type/*from w w w. ja v a 2s . com*/ * @param rs * @param tblWriter * @param doingMapTable * @throws SQLException */ public void process(final int type, final ResultSet rs, final TableWriter tblWriter, final boolean doingMapTable) throws SQLException { Integer idEjemplar = rs.getInt(1); String catNum = rs.getString(2).trim(); String collectorNum = rs.getString(3).trim(); String collector = rs.getString(4); String genus = rs.getString(9); String species = rs.getString(10); String locality = rs.getString(5); int year = rs.getInt(11); int mon = rs.getInt(12); int day = rs.getInt(13); boolean hasDate = year > 0 && mon > 0 && day > 0; String dateStr = hasDate ? String.format("%04d-%02d-%02d", year, mon, day) : " "; String where = null; switch (type) { case 0: where = String.format( "FROM conabio WHERE GenusName = '%s' AND SpeciesName = '%s' AND CollNr = '%s' AND BarCD = '%s'", genus, species, collectorNum, catNum); break; case 1: where = String.format("FROM conabio WHERE CollNr = '%s' AND BarCD = '%s'", collectorNum, catNum); break; case 2: where = String.format("FROM conabio WHERE CollNr = '%s' AND BarCD <> '%s'", collectorNum, catNum); break; case 3: where = String.format("FROM conabio WHERE CollNr <> '%s' AND BarCD = '%s'", collectorNum, catNum); break; } String sql2 = "SELECT COUNT(*) " + where; int cnt = BasicSQLUtils.getCountAsInt(conn, sql2); if (cnt == 1) { for (int i = 0; i < cCls.length; i++) { cCls[i] = null; mCls[i] = null; } if (doingMapTable) { sql2 = "SELECT ID " + where; int id = BasicSQLUtils.getCountAsInt(conn, sql2); mpStmt.setInt(1, idEjemplar); mpStmt.setInt(2, id); mpStmt.executeUpdate(); } sql2 = "SELECT BarCD, CollNr, GenusName, SpeciesName, Collectoragent1, LocalityName, Datecollstandrd " + where; Vector<Object[]> rows = BasicSQLUtils.query(conn, sql2); Object[] cols = rows.get(0); Date date = (Date) cols[6]; boolean michHasDate = date != null; String michDate = michHasDate ? sdf.format(date) : " "; Integer michCatNumInt = (Integer) cols[0]; String michCatNum = michCatNumInt.toString(); String michColNum = ((String) cols[1]).trim(); String michGenus = ((String) cols[2]).trim(); String michSpecies = (String) cols[3]; String michCollector = (String) cols[4]; String michLocality = (String) cols[5]; int michYear = 0; int michMon = 0; int michDay = 0; if (date != null) { cal.setTime(date); michYear = michHasDate ? cal.get(Calendar.YEAR) : 0; michMon = michHasDate ? cal.get(Calendar.MONTH) + 1 : 0; michDay = michHasDate ? cal.get(Calendar.DATE) : 0; } int maxScore = 115; int score = 0; if (hasDate && michHasDate) { score += year == michYear ? 10 : 0; score += mon == michMon ? 20 : 0; score += day == michDay ? 30 : 0; if (year == michYear && mon == michMon && day == michDay && year != 0 && mon != 0 && day != 0) { cCls[6] = BGR; mCls[6] = BGR; } else if (year == michYear && mon == michMon && year != 0 && mon != 0) { cCls[6] = GR; mCls[6] = GR; } else if (year == michYear) { cCls[6] = YW; mCls[6] = YW; } } double ratingLoc = check(locality, michLocality, false); double ratingColtr = check(collector, michCollector, false); if (ratingLoc > 50.0) { cCls[5] = BGR; mCls[5] = BGR; score += 10; } else if (ratingLoc > 30.0) { cCls[5] = GR; mCls[5] = GR; score += 6; } else if (ratingLoc > 0.0) { cCls[5] = YW; mCls[5] = YW; score += 3; } if (ratingColtr > 50.0) { cCls[4] = BGR; mCls[4] = BGR; score += 10; } else if (ratingColtr > 30.0) { cCls[4] = GR; mCls[4] = GR; score += 6; } else if (ratingColtr > 0.0) { cCls[4] = YW; mCls[4] = YW; score += 3; } boolean genusMatches = false; if (michGenus != null && genus != null) { if (michGenus.equals(genus)) { score += 15; cCls[2] = GR; mCls[2] = GR; genusMatches = true; } else if (StringUtils.getLevenshteinDistance(genus, michGenus) < 3) { score += 7; cCls[2] = YW; mCls[2] = YW; } } if (michSpecies != null && species != null) { if (michSpecies.equals(species)) { score += 20; if (genusMatches) { cCls[2] = BGR; mCls[2] = BGR; cCls[3] = BGR; mCls[3] = BGR; } else { cCls[3] = GR; mCls[3] = GR; } } else if (StringUtils.getLevenshteinDistance(species, michSpecies) < 3) { score += 10; cCls[3] = YW; mCls[3] = YW; } } if (michGenus != null && species != null && michGenus.equals(species)) { cCls[3] = DF; mCls[2] = DF; score += 10; } if (michSpecies != null && genus != null && michSpecies.equals(genus)) { cCls[2] = DF; mCls[3] = DF; score += 15; } if (catNum.equals(michCatNum)) { cCls[1] = BGR; mCls[1] = BGR; } if (collectorNum.equals(michColNum)) { cCls[0] = BGR; mCls[0] = BGR; } int finalScore = (int) ((((double) score / maxScore) * 100.0) + 0.5); histo[finalScore]++; totalScore += finalScore; String scoreStr = String.format("%d", finalScore); tblWriter.println("<TR>"); tblWriter.logTDCls(cCls[0], collectorNum); tblWriter.logTDCls(cCls[1], catNum); tblWriter.logTDCls(cCls[2], genus); tblWriter.logTDCls(cCls[3], species); tblWriter.logTDCls(cCls[4], collector); tblWriter.logTDCls(cCls[5], locality); tblWriter.logTDCls(cCls[6], dateStr); tblWriter.logTDCls(cCls[0], michColNum); tblWriter.logTDCls(cCls[1], michCatNum != null ? michCatNum.toString() : " "); tblWriter.logTDCls(mCls[2], michGenus); tblWriter.logTDCls(mCls[3], michSpecies); tblWriter.logTDCls(mCls[4], michCollector); tblWriter.logTDCls(mCls[5], michLocality); tblWriter.logTDCls(mCls[6], michDate); tblWriter.logTDCls(null, scoreStr); tblWriter.println("</TR>"); fndCnt++; System.out.println("Fnd: " + fndCnt + " Num Recs: " + numRecs + " Dif: " + (numRecs - fndCnt)); } numRecs++; }
From source file:edu.brown.utils.UniqueCombinationIterator.java
/** * Find the next unique combination// w ww. j a va2 s. c om */ private void getNext() { assert (this.next == null); final boolean trace = LOG.isTraceEnabled(); final boolean debug = LOG.isDebugEnabled(); if (debug) LOG.debug("Finding next combination [call=" + (this.attempt_ctr++) + "]"); boolean valid = false; Vector<Integer> buffer = null; for (int i = this.last.get(0); i < this.num_elements; i++) { if (trace) LOG.trace("\n" + this); buffer = new Vector<Integer>(); buffer.setSize(this.combo_size); buffer.set(0, i); // We have a new combination! if (this.calculateCombinations(buffer, 1)) { if (trace) LOG.trace("Found new combination: " + buffer); valid = true; break; } if (trace) LOG.trace("No combination found that starts with index #" + i); buffer = null; this.initializeLast(i + 1); } // FOR if (trace) LOG.trace("VALID = " + valid); if (valid) { assert (this.combo_size == buffer.size()); this.next = new ListOrderedSet<E>(); for (int i = 0; i < this.combo_size; i++) { this.next.add(this.data.get(buffer.get(i))); } // FOR if (trace) LOG.trace("NEXT = " + this.next); // Increase the last position's counter so that it is different next // time this.last.set(this.combo_size - 1, this.last.lastElement() + 1); if (trace) LOG.trace("NEW LAST = " + this.last); this.finished = false; } else { this.finished = true; } }
From source file:gsn.http.A3DWebServiceImpl.java
public String[] getMeteoData(String sensor, long from, long to) { String str_from = Long.toString(from); String str_to = Long.toString(to); StringBuilder query = new StringBuilder("select * from " + sensor + " where timed >= " + str_from + " and timed <= " + str_to + " order by timed ASC"); DataEnumerator result;//from www . j av a 2 s .co m try { result = Main.getStorage(sensor).executeQuery(query, true); } catch (SQLException e) { logger.error("ERROR IN EXECUTING, query: " + query); logger.error(e.getMessage(), e); return new String[] { "ERROR IN EXECUTING, query: " + query }; } Vector<String> meteoData = new Vector<String>(); while (result.hasMoreElements()) { StreamElement se = result.nextElement(); StringBuilder sb = new StringBuilder(); sb.append(new StringBuilder("TIMED=" + se.getTimeStamp()).toString() + ";"); for (int i = 0; i < se.getFieldNames().length; i++) { sb.append(se.getFieldNames()[i]).append("="); if (se.getData()[i] != null) if (se.getFieldTypes()[i] == DataTypes.BINARY) sb.append(se.getData()[i].toString()); else sb.append(StringEscapeUtils.escapeXml(se.getData()[i].toString())); sb.append(";"); } meteoData.add(sb.toString()); } //result.close(); String v_meteoData[] = new String[meteoData.size()]; for (int i = 0; i < meteoData.size(); i++) v_meteoData[i] = meteoData.get(i); return v_meteoData; }
From source file:info.icefilms.icestream.browse.Location.java
@SuppressWarnings("unchecked") public ArrayList<Item>[] GetHeadingItems(Callback callback) { // Download the page String page = DownloadPage(mURL, callback); if (page == null) { return null; } else if (page.length() == 0) { if (callback.GetErrorBoolean() == false) { callback.SetErrorBoolean(true); callback.SetErrorStringID(R.string.browse_page_download_error); }//w w w . ja v a2 s. c o m return null; } // Create the matcher Matcher matcher = Pattern.compile("<div class='menu ((indent)|(submenu.*?))'>" + "(.+?)</div>") .matcher(page); // Get all the heading strings Vector<String> headings = new Vector<String>(); while (matcher.find()) headings.add(matcher.group(4)); // Create the array of heading items lists ArrayList<Item>[] headingItems = new ArrayList[headings.size()]; for (int i = 0; i < headingItems.length; ++i) headingItems[i] = new ArrayList<Item>(); // Loop thru the heading strings int size = headings.size(); for (int i = 0; i < size; ++i) { // Redefine the matcher matcher = Pattern.compile("(<a href=(.+?)>(.+?)</a>)|(<b>(.+?)</b>)").matcher(headings.get(i)); // Loop thru all our matches while (matcher.find() == true) { // Check if we got cancelled if (callback.IsCancelled()) return null; // Safely get all the info String name; URL url; boolean selected; if (matcher.group(1) != null) { name = matcher.group(3); try { url = new URL(mIceFilmsURL, matcher.group(2)); } catch (MalformedURLException exception) { continue; } selected = false; } else if (matcher.group(4) != null) { name = matcher.group(5); url = null; selected = true; } else { continue; } // Filter out the forum, donate, and random items if (name.contains("Forum") || name.contains("Donate") || name.contains("Random")) continue; // Clean the string name = CleanString(name); // Add a heading item to the list headingItems[i].add(new HeadingItem(name, url, selected)); } } // Add a link to home to the first heading if (headingItems.length > 0 && headingItems[0].isEmpty() == false) headingItems[0].add(0, new HeadingItem("Home", mIceFilmsURL, mURL.getPath().length() == 0 || mURL.getPath().equals("/"))); // Check for any empty lists for (int i = 0; i < headingItems.length; ++i) { if (headingItems[i].isEmpty()) { if (callback.GetErrorBoolean() == false) { callback.SetErrorBoolean(true); callback.SetErrorStringID(R.string.browse_parse_error); } return null; } } return headingItems; }