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

org.rx.bean.DataRange Maven / Gradle / Ivy

There is a newer version: 3.0.0
Show newest version
package org.rx.bean;

import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.NonNull;

import java.io.Serializable;

import static org.rx.core.Extends.require;

@Data
@NoArgsConstructor
public class DataRange> implements Serializable {
    private static final long serialVersionUID = 2698228026798507997L;
    public T start;
    public T end;

    public DataRange(@NonNull T start, @NonNull T end) {
        require(start, start.compareTo(end) <= 0);

        this.start = start;
        this.end = end;
    }

    public boolean has(T data) {
        return start.compareTo(data) <= 0 && end.compareTo(data) > 0;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy