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

io.redisearch.aggregation.Limit Maven / Gradle / Ivy

The newest version!
package io.redisearch.aggregation;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * Created by mnunberg on 2/22/18.
 */
public class Limit {
    public static final Limit NO_LIMIT = new Limit(0,0);
  
    private final int offset;
    private final int count;

    public Limit(int offset, int count) {
        this.offset = offset;
        this.count = count;
    }
    
    public void addArgs(List args) {
      if (count == 0){
          return;
      }
      args.add("LIMIT");
      args.add(Integer.toString(offset));
      args.add(Integer.toString(count));
    }

    public List getArgs() {
        if (count == 0){
            return Collections.emptyList();
        }
        List ll = new ArrayList<>(3);
        addArgs(ll);
        return ll;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy