Example usage for java.util Vector add

List of usage examples for java.util Vector add

Introduction

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

Prototype

public synchronized boolean add(E e) 

Source Link

Document

Appends the specified element to the end of this Vector.

Usage

From source file:io.jjcastillo.bconferencia.helper.Storage.java

public Vector getAllConferenciasVector() {
    Vector v = new Vector();
    for (Conferencia c : auditorio1.getConferencias()) {
        Vector v1 = new Vector();
        v1.add(auditorio1.getNombre());
        v1.add(c.getNombre());/*from   ww  w .  j  av  a  2  s .co  m*/
        v1.add(HelperUtil.formatDate(c.getFechaInicio()));
        v1.add(HelperUtil.formatDate(c.getFechaFin()));
        v1.add(HelperUtil.PrettifyDateDiff(c.getFechaFin().getTime() - c.getFechaInicio().getTime()));
        v.add(v1);
    }

    for (Conferencia c : auditorio2.getConferencias()) {
        Vector v1 = new Vector();
        v1.add(auditorio2.getNombre());
        v1.add(c.getNombre());
        v1.add(HelperUtil.formatDate(c.getFechaInicio()));
        v1.add(HelperUtil.formatDate(c.getFechaFin()));
        v1.add(HelperUtil.PrettifyDateDiff(c.getFechaFin().getTime() - c.getFechaInicio().getTime()));
        v.add(v1);
    }

    return v;
}

From source file:com.qframework.core.ServerkoParse.java

public static int parseIntData(Vector<int[]> outdata, String data, int[] offsets) {

    int val = 0;
    int arrcount = 0;
    int offsetcount = 0;
    int[] array = null;
    int currsize = 0;
    StringTokenizer tok = new StringTokenizer(data, ",");
    while (tok.hasMoreTokens()) {
        if (arrcount == 0) {
            currsize = offsets[offsetcount++];
            offsetcount = offsetcount % offsets.length;
            array = new int[currsize];
        }/*from  www.j  a v  a  2  s.c  o  m*/
        try {
            val = Integer.parseInt(tok.nextToken());
        } catch (NumberFormatException e) {
        }
        array[arrcount++] = val;
        if (arrcount >= currsize) {
            outdata.add(array);
            arrcount = 0;
        }
    }
    return outdata.size();
}

From source file:de.unibayreuth.bayeos.goat.table.OctetMatrixTableModel.java

public boolean load(Vector objekts, TimeFilter tFilter, AggregateFilter aFilter, Boolean withCounts) {
    try {/*w  w w.j  a v a 2s  .  co  m*/
        Vector params = new Vector();
        params.add(getIds(objekts));
        params.add(tFilter.getVector());
        if (aFilter == null) {
            params.add(null);
        } else {
            params.add(aFilter.getVector());
        }
        params.add(withCounts);
        params.add("obj_stream");
        setColumnClasses(objekts);
        setColumnNames(objekts);
        readStream(xmlClient.executeStream("OctetMatrixHandler.getMatrixAggr", params), objekts);
    } catch (IOException i) {
        MsgBox.error(i.getMessage());
        return false;
    } catch (XmlRpcException e) {
        MsgBox.error(e.getMessage());
        return false;
    }
    return true;
}

From source file:FocusTraversalDemo.java

public FocusTraversalDemo() {
    super(new BorderLayout());

    JTextField tf1 = new JTextField("Field 1");
    JTextField tf2 = new JTextField("A Bigger Field 2");
    JTextField tf3 = new JTextField("Field 3");
    JTextField tf4 = new JTextField("A Bigger Field 4");
    JTextField tf5 = new JTextField("Field 5");
    JTextField tf6 = new JTextField("A Bigger Field 6");
    JTable table = new JTable(4, 3);
    togglePolicy = new JCheckBox("Custom FocusTraversalPolicy");
    togglePolicy.setActionCommand("toggle");
    togglePolicy.addActionListener(this);
    togglePolicy.setFocusable(false); // Remove it from the focus cycle.
    // Note that HTML is allowed and will break this run of text
    // across two lines.
    label = new JLabel(
            "<html>Use Tab (or Shift-Tab) to navigate from component to component.Control-Tab (or Control-Shift-Tab) allows you to break out of the JTable.</html>");

    JPanel leftTextPanel = new JPanel(new GridLayout(3, 2));
    leftTextPanel.add(tf1, BorderLayout.PAGE_START);
    leftTextPanel.add(tf3, BorderLayout.CENTER);
    leftTextPanel.add(tf5, BorderLayout.PAGE_END);
    leftTextPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 5));
    JPanel rightTextPanel = new JPanel(new GridLayout(3, 2));
    rightTextPanel.add(tf2, BorderLayout.PAGE_START);
    rightTextPanel.add(tf4, BorderLayout.CENTER);
    rightTextPanel.add(tf6, BorderLayout.PAGE_END);
    rightTextPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 5));
    JPanel tablePanel = new JPanel(new GridLayout(0, 1));
    tablePanel.add(table, BorderLayout.CENTER);
    tablePanel.setBorder(BorderFactory.createEtchedBorder());
    JPanel bottomPanel = new JPanel(new GridLayout(2, 1));
    bottomPanel.add(togglePolicy, BorderLayout.PAGE_START);
    bottomPanel.add(label, BorderLayout.PAGE_END);

    add(leftTextPanel, BorderLayout.LINE_START);
    add(rightTextPanel, BorderLayout.CENTER);
    add(tablePanel, BorderLayout.LINE_END);
    add(bottomPanel, BorderLayout.PAGE_END);
    setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
    Vector<Component> order = new Vector<Component>(7);
    order.add(tf1);
    order.add(tf2);/*  w w w. ja v  a  2  s.  co  m*/
    order.add(tf3);
    order.add(tf4);
    order.add(tf5);
    order.add(tf6);
    order.add(table);
    newPolicy = new MyOwnFocusTraversalPolicy(order);
}

From source file:com.qframework.core.ServerkoParse.java

public static int parseFloatData(Vector<float[]> outdata, String data, int[] offsets) {

    float val = 0;
    int arrcount = 0;
    int offsetcount = 0;
    float[] array = null;
    int currsize = 0;
    StringTokenizer tok = new StringTokenizer(data, ",");
    while (tok.hasMoreTokens()) {
        if (arrcount == 0) {
            currsize = offsets[offsetcount++];
            offsetcount = offsetcount % offsets.length;
            array = new float[currsize];
        }/*from  w  w w .  ja v  a 2s  .  c o  m*/
        try {
            val = Float.parseFloat(tok.nextToken());
        } catch (NumberFormatException e) {
        }
        array[arrcount++] = val;
        if (arrcount >= currsize) {
            outdata.add(array);
            arrcount = 0;
        }
    }
    return outdata.size();
}

From source file:de.betterform.agent.web.WebUtil.java

/**
 * stores cookies that may exist in request and passes them on to processor for usage in
 * HTTPConnectors. Instance loading and submission then uses these cookies. Important for
 * applications using auth.//www  .j  a v  a2  s. c  o  m
 * <p/>
 * NOTE: this method should be called *before* the Adapter is initialized cause the cookies may
 * already be needed for setup (e.g. loading of XForms via Http)
 */
public static void storeCookies(List<Cookie> requestCookies, XFormsProcessor processor) {
    Vector<BasicClientCookie> commonsCookies = new Vector<BasicClientCookie>();

    if (requestCookies != null && requestCookies.size() > 0) {
        commonsCookies = saveAsBasicClientCookie(requestCookies.iterator(), commonsCookies);
    }

    /*
    if (responseCookies != null && responseCookies.size() > 0) {
    commonsCookies= saveAsBasicClientCookie(responseCookies.iterator(), commonsCookies);
    }
    */
    if (commonsCookies.size() == 0) {
        BasicClientCookie sessionCookie = new BasicClientCookie("JSESSIONID",
                ((WebProcessor) processor).httpSession.getId());
        sessionCookie.setSecure(false);
        sessionCookie.setDomain(null);
        sessionCookie.setPath(null);

        commonsCookies.add(sessionCookie);

    }
    processor.setContextParam(AbstractHTTPConnector.REQUEST_COOKIE,
            commonsCookies.toArray(new BasicClientCookie[0]));
}

From source file:ca.uqac.info.trace.generation.PQTraceGenerator.java

@Override
public EventTrace generate() {
    EventTrace trace = new EventTrace();
    // We choose the number of messages to produce
    int n_messages = super.nextInt(m_maxMessages - m_minMessages) + m_minMessages;
    for (int i = 0; i < n_messages; i++) {
        Node n = trace.getNode();
        Vector<String> available_params = new Vector<String>();
        // We produce the list of available parameters for this message
        available_params.add("p");
        available_params.add("q");
        // We choose the number of param-value pairs to generate
        int arity = super.nextInt(m_maxArity - m_minArity) + m_minArity;
        for (int j = 0; j < arity; j++) {
            // We generate as many param-value pairs as required
            int index = super.nextInt(available_params.size());
            int value = super.nextInt(m_domainSize);
            if (m_minArity == 1 && m_maxArity == 1 && m_flatten) {
                // For traces of messages with fixed arity = 1, we
                // simply put the value as the text child of the "Event"
                // element
                n.appendChild(trace.createTextNode(new Integer(value).toString()));
            } else {
                Node el = trace.createElement(available_params.elementAt(index));
                el.appendChild(trace.createTextNode(new Integer(value).toString()));
                n.appendChild(el);//from  ww  w .  ja v  a 2  s  .c  om
            }
        }
        Event e = new Event(n);
        trace.add(e);
    }
    return trace;
}

From source file:net.nosleep.superanalyzer.analysis.views.QualityView.java

private void refreshDataset() {

    Stat itemStats = null;/*from   www  . ja v a2  s  .co m*/

    if (_comboBox == null) {
        itemStats = _analysis.getStats(Analysis.KIND_TRACK, null);
    } else {
        ComboItem item = (ComboItem) _comboBox.getSelectedItem();
        itemStats = _analysis.getStats(item.getKind(), item.getValue());
    }

    Vector counts = new Vector(5);
    int[] rates = itemStats.getBitRates();
    for (int i = 0; i < rates.length; i++)
        counts.addElement(new Double(rates[i]));

    Vector labels = new Vector(5);
    labels.add(new String(Misc.getString("POOR") + "\n(0-63 kbps)\n"));
    labels.add(new String(Misc.getString("LOW") + "\n(64-127 kbps)\n"));
    labels.add(new String(Misc.getString("GOOD") + "\n(128-191 kbps)\n"));
    labels.add(new String(Misc.getString("HIGH") + "\n(192-255 kbps)\n"));
    labels.add(new String(Misc.getString("EXCELLENT") + "\n(256-320 kbps)\n"));

    _dataset.clear();

    PiePlot3D plot = (PiePlot3D) _chart.getPlot();
    Color[] colors = Theme.getColorSet();
    plot.setIgnoreZeroValues(true);

    for (int i = 0; i < counts.size(); i++) {
        // if((Double)counts.elementAt(i) > 0)
        {
            _dataset.setValue((String) labels.elementAt(i), (Double) counts.elementAt(i));
            plot.setSectionPaint((String) labels.elementAt(i), colors[5 - i]);
        }

    }

}

From source file:com.github.hdl.tensorflow.yarn.app.TFContainer.java

public StringBuilder makeCommands(long containerMemory, String clusterSpec, String jobName, int taskIndex) {
    // Set the necessary command to execute on the allocated container
    Vector<CharSequence> vargs = new Vector<CharSequence>(5);
    vargs.add(ApplicationConstants.Environment.JAVA_HOME.$$() + "/bin/java");
    //vargs.add("-Xmx" + containerMemory + "m");
    vargs.add("-Xmx" + containerMemory + "m");
    String containerClassName = TFServerLauncher.class.getName();
    vargs.add(containerClassName);//from w ww  . j a  v a  2  s.  co m
    vargs.add("--" + TFServerLauncher.OPT_CS + " " + clusterSpec);
    vargs.add("--" + TFServerLauncher.OPT_JN + " " + jobName);
    vargs.add("--" + TFServerLauncher.OPT_TI + " " + taskIndex);
    vargs.add("1>" + ApplicationConstants.LOG_DIR_EXPANSION_VAR + "/TFServerLauncher."
            + ApplicationConstants.STDOUT);
    vargs.add("2>" + ApplicationConstants.LOG_DIR_EXPANSION_VAR + "/TFServerLauncher."
            + ApplicationConstants.STDERR);

    // Get final commmand
    StringBuilder command = new StringBuilder();
    for (CharSequence str : vargs) {
        command.append(str).append(" ");
    }

    return command;
}

From source file:com.ibm.xsp.xflow.activiti_rest.DominoGroupManager.java

@Override
public GroupEntity findGroupById(String groupId) {
    Vector<String> names = new Vector<String>();
    if (StringUtils.isNotEmpty(groupId)) {
        names.add(groupId);
    }// w  w w  .ja v a 2  s  . c o m
    List<Group> groups = findGroups(names, true);
    if (groups.size() == 1) {
        return (GroupEntity) groups.get(0);
    }
    return null;
}