Example usage for java.util Vector iterator

List of usage examples for java.util Vector iterator

Introduction

In this page you can find the example usage for java.util Vector iterator.

Prototype

public synchronized Iterator<E> iterator() 

Source Link

Document

Returns an iterator over the elements in this list in proper sequence.

Usage

From source file:org.kepler.gui.OntLibrarySearcher.java

/**
 * Search for ontology-keyword in the library
 * // w ww .j  ava2  s .co  m
 *@param value
 *            the keyword in the ontology to search for
 *@param authenticate
 *           if true prompt user to login if necessary
 *@return Description of the Return Value
 */
public LibrarySearchResults search(String value, boolean authenticate) {
    // assign the new results of the search
    _results = new LibrarySearchResults();
    // this is a protected class member
    if (value.trim().equals("")) {
        return _results;
    }

    // build the hash table
    NamedObj root = (NamedObj) _library.getModel().getRoot();
    _pathStack = new Stack<NamedObj>();
    _pathStack.push(root);
    _hashTable = new Hashtable<String, Vector<TreePath>>();
    buildHashTable(root, _library.getModel());

    // get the ontology search results
    Vector<NamedObj> ont_results = _engine.search(value, true);
    // find the appropriate results in the library
    Iterator<NamedObj> iter = ont_results.iterator();
    while (iter.hasNext()) {
        NamedObj obj = iter.next();
        Iterator<String> idIter = getIds(obj).iterator();
        // for each id, add the tree path to the result
        while (idIter.hasNext()) {
            String id = idIter.next();
            Iterator<TreePath> pathIter = hashTableGet(id);
            while (pathIter.hasNext()) {
                TreePath path = pathIter.next();
                if (!_results.contains(path)) {
                    _results.add(path);
                }
            }
        }
    }
    return _results;
}

From source file:org.kepler.sms.SemanticTypeManager.java

public Vector<NamedOntClass> getTypesAsNamedOntClasses(Object obj) {
    Vector<NamedOntClass> results = new Vector<NamedOntClass>();

    if (!isObject(obj)) {
        return results;
    }//  w w  w. ja  v a  2s.co  m

    Vector semTypes = getTypes(obj);
    Iterator semTypesItr = semTypes.iterator();
    while (semTypesItr.hasNext()) {
        Object semType = semTypesItr.next();
        if (semType instanceof NamedOntClass) {
            NamedOntClass noc = (NamedOntClass) semType;
            results.add(noc);
        }
    }

    return results;
}

From source file:org.apache.axis.encoding.ser.VectorSerializer.java

/** Serialize a Vector
 *
 * Walk the collection of keys, serializing each key/value pair
 * inside an <item> element./*from   www  .  j  a  va 2 s . c  o m*/
 *
 * @param name the desired QName for the element
 * @param attributes the desired attributes for the element
 * @param value the Object to serialize
 * @param context the SerializationContext in which to do all this
 * @exception IOException
 */
public void serialize(QName name, Attributes attributes, Object value, SerializationContext context)
        throws IOException {
    if (!(value instanceof Vector))
        throw new IOException(
                Messages.getMessage("noVector00", "VectorSerializer", value.getClass().getName()));

    Vector vector = (Vector) value;

    // Check for circular references. 
    if (isRecursive(new IdentityHashMap(), vector)) {
        throw new IOException(Messages.getMessage("badVector00"));
    }

    context.startElement(name, attributes);
    for (Iterator i = vector.iterator(); i.hasNext();) {
        Object item = i.next();
        context.serialize(Constants.QNAME_LITERAL_ITEM, null, item);
    }
    context.endElement();
}

From source file:GifEncoder.java

public void setTransparentColors(Vector vector) {
    try {/*  w  w w .ja  va  2s.c om*/
        Iterator iterator = vector.iterator();
        while (iterator.hasNext()) {
            Color color = (Color) iterator.next();
            addTransparentColor(color);
        }

        return;
    } catch (Exception e) {
    }
}

From source file:org.kepler.sms.SemanticTypeManager.java

/**
 * Set this managers state to the state saved by the memento.
 * /*from w  ww.  ja  va2  s .  co  m*/
 * @param memento
 *            the memento whose state is being loaded
 */
public void setMemento(SemanticTypeManagerMemento memento) {
    SemanticTypeManager manager = memento.getState();
    _objectTable = new Hashtable<Object, Vector<Object>>();
    if (manager == null)
        return;
    Iterator<Object> objIter = manager.getObjects().iterator();
    while (objIter.hasNext()) {
        Object obj = objIter.next();
        addObject(obj);
        Vector<Object> types = manager.getTypes(obj);
        Iterator<Object> typeIter = types.iterator();
        while (typeIter.hasNext())
            addType(obj, (String) typeIter.next());
    }
}

From source file:org.kepler.sms.util.OntologyConfiguration.java

/**
 * Get the file path names for the ontologies
 *///from ww  w .  j  ava  2s  .  c om
public Iterator getFilePathNames() {
    Vector result = new Vector();
    if (_document == null)
        return result.iterator();

    // get the root
    Element root = _document.getDocumentElement();
    if (root == null)
        return result.iterator();

    // iterate through root, get each ontology element and its
    // filename
    NodeList lst = root.getElementsByTagName("ontology");
    for (int i = 0; i < lst.getLength(); i++) {
        Element elem = (Element) lst.item(i);
        Attr att = elem.getAttributeNode("filename");
        if (att != null) {
            String filename = att.getValue();
            if (filename != null)
                result.addElement(getAbsoluteOntologyPath(filename));
        }
    }

    return result.iterator();
}

From source file:com.globalsight.everest.webapp.pagehandler.administration.projects.ModifyProjectHandler.java

private void storeQuotePersons(HttpServletRequest request, Locale p_locale) throws Exception {
    UserComparator userComparator = new UserComparator(UserComparator.DISPLAYNAME, p_locale);
    // Get quote email persons
    Vector<User> qePersons = ServerProxy.getUserManager().getUsers();
    Iterator<User> it = qePersons.iterator();
    // ignore super admin for quote person list.
    while (it.hasNext()) {
        User u = (User) it.next();// www . j a  v a  2  s  . co  m
        if (UserUtil.isSuperAdmin(u.getUserId())) {
            it.remove();
        }
    }
    SortUtil.sort(qePersons, userComparator);
    request.setAttribute("qePersons", qePersons);
}

From source file:graficos.GraficoBarras.java

private void actualizarSubTitulos(Vector<String> subtitulos) {
    // Elimino los ttulos existentes.
    for (Iterator<TextTitle> it = sub_titulos.iterator(); it.hasNext();) {
        TextTitle t = it.next();/*  www .  j a  v a  2 s .  c om*/
        grafico.removeSubtitle(t);
    }
    // Agrego los ttulos nuevos.
    for (Iterator<String> it = subtitulos.iterator(); it.hasNext();) {
        TextTitle t = new TextTitle(it.next());
        sub_titulos.add(t);
        grafico.addSubtitle(t);
    }

}

From source file:org.apache.axis.message.SOAPHeader.java

public Iterator extractHeaderElements(String actor) {
    Vector results = findHeaderElements(actor);

    Iterator iterator = results.iterator();
    // Detach the header elements from the header
    while (iterator.hasNext()) {
        ((SOAPHeaderElement) iterator.next()).detachNode();
    }/*from  ww w .j  a v  a 2  s .c o m*/

    return results.iterator();
}

From source file:org.matsim.counts.algorithms.graphs.CountsSimReal24Graph.java

@Override
public JFreeChart createChart(final int nbr) {

    XYSeriesCollection dataset0 = new XYSeriesCollection();
    XYSeries series = new XYSeries("MATSim volumes");
    // easier to use another dataset
    XYSeriesCollection dataset_outliers = new XYSeriesCollection();
    XYSeries series_outliers = new XYSeries("MATSim outliers");

    CustomXYURLGenerator url_gen = new CustomXYURLGenerator();
    CustomXYToolTipGenerator tt_gen = new CustomXYToolTipGenerator();

    final ArrayList<String> urls = new ArrayList<>();
    final ArrayList<String> tooltips = new ArrayList<>();
    List<Comp> comps = new Vector<>();

    //--------------------
    CountSimComparisonLinkFilter linkFilter = new CountSimComparisonLinkFilter(this.ccl_);

    final Vector<Id<Link>> linkIds = new CountSimComparisonLinkFilter(this.ccl_).getLinkIds();
    Iterator<Id<Link>> id_it = linkIds.iterator();

    double maxCountValue = 0.1;
    double maxSimValue = 0.1;
    // yyyy PtCountsKMLWriterTest.testPtAlightKMLCreation never touches these and then leads to an exception later
    // when they are zero.  Don't know why. kai, sep'16

    while (id_it.hasNext()) {
        Id<Link> id = id_it.next();

        double countVal = linkFilter.getAggregatedCountValue(id);
        double simVal = linkFilter.getAggregatedSimValue(id);

        if (countVal > 100.0 && simVal > 100.0) {

            if (countVal > maxCountValue)
                maxCountValue = countVal;
            if (simVal > maxSimValue)
                maxSimValue = simVal;/*from  w w  w. j  a va 2s.co m*/

            series.add(countVal, simVal);
            comps.add(new Comp(countVal, "link" + id + ".html",
                    "Link " + id + "; " + "Count: " + countVal + ", Sim: " + simVal));
        } else {
            /* values with simVal<100.0 or countVal<100.0 are drawn on the x==100 or/and y==100-line
             */
            countVal = Math.max(100.0, countVal);
            simVal = Math.max(100.0, simVal);
            series_outliers.add(countVal, simVal);

            if (countVal > maxCountValue)
                maxCountValue = countVal;
            if (simVal > maxSimValue)
                maxSimValue = simVal;
        }
    } //while
    dataset0.addSeries(series);
    dataset_outliers.addSeries(series_outliers);

    Collections.sort(comps, new MyComparator());

    for (Iterator<Comp> iter = comps.iterator(); iter.hasNext();) {
        Comp cp = iter.next();
        urls.add(cp.getURL());
        tooltips.add(cp.getTooltip());
    }

    url_gen.addURLSeries(urls);
    tt_gen.addToolTipSeries(tooltips);

    String title = "Avg. Weekday Traffic Volumes, Iteration: " + this.iteration_;
    this.setChartTitle(title);
    this.chart_ = ChartFactory.createXYLineChart(title, "Count Volumes", // x axis label
            "Sim Volumes", // y axis label
            dataset0, // data
            PlotOrientation.VERTICAL, false, // include legend
            true, // tooltips
            true // urls
    );
    XYPlot plot = this.chart_.getXYPlot();
    final LogarithmicAxis axis_x = new LogarithmicAxis("Count Volumes [veh/24h]");
    final LogarithmicAxis axis_y = new LogarithmicAxis("Sim Volumes [veh/24h]");
    axis_x.setAllowNegativesFlag(false);
    axis_y.setAllowNegativesFlag(false);

    //regular values
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setLinesVisible(false);
    renderer.setURLGenerator(url_gen);
    renderer.setSeriesPaint(0, Color.black);
    renderer.setSeriesToolTipGenerator(0, tt_gen);
    renderer.setSeriesShape(0, new Rectangle2D.Double(-1.5, -1.5, 3.0, 3.0));

    //outliers
    XYLineAndShapeRenderer renderer2 = new XYLineAndShapeRenderer();
    renderer2.setLinesVisible(false);
    renderer2.setSeriesPaint(0, Color.red);
    renderer2.setSeriesShape(0, new Ellipse2D.Double(-3.0, -3.0, 6.0, 6.0));

    // error band
    DefaultXYDataset dataset1 = new DefaultXYDataset();
    Gbl.assertIf(maxCountValue > 0.);
    dataset1.addSeries("f1x", new double[][] { { 100.0, maxCountValue }, { 100.0, maxCountValue } });
    dataset1.addSeries("f2x", new double[][] { { 100.0, maxCountValue }, { 200.0, 2 * maxCountValue } });
    dataset1.addSeries("f05x", new double[][] { { 200.0, maxCountValue }, { 100.0, 0.5 * maxCountValue } });

    XYLineAndShapeRenderer renderer3 = new XYLineAndShapeRenderer();
    renderer3.setShapesVisible(false);
    renderer3.setSeriesPaint(0, Color.blue);
    renderer3.setSeriesPaint(1, Color.blue);
    renderer3.setSeriesPaint(2, Color.blue);
    renderer3.setBaseSeriesVisibleInLegend(false);
    renderer3.setSeriesItemLabelsVisible(0, true);
    renderer3.setSeriesItemLabelsVisible(1, false);
    renderer3.setSeriesItemLabelsVisible(2, false);

    XYTextAnnotation annotation0 = new XYTextAnnotation("2.0 count", maxCountValue, 2 * maxCountValue);
    annotation0.setFont(new Font("SansSerif", Font.BOLD, 11));
    plot.addAnnotation(annotation0);
    XYTextAnnotation annotation1 = new XYTextAnnotation("count", maxCountValue, maxCountValue);
    annotation1.setFont(new Font("SansSerif", Font.BOLD, 11));
    plot.addAnnotation(annotation1);
    XYTextAnnotation annotation2 = new XYTextAnnotation("0.5 count", maxCountValue, 0.5 * maxCountValue);
    annotation2.setFont(new Font("SansSerif", Font.BOLD, 11));
    plot.addAnnotation(annotation2);

    plot.setDomainAxis(axis_x);
    plot.setRangeAxis(axis_y);
    plot.setRenderer(0, renderer);

    plot.setRenderer(1, renderer2);
    plot.setDataset(1, dataset_outliers);

    plot.setRenderer(2, renderer3);
    plot.setDataset(2, dataset1);

    //plot.getRangeAxis().setRange(1.0, 19000.0);
    //plot.getDomainAxis().setRange(1.0, 19000.0);

    return this.chart_;
}