Example usage for java.util SortedMap size

List of usage examples for java.util SortedMap size

Introduction

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

Prototype

int size();

Source Link

Document

Returns the number of key-value mappings in this map.

Usage

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamTagTable.java

public CFAccTagBuff[] readDerivedByTenantIdx(CFAccAuthorization Authorization, long TenantId) {
    final String S_ProcName = "CFAccRamTag.readDerivedByTenantIdx() ";
    CFAccTagByTenantIdxKey key = schema.getFactoryTag().newTenantIdxKey();
    key.setRequiredTenantId(TenantId);/*  ww  w.  java2  s.  c  o  m*/

    CFAccTagBuff[] recArray;
    if (dictByTenantIdx.containsKey(key)) {
        SortedMap<CFAccTagPKey, CFAccTagBuff> subdictTenantIdx = dictByTenantIdx.get(key);
        recArray = new CFAccTagBuff[subdictTenantIdx.size()];
        Iterator<CFAccTagBuff> iter = subdictTenantIdx.values().iterator();
        int idx = 0;
        while (iter.hasNext()) {
            recArray[idx++] = iter.next();
        }
    } else {
        recArray = new CFAccTagBuff[0];
    }
    return (recArray);
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccXMsgClient.CFAccXMsgClientTSecGroupTable.java

public CFAccTSecGroupBuff[] readAllDerived(CFAccAuthorization Authorization) {
    final String S_ProcName = "readAllDerived";
    String rqst = CFAccXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t"
            + CFAccXMsgTSecGroupMessageFormatter.formatTSecGroupRqstReadAll("\n\t\t\t") + "\n"
            + CFAccXMsgSchemaMessageFormatter.formatRqstXmlPostamble();
    String rspn = schema.sendReceive(Authorization, rqst);
    if ((rspn == null) || (rspn.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "rspn");
    }// w  ww  . j  a  v a2  s. c  o  m
    CFAccXMsgRspnHandler responseHandler = schema.getResponseHandler();
    responseHandler.parseStringContents(rspn);
    CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised();
    if (exceptionRaised != null) {
        throw exceptionRaised;
    }
    Object sortedMapObj = responseHandler.getSortedMapOfObjects();
    if (sortedMapObj == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                "responseHandler.getSortedMapOfObjects");
    }
    SortedMap<CFAccTSecGroupPKey, ICFAccTSecGroupObj> sortedMap = (SortedMap<CFAccTSecGroupPKey, ICFAccTSecGroupObj>) sortedMapObj;
    int sz = sortedMap.size();
    CFAccTSecGroupBuff arr[] = new CFAccTSecGroupBuff[sz];
    Iterator<ICFAccTSecGroupObj> iter = sortedMap.values().iterator();
    ICFAccTSecGroupObj cur;
    for (int idx = 0; idx < sz; idx++) {
        cur = (ICFAccTSecGroupObj) iter.next();
        arr[idx] = cur.getTSecGroupBuff();
    }
    return (arr);
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccXMsgClient.CFAccXMsgClientTSecGroupTable.java

public CFAccTSecGroupBuff[] readDerivedByTenantIdx(CFAccAuthorization Authorization, long argTenantId) {
    final String S_ProcName = "readDerivedByTenantIdx";
    String rqst = CFAccXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t"
            + CFAccXMsgTSecGroupMessageFormatter.formatTSecGroupRqstReadByTenantIdx("\n\t\t\t", argTenantId)
            + "\n" + CFAccXMsgSchemaMessageFormatter.formatRqstXmlPostamble();
    String rspn = schema.sendReceive(Authorization, rqst);
    if ((rspn == null) || (rspn.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "rspn");
    }/* w  w w.  ja  va2  s. com*/
    CFAccXMsgRspnHandler responseHandler = schema.getResponseHandler();
    responseHandler.parseStringContents(rspn);
    CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised();
    if (exceptionRaised != null) {
        throw exceptionRaised;
    }
    Object sortedMapObj = responseHandler.getSortedMapOfObjects();
    if (sortedMapObj == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                "responseHandler.getSortedMapOfObjects");
    }
    SortedMap<CFAccTSecGroupPKey, ICFAccTSecGroupObj> sortedMap = (SortedMap<CFAccTSecGroupPKey, ICFAccTSecGroupObj>) sortedMapObj;
    int sz = sortedMap.size();
    CFAccTSecGroupBuff arr[] = new CFAccTSecGroupBuff[sz];
    Iterator<ICFAccTSecGroupObj> iter = sortedMap.values().iterator();
    ICFAccTSecGroupObj cur;
    for (int idx = 0; idx < sz; idx++) {
        cur = (ICFAccTSecGroupObj) iter.next();
        arr[idx] = cur.getTSecGroupBuff();
    }
    return (arr);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstXMsgClient.CFAstXMsgClientTSecGroupTable.java

public CFAstTSecGroupBuff[] readAllDerived(CFAstAuthorization Authorization) {
    final String S_ProcName = "readAllDerived";
    String rqst = CFAstXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t"
            + CFAstXMsgTSecGroupMessageFormatter.formatTSecGroupRqstReadAll("\n\t\t\t") + "\n"
            + CFAstXMsgSchemaMessageFormatter.formatRqstXmlPostamble();
    String rspn = schema.sendReceive(Authorization, rqst);
    if ((rspn == null) || (rspn.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "rspn");
    }/*from  w w  w  . j  a  va 2 s.  com*/
    CFAstXMsgRspnHandler responseHandler = schema.getResponseHandler();
    responseHandler.parseStringContents(rspn);
    CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised();
    if (exceptionRaised != null) {
        throw exceptionRaised;
    }
    Object sortedMapObj = responseHandler.getSortedMapOfObjects();
    if (sortedMapObj == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                "responseHandler.getSortedMapOfObjects");
    }
    SortedMap<CFAstTSecGroupPKey, ICFAstTSecGroupObj> sortedMap = (SortedMap<CFAstTSecGroupPKey, ICFAstTSecGroupObj>) sortedMapObj;
    int sz = sortedMap.size();
    CFAstTSecGroupBuff arr[] = new CFAstTSecGroupBuff[sz];
    Iterator<ICFAstTSecGroupObj> iter = sortedMap.values().iterator();
    ICFAstTSecGroupObj cur;
    for (int idx = 0; idx < sz; idx++) {
        cur = (ICFAstTSecGroupObj) iter.next();
        arr[idx] = cur.getTSecGroupBuff();
    }
    return (arr);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstXMsgClient.CFAstXMsgClientTSecGroupTable.java

public CFAstTSecGroupBuff[] readDerivedByTenantIdx(CFAstAuthorization Authorization, long argTenantId) {
    final String S_ProcName = "readDerivedByTenantIdx";
    String rqst = CFAstXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t"
            + CFAstXMsgTSecGroupMessageFormatter.formatTSecGroupRqstReadByTenantIdx("\n\t\t\t", argTenantId)
            + "\n" + CFAstXMsgSchemaMessageFormatter.formatRqstXmlPostamble();
    String rspn = schema.sendReceive(Authorization, rqst);
    if ((rspn == null) || (rspn.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "rspn");
    }/*  w  ww .  ja  va 2 s.  co  m*/
    CFAstXMsgRspnHandler responseHandler = schema.getResponseHandler();
    responseHandler.parseStringContents(rspn);
    CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised();
    if (exceptionRaised != null) {
        throw exceptionRaised;
    }
    Object sortedMapObj = responseHandler.getSortedMapOfObjects();
    if (sortedMapObj == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                "responseHandler.getSortedMapOfObjects");
    }
    SortedMap<CFAstTSecGroupPKey, ICFAstTSecGroupObj> sortedMap = (SortedMap<CFAstTSecGroupPKey, ICFAstTSecGroupObj>) sortedMapObj;
    int sz = sortedMap.size();
    CFAstTSecGroupBuff arr[] = new CFAstTSecGroupBuff[sz];
    Iterator<ICFAstTSecGroupObj> iter = sortedMap.values().iterator();
    ICFAstTSecGroupObj cur;
    for (int idx = 0; idx < sz; idx++) {
        cur = (ICFAstTSecGroupObj) iter.next();
        arr[idx] = cur.getTSecGroupBuff();
    }
    return (arr);
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamDomainBaseTable.java

public CFAccDomainBaseBuff[] readDerivedByTenantIdx(CFAccAuthorization Authorization, long TenantId) {
    final String S_ProcName = "CFAccRamDomainBase.readDerivedByTenantIdx() ";
    CFAccDomainBaseByTenantIdxKey key = schema.getFactoryDomainBase().newTenantIdxKey();
    key.setRequiredTenantId(TenantId);//ww  w.  j a v  a2 s. c  o  m

    CFAccDomainBaseBuff[] recArray;
    if (dictByTenantIdx.containsKey(key)) {
        SortedMap<CFAccDomainBasePKey, CFAccDomainBaseBuff> subdictTenantIdx = dictByTenantIdx.get(key);
        recArray = new CFAccDomainBaseBuff[subdictTenantIdx.size()];
        Iterator<CFAccDomainBaseBuff> iter = subdictTenantIdx.values().iterator();
        int idx = 0;
        while (iter.hasNext()) {
            recArray[idx++] = iter.next();
        }
    } else {
        recArray = new CFAccDomainBaseBuff[0];
    }
    return (recArray);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstRam.CFAstRamDomainBaseTable.java

public CFAstDomainBaseBuff[] readDerivedByTenantIdx(CFAstAuthorization Authorization, long TenantId) {
    final String S_ProcName = "CFAstRamDomainBase.readDerivedByTenantIdx() ";
    CFAstDomainBaseByTenantIdxKey key = schema.getFactoryDomainBase().newTenantIdxKey();
    key.setRequiredTenantId(TenantId);// w  w  w.  j  a va2  s . co m

    CFAstDomainBaseBuff[] recArray;
    if (dictByTenantIdx.containsKey(key)) {
        SortedMap<CFAstDomainBasePKey, CFAstDomainBaseBuff> subdictTenantIdx = dictByTenantIdx.get(key);
        recArray = new CFAstDomainBaseBuff[subdictTenantIdx.size()];
        Iterator<CFAstDomainBaseBuff> iter = subdictTenantIdx.values().iterator();
        int idx = 0;
        while (iter.hasNext()) {
            recArray[idx++] = iter.next();
        }
    } else {
        recArray = new CFAstDomainBaseBuff[0];
    }
    return (recArray);
}

From source file:org.jets3t.service.utils.RestUtils.java

/**
 * Calculate the canonical string for a REST/HTTP request to a storage service.
 *
 * When expires is non-null, it will be used instead of the Date header.
 * @throws UnsupportedEncodingException//from w  w w .  ja  v  a 2 s  .  c  om
 */
public static String makeServiceCanonicalString(String method, String resource, Map<String, Object> headersMap,
        String expires, String headerPrefix, List<String> serviceResourceParameterNames)
        throws UnsupportedEncodingException {
    StringBuilder canonicalStringBuf = new StringBuilder();
    canonicalStringBuf.append(method).append("\n");

    // Add all interesting headers to a list, then sort them.  "Interesting"
    // is defined as Content-MD5, Content-Type, Date, and x-amz-
    SortedMap<String, Object> interestingHeaders = new TreeMap<String, Object>();
    if (headersMap != null && headersMap.size() > 0) {
        for (Map.Entry<String, Object> entry : headersMap.entrySet()) {
            Object key = entry.getKey();
            Object value = entry.getValue();

            if (key == null) {
                continue;
            }
            String lk = key.toString().toLowerCase(Locale.getDefault());

            // Ignore any headers that are not particularly interesting.
            if (lk.equals("content-type") || lk.equals("content-md5") || lk.equals("date")
                    || lk.startsWith(headerPrefix)) {
                interestingHeaders.put(lk, value);
            }
        }
    }

    // Remove default date timestamp if "x-amz-date" or "x-goog-date" is set.
    if (interestingHeaders.containsKey(Constants.REST_METADATA_ALTERNATE_DATE_AMZ)
            || interestingHeaders.containsKey(Constants.REST_METADATA_ALTERNATE_DATE_GOOG)) {
        interestingHeaders.put("date", "");
    }

    // Use the expires value as the timestamp if it is available. This trumps both the default
    // "date" timestamp, and the "x-amz-date" header.
    if (expires != null) {
        interestingHeaders.put("date", expires);
    }

    // these headers require that we still put a new line in after them,
    // even if they don't exist.
    if (!interestingHeaders.containsKey("content-type")) {
        interestingHeaders.put("content-type", "");
    }
    if (!interestingHeaders.containsKey("content-md5")) {
        interestingHeaders.put("content-md5", "");
    }

    // Finally, add all the interesting headers (i.e.: all that start with x-amz- ;-))
    for (Map.Entry<String, Object> entry : interestingHeaders.entrySet()) {
        String key = entry.getKey();
        Object value = entry.getValue();

        if (key.startsWith(headerPrefix)) {
            canonicalStringBuf.append(key).append(':').append(value);
        } else {
            canonicalStringBuf.append(value);
        }
        canonicalStringBuf.append("\n");
    }

    // don't include the query parameters...
    int queryIndex = resource.indexOf('?');
    if (queryIndex == -1) {
        canonicalStringBuf.append(resource);
    } else {
        canonicalStringBuf.append(resource.substring(0, queryIndex));
    }

    // ...unless the parameter(s) are in the set of special params
    // that actually identify a service resource.
    if (queryIndex >= 0) {
        SortedMap<String, String> sortedResourceParams = new TreeMap<String, String>();

        // Parse parameters from resource string
        String query = resource.substring(queryIndex + 1);
        for (String paramPair : query.split("&")) {
            String[] paramNameValue = paramPair.split("=");
            String name = URLDecoder.decode(paramNameValue[0], "UTF-8");
            String value = null;
            if (paramNameValue.length > 1) {
                value = URLDecoder.decode(paramNameValue[1], "UTF-8");
            }
            // Only include parameter (and its value if present) in canonical
            // string if it is a resource-identifying parameter
            if (serviceResourceParameterNames.contains(name)) {
                sortedResourceParams.put(name, value);
            }
        }

        // Add resource parameters
        if (sortedResourceParams.size() > 0) {
            canonicalStringBuf.append("?");
        }
        boolean addedParam = false;
        for (Map.Entry<String, String> entry : sortedResourceParams.entrySet()) {
            if (addedParam) {
                canonicalStringBuf.append("&");
            }
            canonicalStringBuf.append(entry.getKey());
            if (entry.getValue() != null) {
                canonicalStringBuf.append("=").append(entry.getValue());
            }
            addedParam = true;
        }
    }

    return canonicalStringBuf.toString();
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccXMsgClient.CFAccXMsgClientURLProtocolTable.java

public CFAccURLProtocolBuff[] readAllDerived(CFAccAuthorization Authorization) {
    final String S_ProcName = "readAllDerived";
    String rqst = CFAccXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t"
            + CFAccXMsgURLProtocolMessageFormatter.formatURLProtocolRqstReadAll("\n\t\t\t") + "\n"
            + CFAccXMsgSchemaMessageFormatter.formatRqstXmlPostamble();
    String rspn = schema.sendReceive(Authorization, rqst);
    if ((rspn == null) || (rspn.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "rspn");
    }/*from  w  ww . j  ava 2s.  c om*/
    CFAccXMsgRspnHandler responseHandler = schema.getResponseHandler();
    responseHandler.parseStringContents(rspn);
    CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised();
    if (exceptionRaised != null) {
        throw exceptionRaised;
    }
    Object sortedMapObj = responseHandler.getSortedMapOfObjects();
    if (sortedMapObj == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                "responseHandler.getSortedMapOfObjects");
    }
    SortedMap<CFAccURLProtocolPKey, ICFAccURLProtocolObj> sortedMap = (SortedMap<CFAccURLProtocolPKey, ICFAccURLProtocolObj>) sortedMapObj;
    int sz = sortedMap.size();
    CFAccURLProtocolBuff arr[] = new CFAccURLProtocolBuff[sz];
    Iterator<ICFAccURLProtocolObj> iter = sortedMap.values().iterator();
    ICFAccURLProtocolObj cur;
    for (int idx = 0; idx < sz; idx++) {
        cur = (ICFAccURLProtocolObj) iter.next();
        arr[idx] = cur.getURLProtocolBuff();
    }
    return (arr);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstXMsgClient.CFAstXMsgClientURLProtocolTable.java

public CFAstURLProtocolBuff[] readAllDerived(CFAstAuthorization Authorization) {
    final String S_ProcName = "readAllDerived";
    String rqst = CFAstXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t"
            + CFAstXMsgURLProtocolMessageFormatter.formatURLProtocolRqstReadAll("\n\t\t\t") + "\n"
            + CFAstXMsgSchemaMessageFormatter.formatRqstXmlPostamble();
    String rspn = schema.sendReceive(Authorization, rqst);
    if ((rspn == null) || (rspn.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "rspn");
    }// w  ww . j  a va  2  s.com
    CFAstXMsgRspnHandler responseHandler = schema.getResponseHandler();
    responseHandler.parseStringContents(rspn);
    CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised();
    if (exceptionRaised != null) {
        throw exceptionRaised;
    }
    Object sortedMapObj = responseHandler.getSortedMapOfObjects();
    if (sortedMapObj == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                "responseHandler.getSortedMapOfObjects");
    }
    SortedMap<CFAstURLProtocolPKey, ICFAstURLProtocolObj> sortedMap = (SortedMap<CFAstURLProtocolPKey, ICFAstURLProtocolObj>) sortedMapObj;
    int sz = sortedMap.size();
    CFAstURLProtocolBuff arr[] = new CFAstURLProtocolBuff[sz];
    Iterator<ICFAstURLProtocolObj> iter = sortedMap.values().iterator();
    ICFAstURLProtocolObj cur;
    for (int idx = 0; idx < sz; idx++) {
        cur = (ICFAstURLProtocolObj) iter.next();
        arr[idx] = cur.getURLProtocolBuff();
    }
    return (arr);
}