prompto.intrinsic.PromptoRange Maven / Gradle / Ivy
The newest version!
package prompto.intrinsic;
import java.util.Collection;
import java.util.Iterator;
import java.util.Objects;
public abstract class PromptoRange implements IterableWithCounts {
protected T low;
protected T high;
public PromptoRange(T low, T high) {
this.low = low;
this.high = high;
}
public T getLow() {
return low;
}
public T getHigh() {
return high;
}
@Override
public java.lang.Long getCount() {
return getNativeCount();
}
@Override
public java.lang.Long getTotalCount() {
return getNativeCount();
}
@Override
public abstract long getNativeCount();
public abstract T getItem(long item);
@Override
public String toString() {
return "[" + low.toString() + ".." + high.toString() + "]";
}
@Override
public int hashCode() {
return Objects.hash(low, high);
}
@Override
public boolean equals(Object obj) {
return obj instanceof PromptoRange>
&& low.equals(((PromptoRange>)obj).low)
&& high.equals(((PromptoRange>)obj).high);
}
public abstract PromptoRange slice(long first, long last);
protected long adjustLastSliceIndex(long last) {
if(last>=0)
return last;
else
return getNativeCount() + 1 + last;
}
public abstract boolean contains(Object item);
public boolean containsAll(Collection
© 2015 - 2024 Weber Informatics LLC | Privacy Policy