package com.liangjian.dataplatform.member.algorithm;

//import com.google.common.collect.Range;
//import io.shardingsphere.api.algorithm.sharding.RangeShardingValue;
//import io.shardingsphere.api.algorithm.sharding.ShardingValue;
//import io.shardingsphere.api.algorithm.sharding.standard.RangeShardingAlgorithm;

import java.util.*;
import java.util.function.Predicate;

/**
 * @Author: 彭昭成
 * @Date: 2019/12/11
 */
//@Deprecated
//public class TableShardingAlgorithmRange<K extends Comparable<K>> implements RangeShardingAlgorithm<K> {
//
//
//    public TableShardingAlgorithmRange() {
//    }
//
//    @Override
//    public Collection<String> doSharding(Collection<String> collection, RangeShardingValue<K> rangeShardingValue) {
//        /*log.info("Range collection:" + JSON.toJSONString(collection) + ",rangeShardingValue:" + JSON.toJSONString(rangeShardingValue));
//         */
//        Collection<String> collect = new ArrayList<>();
//        Range<K> valueRange = rangeShardingValue.getValueRange();
//        for (K i = valueRange.lowerEndpoint(); i.compareTo(valueRange.upperEndpoint())<0; ) {
//
//            String suffix = Math.abs(i.hashCode()) % collection.size() + "";
//            for (String each : collection) {
//                if (each.endsWith(suffix)) {
//                    collect.add(each);
//                }
//            }
//            i = Range.openClosed(i,valueRange.upperEndpoint() ).lowerEndpoint();
//        }
//        return collect;
//    }
//}