code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
public static int days(EvaluationContext ctx, Object endDate, Object startDate) {
return datedif(ctx, startDate, endDate, "d");
} | java |
public static Temporal edate(EvaluationContext ctx, Object date, Object months) {
Temporal dateOrDateTime = Conversions.toDateOrDateTime(date, ctx);
int _months = Conversions.toInteger(months, ctx);
return dateOrDateTime.plus(_months, ChronoUnit.MONTHS);
} | java |
public static OffsetTime time(EvaluationContext ctx, Object hours, Object minutes, Object seconds) {
int _hours = Conversions.toInteger(hours, ctx);
int _minutes = Conversions.toInteger(minutes, ctx);
int _seconds = Conversions.toInteger(seconds, ctx);
LocalTime localTime = LocalTime.of(... | java |
public static OffsetTime timevalue(EvaluationContext ctx, Object text) {
return Conversions.toTime(text, ctx);
} | java |
public static LocalDate today(EvaluationContext ctx) {
return ctx.getNow().atZone(ctx.getTimezone()).toLocalDate();
} | java |
public static int year(EvaluationContext ctx, Object date) {
return Conversions.toDateOrDateTime(date, ctx).get(ChronoField.YEAR);
} | java |
public static BigDecimal abs(EvaluationContext ctx, Object number) {
return Conversions.toDecimal(number, ctx).abs();
} | java |
public static BigDecimal exp(EvaluationContext ctx, Object number) {
BigDecimal _number = Conversions.toDecimal(number, ctx);
return ExpressionUtils.decimalPow(E, _number);
} | java |
public static int _int(EvaluationContext ctx, Object number) {
return Conversions.toDecimal(number, ctx).setScale(0, RoundingMode.FLOOR).intValue();
} | java |
public static BigDecimal min(EvaluationContext ctx, Object... args) {
if (args.length == 0) {
throw new RuntimeException("Wrong number of arguments");
}
BigDecimal result = null;
for (Object arg : args) {
BigDecimal _arg = Conversions.toDecimal(arg, ctx);
... | java |
public static BigDecimal mod(EvaluationContext ctx, Object number, Object divisor) {
BigDecimal _number = Conversions.toDecimal(number, ctx);
BigDecimal _divisor = Conversions.toDecimal(divisor, ctx);
return _number.subtract(_divisor.multiply(new BigDecimal(_int(ctx, _number.divide(_divisor, 10,... | java |
public static BigDecimal power(EvaluationContext ctx, Object number, Object power) {
BigDecimal _number = Conversions.toDecimal(number, ctx);
BigDecimal _power = Conversions.toDecimal(power, ctx);
return ExpressionUtils.decimalPow(_number, _power);
} | java |
public static int randbetween(EvaluationContext ctx, Object bottom, Object top) {
int _bottom = Conversions.toInteger(bottom, ctx);
int _top = Conversions.toInteger(top, ctx);
return (int)(Math.random() * (_top + 1 - _bottom)) + _bottom;
} | java |
public static BigDecimal round(EvaluationContext ctx, Object number, Object numDigits) {
BigDecimal _number = Conversions.toDecimal(number, ctx);
int _numDigits = Conversions.toInteger(numDigits, ctx);
return ExpressionUtils.decimalRound(_number, _numDigits, RoundingMode.HALF_UP);
} | java |
public static BigDecimal rounddown(EvaluationContext ctx, Object number, Object numDigits) {
BigDecimal _number = Conversions.toDecimal(number, ctx);
int _numDigits = Conversions.toInteger(numDigits, ctx);
return ExpressionUtils.decimalRound(_number, _numDigits, RoundingMode.DOWN);
} | java |
public static BigDecimal roundup(EvaluationContext ctx, Object number, Object numDigits) {
BigDecimal _number = Conversions.toDecimal(number, ctx);
int _numDigits = Conversions.toInteger(numDigits, ctx);
return ExpressionUtils.decimalRound(_number, _numDigits, RoundingMode.UP);
} | java |
public static BigDecimal sum(EvaluationContext ctx, Object... args) {
if (args.length == 0) {
throw new RuntimeException("Wrong number of arguments");
}
BigDecimal result = BigDecimal.ZERO;
for (Object arg : args) {
result = result.add(Conversions.toDecimal(arg, ... | java |
public static int trunc(EvaluationContext ctx, Object number) {
return Conversions.toDecimal(number, ctx).setScale(0, RoundingMode.DOWN).intValue();
} | java |
public static boolean and(EvaluationContext ctx, Object... args) {
for (Object arg : args) {
if (!Conversions.toBoolean(arg, ctx)) {
return false;
}
}
return true;
} | java |
public static Object _if(EvaluationContext ctx, Object logicalTest, @IntegerDefault(0) Object valueIfTrue, @BooleanDefault(false) Object valueIfFalse) {
return Conversions.toBoolean(logicalTest, ctx) ? valueIfTrue : valueIfFalse;
} | java |
public ApiResponse<ModelApiResponse> pingWithHttpInfo() throws ApiException {
com.squareup.okhttp.Call call = pingValidateBeforeCall(null, null);
Type localVarReturnType = new TypeToken<ModelApiResponse>(){}.getType();
return apiClient.execute(call, localVarReturnType);
} | java |
public ApiResponse<Object> retrievePCTokenUsingPOSTWithHttpInfo() throws ApiException {
com.squareup.okhttp.Call call = retrievePCTokenUsingPOSTValidateBeforeCall(null, null);
Type localVarReturnType = new TypeToken<Object>(){}.getType();
return apiClient.execute(call, localVarReturnType);
} | java |
public static String field(EvaluationContext ctx, Object text, Object index, @StringDefault(" ") Object delimiter) {
String _text = Conversions.toString(text, ctx);
int _index = Conversions.toInteger(index, ctx);
String _delimiter = Conversions.toString(delimiter, ctx);
String[] splits ... | java |
public static String first_word(EvaluationContext ctx, Object text) {
// In Excel this would be IF(ISERR(FIND(" ",A2)),"",LEFT(A2,FIND(" ",A2)-1))
return word(ctx, text, 1, false);
} | java |
public static String percent(EvaluationContext ctx, Object number) {
BigDecimal percent = Conversions.toDecimal(number, ctx).multiply(new BigDecimal(100));
return Conversions.toInteger(percent, ctx) + "%";
} | java |
public static BigDecimal epoch(EvaluationContext ctx, Object datetime) {
Instant instant = Conversions.toDateTime(datetime, ctx).toInstant();
BigDecimal nanos = new BigDecimal(instant.getEpochSecond() * 1000000000 + instant.getNano());
return nanos.divide(new BigDecimal(1000000000));
} | java |
public static String read_digits(EvaluationContext ctx, Object text) {
String _text = Conversions.toString(text, ctx).trim();
if (StringUtils.isEmpty(_text)) {
return "";
}
// trim off the plus for phone numbers
if (_text.startsWith("+")) {
_text = _text.... | java |
public static String remove_first_word(EvaluationContext ctx, Object text) {
String _text = StringUtils.stripStart(Conversions.toString(text, ctx), null);
String firstWord = first_word(ctx, _text);
if (StringUtils.isNotEmpty(firstWord)) {
return StringUtils.stripStart(_text.substrin... | java |
public static String word(EvaluationContext ctx, Object text, Object number, @BooleanDefault(false) Object bySpaces) {
return word_slice(ctx, text, number, Conversions.toInteger(number, ctx) + 1, bySpaces);
} | java |
public static int word_count(EvaluationContext ctx, Object text, @BooleanDefault(false) Object bySpaces) {
String _text = Conversions.toString(text, ctx);
boolean _bySpaces = Conversions.toBoolean(bySpaces, ctx);
return getWords(_text, _bySpaces).size();
} | java |
public static String word_slice(EvaluationContext ctx, Object text, Object start, @IntegerDefault(0) Object stop, @BooleanDefault(false) Object bySpaces) {
String _text = Conversions.toString(text, ctx);
int _start = Conversions.toInteger(start, ctx);
Integer _stop = Conversions.toInteger(stop, ... | java |
public static String format_date(EvaluationContext ctx, Object text) {
ZonedDateTime _dt = Conversions.toDateTime(text, ctx).withZoneSameInstant(ctx.getTimezone());
return ctx.getDateFormatter(true).format(_dt);
} | java |
public static String regex_group(EvaluationContext ctx, Object text, Object pattern, Object groupNum) {
String _text = Conversions.toString(text, ctx);
String _pattern = Conversions.toString(pattern, ctx);
int _groupNum = Conversions.toInteger(groupNum, ctx);
try {
// check ... | java |
private static List<String> getWords(String text, boolean bySpaces) {
if (bySpaces) {
List<String> words = new ArrayList<>();
for (String split : text.split("\\s+")) {
if (StringUtils.isNotEmpty(split)) {
words.add(split);
}
... | java |
private static List<String> chunk(String text, int size) {
List<String> chunks = new ArrayList<>();
for (int i = 0; i < text.length(); i += size) {
chunks.add(StringUtils.substring(text, i, i + size));
}
return chunks;
} | java |
public CorsHeaderPlugin flag(String flagValue)
{
if (isRegistered()) throw new UnsupportedOperationException("CorsHeaderPlugin.flag(String) must be called before register()");
if (!flags.contains(flagValue))
{
flags.add(flagValue);
}
return this;
} | java |
private void addPreflightOptionsRequestSupport(RestExpress server, CorsOptionsController corsOptionsController)
{
RouteBuilder rb;
for (String pattern : methodsByPattern.keySet())
{
rb = server.uri(pattern, corsOptionsController)
.action("options", HttpMethod.OPTIONS)
.noSerializ... | java |
@Override
public void process(Request request)
{
String correlationId = request.getHeader(CORRELATION_ID);
// Generation on empty causes problems, since the request already has a value for Correlation-Id in this case.
// The method call request.addHeader() only adds ANOTHER header to the request and doesn't fi... | java |
@Override
public void process(Request request, Response response)
{
if (!response.hasHeader(CORRELATION_ID))
{
response.addHeader(CORRELATION_ID, request.getHeader(CORRELATION_ID));
}
} | java |
protected void extractBundleContent(String bundleRootPath, String toDirRoot) throws IOException {
File toDir = new File(toDirRoot);
if (!toDir.isDirectory()) {
throw new RuntimeException("[" + toDir.getAbsolutePath()
+ "] is not a valid directory or does not exist!");
... | java |
protected void handleAnotherVersionAtStartup(Bundle bundle) throws BundleException {
Version myVersion = this.bundle.getVersion();
Version otherVersion = bundle.getVersion();
if (myVersion.compareTo(otherVersion) > 0) {
handleNewerVersionAtStartup(bundle);
} else {
... | java |
public long getId(final String agent) {
try {
return worker.getId(agent);
} catch (final InvalidUserAgentError e) {
LOGGER.error("Invalid user agent ({})", agent);
throw new SnowizardException(Response.Status.BAD_REQUEST,
"Invalid User-Agent header... | java |
@GET
@Timed
@Produces(MediaType.TEXT_PLAIN)
@CacheControl(mustRevalidate = true, noCache = true, noStore = true)
public String getIdAsString(
@HeaderParam(HttpHeaders.USER_AGENT) final String agent) {
return String.valueOf(getId(agent));
} | java |
@GET
@Timed
@JSONP(callback = "callback", queryParam = "callback")
@Produces({ MediaType.APPLICATION_JSON,
MediaTypeAdditional.APPLICATION_JAVASCRIPT })
@CacheControl(mustRevalidate = true, noCache = true, noStore = true)
public Id getIdAsJSON(
@HeaderParam(HttpHeaders.USER_AGENT... | java |
@GET
@Timed
@Produces(ProtocolBufferMediaType.APPLICATION_PROTOBUF)
@CacheControl(mustRevalidate = true, noCache = true, noStore = true)
public SnowizardResponse getIdAsProtobuf(
@HeaderParam(HttpHeaders.USER_AGENT) final String agent,
@QueryParam("count") final Optional<IntParam... | java |
public RoutesMetadataPlugin flag(String flagValue)
{
for (RouteBuilder routeBuilder : routeBuilders)
{
routeBuilder.flag(flagValue);
}
return this;
} | java |
static int getBitsPerItemForFpRate(double fpProb,double loadFactor) {
/*
* equation from Cuckoo Filter: Practically Better Than Bloom Bin Fan,
* David G. Andersen, Michael Kaminsky , Michael D. Mitzenmacher
*/
return DoubleMath.roundToInt(DoubleMath.log2((1 / fpProb) + 3) / loadFactor, RoundingMode.UP... | java |
static long getBucketsNeeded(long maxKeys,double loadFactor,int bucketSize) {
/*
* force a power-of-two bucket count so hash functions for bucket index
* can hashBits%numBuckets and get randomly distributed index. See wiki
* "Modulo Bias". Only time we can get perfectly distributed index is
* when nu... | java |
private boolean trySwapVictimIntoEmptySpot() {
long curIndex = victim.getI2();
// lock bucket. We always use I2 since victim tag is from bucket I1
bucketLocker.lockSingleBucketWrite(curIndex);
long curTag = table.swapRandomTagInBucket(curIndex, victim.getTag());
bucketLocker.unlockSingleBucketWrite(cur... | java |
private void insertIfVictim() {
long victimLockstamp = writeLockVictimIfSet();
if (victimLockstamp == 0L)
return;
try {
// when we get here we definitely have a victim and a write lock
bucketLocker.lockBucketsWrite(victim.getI1(), victim.getI2());
try {
if (table.insertToBucket(victim.ge... | java |
private static boolean isHashConfigurationIsSupported(long numBuckets, int tagBits, int hashSize) {
int hashBitsNeeded = getTotalBitsNeeded(numBuckets, tagBits);
switch (hashSize) {
case 32:
case 64:
return hashBitsNeeded <= hashSize;
default:
}
if (hashSize >= 128)
return tagBits <= 64 && ... | java |
HashCode hashObjWithSalt(T object, int moreSalt) {
Hasher hashInst = hasher.newHasher();
hashInst.putObject(object, funnel);
hashInst.putLong(seedNSalt);
hashInst.putInt(moreSalt);
return hashInst.hash();
} | java |
static int oversize(int minTargetSize, int bytesPerElement) {
if (minTargetSize < 0) {
// catch usage that accidentally overflows int
throw new IllegalArgumentException("invalid array size " + minTargetSize);
}
if (minTargetSize == 0) {
// wait until at least one element is reque... | java |
long prevSetBit(long index) {
assert index >= 0 && index < numBits : "index=" + index + " numBits=" + numBits;
int i = (int) (index >> 6);
final int subIndex = (int) (index & 0x3f); // index within the word
long word = (bits[i] << (63 - subIndex)); // skip all the bits to the
// left of index
... | java |
void or(LongBitSet other) {
assert other.numWords <= numWords : "numWords=" + numWords + ", other.numWords=" + other.numWords;
int pos = Math.min(numWords, other.numWords);
while (--pos >= 0) {
bits[pos] |= other.bits[pos];
}
} | java |
boolean intersects(LongBitSet other) {
// Depends on the ghost bits being clear!
int pos = Math.min(numWords, other.numWords);
while (--pos >= 0) {
if ((bits[pos] & other.bits[pos]) != 0)
return true;
}
return false;
} | java |
void andNot(LongBitSet other) {
int pos = Math.min(numWords, other.numWords);
while (--pos >= 0) {
bits[pos] &= ~other.bits[pos];
}
} | java |
void flip(long index) {
assert index >= 0 && index < numBits : "index=" + index + " numBits=" + numBits;
int wordNum = (int) (index >> 6); // div 64
long bitmask = 1L << index; // mod 64 is implicit
bits[wordNum] ^= bitmask;
} | java |
static FilterTable create(int bitsPerTag, long numBuckets) {
// why would this ever happen?
checkArgument(bitsPerTag < 48, "tagBits (%s) should be less than 48 bits", bitsPerTag);
// shorter fingerprints don't give us a good fill capacity
checkArgument(bitsPerTag > 4, "tagBits (%s) must be > 4", bitsPerTag)... | java |
boolean insertToBucket(long bucketIndex, long tag) {
for (int i = 0; i < CuckooFilter.BUCKET_SIZE; i++) {
if (checkTag(bucketIndex, i, 0)) {
writeTagNoClear(bucketIndex, i, tag);
return true;
}
}
return false;
} | java |
long swapRandomTagInBucket(long curIndex, long tag) {
int randomBucketPosition = ThreadLocalRandom.current().nextInt(CuckooFilter.BUCKET_SIZE);
return readTagAndSet(curIndex, randomBucketPosition, tag);
} | java |
boolean findTag(long i1, long i2, long tag) {
for (int i = 0; i < CuckooFilter.BUCKET_SIZE; i++) {
if (checkTag(i1, i, tag) || checkTag(i2, i, tag))
return true;
}
return false;
} | java |
boolean deleteFromBucket(long i1, long tag) {
for (int i = 0; i < CuckooFilter.BUCKET_SIZE; i++) {
if (checkTag(i1, i, tag)) {
deleteTag(i1, i);
return true;
}
}
return false;
} | java |
long readTag(long bucketIndex, int posInBucket) {
long tagStartIdx = getTagOffset(bucketIndex, posInBucket);
long tag = 0;
long tagEndIdx = tagStartIdx + bitsPerTag;
// looping over true bits per nextBitSet javadocs
for (long i = memBlock.nextSetBit(tagStartIdx); i >= 0 && i < tagEndIdx; i = memBlock.nex... | java |
long readTagAndSet(long bucketIndex, int posInBucket, long newTag) {
long tagStartIdx = getTagOffset(bucketIndex, posInBucket);
long tag = 0;
long tagEndIdx = tagStartIdx + bitsPerTag;
int tagPos = 0;
for (long i = tagStartIdx; i < tagEndIdx; i++) {
if ((newTag & (1L << tagPos)) != 0) {
if (memB... | java |
boolean checkTag(long bucketIndex, int posInBucket, long tag) {
long tagStartIdx = getTagOffset(bucketIndex, posInBucket);
final int bityPerTag = bitsPerTag;
for (long i = 0; i < bityPerTag; i++) {
if (memBlock.get(i + tagStartIdx) != ((tag & (1L << i)) != 0))
return false;
}
return true;
} | java |
void writeTagNoClear(long bucketIndex, int posInBucket, long tag) {
long tagStartIdx = getTagOffset(bucketIndex, posInBucket);
// BIT BANGIN YEAAAARRHHHGGGHHH
for (int i = 0; i < bitsPerTag; i++) {
// second arg just does bit test in tag
if ((tag & (1L << i)) != 0) {
memBlock.set(tagStartIdx + i);... | java |
private static Object invoke(Object obj, String method, Object... args)
throws NoSuchMethodException, InvocationTargetException,
IllegalAccessException {
Class<?>[] argumentTypes = new Class[args.length];
for (int i = 0; i < args.length; ++i) {
argumentTypes[i] = args... | java |
private void invokeIgnoreExceptions(Object obj, String method,
Object... args) {
try {
invoke(obj, method, args);
} catch (NoSuchMethodException e) {
logger.trace("Unable to log progress", e);
} catch (InvocationTargetException e) {
logger.trace("U... | java |
public static void optimizeTable(FluoConfiguration fluoConfig, TableOptimizations tableOptim)
throws Exception {
Connector conn = getConnector(fluoConfig);
TreeSet<Text> splits = new TreeSet<>();
for (Bytes split : tableOptim.getSplits()) {
splits.add(new Text(split.toArray()));
}
Str... | java |
public void filteredAdd(LogEntry entry, Predicate<LogEntry> filter) {
if (filter.test(entry)) {
add(entry);
}
} | java |
public Map<RowColumn, Bytes> getOperationMap(LogEntry.Operation op) {
Map<RowColumn, Bytes> opMap = new HashMap<>();
for (LogEntry entry : logEntries) {
if (entry.getOp().equals(op)) {
opMap.put(new RowColumn(entry.getRow(), entry.getColumn()), entry.getValue());
}
}
return opMap;
... | java |
private String getProjectStageNameFromJNDI() {
try {
InitialContext context = new InitialContext();
Object obj = context.lookup(ProjectStage.PROJECT_STAGE_JNDI_NAME);
if (obj != null) {
return obj.toString().trim();
}
} catch (NamingExce... | java |
public static RecordingTransactionBase wrap(TransactionBase txb, Predicate<LogEntry> filter) {
return new RecordingTransactionBase(txb, filter);
} | java |
public @Nonnull ThreadDumpRuntime fromCurrentProcess() throws IOException, InterruptedException {
final String jvmName = ManagementFactory.getRuntimeMXBean().getName();
final int index = jvmName.indexOf('@');
if (index < 1) throw new IOException("Unable to extract PID from " + jvmName);
... | java |
@SuppressWarnings({"unchecked", "rawtypes", "unused"})
public void afterPhase(final PhaseEvent event) {
if (PhaseId.RENDER_RESPONSE.equals(event.getPhaseId())) {
RenderContext contextInstance = getContextInstance();
if (contextInstance != null) {
Integer id = contextI... | java |
protected boolean elements(String... name) {
if (name == null || name.length != stack.size()) {
return false;
}
for (int i = 0; i < name.length; i++) {
if (!name[i].equals(stack.get(i))) {
return false;
}
}
return true;
} | java |
public static Predicate<LogEntry> getFilter() {
return le -> le.getOp().equals(LogEntry.Operation.DELETE)
|| le.getOp().equals(LogEntry.Operation.SET);
} | java |
public static void generateMutations(long seq, TxLog txLog, Consumer<Mutation> consumer) {
Map<Bytes, Mutation> mutationMap = new HashMap<>();
for (LogEntry le : txLog.getLogEntries()) {
LogEntry.Operation op = le.getOp();
Column col = le.getColumn();
byte[] cf = col.getFamily().toArray();
... | java |
public UIForm locateForm() {
UIComponent parent = this.getParent();
while (!(parent instanceof UIForm)) {
if ((parent == null) || (parent instanceof UIViewRoot)) {
throw new IllegalStateException(
"The UIValidateForm (<s:validateForm />) component must... | java |
private Bytes getMinimalRow() {
return Bytes.builder(bucketRow.length() + 1).append(bucketRow).append(':').toBytes();
} | java |
public @Nonnull ThreadType onlyThread() throws IllegalStateException {
if (size() != 1) throw new IllegalStateException(
"Exactly one thread expected in the set. Found " + size()
);
return threads.iterator().next();
} | java |
public @Nonnull SetType getBlockedThreads() {
Set<ThreadLock> acquired = new HashSet<ThreadLock>();
for (ThreadType thread: threads) {
acquired.addAll(thread.getAcquiredLocks());
}
Set<ThreadType> blocked = new HashSet<ThreadType>();
for (ThreadType thread: runtime.g... | java |
public @Nonnull SetType getBlockingThreads() {
Set<ThreadLock> waitingTo = new HashSet<ThreadLock>();
for (ThreadType thread: threads) {
if (thread.getWaitingToLock() != null) {
waitingTo.add(thread.getWaitingToLock());
}
}
Set<ThreadType> blockin... | java |
public @Nonnull SetType where(ProcessThread.Predicate pred) {
HashSet<ThreadType> subset = new HashSet<ThreadType>(size() / 2);
for (ThreadType thread: threads) {
if (pred.isValid(thread)) subset.add(thread);
}
return runtime.getThreadSet(subset);
} | java |
public <T extends SingleThreadSetQuery.Result<SetType, RuntimeType, ThreadType>> T query(SingleThreadSetQuery<T> query) {
return query.<SetType, RuntimeType, ThreadType>query((SetType) this);
} | java |
@SuppressWarnings("unused")
private static MBeanServerConnection getServerConnection(int pid) {
try {
JMXServiceURL serviceURL = new JMXServiceURL(connectorAddress(pid));
return JMXConnectorFactory.connect(serviceURL).getMBeanServerConnection();
} catch (MalformedURLExceptio... | java |
private Monitor getMonitorJustAcquired(List<ThreadLock.Monitor> monitors) {
if (monitors.isEmpty()) return null;
Monitor monitor = monitors.get(0);
if (monitor.getDepth() != 0) return null;
for (Monitor duplicateCandidate: monitors) {
if (monitor.equals(duplicateCandidate)) ... | java |
public void setupDecorateMethods(ClassLoader cl) {
synchronized (STAR_IMPORTS) {
if (DECORATED) return;
GroovyShell shell = new GroovyShell(cl, new Binding(), getCompilerConfiguration());
try {
shell.run(
new InputStreamReader(this.get... | java |
private void performObservation(PhaseEvent event, PhaseIdType phaseIdType) {
UIViewRoot viewRoot = (UIViewRoot) event.getFacesContext().getViewRoot();
List<? extends Annotation> restrictionsForPhase = getRestrictionsForPhase(phaseIdType, viewRoot.getViewId());
if (restrictionsForPhase != null) {... | java |
public boolean isAnnotationApplicableToPhase(Annotation annotation, PhaseIdType currentPhase, PhaseIdType[] defaultPhases) {
Method restrictAtViewMethod = getRestrictAtViewMethod(annotation);
PhaseIdType[] phasedIds = null;
if (restrictAtViewMethod != null) {
log.warnf("Annotation %s... | java |
public Method getRestrictAtViewMethod(Annotation annotation) {
Method restrictAtViewMethod;
try {
restrictAtViewMethod = annotation.annotationType().getDeclaredMethod("restrictAtPhase");
} catch (NoSuchMethodException ex) {
restrictAtViewMethod = null;
} catch (Se... | java |
public PhaseIdType[] getRestrictedPhaseIds(Method restrictAtViewMethod, Annotation annotation) {
PhaseIdType[] phaseIds;
try {
phaseIds = (PhaseIdType[]) restrictAtViewMethod.invoke(annotation);
} catch (IllegalAccessException ex) {
throw new IllegalArgumentException("res... | java |
public static TableOptimizations getConfiguredOptimizations(FluoConfiguration fluoConfig) {
try (FluoClient client = FluoFactory.newClient(fluoConfig)) {
SimpleConfiguration appConfig = client.getAppConfiguration();
TableOptimizations tableOptim = new TableOptimizations();
SimpleConfiguration sub... | java |
public void addTransientRange(String id, RowRange range) {
String start = DatatypeConverter.printHexBinary(range.getStart().toArray());
String end = DatatypeConverter.printHexBinary(range.getEnd().toArray());
appConfig.setProperty(PREFIX + id, start + ":" + end);
} | java |
public List<RowRange> getTransientRanges() {
List<RowRange> ranges = new ArrayList<>();
Iterator<String> keys = appConfig.getKeys(PREFIX.substring(0, PREFIX.length() - 1));
while (keys.hasNext()) {
String key = keys.next();
String val = appConfig.getString(key);
String[] sa = val.split(":"... | java |
@SuppressWarnings("unchecked")
protected List<T> getEnabledListeners(Class<? extends T>... classes) {
List<T> listeners = new ArrayList<T>();
for (Class<? extends T> clazz : classes) {
Set<Bean<?>> beans = getBeanManager().getBeans(clazz);
if (!beans.isEmpty()) {
... | java |
public void update(TransactionBase tx, Map<K, V> updates) {
combineQ.addAll(tx, updates);
} | java |
public static void configure(FluoConfiguration fluoConfig, Options opts) {
org.apache.fluo.recipes.core.combine.CombineQueue.FluentOptions cqopts =
CombineQueue.configure(opts.mapId).keyType(opts.keyType).valueType(opts.valueType)
.buckets(opts.numBuckets);
if (opts.bucketsPerTablet != null)... | java |
@Deprecated
public static void configure(FluoConfiguration fluoConfig, Options opts) {
SimpleConfiguration appConfig = fluoConfig.getAppConfiguration();
opts.save(appConfig);
fluoConfig.addObserver(
new org.apache.fluo.api.config.ObserverSpecification(ExportObserver.class.getName(),
C... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.