List of usage examples for java.util ArrayList listIterator
public ListIterator<E> listIterator()
From source file:vteaexploration.plottools.panels.XYChartPanel.java
public void roiCreated(ImagePlus ip) { //if(impoverlay.equals(ip)){ ImageGateOverlay.clear();/*from w w w . j a va2 s . c o m*/ ArrayList<MicroObject> volumes = (ArrayList) plotValues.get(1); ListIterator<MicroObject> itr = volumes.listIterator(); while (itr.hasNext()) { MicroObject m = itr.next(); int[] c = new int[2]; c = m.getBoundsCenter(); if (ip.getRoi().contains(c[0], c[1])) { ImageGateOverlay.add(m); } //} } //System.out.println("PROFILING: XYChartPanel... image gate, found " + ImageGateOverlay.size() + " volumes in region"); //process(xValues,yValues,lValues,xValuesText,yValuesText,lValuesText); //System.out.println("PROFILING: XYChartPanel... image gate processed and updated."); notifiyUpdatePlotWindowListeners(); }
From source file:net.czlee.debatekeeper.PrepTimeBellsEditActivity.java
@SuppressLint("DefaultLocale") private void refreshBellsList() { ArrayList<String> descriptions = mPtbm.getBellDescriptions(); // Convert descriptions to sentence case ListIterator<String> descriptionsIterator = descriptions.listIterator(); while (descriptionsIterator.hasNext()) { String description = descriptionsIterator.next(); descriptionsIterator/* ww w .j a va 2s . c o m*/ .set(description.substring(0, 1).toUpperCase(Locale.getDefault()) + description.substring(1)); } ListView view = (ListView) findViewById(R.id.prepTimeBellsEditor_bellsList); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, descriptions); view.setAdapter(adapter); // Disable the "clear" button if there is nothing to clear ((Button) findViewById(R.id.prepTimeBellsEditor_clearAllButton)).setEnabled(mPtbm.hasBells()); }
From source file:com.telestax.restcomm_olympus.CallActivity.java
private boolean havePermissions(ArrayList<String> permissions) { boolean allGranted = true; ListIterator<String> it = permissions.listIterator(); while (it.hasNext()) { if (ActivityCompat.checkSelfPermission(this, it.next()) != PackageManager.PERMISSION_GRANTED) { allGranted = false;// www . j a v a2 s . co m } else { // permission granted, remove it from permissions it.remove(); } } return allGranted; }
From source file:com.smi.travel.monitor.MonitorGalileo.java
@Override void buildBookingFlight(BookingAirline bAir) { MGalileo flightNumber = galileoMap.get("flight number"); String section = flightNumber.getSection(); MGalileo source = galileoMap.get("source"); MGalileo destination = galileoMap.get("destination"); MGalileo departureDate = galileoMap.get("departure date"); MGalileo arrivalDate = galileoMap.get("arrive date"); MGalileo ticketDate = galileoMap.get("ticket date"); MGalileo deptTime = galileoMap.get("departure time"); MGalileo arrvTime = galileoMap.get("arrive time"); int lineNo = Integer.parseInt(ticketDate.getLine()); String lineT = lineData.get(lineNo); String ticketDateS = lineT.substring(ticketDate.getStartlength() - 1, ticketDate.getStartlength() - 1 + ticketDate.getLength()); String year = ticketDateS.substring(5); //Check how many rows there is. ArrayList<String> lines = (ArrayList<String>) sectionData.get(section); ListIterator<String> iterator = lines.listIterator(); BookingFlight bf = null;/*from w w w . j av a 2 s . c o m*/ while (iterator.hasNext()) { String line = iterator.next(); System.out.println("BookingFlingt input line[" + line + "]"); String flightNo = bAir.getAirlineCode() + getField("flight number", line).trim(); // String flightNo = line.substring(flightNumber.getStartlength() - 1, flightNumber.getStartlength() - 1 + flightNumber.getLength()); String sourceCode = line.substring(source.getStartlength() - 1, source.getStartlength() - 1 + source.getLength()); String desCode = line.substring(destination.getStartlength() - 1, destination.getStartlength() - 1 + destination.getLength()); String deptDateS = line.substring(departureDate.getStartlength() - 1, departureDate.getStartlength() - 1 + departureDate.getLength()); String arrivalDateS = line.substring(arrivalDate.getStartlength() - 1, arrivalDate.getStartlength() - 1 + arrivalDate.getLength()); // String deptTimeS = line.substring(deptTime.getStartlength() - 1, deptTime.getStartlength() - 1 + deptTime.getLength()); String deptTimeS = getField("departure time", line); String arrvTimeS = line.substring(arrvTime.getStartlength() - 1, arrvTime.getStartlength() - 1 + arrvTime.getLength()); Date deptDate = convertStringToDate(deptDateS + year); Date arrvDate = convertStringToDate(deptDateS + year, Integer.parseInt(arrivalDateS)); String flightClass = getField("flight class", line); bf = new BookingFlight(flightNo, sourceCode, desCode, deptDate, arrvDate, flightClass); bf.setDepartTime(deptTimeS); bf.setArriveTime(arrvTimeS); bf.setAdCost(0); bf.setAdPrice(0); bf.setAdTax(0); bf.setChCost(0); bf.setChPrice(0); bf.setChTax(0); bf.setInCost(0); bf.setInPrice(0); bf.setInTax(0); bf.setOtCost(0); bf.setOtPrice(0); bf.setOtTax(0); bAir.getBookingFlights().add(bf); bf.setBookingAirline(bAir); // System.out.println("Build BookingFlight - " + bf.toString()); } return; }
From source file:com.smi.travel.monitor.MonitorGalileo.java
@Override void buildBookingPassenger(BookingAirline bAir) { String passengerTypes = new String(""); int costRefIndex = 0; String section = galileoMap.get("passenger name").getSection(); MGalileo airNo = galileoMap.get("airline number"); int lineNo = Integer.parseInt(airNo.getLine()); String line = lineData.get(lineNo); String ticketNoS1 = line.substring(airNo.getStartlength() - 1, airNo.getStartlength() - 1 + airNo.getLength()); MGalileo type = galileoMap.get("ticket type"); lineNo = Integer.parseInt(type.getLine()); line = lineData.get(lineNo);/*from ww w .j a v a2s . c o m*/ String ticketType = line.substring(type.getStartlength() - 1, type.getStartlength() - 1 + type.getLength()); ArrayList<String> lines = (ArrayList<String>) sectionData.get(section); // System.out.println("Passenger " + lines.size()); ListIterator<String> iterator = lines.listIterator(); BookingPassenger bp = null; while (iterator.hasNext()) { line = iterator.next(); System.out.println("line-> " + line); String passengerName = getField("passenger name", line).trim(); String passengerType = getField("passenger type", line); if (StringUtils.isEmpty(passengerType) || (!("ADT".equalsIgnoreCase(passengerType)) && !("CHD".equalsIgnoreCase(passengerType)) && !("INF".equalsIgnoreCase(passengerType)))) { passengerType = "NON"; } String[] splitName = passengerName.split("/"); String lastName = splitName[0]; String firstName = splitName[1].substring(0, splitName[1].length() - 2); String initial = splitName[1].substring(splitName[1].length() - 2); String ticketSerial2 = getField("ticket serial2", line); String ticketSerial3 = getField("ticket serial3", line); String fareNo = getField("fare reference", line); String fareSection = galileoMap.get("ticket fare").getSection(); ArrayList<String> fareLines = (ArrayList<String>) sectionData.get(fareSection); String fareLine = fareLines.get(Integer.parseInt(fareNo) - 1); String currency = getField("currency", fareLine); String ticketFare = getTicketFare(currency, fareLine); String ticketTotalS = getField("ticket total", fareLine); ticketTotalS = stripNumberDecimalString(ticketTotalS); ticketFare = stripNumberDecimalString(ticketFare); int tax = Integer.parseInt(ticketTotalS.trim()) - Integer.parseInt(ticketFare.trim()); bp = new BookingPassenger(); bp.setFirstName(firstName); bp.setLastName(lastName); bp.setInitialName(initial); bp.setPassengerType(passengerType); bp.setTicketType(ticketType); bp.setTicketnoS1(ticketNoS1); bp.setTicketnoS2(ticketSerial2); bp.setTicketnoS3(ticketSerial3); bp.setTicketFare(Integer.valueOf(ticketFare.trim())); bp.setTicketTax(Integer.valueOf(tax)); bAir.getBookingPassengers().add(bp); bp.setBookingAirline(bAir); if (!passengerTypes.contains(passengerType)) { passengerTypes = passengerTypes + "," + passengerType; String costS = getField("cost", costRefIndex).trim(); String priceS = getField("price", costRefIndex).trim(); Integer cost = Integer.valueOf(costS); Integer price = Integer.valueOf(priceS); costRefIndex++; //Update cost,price,tax according to passengertype BookingFlight bf = this.getMostEarlyFlight(bAir.getBookingPnr()); if ("ADT".equalsIgnoreCase(passengerType)) { bf.setAdCost(cost); bf.setAdPrice(price); bf.setAdTax(tax); } else if ("CHD".equalsIgnoreCase(passengerType)) { bf.setChCost(cost); bf.setChPrice(price); bf.setChTax(tax); } else if ("INF".equalsIgnoreCase(passengerType)) { bf.setInCost(cost); bf.setInPrice(price); bf.setInTax(tax); } else { bf.setAdCost(cost); bf.setAdPrice(price); bf.setAdTax(tax); } // } } } return; }
From source file:org.hfoss.posit.web.Communicator.java
public boolean sendFind(Find find, String action) { boolean success = false; String url;/* w w w .j a v a2 s. c om*/ HashMap<String, String> sendMap = find.getContentMapGuid(); //Log.i(TAG, "sendFind map = " + sendMap.toString()); cleanupOnSend(sendMap); sendMap.put("imei", imei); String guid = sendMap.get(PositDbHelper.FINDS_GUID); // Create the url if (action.equals("create")) { url = server + "/api/createFind?authKey=" + authKey; } else { url = server + "/api/updateFind?authKey=" + authKey; } if (Utils.debug) { Log.i(TAG, "SendFind=" + sendMap.toString()); } // Send the find try { responseString = doHTTPPost(url, sendMap); } catch (Exception e) { Log.i(TAG, e.getMessage()); Utils.showToast(mContext, e.getMessage()); } if (Utils.debug) Log.i(TAG, "sendFind.ResponseString: " + responseString); // If the update failed return false if (responseString.indexOf("True") == -1) { Log.i(TAG, "sendFind result doesn't contain 'True'"); return false; } else { PositDbHelper dbh = new PositDbHelper(mContext); long id = find.getId(); success = dbh.markFindSynced(id); if (Utils.debug) Log.i(TAG, "sendfind synced " + id + " " + success); } if (!success) return false; // Otherwise send the Find's images long id = Long.parseLong(sendMap.get(PositDbHelper.FINDS_ID)); PositDbHelper dbh = new PositDbHelper(mContext); ArrayList<ContentValues> photosList = dbh.getImagesListSinceUpdate(id); Log.i(TAG, "sendFind, photosList=" + photosList.toString()); Iterator<ContentValues> it = photosList.listIterator(); while (it.hasNext()) { ContentValues imageData = it.next(); Uri uri = Uri.parse(imageData.getAsString(PositDbHelper.PHOTOS_IMAGE_URI)); String base64Data = convertUriToBase64(uri); uri = Uri.parse(imageData.getAsString(PositDbHelper.PHOTOS_THUMBNAIL_URI)); String base64Thumbnail = convertUriToBase64(uri); sendMap = new HashMap<String, String>(); sendMap.put(COLUMN_IMEI, Utils.getIMEI(mContext)); sendMap.put(PositDbHelper.FINDS_GUID, guid); sendMap.put(PositDbHelper.PHOTOS_IDENTIFIER, imageData.getAsString(PositDbHelper.PHOTOS_IDENTIFIER)); sendMap.put(PositDbHelper.FINDS_PROJECT_ID, imageData.getAsString(PositDbHelper.FINDS_PROJECT_ID)); sendMap.put(PositDbHelper.FINDS_TIME, imageData.getAsString(PositDbHelper.FINDS_TIME)); sendMap.put(PositDbHelper.PHOTOS_MIME_TYPE, imageData.getAsString(PositDbHelper.PHOTOS_MIME_TYPE)); sendMap.put("mime_type", "image/jpeg"); sendMap.put(PositDbHelper.PHOTOS_DATA_FULL, base64Data); sendMap.put(PositDbHelper.PHOTOS_DATA_THUMBNAIL, base64Thumbnail); sendMedia(sendMap); //it.next(); } // Update the Synced attribute. return true; }
From source file:com.smi.travel.monitor.MonitorAmadeus.java
@Override void buildBookingFlight(BookingAirline bAir) { MAmadeus flightNumber = amadeusMap.get("flight number"); String ticketDateS = getField("ticket date"); String year = "20" + ticketDateS.substring(0, 2); //Check how many rows there is. ArrayList<String> lines = (ArrayList<String>) sectionData.get(flightNumber.getSection()); // System.out.println("Flight " + lines.size()); ListIterator<String> iterator = lines.listIterator(); BookingFlight bf = null;/* w w w. ja v a 2 s .co m*/ while (iterator.hasNext()) { String line = iterator.next(); if (isVoidFlight(line)) { System.out.println("Skipping - " + line); continue; } // System.out.println("Line " + line); String flightNo = getField("flight number", line); flightNo = bAir.getAirlineCode() + flightNo.replaceAll("\\s+", ""); String sourceCode = getField("source", line); String desCode = getField("destination", line); String deptDateS = getField("departure date", line); String arrivalDateS = getField("arrive date", line); Date deptDate = null; if (!deptDateS.isEmpty()) { deptDate = convertStringToDate(deptDateS + year); } Date arrvDate = null; if (!arrivalDateS.isEmpty()) { arrvDate = convertStringToDate(arrivalDateS + year); } String deptTime = getField("departure time", line); String arrvTime = getField("arrive time", line); String flightClass = getField("flight class", line); bf = new BookingFlight(flightNo, sourceCode, desCode, deptDate, arrvDate, flightClass); bf.setDepartTime(deptTime); bf.setArriveTime(arrvTime); bf.setAdCost(0); bf.setAdPrice(0); bf.setAdTax(0); bf.setChCost(0); bf.setChPrice(0); bf.setChTax(0); bf.setInCost(0); bf.setInPrice(0); bf.setInTax(0); bf.setOtCost(0); bf.setOtPrice(0); bf.setOtTax(0); bAir.getBookingFlights().add(bf); bf.setBookingAirline(bAir); } }
From source file:vteaexploration.plottools.panels.XYExplorationPanel.java
@Override public int getGatedObjects(ImagePlus ip) { ArrayList<MicroObject> ImageGatedObjects = new ArrayList<MicroObject>(); try {//from w w w. ja v a2 s.c o m ArrayList<MicroObject> volumes = (ArrayList) plotvalues.get(1); ListIterator<MicroObject> itr = volumes.listIterator(); while (itr.hasNext()) { MicroObject m = itr.next(); int[] c = new int[2]; c = m.getBoundsCenter(); if (ip.getRoi().contains(c[0], c[1])) { ImageGatedObjects.add(m); m.setGated(true); } } } catch (NullPointerException e) { return 0; } return ImageGatedObjects.size(); }
From source file:hu.sztaki.lpds.pgportal.services.dspace.DSpaceUtil.java
/** * This function takes a string of comma-separated items and parses them, * returning a ListIterator.//from w w w . j a v a 2 s. c o m * * @param keywords String of comma separated terms * @return ListIterator to iterate over list of Strings */ private ListIterator<String> parseKeywords(String keywords) { // Parse keywords by commas String[] keywordList = keywords.split(","); // Create an ArrayList, add keywords only if not empty strings ArrayList<String> keywordArray = new ArrayList<String>(); for (int i = 0; i < keywordList.length; i++) { //if (!keywordList[i].isEmpty()) keywordArray.add(keywordList[i].trim()); if (!keywordList[i].equals(new String(""))) { keywordArray.add(keywordList[i].trim()); } } // Make iterator, return ListIterator<String> keywordIterator = keywordArray.listIterator(); return keywordIterator; }
From source file:mp.teardrop.SongTimeline.java
/** * Remove the song with the given id from the timeline. * * @param id The MediaStore id of the song to remove. *//*from w w w.j ava 2 s .c om*/ public void removeSong(long id) { synchronized (this) { saveActiveSongs(); ArrayList<Song> songs = mSongs; ListIterator<Song> it = songs.listIterator(); while (it.hasNext()) { int i = it.nextIndex(); if (Song.getId(it.next()) == id) { if (i < mCurrentPos) --mCurrentPos; it.remove(); } } broadcastChangedSongs(); } changed(); }