List of usage examples for java.util ListIterator next
E next();
From source file:com.ivli.roim.controls.ChartControl.java
void removeMarker(DomainMarker aM) { ListIterator<Interpolation> it = iInterpolations.listIterator(); while (it.hasNext()) { Interpolation i = it.next(); if (i.iLhs == aM || i.iRhs == aM) { it.remove();/*from w w w. j a v a2 s. co m*/ i.close(); } } getChart().getXYPlot().removeRangeMarker(aM.getLinkedMarker(), Layer.FOREGROUND); getChart().getXYPlot().removeDomainMarker(aM, Layer.FOREGROUND); }
From source file:com.xpn.xwiki.plugin.tag.TagPlugin.java
/** * Remove a tag from a document. The document is saved (minor edit) after this operation. * // www. j a v a 2 s . c om * @param tag tag to remove. * @param document the document. * @param context XWiki context. * @return the {@link TagOperationResult result} of the operation * @throws XWikiException if document save fails for some reason (Insufficient rights, DB access, etc). */ public TagOperationResult removeTagFromDocument(String tag, XWikiDocument document, XWikiContext context) throws XWikiException { List<String> tags = getTagsFromDocument(document); boolean needsUpdate = false; ListIterator<String> it = tags.listIterator(); while (it.hasNext()) { if (tag.equalsIgnoreCase(it.next())) { needsUpdate = true; it.remove(); } } if (needsUpdate) { setDocumentTags(document, tags, context); List<String> commentArgs = new ArrayList<String>(); commentArgs.add(tag); String comment = context.getMessageTool().get("plugin.tag.editcomment.removed", commentArgs); // Since we're changing the document we need to set the new author document.setAuthorReference(context.getUserReference()); context.getWiki().saveDocument(document, comment, true, context); return TagOperationResult.OK; } else { // Document doesn't contain this tag. return TagOperationResult.NO_EFFECT; } }
From source file:com.danielme.muspyforandroid.services.MusicBrainzClient.java
/** * Label, country, format and mbid of the concrete release * @since 1.2//from w w w. j a v a 2 s . c o m */ public void loadReleaseConcrete(Release release) { if (releases.get(release.getMbid()) != null) { Release temp = releases.get(release.getMbid()); release.setCountry(temp.getCountry()); release.setFormat(temp.getFormat()); release.setLabel(temp.getLabel()); release.setTrackCount(temp.getTrackCount()); release.setMbidConcreteRelease(temp.getMbidConcreteRelease()); } else { String url = String.format(Constants.MBRAINZ.URL_RELEASES, URLEncoder.encode(release.getMbid())); HttpGet httpGet = new HttpGet(url); httpGet.setHeader(Constants.CONTENT_TYPE, Constants.TYPE_JSON); try { HttpResponse response = httpClient.execute(httpGet); StatusLine statusLine = response.getStatusLine(); //sometimes we receive HTTP 504 if (statusLine != null && statusLine.getStatusCode() == MBGatewayTimeOutException.STATUS_CODE) { throw new MBGatewayTimeOutException(); } String responseString = EntityUtils.toString(response.getEntity()); JSONObject responseJSON = new JSONObject(responseString); JSONArray jsonArray = responseJSON.getJSONArray(Constants.MBRAINZ.RELEASES); String date = getReleaseDate(release); List<JSONObject> candidates = new LinkedList<JSONObject>(); for (int i = 0; i < jsonArray.length(); i++) { if (jsonArray.getJSONObject(i).getString("date").equals(date)) { candidates.add(jsonArray.getJSONObject(i)); } } ListIterator<JSONObject> listIterator = candidates.listIterator(); boolean found = false; JSONObject releaseJson = null; String country = null; //USA while (listIterator.hasNext() && !found) { releaseJson = listIterator.next(); country = releaseJson.getString("country"); if (country.equals("US")) { found = true; loadDetails(releaseJson, release); } } //UK if (!found) { listIterator = candidates.listIterator(); while (listIterator.hasNext() && !found) { releaseJson = listIterator.next(); country = releaseJson.getString("country"); if (country.equals("GB")) { found = true; loadDetails(releaseJson, release); } } } //the first release if (!found && !candidates.isEmpty()) { loadDetails(jsonArray.getJSONObject(0), release); } } catch (Exception ex) { //this feature is not critical Log.w(this.getClass().toString(), ex.getMessage()); } releases.put(release.getMbid(), release); } }
From source file:com.taobao.gecko.service.impl.GeckoHandler.java
private boolean removeDisconnectedConnection(final String group) { // connection) final List<Connection> currentConnList = this.remotingController.getRemotingContext() .getConnectionsByGroup(group); Connection disconnectedConn = null; if (currentConnList != null) { synchronized (currentConnList) { final ListIterator<Connection> it = currentConnList.listIterator(); while (it.hasNext()) { final Connection currentConn = it.next(); if (!currentConn.isConnected()) { disconnectedConn = currentConn; break; } else { // // if (!((DefaultConnection) currentConn).isReady() && !currentConn.getGroupSet().isEmpty()) { this.notifyConnectionReady((DefaultConnection) currentConn); }// www.ja v a2 s .c o m } } } } if (disconnectedConn != null) { return currentConnList.remove(disconnectedConn); } else { return false; } }
From source file:com.alibaba.napoli.gecko.service.impl.GeckoHandler.java
private boolean removeDisconnectedConnection(final String group) { // ???connection??) final List<Connection> currentConnList = this.remotingController.getRemotingContext() .getConnectionsByGroup(group); Connection disconnectedConn = null; if (currentConnList != null) { synchronized (currentConnList) { final ListIterator<Connection> it = currentConnList.listIterator(); while (it.hasNext()) { final Connection currentConn = it.next(); if (!currentConn.isConnected()) { disconnectedConn = currentConn; break; } else { // ????? // ??? if (!((DefaultConnection) currentConn).isReady() && !currentConn.getGroupSet().isEmpty()) { this.notifyConnectionReady((DefaultConnection) currentConn); }// ww w .j ava2 s . co m } } } } if (disconnectedConn != null) { return currentConnList.remove(disconnectedConn); } else { return false; } }
From source file:com.impetus.kundera.query.KunderaQueryParser.java
/** * @param selectExpression//from www. jav a 2 s . c o m * @return Count of aggregation required */ private int countAggregation(Expression selectExpression) { int count = 0; if (selectExpression instanceof CollectionExpression) { CollectionExpression selectColumnExpression = (CollectionExpression) selectExpression; ListIterator<Expression> selectColumnIter = selectColumnExpression.children().iterator(); while (selectColumnIter.hasNext()) { count = validateExpression(selectColumnIter.next()) ? ++count : count; } } else { if (validateExpression(selectExpression)) count = 1; } return count; }
From source file:vteaexploration.plottools.panels.XYChartPanel.java
private DefaultXYZDataset createXYZDataset(ArrayList alVolumes, int x, int y, int l) { //System.out.println("PROFILING: New dataset, for " + alVolumes.size() + " objects."); DefaultXYZDataset result = new DefaultXYZDataset(); int counter = 0; double[] xCorrected = new double[alVolumes.size()]; double[] yCorrected = new double[alVolumes.size()]; double[] lCorrected = new double[alVolumes.size()]; ListIterator litr = alVolumes.listIterator(); while (litr.hasNext()) { // try { MicroObjectModel volume = (MicroObjectModel) litr.next(); xCorrected[counter] = processPosition(x, volume).doubleValue(); yCorrected[counter] = processPosition(y, volume).doubleValue(); if (l > 0) { lCorrected[counter] = processPosition(l, volume).doubleValue(); } else {/*from w w w . java 2 s . c om*/ lCorrected[counter] = 0; } counter++; // } // catch (NullPointerException e) { // System.out.println("EXCEPTION: Error building dataset."); // } } double[][] series = new double[][] { xCorrected, yCorrected, lCorrected }; result.addSeries("first", series); return result; }
From source file:edu.cornell.mannlib.vitro.webapp.dao.filtering.IndividualFiltering.java
@Override public List<DataProperty> getDataPropertyList() { List<DataProperty> dprops = _innerIndividual.getDataPropertyList(); LinkedList<DataProperty> outdProps = new LinkedList<DataProperty>(); if (dprops == null) return outdProps; Filter.filter(dprops, _filters.getDataPropertyFilter(), outdProps); ListIterator<DataProperty> it = outdProps.listIterator(); while (it.hasNext()) { DataProperty dp = it.next(); List<DataPropertyStatement> filteredStmts = new LinkedList<DataPropertyStatement>(); Filter.filter(dp.getDataPropertyStatements(), _filters.getDataPropertyStatementFilter(), filteredStmts); if (filteredStmts.size() == 0) { it.remove();/*from w w w .j a va2s. c om*/ } else { dp.setDataPropertyStatements(filteredStmts); } } return outdProps; }
From source file:com.projity.pm.graphic.model.transform.NodeCacheTransformer.java
private void placeVoidNodes(List list) { ListIterator i = list.listIterator(); while (i.hasNext()) { GraphicNode gnode = (GraphicNode) i.next(); //if (!gnode.isGroup()){ //Already disabled if sorters or groupers are working placeVoidNodes(i, gnode.getNode()); //}//from ww w . j av a 2 s . c om } placeVoidNodes(i, (Node) refCache.getModel().getRoot()); }