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.CFAccRamServiceTable.java

public CFAccServiceBuff[] readDerivedByClusterIdx(CFAccAuthorization Authorization, long ClusterId) {
    final String S_ProcName = "CFAccRamService.readDerivedByClusterIdx() ";
    CFAccServiceByClusterIdxKey key = schema.getFactoryService().newClusterIdxKey();
    key.setRequiredClusterId(ClusterId);

    CFAccServiceBuff[] recArray;/*from ww  w.ja  v a2 s . co  m*/
    if (dictByClusterIdx.containsKey(key)) {
        SortedMap<CFAccServicePKey, CFAccServiceBuff> subdictClusterIdx = dictByClusterIdx.get(key);
        recArray = new CFAccServiceBuff[subdictClusterIdx.size()];
        Iterator<CFAccServiceBuff> iter = subdictClusterIdx.values().iterator();
        int idx = 0;
        while (iter.hasNext()) {
            recArray[idx++] = iter.next();
        }
    } else {
        recArray = new CFAccServiceBuff[0];
    }
    return (recArray);
}

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

public CFAstServiceBuff[] readDerivedByClusterIdx(CFAstAuthorization Authorization, long ClusterId) {
    final String S_ProcName = "CFAstRamService.readDerivedByClusterIdx() ";
    CFAstServiceByClusterIdxKey key = schema.getFactoryService().newClusterIdxKey();
    key.setRequiredClusterId(ClusterId);

    CFAstServiceBuff[] recArray;/*from  w w  w  . j a  va  2  s. c om*/
    if (dictByClusterIdx.containsKey(key)) {
        SortedMap<CFAstServicePKey, CFAstServiceBuff> subdictClusterIdx = dictByClusterIdx.get(key);
        recArray = new CFAstServiceBuff[subdictClusterIdx.size()];
        Iterator<CFAstServiceBuff> iter = subdictClusterIdx.values().iterator();
        int idx = 0;
        while (iter.hasNext()) {
            recArray[idx++] = iter.next();
        }
    } else {
        recArray = new CFAstServiceBuff[0];
    }
    return (recArray);
}

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

public CFAstConfigurationFileBuff[] readDerivedByClusterIdx(CFAstAuthorization Authorization, long ClusterId) {
    final String S_ProcName = "CFAstRamConfigurationFile.readDerivedByClusterIdx() ";
    CFAstConfigurationFileByClusterIdxKey key = schema.getFactoryConfigurationFile().newClusterIdxKey();
    key.setRequiredClusterId(ClusterId);

    CFAstConfigurationFileBuff[] recArray;
    if (dictByClusterIdx.containsKey(key)) {
        SortedMap<CFAstConfigurationFilePKey, CFAstConfigurationFileBuff> subdictClusterIdx = dictByClusterIdx
                .get(key);//from  ww  w .  j a  va  2 s .c om
        recArray = new CFAstConfigurationFileBuff[subdictClusterIdx.size()];
        Iterator<CFAstConfigurationFileBuff> iter = subdictClusterIdx.values().iterator();
        int idx = 0;
        while (iter.hasNext()) {
            recArray[idx++] = iter.next();
        }
    } else {
        recArray = new CFAstConfigurationFileBuff[0];
    }
    return (recArray);
}

From source file:accumulo.balancer.GroupBalancer.java

@Override
public void getAssignments(SortedMap<TServerInstance, TabletServerStatus> current,
        Map<KeyExtent, TServerInstance> unassigned, Map<KeyExtent, TServerInstance> assignments) {

    if (current.size() == 0) {
        return;/*w w  w  .j a  va 2s  .c  om*/
    }

    Function<KeyExtent, String> partitioner = getPartitioner();

    List<ComparablePair<String, KeyExtent>> tabletsByGroup = new ArrayList<>();
    for (Entry<KeyExtent, TServerInstance> entry : unassigned.entrySet()) {
        TServerInstance last = entry.getValue();
        if (last != null) {
            // Maintain locality
            String fakeSessionID = " ";
            TServerInstance simple = new TServerInstance(last.getLocation(), fakeSessionID);
            Iterator<TServerInstance> find = current.tailMap(simple).keySet().iterator();
            if (find.hasNext()) {
                TServerInstance tserver = find.next();
                if (tserver.host().equals(last.host())) {
                    assignments.put(entry.getKey(), tserver);
                    continue;
                }
            }
        }

        tabletsByGroup
                .add(new ComparablePair<String, KeyExtent>(partitioner.apply(entry.getKey()), entry.getKey()));
    }

    Collections.sort(tabletsByGroup);

    Iterator<TServerInstance> tserverIter = Iterators.cycle(current.keySet());
    for (ComparablePair<String, KeyExtent> pair : tabletsByGroup) {
        KeyExtent ke = pair.getSecond();
        assignments.put(ke, tserverIter.next());
    }

}

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

public CFAccSecGroupIncludeBuff[] readDerivedByClusterIdx(CFAccAuthorization Authorization, long ClusterId) {
    final String S_ProcName = "CFAccRamSecGroupInclude.readDerivedByClusterIdx() ";
    CFAccSecGroupIncludeByClusterIdxKey key = schema.getFactorySecGroupInclude().newClusterIdxKey();
    key.setRequiredClusterId(ClusterId);

    CFAccSecGroupIncludeBuff[] recArray;
    if (dictByClusterIdx.containsKey(key)) {
        SortedMap<CFAccSecGroupIncludePKey, CFAccSecGroupIncludeBuff> subdictClusterIdx = dictByClusterIdx
                .get(key);/* w  ww. j a  va2 s  .  c  om*/
        recArray = new CFAccSecGroupIncludeBuff[subdictClusterIdx.size()];
        Iterator<CFAccSecGroupIncludeBuff> iter = subdictClusterIdx.values().iterator();
        int idx = 0;
        while (iter.hasNext()) {
            recArray[idx++] = iter.next();
        }
    } else {
        recArray = new CFAccSecGroupIncludeBuff[0];
    }
    return (recArray);
}

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

public CFAstSecGroupIncludeBuff[] readDerivedByClusterIdx(CFAstAuthorization Authorization, long ClusterId) {
    final String S_ProcName = "CFAstRamSecGroupInclude.readDerivedByClusterIdx() ";
    CFAstSecGroupIncludeByClusterIdxKey key = schema.getFactorySecGroupInclude().newClusterIdxKey();
    key.setRequiredClusterId(ClusterId);

    CFAstSecGroupIncludeBuff[] recArray;
    if (dictByClusterIdx.containsKey(key)) {
        SortedMap<CFAstSecGroupIncludePKey, CFAstSecGroupIncludeBuff> subdictClusterIdx = dictByClusterIdx
                .get(key);//w w w.jav  a  2  s.c  o  m
        recArray = new CFAstSecGroupIncludeBuff[subdictClusterIdx.size()];
        Iterator<CFAstSecGroupIncludeBuff> iter = subdictClusterIdx.values().iterator();
        int idx = 0;
        while (iter.hasNext()) {
            recArray[idx++] = iter.next();
        }
    } else {
        recArray = new CFAstSecGroupIncludeBuff[0];
    }
    return (recArray);
}

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

public CFAccTSecGroupIncludeBuff[] readDerivedByTenantIdx(CFAccAuthorization Authorization, long TenantId) {
    final String S_ProcName = "CFAccRamTSecGroupInclude.readDerivedByTenantIdx() ";
    CFAccTSecGroupIncludeByTenantIdxKey key = schema.getFactoryTSecGroupInclude().newTenantIdxKey();
    key.setRequiredTenantId(TenantId);// w  w  w .j av a  2s .c  o  m

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

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

public CFAccTSecGroupIncludeBuff[] readDerivedByGroupIdx(CFAccAuthorization Authorization, long TenantId,
        int TSecGroupId) {
    final String S_ProcName = "CFAccRamTSecGroupInclude.readDerivedByGroupIdx() ";
    CFAccTSecGroupIncludeByGroupIdxKey key = schema.getFactoryTSecGroupInclude().newGroupIdxKey();
    key.setRequiredTenantId(TenantId);//from  w w  w .  j a v  a  2 s.c  o  m
    key.setRequiredTSecGroupId(TSecGroupId);

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

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

public CFAstTSecGroupIncludeBuff[] readDerivedByTenantIdx(CFAstAuthorization Authorization, long TenantId) {
    final String S_ProcName = "CFAstRamTSecGroupInclude.readDerivedByTenantIdx() ";
    CFAstTSecGroupIncludeByTenantIdxKey key = schema.getFactoryTSecGroupInclude().newTenantIdxKey();
    key.setRequiredTenantId(TenantId);//from   w  w w.  j  a v  a 2  s  .  c  o m

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