Example usage for org.apache.commons.lang3.text StrTokenizer size

List of usage examples for org.apache.commons.lang3.text StrTokenizer size

Introduction

In this page you can find the example usage for org.apache.commons.lang3.text StrTokenizer size.

Prototype

public int size() 

Source Link

Document

Gets the number of tokens found in the String.

Usage

From source file:edu.lternet.pasta.portal.PastaStatistics.java

/**
 * Iterates through the list of scopes and identifiers of site contributed
 * data packages to calculate the total number of site contributed data
 * packages in PASTA./*from  ww  w  .ja va  2s .c  o m*/
 * 
 * @return The number of site contributed data packages.
 */
public Integer getNumDataPackagesSites() {

    Integer numDataPackages = 0;
    String[] scopeList = { "knb-lter-and", "knb-lter-arc", "knb-lter-bes", "knb-lter-bnz", "knb-lter-cce",
            "knb-lter-cdr", "knb-lter-cap", "knb-lter-cwt", "knb-lter-fce", "knb-lter-gce", "knb-lter-hfr",
            "knb-lter-hbr", "knb-lter-jrn", "knb-lter-kbs", "knb-lter-knz", "knb-lter-luq", "knb-lter-mcm",
            "knb-lter-mcr", "knb-lter-nin", "knb-lter-nwt", "knb-lter-ntl", "knb-lter-pal", "knb-lter-pie",
            "knb-lter-sbc", "knb-lter-sev", "knb-lter-sgs", "knb-lter-vcr" };

    for (String scope : scopeList) {

        String idList = null;

        try {
            idList = this.dpmClient.listDataPackageIdentifiers(scope);
        } catch (Exception e) {
            logger.error("PastaStatistics: " + e.getMessage());
            e.printStackTrace();
        }

        StrTokenizer identifiers = new StrTokenizer(idList);

        numDataPackages += identifiers.size();

    }

    return numDataPackages;

}

From source file:edu.lternet.pasta.portal.PastaStatistics.java

/**
 * Iterates through the list of scopes and identifiers to calculate
 * the number of data packages in PASTA.
 * /*w  w  w .j a  va2s  . c om*/
 * @return The number of data packages.
 */
public Integer getNumDataPackages() {

    Integer numDataPackages = 0;
    String scopeList = null;

    try {
        scopeList = this.dpmClient.listDataPackageScopes();
    } catch (Exception e) {
        logger.error("PastaStatistics: " + e.getMessage());
        e.printStackTrace();
    }

    StrTokenizer scopes = new StrTokenizer(scopeList);

    while (scopes.hasNext()) {
        String scope = scopes.nextToken();

        String idList = null;

        try {
            idList = this.dpmClient.listDataPackageIdentifiers(scope);
        } catch (Exception e) {
            logger.error("PastaStatistics: " + e.getMessage());
            e.printStackTrace();
        }

        StrTokenizer identifiers = new StrTokenizer(idList);

        numDataPackages += identifiers.size();

    }

    return numDataPackages;

}