Example usage for java.util Vector Vector

List of usage examples for java.util Vector Vector

Introduction

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

Prototype

public Vector() 

Source Link

Document

Constructs an empty vector so that its internal data array has size 10 and its standard capacity increment is zero.

Usage

From source file:com.redhat.rhn.frontend.servlets.test.CreateRedirectURITest.java

/**
 *
 *///from   w  w w.  j  ava  2  s .co m
public final void testExecuteWhenRequestHasNoParams() throws Exception {
    mockRequest.stubs().method("getParameterNames").will(returnValue(new Vector<String>().elements()));

    CreateRedirectURI command = new CreateRedirectURI();
    String redirectUrl = command.execute(getMockRequest());

    assertEquals("/YourRhn.do?", redirectUrl);
}

From source file:gsn.http.A3DWebServiceImpl.java

public String[] getSensors() {
    Iterator<VSensorConfig> vsIterator = Mappings.getAllVSensorConfigs();

    Vector<String> sensors = new Vector<String>();

    while (vsIterator.hasNext()) {
        VSensorConfig sensorConfig = vsIterator.next();
        sensors.add(sensorConfig.getName());
    }/* ww  w . ja  v a 2s. c  o m*/
    String v_sensors[] = new String[sensors.size()];
    for (int i = 0; i < sensors.size(); i++)
        v_sensors[i] = sensors.get(i);

    return v_sensors;
}

From source file:it.eng.spagobi.studio.console.model.bo.LayoutManagerConfig.java

/**
 * @return the columnWidths/*from   w  w  w . ja  v a2 s.  co  m*/
 */
public Vector<String> getColumnWidths() {
    if (columnWidths == null)
        columnWidths = new Vector<String>();

    return columnWidths;
}

From source file:account.management.controller.ReceiptPaymentController.java

@FXML
private void onShowButtonClick(ActionEvent event) throws ParseException {
    String start = this.start.getValue().toString();
    String end = this.end.getValue().toString();

    try {/* w w  w .j  av  a2 s .c  o  m*/
        JSONObject res = Unirest.get(MetaData.baseUrl + "report/financial/statement/with/date")
                .queryString("start_date", start).queryString("end_date", end).asJson().getBody().getObject();

        Report report = new Report();
        Vector v = new Vector();
        HashMap params = new HashMap();
        params.put("title1", "Financial Statement for the period ended "
                + new SimpleDateFormat("dd-MM-yyyy").format(new SimpleDateFormat("yyyy-MM-dd").parse(end)));
        params.put("title2", "Receipt And Payment Account From "
                + new SimpleDateFormat("dd-MM-yyyy").format(new SimpleDateFormat("yyyy-MM-dd").parse(start))
                + " to "
                + new SimpleDateFormat("dd-MM-yyyy").format(new SimpleDateFormat("yyyy-MM-dd").parse(end)));
        params.put("receipt_from_trade_debtors",
                String.valueOf(Double.parseDouble(res.getString("receipts_from_trade_debtors"))));
        params.put("other_income", String.valueOf(Double.parseDouble(res.getString("other_income"))));
        params.put("total_receipts",
                String.valueOf(Double.parseDouble(res.getString("receipts_from_trade_debtors"))
                        + Double.parseDouble(res.getString("other_income"))));

        JSONArray array = res.getJSONArray("payments");
        int len = array.length();
        double total_payments = 0;
        for (int i = 0; i < len; i++) {
            JSONObject obj = array.getJSONObject(i);
            v.add(new ReceiptPaymentData(obj.getString("name"), "", String.valueOf(obj.getDouble("balance"))));
            total_payments += obj.getDouble("balance");
        }
        params.put("total_payments", String.valueOf(total_payments));
        params.put("excess_of_payments",
                String.valueOf(Double.parseDouble((String) params.get("total_receipts")) - total_payments));
        params.put("cash_in_hand_opening_title", "Cash in hand at "
                + new SimpleDateFormat("dd-MM-yyyy").format(new SimpleDateFormat("yyyy-MM-dd").parse(start)));
        params.put("cash_at_bank_opening_title", "Cash at bank at "
                + new SimpleDateFormat("dd-MM-yyyy").format(new SimpleDateFormat("yyyy-MM-dd").parse(start)));
        params.put("cash_in_hand_closing_title", "Cash in hand at "
                + new SimpleDateFormat("dd-MM-yyyy").format(new SimpleDateFormat("yyyy-MM-dd").parse(end)));
        params.put("cash_at_bank_closing_title", "Cash at bank at "
                + new SimpleDateFormat("dd-MM-yyyy").format(new SimpleDateFormat("yyyy-MM-dd").parse(end)));
        params.put("cash_in_hand_opening", res.getString("cash_in_hand_opening"));
        params.put("cash_at_bank_opening", res.getString("cash_at_bank_opening"));
        params.put("cash_in_hand_closing",
                String.valueOf(Double.parseDouble(res.getString("cash_in_hand_closing"))));
        params.put("cash_at_bank_closing",
                String.valueOf(Double.parseDouble(res.getString("cash_at_bank_closing"))));
        params.put("total",
                String.valueOf(Double.parseDouble((String) params.get("excess_of_payments"))
                        + Double.parseDouble(res.getString("cash_in_hand_opening"))
                        + Double.parseDouble(res.getString("cash_at_bank_opening"))));

        report.getReport("src\\report\\ReceiptPayments.jrxml", new JRBeanCollectionDataSource(v), params,
                "Receipt Payment");

    } catch (UnirestException ex) {
        Logger.getLogger(ReceiptPaymentController.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:com.intel.xdk.geolocation.Geolocation.java

@Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
    super.initialize(cordova, webView);

    //get convenience reference to activity
    activity = cordova.getActivity();/*  w w w .j  a v  a  2 s. c om*/

    locMan = (LocationManager) activity.getSystemService(Context.LOCATION_SERVICE);
    listeners = new Vector<MobiLocationListener>();
}

From source file:org.openmrs.web.controller.program.ProgramListController.java

/**
 * This is called prior to displaying a form for the first time. It tells Spring the
 * form/command object to load into the request
 *
 * @see org.springframework.web.servlet.mvc.AbstractFormController#formBackingObject(javax.servlet.http.HttpServletRequest)
 *///from   www .  j a  va  2  s.  co  m
protected Object formBackingObject(HttpServletRequest request) throws ServletException {

    //default empty Object
    List<Program> programList = new Vector<Program>();

    //only fill the Object if the user has authenticated properly
    if (Context.isAuthenticated()) {
        ProgramWorkflowService ps = Context.getProgramWorkflowService();
        programList = ps.getAllPrograms();
    }

    return programList;
}

From source file:Main.java

public static void cleanText(Node node) {
    try {/*from  w w  w.  j ava  2  s . c  o m*/
        NodeList childNodes = node.getChildNodes();
        int noChildren = childNodes.getLength();
        Node n = null;
        short type = 0;
        Vector rem = new Vector();
        for (int i = 0; i < noChildren; i++) {
            n = childNodes.item(i);
            type = n.getNodeType();
            if (type == Node.TEXT_NODE) {
                rem.add(n);
            } else if (type == Node.ELEMENT_NODE) {
                cleanText(n);
            }
        }
        for (int i = 0; i < rem.size(); i++) {
            node.removeChild((Node) rem.get(i));
        }
    } catch (Exception e) {
        //DebugUtil.debug(e);
    }
}

From source file:edu.caltechUcla.sselCassel.projects.jMarkets.server.network.ConnectionMonitor.java

/** Creates a new instance of ConnectionMonitor */
public ConnectionMonitor(Controller controlServ, Updater updateServ, Monitor monitorServ) {
    this.controlServ = controlServ;
    this.updateServ = updateServ;
    this.monitorServ = monitorServ;

    alreadyDisconnected = new Vector();
}

From source file:edu.ku.brc.specify.conversion.TableDataChecker.java

/**
 * @param tableName//  ww  w.  jav  a 2s.co  m
 * @param skipNames
 * @return
 */
public List<Pair<String, String>> getColumnNamesWithData(final String tableName,
        final HashSet<String> skipNames) {
    List<Pair<String, String>> fieldsWithData = new Vector<Pair<String, String>>();

    int numRows = BasicSQLUtils.getNumRecords(connection, tableName);
    if (numRows > 0) {
        try {
            Vector<Object[]> rows = BasicSQLUtils.query(connection, String.format(
                    "SELECT COLUMN_NAME, DATA_TYPE, IS_NULLABLE, COLUMN_DEFAULT FROM INFORMATION_SCHEMA.COLUMNS "
                            + "WHERE table_name = '%s' AND table_schema = '%s'",
                    tableName, connection.getCatalog()));

            for (Object[] cols : rows) {
                String fieldName = cols[0].toString();

                if ((skipNames == null || !skipNames.contains(fieldName.toLowerCase()))) {
                    if (cols[2].equals("YES")) {
                        String sql = String.format("SELECT COUNT(*) FROM `%s` WHERE `%s` IS NOT NULL",
                                tableName, fieldName);
                        int cnt = BasicSQLUtils.getCountAsInt(connection, sql);
                        if (cnt > 0) {
                            sql = String.format(
                                    "SELECT DISTINCT c.caption, fst.TextForValue from usysmetacontrol c INNER JOIN usysmetaobject o on o.objectid = c.objectid "
                                            + "INNER JOIN usysmetafieldset fs on fs.fieldsetid = o.fieldsetid LEFT JOIN usysmetafieldsetsubtype fst on fst.fieldsetsubtypeid = c.fieldsetsubtypeid "
                                            + "WHERE fs.fieldsetname = '%s' and o.objectname = '%s' and (fst.TextForValue is null or (fst.TextForValue not in('TissueOrExtract', 'KaryoSlide', 'HistoSlideSeries', 'Image', 'Sound', 'SoundRecording', 'ImagePrint', 'Spectrogram', 'Container')))",
                                    tableName, fieldName);

                            Pair<String, String> namePair = new Pair<String, String>();
                            Vector<Object[]> captions = BasicSQLUtils.query(connection, sql);
                            if (captions.size() > 0) {
                                namePair.second = (String) captions.get(0)[0];
                            }
                            namePair.first = fieldName;
                            fieldsWithData.add(namePair);
                        }
                    }
                }
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
    return fieldsWithData;
}

From source file:MovieBot.java

public MovieBot(String... args) {
    super();//from  w w w  . jav a  2 s .com

    this.mode = Mode.Normal;
    this.contributor = new Vector<String>();
    this.movies = new Vector<Movie>();
    this.run(args[0], args[1]);
}