List of usage examples for java.util List listIterator
ListIterator<E> listIterator();
From source file:org.apache.hadoop.hbase.filter.RowListFilter.java
/** * Constructor./*from w w w . j ava 2 s .co m*/ * @param rowCompareOp the compare op for row matching * @param rowComparator the comparator for row matching */ public RowListFilter(final List<byte[]> bytesSet) { log.debug("Size of bytesSet is: " + bytesSet.size()); this.bytesSet = bytesSet; this.bytesSetIterator = bytesSet.listIterator(); if (this.bytesSetIterator.hasNext()) { this.rowComparator = new BinaryComparator(this.bytesSetIterator.next()); } else { // Skip everything, there is nothing in the iterator. hasMoreRows = false; } }
From source file:com.att.aro.ui.view.diagnostictab.plot.AlarmPlot.java
private List<ScheduledAlarmInfo> getHasFiredAlarms(Map<String, List<ScheduledAlarmInfo>> pendingAlarms) { List<ScheduledAlarmInfo> result = new ArrayList<ScheduledAlarmInfo>(); for (Map.Entry<String, List<ScheduledAlarmInfo>> entry : pendingAlarms.entrySet()) { List<ScheduledAlarmInfo> alarms = entry.getValue(); @SuppressWarnings("rawtypes") ListIterator itrAlarms = alarms.listIterator(); while (itrAlarms.hasNext()) { ScheduledAlarmInfo alarm = (ScheduledAlarmInfo) itrAlarms.next(); if (alarm.getHasFired() > 0) { result.add(alarm);/* ww w .ja v a 2 s . c om*/ } } } return result; }
From source file:com.projity.grouping.core.transform.sorting.NodeSorter.java
public int compare(Object o1, Object o2) { NodeSorter sorter;/* w w w . j a v a 2 s . co m*/ List sorters = getSubTransforms(); if (sorters != null) { currentSorter = sorters.listIterator(); while (currentSorter.hasNext()) { sorter = (NodeSorter) currentSorter.next(); int r = sorter.compare(o1, o2); if (r != 0) { currentSorter.previous(); return r; } } } return 0; }
From source file:com.apigee.sdk.apm.http.impl.client.cache.CacheEntryUpdater.java
private void removeCacheHeadersThatMatchResponse(List<Header> cacheEntryHeaderList, HttpResponse response) { for (Header responseHeader : response.getAllHeaders()) { ListIterator<Header> cacheEntryHeaderListIter = cacheEntryHeaderList.listIterator(); while (cacheEntryHeaderListIter.hasNext()) { String cacheEntryHeaderName = cacheEntryHeaderListIter.next().getName(); if (cacheEntryHeaderName.equals(responseHeader.getName())) { cacheEntryHeaderListIter.remove(); }/*from w w w. j a v a 2s. c o m*/ } } }
From source file:org.wikimedia.analytics.kraken.pageview.PageviewCanonical.java
/** * Enter one or more keys to search for, this list of keys is * interpreted as key1 or key2; this function is not intended * to retrieve the values of multiple keys. In that case, * call this function multiple times.//from w w w . j a va 2 s.co m * @param keys * @return */ private String searchQueryAction(final String[] keys) { try { URL pURL = fixApacheHttpComponentBug(url); List<NameValuePair> qparams = URLEncodedUtils.parse(pURL.toURI(), "utf-8"); ListIterator<NameValuePair> it = qparams.listIterator(); while (it.hasNext()) { NameValuePair nvp = it.next(); for (String key : keys) { if (nvp.getName().equals(key)) { return nvp.getValue(); } } } } catch (URISyntaxException e) { return "key.not.found"; } catch (MalformedURLException e) { return "malformed.url"; } return "key.not.found"; }
From source file:br.com.ingenieux.mojo.cloudfront.AbstractCloudfrontMojo.java
protected List<String> fetchLocalDistributionFiles(Distribution d) throws IOException { List<String> filenames = FileUtils.getFileNames(webappDirectory, d.includes, d.excludes, false); if (filenames.size() > 1000) getLog().warn("Wait! We still don't support > 1000 files. **USE AT YOUR OWN PERIL**"); ListIterator<String> listIterator = filenames.listIterator(); while (listIterator.hasNext()) { String f = listIterator.next(); String normalized = stripStart(FileUtils.normalize(f).replace('\\', '/'), "/"); listIterator.set(normalized);/*from w w w . j a va 2 s . c o m*/ } return filenames; }
From source file:org.apache.qpid.amqp_1_0.client.Respond.java
private void respond(Message m) throws Sender.SenderCreationException { List<Section> sections = m.getPayload(); String replyTo = null;//from ww w. j a va2 s. com Object correlationId = null; for (Section section : sections) { if (section instanceof Properties) { replyTo = getResponseQueue() == null ? ((Properties) section).getReplyTo() : getResponseQueue(); correlationId = ((Properties) section).getMessageId(); break; } } if (replyTo != null) { Sender s = _senders.get(replyTo); if (s == null) { s = (isUseMultipleConnections() ? _session2 : _session).createSender(replyTo, getWindowSize()); _senders.put(replyTo, s); } List<Section> replySections = new ArrayList<Section>(sections); ListIterator<Section> sectionIterator = replySections.listIterator(); while (sectionIterator.hasNext()) { Section section = sectionIterator.next(); if (section instanceof Properties) { Properties newProps = new Properties(); newProps.setTo(replyTo); newProps.setCorrelationId(correlationId); newProps.setMessageId(_responseMsgId); _responseMsgId = _responseMsgId.add(UnsignedLong.ONE); sectionIterator.set(newProps); } } Message replyMessage = new Message(replySections); System.out.println("Sent Message: " + replySections); s.send(replyMessage, _txn); } _receiver.acknowledge(m.getDeliveryTag(), _txn); }
From source file:com.manydesigns.portofino.dispatcher.Dispatcher.java
/** * Returns a dispatch for the provided path. * @param path the path to resolve, not including the context path. * @return the dispatch. If no dispatch can be constructed, this method returns null. *///from w ww. j a v a2 s . c om public Dispatch getDispatch(String path) { if (path.endsWith(".jsp")) { logger.debug("Path is a JSP page ({}), not dispatching.", path); return null; } path = normalizePath(path); Dispatch dispatch = cache.get(path); if (dispatch != null) { return dispatch; } int index; String subPath = path; while ((index = subPath.lastIndexOf('/')) != -1) { subPath = path.substring(0, index); dispatch = cache.get(subPath); if (dispatch != null) { break; } } if (dispatch == null) { List<PageInstance> pagePath = new ArrayList<PageInstance>(); String[] fragments = StringUtils.split(path, '/'); List<String> fragmentsAsList = Arrays.asList(fragments); ListIterator<String> fragmentsIterator = fragmentsAsList.listIterator(); File rootDir = pagesDirectory; Page rootPage; try { rootPage = DispatcherLogic.getPage(rootDir); } catch (Exception e) { logger.error("Cannot load root page", e); return null; } PageInstance rootPageInstance = new PageInstance(null, rootDir, rootPage, null); pagePath.add(rootPageInstance); dispatch = getDispatch(pagePath, fragmentsIterator); if (dispatch != null) { cache.put(path, dispatch); } return dispatch; } else { List<PageInstance> pagePath = new ArrayList<PageInstance>( Arrays.asList(dispatch.getPageInstancePath())); String[] fragments = StringUtils.split(path.substring(subPath.length()), '/'); List<String> fragmentsAsList = Arrays.asList(fragments); ListIterator<String> fragmentsIterator = fragmentsAsList.listIterator(); dispatch = getDispatch(pagePath, fragmentsIterator); if (dispatch != null) { cache.put(path, dispatch); } return dispatch; } }
From source file:it.avalz.opendaylight.controller.Controller.java
public void installPath(List<Vertex> sp, int ingressPort, int outputPort, String destination) throws NoLinkException { Iterator<Vertex> i = sp.listIterator(); // Setup/*from w w w . j a v a2 s . co m*/ Vertex prev = null; Vertex v = i.next(); Vertex next = i.next(); Flow f = null; int prevPort; int nextPort; // First step f = new Flow(v, destination); // prevPort = v.getIncomingPortTo(prev); Not the first step. prevPort = ingressPort; nextPort = v.getPortTo(next); f.setIngressPort(prevPort); f.addOutputAction(nextPort); this.addFlow(f); // Intermediate steps while (i.hasNext()) { // Rotating values one step prev = v; v = next; next = i.next(); // Creating a flow for the "v" vertex, with ingressPort and outputPort f = new Flow(v, destination); prevPort = v.getIncomingPortTo(prev); nextPort = v.getPortTo(next); f.setIngressPort(prevPort); f.addOutputAction(nextPort); this.addFlow(f); } // Last step prev = v; v = next; // next = null; Not needed f = new Flow(v, destination); prevPort = v.getIncomingPortTo(prev); nextPort = outputPort; f.setIngressPort(prevPort); f.addOutputAction(nextPort); this.addFlow(f); }
From source file:net.sf.jasperreports.crosstabs.fill.calculation.OrderByColumnOrderer.java
private void initBucketValues() { List<ColumnValueInfo> columnValues = orderInfo.getColumnValues(); bucketValues = new ArrayList<Bucket>(columnValues.size()); // TODO lucianc handle cases when the values no longer match the groups for (ListIterator<ColumnValueInfo> it = columnValues.listIterator(); it.hasNext();) { Bucket bucketValue;//from w ww. j a v a 2s . co m ColumnValueInfo columnValue = it.next(); if (columnValue.isTotal()) { bucketValue = bucketingData.getColumnTotalBucket(it.previousIndex()); } else { Object value; if (columnValue.getValue() == null) { value = null; } else { value = JRValueStringUtils.deserialize(columnValue.getValueType(), columnValue.getValue()); } // TODO lucianc check against column group value type? bucketValue = bucketingData.getColumnBucket(it.previousIndex(), value); } bucketValues.add(bucketValue); } }