com.infomaximum.database.utils.ByteInterval Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rdao Show documentation
Show all versions of rdao Show documentation
Library for creating a light cluster
The newest version!
package com.infomaximum.database.utils;
import com.google.common.primitives.Bytes;
import com.google.common.primitives.UnsignedBytes;
public class ByteInterval {
private byte[] begin;
private byte[] end;
public byte[] getBegin() {
return begin;
}
public void setBegin(byte[] begin) {
this.begin = begin;
}
public byte[] getEnd() {
return end;
}
public void setEnd(byte[] end) {
this.end = end;
}
public void setBeginIfAbsent(byte[] begin) {
if (this.begin == null) {
this.begin = begin;
}
}
public void validate() {
if (begin != null && end != null && UnsignedBytes.lexicographicalComparator().compare(begin, end) > 0) {
throw new IllegalArgumentException("Begin interval bigger than end. Begin: " + Bytes.asList(begin) + ", End: " + Bytes.asList(end));
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy