@@ -0,0 +1,1926 @@
+/*%0A * Copyright 2016-2018 shardingsphere.io.%0A * %3Cp%3E%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A * %3C/p%3E%0A */%0A%0Apackage io.shardingsphere.example.algorithm;%0A%0Aimport com.google.common.collect.Range;%0Aimport io.shardingsphere.api.algorithm.sharding.RangeShardingValue;%0Aimport io.shardingsphere.api.algorithm.sharding.standard.RangeShardingAlgorithm;%0A%0Aimport java.util.Collection;%0Aimport java.util.LinkedHashSet;%0A%0Apublic class RangeModuloShardingTableAlgorithm implements RangeShardingAlgorithm%3CLong%3E %7B%0A    %0A    @Override%0A    public Collection%3CString%3E doSharding(final Collection%3CString%3E tableNames, final RangeShardingValue%3CLong%3E shardingValue) %7B%0A        LinkedHashSet%3CString%3E result = new LinkedHashSet%3C%3E();%0A        if (Range.closed(1L, 10L).encloses(shardingValue.getValueRange())) %7B%0A            for (String each : tableNames) %7B%0A                if (each.endsWith(%220%22)) %7B%0A                    result.add(each);%0A                %7D%0A            %7D%0A        %7D else if (Range.closed(11L, 20L).encloses(shardingValue.getValueRange())) %7B%0A            for (String each : tableNames) %7B%0A                if (each.endsWith(%221%22)) %7B%0A                    result.add(each);%0A                %7D%0A            %7D%0A        %7D else if (Range.closed(1L, 20L).encloses(shardingValue.getValueRange())) %7B%0A            result.addAll(tableNames);%0A        %7D else %7B%0A            throw new UnsupportedOperationException();%0A        %7D%0A        return result;%0A    %7D%0A%7D%0A

add RangeModuloShardingTableAlgorithm