@@ -0,0 +1,2042 @@
+package org.finikes.sider.strategy;%0A%0Aimport java.util.HashMap;%0Aimport java.util.List;%0Aimport java.util.Map;%0Aimport java.util.Random;%0Aimport java.util.Set;%0A%0Aimport org.finikes.sider.strategy.exception.StrategyException;%0A%0Apublic class SectionMaxCapacityStrategy implements Strategy %7B%0A%09private int sectionMaxCapacity;%0A%0A%09public int getSectionMaxCapacity() %7B%0A%09%09return sectionMaxCapacity;%0A%09%7D%0A%0A%09public void setSectionMaxCapacity(int sectionMaxCapacity) %7B%0A%09%09this.sectionMaxCapacity = sectionMaxCapacity;%0A%09%7D%0A%0A%09public SectionMaxCapacityStrategy(Integer sectionMaxCapacity) %7B%0A%09%09this.sectionMaxCapacity = sectionMaxCapacity;%0A%09%7D%0A%0A%09public SectionMaxCapacityStrategy() %7B%0A%09%7D%0A%0A%09private Random ran = new Random();%0A%0A%09@Override%0A%09public Map%3CString, List%3CString%3E%3E filter(Map%3CString, List%3CString%3E%3E keysSection) %7B%0A%09%09Set%3Cjava.util.Map.Entry%3CString, List%3CString%3E%3E%3E set = keysSection.entrySet();%0A%09%09Map%3CString, List%3CString%3E%3E _keysSection = new HashMap%3CString, List%3CString%3E%3E(%0A%09%09%09%09keysSection.size() * sectionMaxCapacity);%0A%09%09for (java.util.Map.Entry%3CString, List%3CString%3E%3E e : set) %7B%0A%09%09%09String origNodeId = e.getKey();%0A%09%09%09List%3CString%3E keys = e.getValue();%0A%09%09%09int keysQuantity = keys.size();%0A%09%09%09int sectionQuantity = keysQuantity / sectionMaxCapacity;%0A%09%09%09int last = keysQuantity %25 sectionMaxCapacity;%0A%0A%09%09%09int j = 0;%0A%09%09%09int i = 0;%0A%09%09%09for (i = 0; i %3C sectionQuantity; i++) %7B%0A%09%09%09%09j = i * sectionMaxCapacity;%0A%09%09%09%09List%3CString%3E listx = keys.subList(j, j + sectionMaxCapacity);%0A%09%09%09%09origNodeId = origNodeId + %22-%22 + ran.nextInt(10000) * 10 + i;%0A%09%09%09%09if (_keysSection.containsKey(origNodeId)) %7B%0A%09%09%09%09%09throw new StrategyException(%22Don't have to deal with.%22);%0A%09%09%09%09%7D%0A%09%09%09%09_keysSection.put(origNodeId, listx);%0A%09%09%09%7D%0A%0A%09%09%09if (0 != last) %7B%0A%09%09%09%09List%3CString%3E listx = keys.subList(j + sectionMaxCapacity, j + sectionMaxCapacity + last);%0A%09%09%09%09origNodeId = origNodeId + %22-%22 + ran.nextInt(10000) * 10 + i;%0A%09%09%09%09if (_keysSection.containsKey(origNodeId)) %7B%0A%09%09%09%09%09throw new StrategyException(%22Don't have to deal with.%22);%0A%09%09%09%09%7D%0A%09%09%09%09_keysSection.put(origNodeId, listx);%0A%09%09%09%7D%0A%09%09%7D%0A%0A%09%09return _keysSection;%0A%09%7D%0A%0A%7D%0A

Create SectionMaxCapacityStrategy.java