List of usage examples for java.util Vector iterator
public synchronized Iterator<E> iterator()
From source file:net.sf.mzmine.modules.visualization.neutralloss.NeutralLossDataSet.java
public NeutralLossDataPoint getDataPoint(double xValue, double yValue) { Vector<NeutralLossDataPoint> dataCopy = new Vector<NeutralLossDataPoint>(dataSeries.get(RAW_LEVEL)); Iterator<NeutralLossDataPoint> it = dataCopy.iterator(); double currentX, currentY; while (it.hasNext()) { NeutralLossDataPoint point = it.next(); if (xAxisType == NeutralLossParameters.xAxisPrecursor) currentX = point.getPrecursorMass(); else/* w w w. ja va 2 s. c o m*/ currentX = point.getRetentionTime(); currentY = point.getNeutralLoss(); // check for equality if ((Math.abs(currentX - xValue) < 0.00000001) && (Math.abs(currentY - yValue) < 0.00000001)) return point; } return null; }
From source file:net.sourceforge.floggy.persistence.fr2935390.FR2935390Test.java
/** * DOCUMENT ME!/*from www . j ava2s . c o m*/ * * @throws Exception DOCUMENT ME! */ public void testFindOne() throws Exception { Vector birds = buildOrderedPersons(100); final String colorExpected = "color98"; try { for (Iterator iterator = birds.iterator(); iterator.hasNext();) { Bird bird = (Bird) iterator.next(); manager.save(bird); } IndexFilter indexFilter = new IndexFilter("byColor", colorExpected); ObjectSet os = manager.find(Bird.class, indexFilter, false); assertEquals(1, os.size()); assertEquals(colorExpected, ((Bird) os.get(0)).getColor()); } catch (Exception e) { fail(e.getMessage()); } finally { for (Iterator iterator = birds.iterator(); iterator.hasNext();) { Bird bird = (Bird) iterator.next(); manager.delete(bird); } } }
From source file:net.sourceforge.floggy.persistence.fr2935390.FR2935390Test.java
/** * DOCUMENT ME!/*from ww w . j a v a2s. c o m*/ * * @throws Exception DOCUMENT ME! */ public void testDoesNotFind() throws Exception { Vector birds = buildOrderedPersons(100); final String colorExpected = "noColor"; try { for (Iterator iterator = birds.iterator(); iterator.hasNext();) { Bird bird = (Bird) iterator.next(); manager.save(bird); } IndexFilter indexFilter = new IndexFilter("byColor", colorExpected); ObjectSet os = manager.find(Bird.class, indexFilter, false); assertEquals(0, os.size()); } catch (Exception e) { fail(e.getMessage()); } finally { IndexManager.shutdown(); for (Iterator iterator = birds.iterator(); iterator.hasNext();) { Bird bird = (Bird) iterator.next(); manager.delete(bird); } } }
From source file:com.ripariandata.timberwolf.conf4j.ConfigFileParserTest.java
License:asdf
private Configuration mockConfiguration(final Object... settings) { if ((settings.length % 2) != 0) { return null; }// ww w . jav a2 s.co m Configuration config = mock(Configuration.class); Vector<String> keys = new Vector<String>(); for (int i = 0; i < settings.length; i += 2) { String key = settings[i].toString(); keys.add(key); when(config.getProperty(key)).thenReturn(settings[i + 1]); } when(config.getKeys()).thenReturn(keys.iterator()); return config; }
From source file:net.sourceforge.floggy.persistence.fr2935390.FR2935390Test.java
/** * DOCUMENT ME!// w w w. ja v a2 s . c o m * * @throws Exception DOCUMENT ME! */ public void testFindTwo() throws Exception { Vector birds = buildOrderedPersons(100); final String colorExpected = "color98"; try { for (Iterator iterator = birds.iterator(); iterator.hasNext();) { Bird bird = (Bird) iterator.next(); manager.save(bird); } Bird bird = new Bird(); bird.setColor(colorExpected); manager.save(bird); IndexFilter indexFilter = new IndexFilter("byColor", colorExpected); ObjectSet os = manager.find(Bird.class, indexFilter, false); assertEquals(2, os.size()); assertEquals(colorExpected, ((Bird) os.get(0)).getColor()); assertEquals(colorExpected, ((Bird) os.get(1)).getColor()); manager.delete(bird); } catch (Exception e) { fail(e.getMessage()); } finally { for (Iterator iterator = birds.iterator(); iterator.hasNext();) { Bird bird = (Bird) iterator.next(); manager.delete(bird); } } }
From source file:net.sourceforge.floggy.persistence.fr2935390.FR2935390Test.java
/** * DOCUMENT ME!//w w w . j a v a 2s. c o m * * @throws Exception DOCUMENT ME! */ public void testFindThree() throws Exception { Vector birds = buildOrderedPersons(100); final String colorExpected = "color98"; try { for (Iterator iterator = birds.iterator(); iterator.hasNext();) { Bird bird = (Bird) iterator.next(); manager.save(bird); } Bird bird1 = new Bird(); bird1.setColor(colorExpected); manager.save(bird1); Bird bird2 = new Bird(); bird2.setColor(colorExpected); manager.save(bird2); IndexFilter indexFilter = new IndexFilter("byColor", colorExpected); ObjectSet os = manager.find(Bird.class, indexFilter, false); assertEquals(3, os.size()); assertEquals(colorExpected, ((Bird) os.get(0)).getColor()); assertEquals(colorExpected, ((Bird) os.get(1)).getColor()); manager.delete(bird1); manager.delete(bird2); } catch (Exception e) { fail(e.getMessage()); } finally { for (Iterator iterator = birds.iterator(); iterator.hasNext();) { Bird bird = (Bird) iterator.next(); manager.delete(bird); } } }
From source file:com.sampas.socbs.core.data.arcsde.impl.ArcSDEPooledConnection.java
/** * Caches both tables and layers//from ww w . j a v a2s.c o m * @throws SeException */ // @SuppressWarnings("unchecked") private void cacheLayers() throws SeException { Vector/* <SeLayer> */ layers = this.getLayers(); String qualifiedName; SeLayer layer; SeTable table; cachedTables.clear(); cachedLayers.clear(); for (Iterator it = layers.iterator(); it.hasNext();) { layer = (SeLayer) it.next(); qualifiedName = layer.getQualifiedName(); table = new SeTable((SeConnection) this, qualifiedName); cachedLayers.put(qualifiedName, layer); cachedTables.put(qualifiedName, table); } }
From source file:agentlogfileanalyzer.histogram.AbstractHistogram.java
/** * Returns a panel containing a histogram. The data displayed in the * histogram is given as parameter. Data not inside the given limits is * discarded.// ww w. j a v a2 s. c o m * * @param _histogramData * the data displayed in the histogram * @param _lowerLimit * the lower limit that was entered by the user * @param _upperLimit * the upper limit that was entered by the user * @return a <code>JPanel</code> containing the histogram */ JPanel createHistogram(Vector<Double> _histogramData, double _lowerLimit, double _upperLimit) { // Remove values outside the given limits... Vector<Double> vectorHistogramDataWithinLimits = new Vector<Double>(); for (Iterator<Double> iterator = _histogramData.iterator(); iterator.hasNext();) { double d = ((Double) iterator.next()).doubleValue(); if (valueWithinLimits(d, _lowerLimit, _upperLimit)) { vectorHistogramDataWithinLimits.add(d); } } // Store number of elements shown in histogram... this.numberOfVisibleClassifiers = vectorHistogramDataWithinLimits.size(); // Convert vector to array... double[] arrayHistogramDataWithinLimits = new double[vectorHistogramDataWithinLimits.size()]; for (int i = 0; i < vectorHistogramDataWithinLimits.size(); i++) { double d = vectorHistogramDataWithinLimits.get(i).doubleValue(); arrayHistogramDataWithinLimits[i] = d; } if (arrayHistogramDataWithinLimits.length > 0) { // Create // histogram... HistogramDataset data = new HistogramDataset(); data.addSeries("Suchwert", // key arrayHistogramDataWithinLimits, // data Math.max(100, arrayHistogramDataWithinLimits.length) // #bins ); JFreeChart chart = ChartFactory.createHistogram(description, // title description, // x axis label "frequency", // y axis label data, // data PlotOrientation.VERTICAL, // orientation false, // legend true, // tooltips false // URL ); return new ChartPanel(chart); } else { return createErrorPanel("No data available (within the given limits)."); } }
From source file:com.mirth.connect.connectors.file.filesystems.SftpConnection.java
@Override public List<String> listDirectories(String fromDir) throws Exception { List<String> directories = new ArrayList<String>(); cwd(fromDir);/*from ww w . ja va2s .c om*/ @SuppressWarnings("unchecked") Vector<ChannelSftp.LsEntry> entries = client.ls("."); for (Iterator<ChannelSftp.LsEntry> iter = entries.iterator(); iter.hasNext();) { ChannelSftp.LsEntry entry = iter.next(); if (entry.getAttrs().isDir() || entry.getAttrs().isLink()) { directories.add(new SftpFileInfo(fromDir, entry).getAbsolutePath()); } } return directories; }
From source file:com.netpace.aims.controller.application.WapApplicationHelper.java
public static String getLicenseTypesForVersion(String licenseTypeIds) { AimsWapLicenseType aimsWapLicenseType = null; Vector licenseVector = StringFuncs.ConvertArrToVector(StringFuncs.tokenize(licenseTypeIds, ",")); Vector licenseNameVector = new Vector(); for (Iterator it = licenseVector.iterator(); it.hasNext();) { try {/*w w w . j a v a2 s. c om*/ aimsWapLicenseType = (AimsWapLicenseType) DBHelper.getInstance().load(AimsWapLicenseType.class, (String) it.next()); licenseNameVector.add(aimsWapLicenseType.getLicenseTypeName()); } catch (HibernateException hEx) { //Handle exception } catch (Exception ex) { //Handle exception } } String[] abc = StringFuncs.ConvertListToStringArray(licenseNameVector); Arrays.sort(abc); return StringFuncs.ConvertArrToString(abc, ", "); }