All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.aliyun.tair.tairzset.params.RankParams Maven / Gradle / Ivy

package com.aliyun.tair.tairzset.params;

import java.util.ArrayList;

import redis.clients.jedis.params.Params;
import redis.clients.jedis.util.SafeEncoder;

public class RankParams extends Params {
    private static final String APPROXIMATE = "APPROXIMATE";

    public RankParams() {}

    public static RankParams RankParams() {
        return new RankParams();
    }

    public RankParams approximate() {
        addParam(APPROXIMATE);
        return this;
    }

    private void addParamWithValue(ArrayList byteParams, String option) {
        if (contains(option)) {
            byteParams.add(SafeEncoder.encode(option));
            byteParams.add(SafeEncoder.encode(String.valueOf((Object)getParam(option))));
        }
    }

    public byte[][] getByteParams(byte[]... args) {
        ArrayList byteParams = new ArrayList();
        for (byte[] arg : args) {
            byteParams.add(arg);
        }

        if (contains(APPROXIMATE)) {
            byteParams.add(SafeEncoder.encode(APPROXIMATE));
        }

        return byteParams.toArray(new byte[byteParams.size()][]);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy