Warning: session_start(): open(/var/lib/php/sessions/sess_6rsg9v9e39lak2irfr2mq452tc, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
sclass LongBuffer implements Iterable, ILongQueue, IIntSize {
long[] data;
int size;
*() {}
*(int size) { if (size != 0) data = new long[size]; }
*(Iterable l) {
if (l cast Cl) allocate(l.size());
addAll(l);
}
public void add(long i) {
if (size >= lLongArray(data)) {
data = resizeLongArray(data, Math.max(1, toInt(Math.min(maximumSafeArraySize(), lLongArray(data)*2L))));
if (size >= data.length) fail("LongBuffer too large: " + size);
}
data[size++] = i;
}
void allocate(int n) {
data = resizeLongArray(data, max(n, size()));
}
void addAll(Iterable l) {
if (l != null) for (long i : l) add(i);
}
long[] toArray() {
ret size == 0 ? null : resizeLongArray(data, size);
}
L toList() {
ret longArrayToList(data, 0, size);
}
L asVirtualList() {
ret listFromFunction get(size);
}
void reset { size = 0; }
void clear { reset(); }
int size() { ret size; }
public bool isEmpty() { ret size == 0; }
long get(int idx) {
if (idx >= size) fail("Index out of range: " + idx + "/" + size);
ret data[idx];
}
void set(int idx, long value) {
if (idx >= size) fail("Index out of range: " + idx + "/" + size);
data[idx] = value;
}
long popLast() {
if (size == 0) fail("empty buffer");
ret data[--size];
}
long last() { ret data[size-1]; }
long nextToLast() { ret data[size-2]; }
toString { ret squareBracket(joinWithSpace(toList())); }
public Iterator iterator() {
ret new ItIt {
int i = 0;
public bool hasNext() { ret i < size; }
public Long next() {
if (!hasNext()) fail("Index out of bounds: " + i);
ret data[i++];
}
};
}
void trimToSize {
data = resizeLongArray(data, size);
}
void remove(int idx) {
arraycopy(data, idx+1, data, idx, size-1-idx);
--size;
}
// don't rely on return value if buffer is empty
public long poll() {
ret size == 0 ? -1 : data[--size];
}
}