com.javanut.json.encode.JSONSelect Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pronghorn-pipes Show documentation
Show all versions of pronghorn-pipes Show documentation
Ring buffer based queuing utility for applications that require high performance and/or a small
footprint. Well suited for embedded and stream based processing.
package com.javanut.json.encode;
import com.javanut.json.encode.function.ToBoolFunction;
public abstract class JSONSelect {
private final JSONBuilder builder;
private int count = 0;
private final ToBoolFunction[] branches = new ToBoolFunction[512];
private final JSONBuilder[] cases = new JSONBuilder[512];
public JSONSelect(JSONBuilder builder) {
this.builder = builder;
}
public JSONRoot> tryCase(ToBoolFunction select) {
JSONRoot> root = new JSONRoot>(builder.tryCase()) {
@Override
JSONSelect rootEnded() {
return JSONSelect.this;
}
};
cases[count] = root.builder;
branches[count] = select;
count++;
return root;
}
abstract P selectEnded();
public P endSelect() {
builder.endSelect(count, branches, cases);
return selectEnded();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy