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:RSAccounts.java

private void loadAccounts() {
    Vector v = new Vector();
    try {//from w ww.  j a v  a 2  s .co m
        rs = statement.executeQuery("SELECT * FROM acc_acc");

        while (rs.next()) {
            v.addElement(rs.getString("acc_id"));
        }
    } catch (SQLException e) {
        displaySQLErrors(e);
    }
    accountNumberList.setListData(v);
}

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

@FXML
private void onClickShowTrialBalance(ActionEvent event) {
    try {// w ww .java  2  s .  co m
        HttpResponse<JsonNode> res = Unirest.get(MetaData.baseUrl + "report/trialbalance/with/date")
                .queryString("start_date", this.start.getValue().toString())
                .queryString("end_date", this.end.getValue().toString()).asJson();
        JSONArray array = res.getBody().getArray();
        Vector v = new Vector();
        HashMap params = new HashMap();
        float total_dr = 0, total_cr = 0;
        for (int i = 1; i < array.length(); i++) {
            JSONObject obj = array.getJSONObject(i);
            String id = obj.get("id").toString();
            String name = obj.getString("name");
            String balance = String.format("%1$.2f", obj.getDouble("balance"));
            //String balance = String.valueOf(obj.getDouble("balance"));
            String dr, cr;
            if (Float.parseFloat(balance) < 0) {
                cr = balance;
                dr = "";
                total_cr += Float.parseFloat(cr);
            } else {
                dr = balance;
                total_dr += Float.parseFloat(dr);
                cr = "";
            }
            if (!dr.equals(""))
                dr = String.format("%1$.2f", Double.parseDouble(dr));
            if (!cr.equals(""))
                cr = String.format("%1$.2f", Double.parseDouble(cr));
            v.add(new TrialBalance(name, dr, cr));
        }

        Vector trialBalanceVector = getSortedTrialBalance(v, array);

        params.put("total_dr", String.format("%1$.2f", total_dr));
        params.put("total_cr", String.format("%1$.2f", total_cr * (-1)));
        Report report = new Report();
        report.getReport("src\\report\\trialBalance.jrxml", new JRBeanCollectionDataSource(trialBalanceVector),
                params, "Trial Balance");

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

From source file:com.miragedev.mononara.core.io.DictionnaryHandlerImpl.java

public DictionnaryHandlerImpl() {
    listeners = new Vector<DictionaryEntryAddedListener>();
    numberOfEntry = -1;
    entryNumber = 0;
}

From source file:org.openmrs.web.controller.concept.ConceptProposalListController.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 w  ww  .j  a v a 2s.  co  m
protected Object formBackingObject(HttpServletRequest request) throws ServletException {

    //default empty Object
    List<ConceptProposal> cpList = new Vector<ConceptProposal>();
    Map<String, List<ConceptProposal>> origText = new HashMap<String, List<ConceptProposal>>();

    //only fill the Object is the user has authenticated properly
    if (Context.isAuthenticated()) {
        ConceptService cs = Context.getConceptService();
        log.debug("tmp value: " + request.getParameter("includeCompleted"));
        boolean b = new Boolean(request.getParameter("includeCompleted"));
        log.debug("b value: " + b);
        cpList = cs.getAllConceptProposals(b);
    }

    // create map of distinct OriginalText->#occurences
    for (ConceptProposal cp : cpList) {
        List<ConceptProposal> matchingProposals = origText.get(cp.getOriginalText());
        if (matchingProposals == null) {
            matchingProposals = new Vector<ConceptProposal>();
        }
        matchingProposals.add(cp);
        origText.put(cp.getOriginalText(), matchingProposals);
    }

    boolean asc = new Boolean("asc".equals(request.getParameter("sortOrder")));
    String sortOn = request.getParameter("sortOn");
    if (sortOn == null) {
        sortOn = "occurences";
    }

    Map<List<ConceptProposal>, Integer> cpMap = new TreeMap<List<ConceptProposal>, Integer>();

    if (sortOn.equals("occurences")) {
        cpMap = new TreeMap<List<ConceptProposal>, Integer>(new CompareListSize(asc));
    } else {
        //if (sortOn.equals("text"))
        cpMap = new TreeMap<List<ConceptProposal>, Integer>(new CompareListText(asc));
    }

    // loop over that map to sort on size or text
    for (List<ConceptProposal> matchingProposals : origText.values()) {
        cpMap.put(matchingProposals, matchingProposals.size());
    }

    return cpMap;
}

From source file:edu.ku.brc.af.ui.weblink.WebLinkDef.java

/**
 * // w w w.  ja  va 2  s  .  c o  m
 */
public WebLinkDef(final String name, final String tableName) {
    this(name, tableName, null, null);
    this.args = new Vector<WebLinkDefArg>();
    this.usedByList = new Vector<WebLinkUsedBy>();
}

From source file:SelectionHandler.java

private void addToDestination(String item) {
    ListModel model = destination.getModel();
    Vector listData = new Vector();
    for (int i = 0; i < model.getSize(); i++) {
        listData.addElement(model.getElementAt(i));
    }//  w ww.  j av  a  2 s  . co m
    listData.addElement(item);
    destination.setListData(listData);
}

From source file:com.integryst.kdbrowser.objects.SearchHelper.java

private Vector getResults(HttpServletRequest httpRequest) {
    Vector files = new Vector();
    int tempObjectId;

    //search for users and groups that match this query
    IPTSearchRequest request = m_session.getSession().GetSearchRequest();

    //turn off requests for collab/content apps
    request.SetSettings(PT_SEARCH_SETTING.PT_SEARCHSETTING_APPS, PT_SEARCH_APPS.PT_SEARCH_APPS_PORTAL);

    // restrict to folders?
    if ((options == SEARCHOPTION.CURRENT_FOLDER_AND_SUBS) || (options == SEARCHOPTION.CURRENT_FOLDER_ONLY))
        request.SetSettings(PT_SEARCH_SETTING.PT_SEARCHSETTING_DDFOLDERS, new int[] { folderId });

    // include subfolders?    
    if (options == SEARCHOPTION.CURRENT_FOLDER_AND_SUBS)
        request.SetSettings(PT_SEARCH_SETTING.PT_SEARCHSETTING_INCLUDE_SUBFOLDERS, true);
    else//from  w ww .j ava  2  s .c o  m
        request.SetSettings(PT_SEARCH_SETTING.PT_SEARCHSETTING_INCLUDE_SUBFOLDERS, false);

    // Start index
    request.SetSettings(PT_SEARCH_SETTING.PT_SEARCHSETTING_SKIPRESULTS, start_index);

    // limit results
    request.SetSettings(PT_SEARCH_SETTING.PT_SEARCHSETTING_MAXRESULTS, limit);

    // Restrict the search to documents
    request.SetSettings(PT_SEARCH_SETTING.PT_SEARCHSETTING_OBJTYPES,
            new int[] { PT_CLASSIDS.PT_CATALOGCARD_ID });

    // make sure the appropriate fields are returned.
    request.SetSettings(PT_SEARCH_SETTING.PT_SEARCHSETTING_RET_PROPS,
            new int[] { PT_INTRINSICS.PT_PROPERTY_OBJECTID });

    // sort by the name
    request.SetSettings(PT_SEARCH_SETTING.PT_SEARCHSETTING_ORDERBY, PT_INTRINSICS.PT_PROPERTY_OBJECTNAME);
    IPTSearchQuery query = request.CreateBasicQuery(searchText, null);

    IPTSearchResponse res = request.Search(query);

    for (int i = 0; i < res.GetResultsReturned(); i++) {
        int matches = res.GetTotalMatches();
        int skipped = res.GetSkipped();
        tempObjectId = res.GetFieldsAsInt(i, PT_INTRINSICS.PT_PROPERTY_OBJECTID);
        File tempFile = new File(m_session, tempObjectId);
        tempFile.loadProperties(httpRequest);
        files.add(tempFile);
    }
    return files;
}

From source file:com.thinkbiganalytics.util.PartitionSpec.java

/**
 * Creates partition keys from a string specification in format: field|type|formula\n
 * format, e.g./* ww w  . j  av a 2s .  c  om*/
 * year|string|year(hired)
 * month|int|month(hired)
 * country|int|country
 **/
public PartitionSpec(String spec) {
    super();
    keys = new Vector<>();
    if (!StringUtils.isEmpty(spec)) {
        try (BufferedReader br = new BufferedReader(new StringReader(spec))) {

            String line = null;
            while ((line = br.readLine()) != null) {
                PartitionKey partitionKey = PartitionKey.createFromString(line);
                if (partitionKey != null) {
                    keys.add(partitionKey);
                }
            }

        } catch (IOException e) {
            throw new RuntimeException("Failed to process specification [" + spec + "]");
        }
    }
}

From source file:com.miragedev.mononara.core.io.KanjiHandlerImpl.java

public KanjiHandlerImpl() {
    listeners = new Vector<KanjiAddedListener>();
    numberOfEntry = -1;
    entryNumber = 0;
}

From source file:BlockingQueue.java

/**
 * Creates a new, empty BlockingQueue.
 */

public BlockingQueue() {
    queue = new Vector();
}