code stringlengths 63 466k | code_sememe stringlengths 141 3.79M | token_type stringlengths 274 1.23M |
|---|---|---|
protected String getLabel(ArgumentComponent argumentComponent, Token token)
{
StringBuilder sb = new StringBuilder(argumentComponent.getClass().getSimpleName());
if ("BIO".equals(this.codingGranularity)) {
// Does the component begin here?
if (argumentComponent.getBegin() == token.getBegin()) {
sb.append(B_SUFFIX);
}
else {
sb.append(I_SUFFIX);
}
}
else {
sb.append(I_SUFFIX);
}
return sb.toString();
} | class class_name[name] begin[{]
method[getLabel, return_type[type[String]], modifier[protected], parameter[argumentComponent, token]] begin[{]
local_variable[type[StringBuilder], sb]
if[literal["BIO"]] begin[{]
if[binary_operation[call[argumentComponent.getBegin, parameter[]], ==, call[token.getBegin, parameter[]]]] begin[{]
call[sb.append, parameter[member[.B_SUFFIX]]]
else begin[{]
call[sb.append, parameter[member[.I_SUFFIX]]]
end[}]
else begin[{]
call[sb.append, parameter[member[.I_SUFFIX]]]
end[}]
return[call[sb.toString, parameter[]]]
end[}]
END[}] | Keyword[protected] identifier[String] identifier[getLabel] operator[SEP] identifier[ArgumentComponent] identifier[argumentComponent] , identifier[Token] identifier[token] operator[SEP] {
identifier[StringBuilder] identifier[sb] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] identifier[argumentComponent] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] Keyword[this] operator[SEP] identifier[codingGranularity] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[argumentComponent] operator[SEP] identifier[getBegin] operator[SEP] operator[SEP] operator[==] identifier[token] operator[SEP] identifier[getBegin] operator[SEP] operator[SEP] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[B_SUFFIX] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[I_SUFFIX] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[I_SUFFIX] operator[SEP] operator[SEP]
}
Keyword[return] identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
private boolean symmetryBreakingForStayingVMs(ReconfigurationProblem rp) {
for (VM vm : rp.getFutureRunningVMs()) {
VMTransition a = rp.getVMAction(vm);
Slice dSlice = a.getDSlice();
Slice cSlice = a.getCSlice();
if (dSlice != null && cSlice != null) {
BoolVar stay = ((KeepRunningVM) a).isStaying();
Boolean ret = strictlyDecreasingOrUnchanged(vm);
if (Boolean.TRUE.equals(ret) && !zeroDuration(rp, stay, cSlice)) {
return false;
//Else, the resource usage is decreasing, so
// we set the cSlice duration to 0 to directly reduces the resource allocation
} else if (Boolean.FALSE.equals(ret) && !zeroDuration(rp, stay, dSlice)) {
//If the resource usage will be increasing
//Then the duration of the dSlice can be set to 0
//(the allocation will be performed at the end of the reconfiguration process)
return false;
}
}
}
return true;
} | class class_name[name] begin[{]
method[symmetryBreakingForStayingVMs, return_type[type[boolean]], modifier[private], parameter[rp]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=vm, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getVMAction, postfix_operators=[], prefix_operators=[], qualifier=rp, selectors=[], type_arguments=None), name=a)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=VMTransition, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getDSlice, postfix_operators=[], prefix_operators=[], qualifier=a, selectors=[], type_arguments=None), name=dSlice)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Slice, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getCSlice, postfix_operators=[], prefix_operators=[], qualifier=a, selectors=[], type_arguments=None), name=cSlice)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Slice, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=dSlice, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=cSlice, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=KeepRunningVM, sub_type=None)), name=stay)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BoolVar, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=vm, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=strictlyDecreasingOrUnchanged, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=ret)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Boolean, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=ret, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=Boolean.TRUE, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=rp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=stay, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=cSlice, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=zeroDuration, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[], type_arguments=None), operator=&&), else_statement=IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=ret, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=Boolean.FALSE, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=rp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=stay, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dSlice, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=zeroDuration, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)]))]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getFutureRunningVMs, postfix_operators=[], prefix_operators=[], qualifier=rp, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=vm)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=VM, sub_type=None))), label=None)
return[literal[true]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[symmetryBreakingForStayingVMs] operator[SEP] identifier[ReconfigurationProblem] identifier[rp] operator[SEP] {
Keyword[for] operator[SEP] identifier[VM] identifier[vm] operator[:] identifier[rp] operator[SEP] identifier[getFutureRunningVMs] operator[SEP] operator[SEP] operator[SEP] {
identifier[VMTransition] identifier[a] operator[=] identifier[rp] operator[SEP] identifier[getVMAction] operator[SEP] identifier[vm] operator[SEP] operator[SEP] identifier[Slice] identifier[dSlice] operator[=] identifier[a] operator[SEP] identifier[getDSlice] operator[SEP] operator[SEP] operator[SEP] identifier[Slice] identifier[cSlice] operator[=] identifier[a] operator[SEP] identifier[getCSlice] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dSlice] operator[!=] Other[null] operator[&&] identifier[cSlice] operator[!=] Other[null] operator[SEP] {
identifier[BoolVar] identifier[stay] operator[=] operator[SEP] operator[SEP] identifier[KeepRunningVM] operator[SEP] identifier[a] operator[SEP] operator[SEP] identifier[isStaying] operator[SEP] operator[SEP] operator[SEP] identifier[Boolean] identifier[ret] operator[=] identifier[strictlyDecreasingOrUnchanged] operator[SEP] identifier[vm] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Boolean] operator[SEP] identifier[TRUE] operator[SEP] identifier[equals] operator[SEP] identifier[ret] operator[SEP] operator[&&] operator[!] identifier[zeroDuration] operator[SEP] identifier[rp] , identifier[stay] , identifier[cSlice] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[Boolean] operator[SEP] identifier[FALSE] operator[SEP] identifier[equals] operator[SEP] identifier[ret] operator[SEP] operator[&&] operator[!] identifier[zeroDuration] operator[SEP] identifier[rp] , identifier[stay] , identifier[dSlice] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public static void setBytes(long address, byte[] buffer, int bufferOffset, int count)
{
assert buffer != null;
assert !(bufferOffset < 0 || count < 0 || bufferOffset + count > buffer.length);
setBytes(buffer, bufferOffset, address, count);
} | class class_name[name] begin[{]
method[setBytes, return_type[void], modifier[public static], parameter[address, buffer, bufferOffset, count]] begin[{]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=buffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None, value=None)
AssertStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=bufferOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=<), operandr=BinaryOperation(operandl=MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=<), operator=||), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=bufferOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=buffer, selectors=[]), operator=>), operator=||), label=None, value=None)
call[.setBytes, parameter[member[.buffer], member[.bufferOffset], member[.address], member[.count]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[setBytes] operator[SEP] Keyword[long] identifier[address] , Keyword[byte] operator[SEP] operator[SEP] identifier[buffer] , Keyword[int] identifier[bufferOffset] , Keyword[int] identifier[count] operator[SEP] {
Keyword[assert] identifier[buffer] operator[!=] Other[null] operator[SEP] Keyword[assert] operator[!] operator[SEP] identifier[bufferOffset] operator[<] Other[0] operator[||] identifier[count] operator[<] Other[0] operator[||] identifier[bufferOffset] operator[+] identifier[count] operator[>] identifier[buffer] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[setBytes] operator[SEP] identifier[buffer] , identifier[bufferOffset] , identifier[address] , identifier[count] operator[SEP] operator[SEP]
}
|
private ListenableFuture<TaskStatus> attachCallbacks(final Task task, final ListenableFuture<TaskStatus> statusFuture)
{
final ServiceMetricEvent.Builder metricBuilder = new ServiceMetricEvent.Builder();
IndexTaskUtils.setTaskDimensions(metricBuilder, task);
Futures.addCallback(
statusFuture,
new FutureCallback<TaskStatus>()
{
@Override
public void onSuccess(final TaskStatus status)
{
log.info("Received %s status for task: %s", status.getStatusCode(), status.getId());
handleStatus(status);
}
@Override
public void onFailure(final Throwable t)
{
log.makeAlert(t, "Failed to run task")
.addData("task", task.getId())
.addData("type", task.getType())
.addData("dataSource", task.getDataSource())
.emit();
handleStatus(TaskStatus.failure(task.getId()));
}
private void handleStatus(final TaskStatus status)
{
try {
// If we're not supposed to be running anymore, don't do anything. Somewhat racey if the flag gets set
// after we check and before we commit the database transaction, but better than nothing.
if (!active) {
log.info("Abandoning task due to shutdown: %s", task.getId());
return;
}
notifyStatus(task, status, "notified status change from task");
// Emit event and log, if the task is done
if (status.isComplete()) {
IndexTaskUtils.setTaskStatusDimensions(metricBuilder, status);
emitter.emit(metricBuilder.build("task/run/time", status.getDuration()));
log.info(
"Task %s: %s (%d run duration)",
status.getStatusCode(),
task,
status.getDuration()
);
if (status.isSuccess()) {
Counters.incrementAndGetLong(totalSuccessfulTaskCount, task.getDataSource());
} else {
Counters.incrementAndGetLong(totalFailedTaskCount, task.getDataSource());
}
}
}
catch (Exception e) {
log.makeAlert(e, "Failed to handle task status")
.addData("task", task.getId())
.addData("statusCode", status.getStatusCode())
.emit();
}
}
}
);
return statusFuture;
} | class class_name[name] begin[{]
method[attachCallbacks, return_type[type[ListenableFuture]], modifier[private], parameter[task, statusFuture]] begin[{]
local_variable[type[ServiceMetricEvent], metricBuilder]
call[IndexTaskUtils.setTaskDimensions, parameter[member[.metricBuilder], member[.task]]]
call[Futures.addCallback, parameter[member[.statusFuture], ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Received %s status for task: %s"), MethodInvocation(arguments=[], member=getStatusCode, postfix_operators=[], prefix_operators=[], qualifier=status, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=status, selectors=[], type_arguments=None)], member=info, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=status, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=handleStatus, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=onSuccess, parameters=[FormalParameter(annotations=[], modifiers={'final'}, name=status, type=ReferenceType(arguments=None, dimensions=[], name=TaskStatus, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to run task")], member=makeAlert, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="task"), MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=task, selectors=[], type_arguments=None)], member=addData, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="type"), MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=task, selectors=[], type_arguments=None)], member=addData, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="dataSource"), MethodInvocation(arguments=[], member=getDataSource, postfix_operators=[], prefix_operators=[], qualifier=task, selectors=[], type_arguments=None)], member=addData, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=emit, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=task, selectors=[], type_arguments=None)], member=failure, postfix_operators=[], prefix_operators=[], qualifier=TaskStatus, selectors=[], type_arguments=None)], member=handleStatus, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=onFailure, parameters=[FormalParameter(annotations=[], modifiers={'final'}, name=t, type=ReferenceType(arguments=None, dimensions=[], name=Throwable, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None), MethodDeclaration(annotations=[], body=[TryStatement(block=[IfStatement(condition=MemberReference(member=active, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Abandoning task due to shutdown: %s"), MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=task, selectors=[], type_arguments=None)], member=info, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=task, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=status, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="notified status change from task")], member=notifyStatus, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=isComplete, postfix_operators=[], prefix_operators=[], qualifier=status, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=metricBuilder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=status, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setTaskStatusDimensions, postfix_operators=[], prefix_operators=[], qualifier=IndexTaskUtils, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="task/run/time"), MethodInvocation(arguments=[], member=getDuration, postfix_operators=[], prefix_operators=[], qualifier=status, selectors=[], type_arguments=None)], member=build, postfix_operators=[], prefix_operators=[], qualifier=metricBuilder, selectors=[], type_arguments=None)], member=emit, postfix_operators=[], prefix_operators=[], qualifier=emitter, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Task %s: %s (%d run duration)"), MethodInvocation(arguments=[], member=getStatusCode, postfix_operators=[], prefix_operators=[], qualifier=status, selectors=[], type_arguments=None), MemberReference(member=task, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getDuration, postfix_operators=[], prefix_operators=[], qualifier=status, selectors=[], type_arguments=None)], member=info, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=isSuccess, postfix_operators=[], prefix_operators=[], qualifier=status, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=totalFailedTaskCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getDataSource, postfix_operators=[], prefix_operators=[], qualifier=task, selectors=[], type_arguments=None)], member=incrementAndGetLong, postfix_operators=[], prefix_operators=[], qualifier=Counters, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=totalSuccessfulTaskCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getDataSource, postfix_operators=[], prefix_operators=[], qualifier=task, selectors=[], type_arguments=None)], member=incrementAndGetLong, postfix_operators=[], prefix_operators=[], qualifier=Counters, selectors=[], type_arguments=None), label=None)]))]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to handle task status")], member=makeAlert, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="task"), MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=task, selectors=[], type_arguments=None)], member=addData, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="statusCode"), MethodInvocation(arguments=[], member=getStatusCode, postfix_operators=[], prefix_operators=[], qualifier=status, selectors=[], type_arguments=None)], member=addData, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=emit, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)], documentation=None, modifiers={'private'}, name=handleStatus, parameters=[FormalParameter(annotations=[], modifiers={'final'}, name=status, type=ReferenceType(arguments=None, dimensions=[], name=TaskStatus, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=TaskStatus, sub_type=None))], dimensions=None, name=FutureCallback, sub_type=None))]]
return[member[.statusFuture]]
end[}]
END[}] | Keyword[private] identifier[ListenableFuture] operator[<] identifier[TaskStatus] operator[>] identifier[attachCallbacks] operator[SEP] Keyword[final] identifier[Task] identifier[task] , Keyword[final] identifier[ListenableFuture] operator[<] identifier[TaskStatus] operator[>] identifier[statusFuture] operator[SEP] {
Keyword[final] identifier[ServiceMetricEvent] operator[SEP] identifier[Builder] identifier[metricBuilder] operator[=] Keyword[new] identifier[ServiceMetricEvent] operator[SEP] identifier[Builder] operator[SEP] operator[SEP] operator[SEP] identifier[IndexTaskUtils] operator[SEP] identifier[setTaskDimensions] operator[SEP] identifier[metricBuilder] , identifier[task] operator[SEP] operator[SEP] identifier[Futures] operator[SEP] identifier[addCallback] operator[SEP] identifier[statusFuture] , Keyword[new] identifier[FutureCallback] operator[<] identifier[TaskStatus] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onSuccess] operator[SEP] Keyword[final] identifier[TaskStatus] identifier[status] operator[SEP] {
identifier[log] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[status] operator[SEP] identifier[getStatusCode] operator[SEP] operator[SEP] , identifier[status] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[handleStatus] operator[SEP] identifier[status] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onFailure] operator[SEP] Keyword[final] identifier[Throwable] identifier[t] operator[SEP] {
identifier[log] operator[SEP] identifier[makeAlert] operator[SEP] identifier[t] , literal[String] operator[SEP] operator[SEP] identifier[addData] operator[SEP] literal[String] , identifier[task] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[addData] operator[SEP] literal[String] , identifier[task] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[addData] operator[SEP] literal[String] , identifier[task] operator[SEP] identifier[getDataSource] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[emit] operator[SEP] operator[SEP] operator[SEP] identifier[handleStatus] operator[SEP] identifier[TaskStatus] operator[SEP] identifier[failure] operator[SEP] identifier[task] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[private] Keyword[void] identifier[handleStatus] operator[SEP] Keyword[final] identifier[TaskStatus] identifier[status] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] operator[!] identifier[active] operator[SEP] {
identifier[log] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[task] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
identifier[notifyStatus] operator[SEP] identifier[task] , identifier[status] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[status] operator[SEP] identifier[isComplete] operator[SEP] operator[SEP] operator[SEP] {
identifier[IndexTaskUtils] operator[SEP] identifier[setTaskStatusDimensions] operator[SEP] identifier[metricBuilder] , identifier[status] operator[SEP] operator[SEP] identifier[emitter] operator[SEP] identifier[emit] operator[SEP] identifier[metricBuilder] operator[SEP] identifier[build] operator[SEP] literal[String] , identifier[status] operator[SEP] identifier[getDuration] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[status] operator[SEP] identifier[getStatusCode] operator[SEP] operator[SEP] , identifier[task] , identifier[status] operator[SEP] identifier[getDuration] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[status] operator[SEP] identifier[isSuccess] operator[SEP] operator[SEP] operator[SEP] {
identifier[Counters] operator[SEP] identifier[incrementAndGetLong] operator[SEP] identifier[totalSuccessfulTaskCount] , identifier[task] operator[SEP] identifier[getDataSource] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[Counters] operator[SEP] identifier[incrementAndGetLong] operator[SEP] identifier[totalFailedTaskCount] , identifier[task] operator[SEP] identifier[getDataSource] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[log] operator[SEP] identifier[makeAlert] operator[SEP] identifier[e] , literal[String] operator[SEP] operator[SEP] identifier[addData] operator[SEP] literal[String] , identifier[task] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[addData] operator[SEP] literal[String] , identifier[status] operator[SEP] identifier[getStatusCode] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[emit] operator[SEP] operator[SEP] operator[SEP]
}
}
} operator[SEP] operator[SEP] Keyword[return] identifier[statusFuture] operator[SEP]
}
|
public static InsertType detectInsertType(SQLiteModelMethod method) {
SQLiteDaoDefinition daoDefinition = method.getParent();
SQLiteEntity entity = method.getEntity();
TypeName beanTypeName = typeName(entity.getElement());
InsertType insertResultType = null;
// check type of arguments
int beanCounter = 0;
int beanCollectionCounter = 0;
for (Pair<String, TypeName> param : method.getParameters()) {
if (TypeUtility.isEquals(param.value1, beanTypeName)) {
beanCounter++;
} else if (TypeUtility.isCollectionOfType(param.value1, beanTypeName)) {
beanCollectionCounter++;
}
}
AssertKripton.failWithInvalidMethodSignException(method.getParameters().size() == 0, method,
" INSERT operations require at least one parameter");
if (beanCounter == 0 && beanCollectionCounter == 0) {
// method to insert raw data: no bean is used
insertResultType = InsertType.INSERT_RAW;
ModelAnnotation annotation = method.getAnnotation(BindSqlInsert.class);
// check value attribute
AssertKripton.failWithInvalidMethodSignException(
AnnotationUtility.extractAsStringArray(method, annotation, AnnotationAttributeType.FIELDS)
.size() > 0,
method, " can not use attribute %s in this kind of query definition",
AnnotationAttributeType.FIELDS.getValue());
// check excludeFields attribute
AssertKripton.failWithInvalidMethodSignException(
AnnotationUtility.extractAsStringArray(method, annotation, AnnotationAttributeType.EXCLUDED_FIELDS)
.size() > 0,
method, " can not use attribute %s in this kind of query definition",
AnnotationAttributeType.EXCLUDED_FIELDS.getValue());
// check if there is only one parameter
AssertKripton.failWithInvalidMethodSignException(method.getParameters().size() != 1
&& TypeUtility.isEquals(method.getParameters().get(0).value1, daoDefinition.getEntityClassName()),
method);
// check no
AssertKripton.failWithInvalidMethodSignException(
annotation.getAttributeAsBoolean(AnnotationAttributeType.INCLUDE_PRIMARY_KEY), method,
"attribute '%s' can not be used here", AnnotationAttributeType.INCLUDE_PRIMARY_KEY.getValue());
} else if (beanCounter == 1) {
insertResultType = InsertType.INSERT_BEAN;
AssertKripton.failWithInvalidMethodSignException(method.getParameters().size() > 1, method,
" aspected only one parameter of %s type", daoDefinition.getEntityClassName());
} else if (beanCollectionCounter == 1) {
insertResultType = InsertType.INSERT_LIST_BEAN;
AssertKripton.failWithInvalidMethodSignException(method.getParameters().size() > 1, method,
" aspected only one collection of %s type as parameter", daoDefinition.getEntityClassName());
AssertKripton.assertTrueOrInvalidMethodSignException(
TypeUtility.isCollectionOfType(method.getReturnClass(), beanTypeName)
|| TypeUtility.isEquals(method.getReturnClass(), typeName(Void.TYPE)),
method, " invalid return type for multiple insert method",
daoDefinition.getEntityClassName());
} else {
throw (new InvalidMethodSignException(method,
"only one parameter of type " + typeName(entity.getElement()) + " can be used"));
}
return insertResultType;
} | class class_name[name] begin[{]
method[detectInsertType, return_type[type[InsertType]], modifier[public static], parameter[method]] begin[{]
local_variable[type[SQLiteDaoDefinition], daoDefinition]
local_variable[type[SQLiteEntity], entity]
local_variable[type[TypeName], beanTypeName]
local_variable[type[InsertType], insertResultType]
local_variable[type[int], beanCounter]
local_variable[type[int], beanCollectionCounter]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=value1, postfix_operators=[], prefix_operators=[], qualifier=param, selectors=[]), MemberReference(member=beanTypeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isEquals, postfix_operators=[], prefix_operators=[], qualifier=TypeUtility, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=value1, postfix_operators=[], prefix_operators=[], qualifier=param, selectors=[]), MemberReference(member=beanTypeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isCollectionOfType, postfix_operators=[], prefix_operators=[], qualifier=TypeUtility, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=beanCollectionCounter, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=beanCounter, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getParameters, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=param)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=TypeName, sub_type=None))], dimensions=[], name=Pair, sub_type=None))), label=None)
call[AssertKripton.failWithInvalidMethodSignException, parameter[binary_operation[call[method.getParameters, parameter[]], ==, literal[0]], member[.method], literal[" INSERT operations require at least one parameter"]]]
if[binary_operation[binary_operation[member[.beanCounter], ==, literal[0]], &&, binary_operation[member[.beanCollectionCounter], ==, literal[0]]]] begin[{]
assign[member[.insertResultType], member[InsertType.INSERT_RAW]]
local_variable[type[ModelAnnotation], annotation]
call[AssertKripton.failWithInvalidMethodSignException, parameter[binary_operation[call[AnnotationUtility.extractAsStringArray, parameter[member[.method], member[.annotation], member[AnnotationAttributeType.FIELDS]]], >, literal[0]], member[.method], literal[" can not use attribute %s in this kind of query definition"], call[AnnotationAttributeType.FIELDS.getValue, parameter[]]]]
call[AssertKripton.failWithInvalidMethodSignException, parameter[binary_operation[call[AnnotationUtility.extractAsStringArray, parameter[member[.method], member[.annotation], member[AnnotationAttributeType.EXCLUDED_FIELDS]]], >, literal[0]], member[.method], literal[" can not use attribute %s in this kind of query definition"], call[AnnotationAttributeType.EXCLUDED_FIELDS.getValue, parameter[]]]]
call[AssertKripton.failWithInvalidMethodSignException, parameter[binary_operation[binary_operation[call[method.getParameters, parameter[]], !=, literal[1]], &&, call[TypeUtility.isEquals, parameter[call[method.getParameters, parameter[]], call[daoDefinition.getEntityClassName, parameter[]]]]], member[.method]]]
call[AssertKripton.failWithInvalidMethodSignException, parameter[call[annotation.getAttributeAsBoolean, parameter[member[AnnotationAttributeType.INCLUDE_PRIMARY_KEY]]], member[.method], literal["attribute '%s' can not be used here"], call[AnnotationAttributeType.INCLUDE_PRIMARY_KEY.getValue, parameter[]]]]
else begin[{]
if[binary_operation[member[.beanCounter], ==, literal[1]]] begin[{]
assign[member[.insertResultType], member[InsertType.INSERT_BEAN]]
call[AssertKripton.failWithInvalidMethodSignException, parameter[binary_operation[call[method.getParameters, parameter[]], >, literal[1]], member[.method], literal[" aspected only one parameter of %s type"], call[daoDefinition.getEntityClassName, parameter[]]]]
else begin[{]
if[binary_operation[member[.beanCollectionCounter], ==, literal[1]]] begin[{]
assign[member[.insertResultType], member[InsertType.INSERT_LIST_BEAN]]
call[AssertKripton.failWithInvalidMethodSignException, parameter[binary_operation[call[method.getParameters, parameter[]], >, literal[1]], member[.method], literal[" aspected only one collection of %s type as parameter"], call[daoDefinition.getEntityClassName, parameter[]]]]
call[AssertKripton.assertTrueOrInvalidMethodSignException, parameter[binary_operation[call[TypeUtility.isCollectionOfType, parameter[call[method.getReturnClass, parameter[]], member[.beanTypeName]]], ||, call[TypeUtility.isEquals, parameter[call[method.getReturnClass, parameter[]], call[.typeName, parameter[member[Void.TYPE]]]]]], member[.method], literal[" invalid return type for multiple insert method"], call[daoDefinition.getEntityClassName, parameter[]]]]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=method, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="only one parameter of type "), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getElement, postfix_operators=[], prefix_operators=[], qualifier=entity, selectors=[], type_arguments=None)], member=typeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" can be used"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InvalidMethodSignException, sub_type=None)), label=None)
end[}]
end[}]
end[}]
return[member[.insertResultType]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[InsertType] identifier[detectInsertType] operator[SEP] identifier[SQLiteModelMethod] identifier[method] operator[SEP] {
identifier[SQLiteDaoDefinition] identifier[daoDefinition] operator[=] identifier[method] operator[SEP] identifier[getParent] operator[SEP] operator[SEP] operator[SEP] identifier[SQLiteEntity] identifier[entity] operator[=] identifier[method] operator[SEP] identifier[getEntity] operator[SEP] operator[SEP] operator[SEP] identifier[TypeName] identifier[beanTypeName] operator[=] identifier[typeName] operator[SEP] identifier[entity] operator[SEP] identifier[getElement] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[InsertType] identifier[insertResultType] operator[=] Other[null] operator[SEP] Keyword[int] identifier[beanCounter] operator[=] Other[0] operator[SEP] Keyword[int] identifier[beanCollectionCounter] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[Pair] operator[<] identifier[String] , identifier[TypeName] operator[>] identifier[param] operator[:] identifier[method] operator[SEP] identifier[getParameters] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[TypeUtility] operator[SEP] identifier[isEquals] operator[SEP] identifier[param] operator[SEP] identifier[value1] , identifier[beanTypeName] operator[SEP] operator[SEP] {
identifier[beanCounter] operator[++] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[TypeUtility] operator[SEP] identifier[isCollectionOfType] operator[SEP] identifier[param] operator[SEP] identifier[value1] , identifier[beanTypeName] operator[SEP] operator[SEP] {
identifier[beanCollectionCounter] operator[++] operator[SEP]
}
}
identifier[AssertKripton] operator[SEP] identifier[failWithInvalidMethodSignException] operator[SEP] identifier[method] operator[SEP] identifier[getParameters] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[0] , identifier[method] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[beanCounter] operator[==] Other[0] operator[&&] identifier[beanCollectionCounter] operator[==] Other[0] operator[SEP] {
identifier[insertResultType] operator[=] identifier[InsertType] operator[SEP] identifier[INSERT_RAW] operator[SEP] identifier[ModelAnnotation] identifier[annotation] operator[=] identifier[method] operator[SEP] identifier[getAnnotation] operator[SEP] identifier[BindSqlInsert] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[AssertKripton] operator[SEP] identifier[failWithInvalidMethodSignException] operator[SEP] identifier[AnnotationUtility] operator[SEP] identifier[extractAsStringArray] operator[SEP] identifier[method] , identifier[annotation] , identifier[AnnotationAttributeType] operator[SEP] identifier[FIELDS] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] , identifier[method] , literal[String] , identifier[AnnotationAttributeType] operator[SEP] identifier[FIELDS] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[AssertKripton] operator[SEP] identifier[failWithInvalidMethodSignException] operator[SEP] identifier[AnnotationUtility] operator[SEP] identifier[extractAsStringArray] operator[SEP] identifier[method] , identifier[annotation] , identifier[AnnotationAttributeType] operator[SEP] identifier[EXCLUDED_FIELDS] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] , identifier[method] , literal[String] , identifier[AnnotationAttributeType] operator[SEP] identifier[EXCLUDED_FIELDS] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[AssertKripton] operator[SEP] identifier[failWithInvalidMethodSignException] operator[SEP] identifier[method] operator[SEP] identifier[getParameters] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[!=] Other[1] operator[&&] identifier[TypeUtility] operator[SEP] identifier[isEquals] operator[SEP] identifier[method] operator[SEP] identifier[getParameters] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[value1] , identifier[daoDefinition] operator[SEP] identifier[getEntityClassName] operator[SEP] operator[SEP] operator[SEP] , identifier[method] operator[SEP] operator[SEP] identifier[AssertKripton] operator[SEP] identifier[failWithInvalidMethodSignException] operator[SEP] identifier[annotation] operator[SEP] identifier[getAttributeAsBoolean] operator[SEP] identifier[AnnotationAttributeType] operator[SEP] identifier[INCLUDE_PRIMARY_KEY] operator[SEP] , identifier[method] , literal[String] , identifier[AnnotationAttributeType] operator[SEP] identifier[INCLUDE_PRIMARY_KEY] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[beanCounter] operator[==] Other[1] operator[SEP] {
identifier[insertResultType] operator[=] identifier[InsertType] operator[SEP] identifier[INSERT_BEAN] operator[SEP] identifier[AssertKripton] operator[SEP] identifier[failWithInvalidMethodSignException] operator[SEP] identifier[method] operator[SEP] identifier[getParameters] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[1] , identifier[method] , literal[String] , identifier[daoDefinition] operator[SEP] identifier[getEntityClassName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[beanCollectionCounter] operator[==] Other[1] operator[SEP] {
identifier[insertResultType] operator[=] identifier[InsertType] operator[SEP] identifier[INSERT_LIST_BEAN] operator[SEP] identifier[AssertKripton] operator[SEP] identifier[failWithInvalidMethodSignException] operator[SEP] identifier[method] operator[SEP] identifier[getParameters] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[1] , identifier[method] , literal[String] , identifier[daoDefinition] operator[SEP] identifier[getEntityClassName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[AssertKripton] operator[SEP] identifier[assertTrueOrInvalidMethodSignException] operator[SEP] identifier[TypeUtility] operator[SEP] identifier[isCollectionOfType] operator[SEP] identifier[method] operator[SEP] identifier[getReturnClass] operator[SEP] operator[SEP] , identifier[beanTypeName] operator[SEP] operator[||] identifier[TypeUtility] operator[SEP] identifier[isEquals] operator[SEP] identifier[method] operator[SEP] identifier[getReturnClass] operator[SEP] operator[SEP] , identifier[typeName] operator[SEP] identifier[Void] operator[SEP] identifier[TYPE] operator[SEP] operator[SEP] , identifier[method] , literal[String] , identifier[daoDefinition] operator[SEP] identifier[getEntityClassName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] operator[SEP] Keyword[new] identifier[InvalidMethodSignException] operator[SEP] identifier[method] , literal[String] operator[+] identifier[typeName] operator[SEP] identifier[entity] operator[SEP] identifier[getElement] operator[SEP] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[insertResultType] operator[SEP]
}
|
public static Map<FastaSequence,float[]> getDisorderScores(List<FastaSequence> sequences) {
Map<FastaSequence,float[]> results = new TreeMap<FastaSequence, float[]>();
for(FastaSequence fsequence : sequences) {
results.put(fsequence, predictSerial(fsequence));
}
return results;
} | class class_name[name] begin[{]
method[getDisorderScores, return_type[type[Map]], modifier[public static], parameter[sequences]] begin[{]
local_variable[type[Map], results]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=fsequence, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=fsequence, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=predictSerial, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=results, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=sequences, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=fsequence)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FastaSequence, sub_type=None))), label=None)
return[member[.results]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Map] operator[<] identifier[FastaSequence] , Keyword[float] operator[SEP] operator[SEP] operator[>] identifier[getDisorderScores] operator[SEP] identifier[List] operator[<] identifier[FastaSequence] operator[>] identifier[sequences] operator[SEP] {
identifier[Map] operator[<] identifier[FastaSequence] , Keyword[float] operator[SEP] operator[SEP] operator[>] identifier[results] operator[=] Keyword[new] identifier[TreeMap] operator[<] identifier[FastaSequence] , Keyword[float] operator[SEP] operator[SEP] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[FastaSequence] identifier[fsequence] operator[:] identifier[sequences] operator[SEP] {
identifier[results] operator[SEP] identifier[put] operator[SEP] identifier[fsequence] , identifier[predictSerial] operator[SEP] identifier[fsequence] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[results] operator[SEP]
}
|
@Action(
semantics = SemanticsOf.SAFE // obviously, a mistake
)
@ActionLayout(
describedAs = "'Mistakenly' annotated as being invoked with safe semantics, not annotated as a Command; should persist anyway"
)
public SomeCommandAnnotatedObject changeNameWithSafeSemantics(
@ParameterLayout(named = "New name")
final String newName) {
setName(newName);
return this;
} | class class_name[name] begin[{]
method[changeNameWithSafeSemantics, return_type[type[SomeCommandAnnotatedObject]], modifier[public], parameter[newName]] begin[{]
call[.setName, parameter[member[.newName]]]
return[THIS[]]
end[}]
END[}] | annotation[@] identifier[Action] operator[SEP] identifier[semantics] operator[=] identifier[SemanticsOf] operator[SEP] identifier[SAFE] operator[SEP] annotation[@] identifier[ActionLayout] operator[SEP] identifier[describedAs] operator[=] literal[String] operator[SEP] Keyword[public] identifier[SomeCommandAnnotatedObject] identifier[changeNameWithSafeSemantics] operator[SEP] annotation[@] identifier[ParameterLayout] operator[SEP] identifier[named] operator[=] literal[String] operator[SEP] Keyword[final] identifier[String] identifier[newName] operator[SEP] {
identifier[setName] operator[SEP] identifier[newName] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
private int awaitWork(WorkQueue w) {
int stat = 0;
if (w != null && w.scanState < 0) {
long c = ctl;
if ((int)(c >> AC_SHIFT) + (config & SMASK) <= 0)
stat = timedAwaitWork(w, c); // possibly quiescent
else if ((runState & STOP) != 0)
stat = w.qlock = -1; // pool terminating
else if (w.scanState < 0) {
w.parker = Thread.currentThread();
if (w.scanState < 0) // recheck after write
LockSupport.park(this);
w.parker = null;
if ((runState & STOP) != 0)
stat = w.qlock = -1; // recheck
else if (w.scanState < 0)
Thread.interrupted(); // clear status
}
}
return stat;
} | class class_name[name] begin[{]
method[awaitWork, return_type[type[int]], modifier[private], parameter[w]] begin[{]
local_variable[type[int], stat]
if[binary_operation[binary_operation[member[.w], !=, literal[null]], &&, binary_operation[member[w.scanState], <, literal[0]]]] begin[{]
local_variable[type[long], c]
if[binary_operation[binary_operation[Cast(expression=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=AC_SHIFT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>>), type=BasicType(dimensions=[], name=int)), +, binary_operation[member[.config], &, member[.SMASK]]], <=, literal[0]]] begin[{]
assign[member[.stat], call[.timedAwaitWork, parameter[member[.w], member[.c]]]]
else begin[{]
if[binary_operation[binary_operation[member[.runState], &, member[.STOP]], !=, literal[0]]] begin[{]
assign[member[.stat], assign[member[w.qlock], literal[1]]]
else begin[{]
if[binary_operation[member[w.scanState], <, literal[0]]] begin[{]
assign[member[w.parker], call[Thread.currentThread, parameter[]]]
if[binary_operation[member[w.scanState], <, literal[0]]] begin[{]
call[LockSupport.park, parameter[THIS[]]]
else begin[{]
None
end[}]
assign[member[w.parker], literal[null]]
if[binary_operation[binary_operation[member[.runState], &, member[.STOP]], !=, literal[0]]] begin[{]
assign[member[.stat], assign[member[w.qlock], literal[1]]]
else begin[{]
if[binary_operation[member[w.scanState], <, literal[0]]] begin[{]
call[Thread.interrupted, parameter[]]
else begin[{]
None
end[}]
end[}]
else begin[{]
None
end[}]
end[}]
end[}]
else begin[{]
None
end[}]
return[member[.stat]]
end[}]
END[}] | Keyword[private] Keyword[int] identifier[awaitWork] operator[SEP] identifier[WorkQueue] identifier[w] operator[SEP] {
Keyword[int] identifier[stat] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[w] operator[!=] Other[null] operator[&&] identifier[w] operator[SEP] identifier[scanState] operator[<] Other[0] operator[SEP] {
Keyword[long] identifier[c] operator[=] identifier[ctl] operator[SEP] Keyword[if] operator[SEP] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[c] operator[>] operator[>] identifier[AC_SHIFT] operator[SEP] operator[+] operator[SEP] identifier[config] operator[&] identifier[SMASK] operator[SEP] operator[<=] Other[0] operator[SEP] identifier[stat] operator[=] identifier[timedAwaitWork] operator[SEP] identifier[w] , identifier[c] operator[SEP] operator[SEP] Keyword[else] Keyword[if] operator[SEP] operator[SEP] identifier[runState] operator[&] identifier[STOP] operator[SEP] operator[!=] Other[0] operator[SEP] identifier[stat] operator[=] identifier[w] operator[SEP] identifier[qlock] operator[=] operator[-] Other[1] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[w] operator[SEP] identifier[scanState] operator[<] Other[0] operator[SEP] {
identifier[w] operator[SEP] identifier[parker] operator[=] identifier[Thread] operator[SEP] identifier[currentThread] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[w] operator[SEP] identifier[scanState] operator[<] Other[0] operator[SEP] identifier[LockSupport] operator[SEP] identifier[park] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[w] operator[SEP] identifier[parker] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[runState] operator[&] identifier[STOP] operator[SEP] operator[!=] Other[0] operator[SEP] identifier[stat] operator[=] identifier[w] operator[SEP] identifier[qlock] operator[=] operator[-] Other[1] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[w] operator[SEP] identifier[scanState] operator[<] Other[0] operator[SEP] identifier[Thread] operator[SEP] identifier[interrupted] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[stat] operator[SEP]
}
|
public static <U, T> StreamEx<T> ofPairs(U[] array, BiFunction<? super U, ? super U, ? extends T> mapper) {
return ofPairs(Arrays.asList(array), mapper);
} | class class_name[name] begin[{]
method[ofPairs, return_type[type[StreamEx]], modifier[public static], parameter[array, mapper]] begin[{]
return[call[.ofPairs, parameter[call[Arrays.asList, parameter[member[.array]]], member[.mapper]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[U] , identifier[T] operator[>] identifier[StreamEx] operator[<] identifier[T] operator[>] identifier[ofPairs] operator[SEP] identifier[U] operator[SEP] operator[SEP] identifier[array] , identifier[BiFunction] operator[<] operator[?] Keyword[super] identifier[U] , operator[?] Keyword[super] identifier[U] , operator[?] Keyword[extends] identifier[T] operator[>] identifier[mapper] operator[SEP] {
Keyword[return] identifier[ofPairs] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[array] operator[SEP] , identifier[mapper] operator[SEP] operator[SEP]
}
|
public BeanDefinitionHolder decorateBeanDefinitionIfRequired(Element ele,
BeanDefinitionHolder definitionHolder) {
return decorateBeanDefinitionIfRequired(ele, definitionHolder, null);
} | class class_name[name] begin[{]
method[decorateBeanDefinitionIfRequired, return_type[type[BeanDefinitionHolder]], modifier[public], parameter[ele, definitionHolder]] begin[{]
return[call[.decorateBeanDefinitionIfRequired, parameter[member[.ele], member[.definitionHolder], literal[null]]]]
end[}]
END[}] | Keyword[public] identifier[BeanDefinitionHolder] identifier[decorateBeanDefinitionIfRequired] operator[SEP] identifier[Element] identifier[ele] , identifier[BeanDefinitionHolder] identifier[definitionHolder] operator[SEP] {
Keyword[return] identifier[decorateBeanDefinitionIfRequired] operator[SEP] identifier[ele] , identifier[definitionHolder] , Other[null] operator[SEP] operator[SEP]
}
|
public Response findByIds(@NotNull @PathParam("ids") URI_ID id,
@NotNull @PathParam("ids") final PathSegment ids,
@QueryParam("include_deleted") final boolean includeDeleted) throws Exception {
final Query<MODEL> query = server.find(modelType);
final MODEL_ID firstId = tryConvertId(ids.getPath());
Set<String> idSet = ids.getMatrixParameters().keySet();
final Set<MODEL_ID> idCollection = Sets.newLinkedHashSet();
idCollection.add(firstId);
if (!idSet.isEmpty()) {
idCollection.addAll(Collections2.transform(idSet, this::tryConvertId));
}
matchedFindByIds(firstId, idCollection, includeDeleted);
Object model;
if (includeDeleted) {
query.setIncludeSoftDeletes();
}
final TxRunnable configureQuery = t -> {
configDefaultQuery(query);
configFindByIdsQuery(query, includeDeleted);
applyUriQuery(query, false);
};
if (!idSet.isEmpty()) {
model = executeTx(t -> {
configureQuery.run(t);
List<MODEL> m = query.where().idIn(idCollection.toArray()).findList();
return processFoundByIdsModelList(m, includeDeleted);
});
} else {
model = executeTx(t -> {
configureQuery.run(t);
MODEL m = query.setId(firstId).findOne();
return processFoundByIdModel(m, includeDeleted);
});
}
if (isEmptyEntity(model)) {
throw new NotFoundException();
}
return Response.ok(model).build();
} | class class_name[name] begin[{]
method[findByIds, return_type[type[Response]], modifier[public], parameter[id, ids, includeDeleted]] begin[{]
local_variable[type[Query], query]
local_variable[type[MODEL_ID], firstId]
local_variable[type[Set], idSet]
local_variable[type[Set], idCollection]
call[idCollection.add, parameter[member[.firstId]]]
if[call[idSet.isEmpty, parameter[]]] begin[{]
call[idCollection.addAll, parameter[call[Collections2.transform, parameter[member[.idSet], MethodReference(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), method=MemberReference(member=tryConvertId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type_arguments=[])]]]]
else begin[{]
None
end[}]
call[.matchedFindByIds, parameter[member[.firstId], member[.idCollection], member[.includeDeleted]]]
local_variable[type[Object], model]
if[member[.includeDeleted]] begin[{]
call[query.setIncludeSoftDeletes, parameter[]]
else begin[{]
None
end[}]
local_variable[type[TxRunnable], configureQuery]
if[call[idSet.isEmpty, parameter[]]] begin[{]
assign[member[.model], call[.executeTx, parameter[LambdaExpression(body=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=run, postfix_operators=[], prefix_operators=[], qualifier=configureQuery, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=where, postfix_operators=[], prefix_operators=[], qualifier=query, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toArray, postfix_operators=[], prefix_operators=[], qualifier=idCollection, selectors=[], type_arguments=None)], member=idIn, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=findList, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=m)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=MODEL, sub_type=None))], dimensions=[], name=List, sub_type=None)), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=m, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=includeDeleted, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=processFoundByIdsModelList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], parameters=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]]
else begin[{]
assign[member[.model], call[.executeTx, parameter[LambdaExpression(body=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=run, postfix_operators=[], prefix_operators=[], qualifier=configureQuery, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=firstId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setId, postfix_operators=[], prefix_operators=[], qualifier=query, selectors=[MethodInvocation(arguments=[], member=findOne, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=m)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MODEL, sub_type=None)), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=m, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=includeDeleted, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=processFoundByIdModel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], parameters=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]]
end[}]
if[call[.isEmptyEntity, parameter[member[.model]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NotFoundException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[call[Response.ok, parameter[member[.model]]]]
end[}]
END[}] | Keyword[public] identifier[Response] identifier[findByIds] operator[SEP] annotation[@] identifier[NotNull] annotation[@] identifier[PathParam] operator[SEP] literal[String] operator[SEP] identifier[URI_ID] identifier[id] , annotation[@] identifier[NotNull] annotation[@] identifier[PathParam] operator[SEP] literal[String] operator[SEP] Keyword[final] identifier[PathSegment] identifier[ids] , annotation[@] identifier[QueryParam] operator[SEP] literal[String] operator[SEP] Keyword[final] Keyword[boolean] identifier[includeDeleted] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[final] identifier[Query] operator[<] identifier[MODEL] operator[>] identifier[query] operator[=] identifier[server] operator[SEP] identifier[find] operator[SEP] identifier[modelType] operator[SEP] operator[SEP] Keyword[final] identifier[MODEL_ID] identifier[firstId] operator[=] identifier[tryConvertId] operator[SEP] identifier[ids] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Set] operator[<] identifier[String] operator[>] identifier[idSet] operator[=] identifier[ids] operator[SEP] identifier[getMatrixParameters] operator[SEP] operator[SEP] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Set] operator[<] identifier[MODEL_ID] operator[>] identifier[idCollection] operator[=] identifier[Sets] operator[SEP] identifier[newLinkedHashSet] operator[SEP] operator[SEP] operator[SEP] identifier[idCollection] operator[SEP] identifier[add] operator[SEP] identifier[firstId] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[idSet] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[idCollection] operator[SEP] identifier[addAll] operator[SEP] identifier[Collections2] operator[SEP] identifier[transform] operator[SEP] identifier[idSet] , Keyword[this] operator[::] identifier[tryConvertId] operator[SEP] operator[SEP] operator[SEP]
}
identifier[matchedFindByIds] operator[SEP] identifier[firstId] , identifier[idCollection] , identifier[includeDeleted] operator[SEP] operator[SEP] identifier[Object] identifier[model] operator[SEP] Keyword[if] operator[SEP] identifier[includeDeleted] operator[SEP] {
identifier[query] operator[SEP] identifier[setIncludeSoftDeletes] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[final] identifier[TxRunnable] identifier[configureQuery] operator[=] identifier[t] operator[->] {
identifier[configDefaultQuery] operator[SEP] identifier[query] operator[SEP] operator[SEP] identifier[configFindByIdsQuery] operator[SEP] identifier[query] , identifier[includeDeleted] operator[SEP] operator[SEP] identifier[applyUriQuery] operator[SEP] identifier[query] , literal[boolean] operator[SEP] operator[SEP]
} operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[idSet] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[model] operator[=] identifier[executeTx] operator[SEP] identifier[t] operator[->] {
identifier[configureQuery] operator[SEP] identifier[run] operator[SEP] identifier[t] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[MODEL] operator[>] identifier[m] operator[=] identifier[query] operator[SEP] identifier[where] operator[SEP] operator[SEP] operator[SEP] identifier[idIn] operator[SEP] identifier[idCollection] operator[SEP] identifier[toArray] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[findList] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[processFoundByIdsModelList] operator[SEP] identifier[m] , identifier[includeDeleted] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[model] operator[=] identifier[executeTx] operator[SEP] identifier[t] operator[->] {
identifier[configureQuery] operator[SEP] identifier[run] operator[SEP] identifier[t] operator[SEP] operator[SEP] identifier[MODEL] identifier[m] operator[=] identifier[query] operator[SEP] identifier[setId] operator[SEP] identifier[firstId] operator[SEP] operator[SEP] identifier[findOne] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[processFoundByIdModel] operator[SEP] identifier[m] , identifier[includeDeleted] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[isEmptyEntity] operator[SEP] identifier[model] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NotFoundException] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[Response] operator[SEP] identifier[ok] operator[SEP] identifier[model] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
|
protected void loadPosition()
{
CSSDecoder dec = new CSSDecoder(ctx);
int contw = getContainingBlock().width;
int conth = getContainingBlock().height;
CSSProperty.Top ptop = style.getProperty("top");
CSSProperty.Right pright = style.getProperty("right");
CSSProperty.Bottom pbottom = style.getProperty("bottom");
CSSProperty.Left pleft = style.getProperty("left");
topset = !(ptop == null || ptop == CSSProperty.Top.AUTO);
rightset = !(pright == null || pright == CSSProperty.Right.AUTO);
bottomset = !(pbottom == null || pbottom == CSSProperty.Bottom.AUTO);
leftset = !(pleft == null || pleft == CSSProperty.Left.AUTO);
coords = new LengthSet();
if (topset)
coords.top = dec.getLength(getLengthValue("top"), (ptop == CSSProperty.Top.AUTO), 0, 0, conth);
if (rightset)
coords.right = dec.getLength(getLengthValue("right"), (pright == CSSProperty.Right.AUTO), 0, 0, contw);
if (bottomset)
coords.bottom = dec.getLength(getLengthValue("bottom"), (pbottom == CSSProperty.Bottom.AUTO), 0, 0, conth);
if (leftset)
coords.left = dec.getLength(getLengthValue("left"), (pleft == CSSProperty.Left.AUTO), 0, 0, contw);
} | class class_name[name] begin[{]
method[loadPosition, return_type[void], modifier[protected], parameter[]] begin[{]
local_variable[type[CSSDecoder], dec]
local_variable[type[int], contw]
local_variable[type[int], conth]
local_variable[type[CSSProperty], ptop]
local_variable[type[CSSProperty], pright]
local_variable[type[CSSProperty], pbottom]
local_variable[type[CSSProperty], pleft]
assign[member[.topset], binary_operation[binary_operation[member[.ptop], ==, literal[null]], ||, binary_operation[member[.ptop], ==, member[CSSProperty.Top.AUTO]]]]
assign[member[.rightset], binary_operation[binary_operation[member[.pright], ==, literal[null]], ||, binary_operation[member[.pright], ==, member[CSSProperty.Right.AUTO]]]]
assign[member[.bottomset], binary_operation[binary_operation[member[.pbottom], ==, literal[null]], ||, binary_operation[member[.pbottom], ==, member[CSSProperty.Bottom.AUTO]]]]
assign[member[.leftset], binary_operation[binary_operation[member[.pleft], ==, literal[null]], ||, binary_operation[member[.pleft], ==, member[CSSProperty.Left.AUTO]]]]
assign[member[.coords], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LengthSet, sub_type=None))]
if[member[.topset]] begin[{]
assign[member[coords.top], call[dec.getLength, parameter[call[.getLengthValue, parameter[literal["top"]]], binary_operation[member[.ptop], ==, member[CSSProperty.Top.AUTO]], literal[0], literal[0], member[.conth]]]]
else begin[{]
None
end[}]
if[member[.rightset]] begin[{]
assign[member[coords.right], call[dec.getLength, parameter[call[.getLengthValue, parameter[literal["right"]]], binary_operation[member[.pright], ==, member[CSSProperty.Right.AUTO]], literal[0], literal[0], member[.contw]]]]
else begin[{]
None
end[}]
if[member[.bottomset]] begin[{]
assign[member[coords.bottom], call[dec.getLength, parameter[call[.getLengthValue, parameter[literal["bottom"]]], binary_operation[member[.pbottom], ==, member[CSSProperty.Bottom.AUTO]], literal[0], literal[0], member[.conth]]]]
else begin[{]
None
end[}]
if[member[.leftset]] begin[{]
assign[member[coords.left], call[dec.getLength, parameter[call[.getLengthValue, parameter[literal["left"]]], binary_operation[member[.pleft], ==, member[CSSProperty.Left.AUTO]], literal[0], literal[0], member[.contw]]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[loadPosition] operator[SEP] operator[SEP] {
identifier[CSSDecoder] identifier[dec] operator[=] Keyword[new] identifier[CSSDecoder] operator[SEP] identifier[ctx] operator[SEP] operator[SEP] Keyword[int] identifier[contw] operator[=] identifier[getContainingBlock] operator[SEP] operator[SEP] operator[SEP] identifier[width] operator[SEP] Keyword[int] identifier[conth] operator[=] identifier[getContainingBlock] operator[SEP] operator[SEP] operator[SEP] identifier[height] operator[SEP] identifier[CSSProperty] operator[SEP] identifier[Top] identifier[ptop] operator[=] identifier[style] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[CSSProperty] operator[SEP] identifier[Right] identifier[pright] operator[=] identifier[style] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[CSSProperty] operator[SEP] identifier[Bottom] identifier[pbottom] operator[=] identifier[style] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[CSSProperty] operator[SEP] identifier[Left] identifier[pleft] operator[=] identifier[style] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[topset] operator[=] operator[!] operator[SEP] identifier[ptop] operator[==] Other[null] operator[||] identifier[ptop] operator[==] identifier[CSSProperty] operator[SEP] identifier[Top] operator[SEP] identifier[AUTO] operator[SEP] operator[SEP] identifier[rightset] operator[=] operator[!] operator[SEP] identifier[pright] operator[==] Other[null] operator[||] identifier[pright] operator[==] identifier[CSSProperty] operator[SEP] identifier[Right] operator[SEP] identifier[AUTO] operator[SEP] operator[SEP] identifier[bottomset] operator[=] operator[!] operator[SEP] identifier[pbottom] operator[==] Other[null] operator[||] identifier[pbottom] operator[==] identifier[CSSProperty] operator[SEP] identifier[Bottom] operator[SEP] identifier[AUTO] operator[SEP] operator[SEP] identifier[leftset] operator[=] operator[!] operator[SEP] identifier[pleft] operator[==] Other[null] operator[||] identifier[pleft] operator[==] identifier[CSSProperty] operator[SEP] identifier[Left] operator[SEP] identifier[AUTO] operator[SEP] operator[SEP] identifier[coords] operator[=] Keyword[new] identifier[LengthSet] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[topset] operator[SEP] identifier[coords] operator[SEP] identifier[top] operator[=] identifier[dec] operator[SEP] identifier[getLength] operator[SEP] identifier[getLengthValue] operator[SEP] literal[String] operator[SEP] , operator[SEP] identifier[ptop] operator[==] identifier[CSSProperty] operator[SEP] identifier[Top] operator[SEP] identifier[AUTO] operator[SEP] , Other[0] , Other[0] , identifier[conth] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[rightset] operator[SEP] identifier[coords] operator[SEP] identifier[right] operator[=] identifier[dec] operator[SEP] identifier[getLength] operator[SEP] identifier[getLengthValue] operator[SEP] literal[String] operator[SEP] , operator[SEP] identifier[pright] operator[==] identifier[CSSProperty] operator[SEP] identifier[Right] operator[SEP] identifier[AUTO] operator[SEP] , Other[0] , Other[0] , identifier[contw] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bottomset] operator[SEP] identifier[coords] operator[SEP] identifier[bottom] operator[=] identifier[dec] operator[SEP] identifier[getLength] operator[SEP] identifier[getLengthValue] operator[SEP] literal[String] operator[SEP] , operator[SEP] identifier[pbottom] operator[==] identifier[CSSProperty] operator[SEP] identifier[Bottom] operator[SEP] identifier[AUTO] operator[SEP] , Other[0] , Other[0] , identifier[conth] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[leftset] operator[SEP] identifier[coords] operator[SEP] identifier[left] operator[=] identifier[dec] operator[SEP] identifier[getLength] operator[SEP] identifier[getLengthValue] operator[SEP] literal[String] operator[SEP] , operator[SEP] identifier[pleft] operator[==] identifier[CSSProperty] operator[SEP] identifier[Left] operator[SEP] identifier[AUTO] operator[SEP] , Other[0] , Other[0] , identifier[contw] operator[SEP] operator[SEP]
}
|
private INDArray asMatrix(BytePointer bytes, long length) throws IOException {
PIXA pixa;
pixa = pixaReadMemMultipageTiff(bytes, length);
INDArray data;
INDArray currentD;
INDArrayIndex[] index = null;
switch (this.multiPageMode) {
case MINIBATCH:
data = Nd4j.create(pixa.n(), 1, pixa.pix(0).h(), pixa.pix(0).w());
break;
case CHANNELS:
data = Nd4j.create(1, pixa.n(), pixa.pix(0).h(), pixa.pix(0).w());
break;
case FIRST:
data = Nd4j.create(1, 1, pixa.pix(0).h(), pixa.pix(0).w());
PIX pix = pixa.pix(0);
currentD = asMatrix(convert(pix));
pixDestroy(pix);
index = new INDArrayIndex[]{NDArrayIndex.point(0), NDArrayIndex.point(0),NDArrayIndex.all(),NDArrayIndex.all()};
data.put(index , currentD.get(NDArrayIndex.all(), NDArrayIndex.all(),NDArrayIndex.all()));
return data;
default: throw new UnsupportedOperationException("Unsupported MultiPageMode: " + multiPageMode);
}
for (int i = 0; i < pixa.n(); i++) {
PIX pix = pixa.pix(i);
currentD = asMatrix(convert(pix));
pixDestroy(pix);
//TODO to change when 16-bit image is supported
switch (this.multiPageMode) {
case MINIBATCH:
index = new INDArrayIndex[]{NDArrayIndex.point(i), NDArrayIndex.all(),NDArrayIndex.all(),NDArrayIndex.all()};
break;
case CHANNELS:
index = new INDArrayIndex[]{NDArrayIndex.all(), NDArrayIndex.point(i),NDArrayIndex.all(),NDArrayIndex.all()};
break;
default: throw new UnsupportedOperationException("Unsupported MultiPageMode: " + multiPageMode);
}
data.put(index , currentD.get(NDArrayIndex.all(), NDArrayIndex.all(),NDArrayIndex.all()));
}
return data;
} | class class_name[name] begin[{]
method[asMatrix, return_type[type[INDArray]], modifier[private], parameter[bytes, length]] begin[{]
local_variable[type[PIXA], pixa]
assign[member[.pixa], call[.pixaReadMemMultipageTiff, parameter[member[.bytes], member[.length]]]]
local_variable[type[INDArray], data]
local_variable[type[INDArray], currentD]
local_variable[type[INDArrayIndex], index]
SwitchStatement(cases=[SwitchStatementCase(case=['MINIBATCH'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=n, postfix_operators=[], prefix_operators=[], qualifier=pixa, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=pix, postfix_operators=[], prefix_operators=[], qualifier=pixa, selectors=[MethodInvocation(arguments=[], member=h, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=pix, postfix_operators=[], prefix_operators=[], qualifier=pixa, selectors=[MethodInvocation(arguments=[], member=w, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=create, postfix_operators=[], prefix_operators=[], qualifier=Nd4j, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['CHANNELS'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), MethodInvocation(arguments=[], member=n, postfix_operators=[], prefix_operators=[], qualifier=pixa, selectors=[], type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=pix, postfix_operators=[], prefix_operators=[], qualifier=pixa, selectors=[MethodInvocation(arguments=[], member=h, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=pix, postfix_operators=[], prefix_operators=[], qualifier=pixa, selectors=[MethodInvocation(arguments=[], member=w, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=create, postfix_operators=[], prefix_operators=[], qualifier=Nd4j, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['FIRST'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=pix, postfix_operators=[], prefix_operators=[], qualifier=pixa, selectors=[MethodInvocation(arguments=[], member=h, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=pix, postfix_operators=[], prefix_operators=[], qualifier=pixa, selectors=[MethodInvocation(arguments=[], member=w, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=create, postfix_operators=[], prefix_operators=[], qualifier=Nd4j, selectors=[], type_arguments=None)), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=pix, postfix_operators=[], prefix_operators=[], qualifier=pixa, selectors=[], type_arguments=None), name=pix)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=PIX, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=currentD, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=pix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=convert, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=asMatrix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=pix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=pixDestroy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=point, postfix_operators=[], prefix_operators=[], qualifier=NDArrayIndex, selectors=[], type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=point, postfix_operators=[], prefix_operators=[], qualifier=NDArrayIndex, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=all, postfix_operators=[], prefix_operators=[], qualifier=NDArrayIndex, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=all, postfix_operators=[], prefix_operators=[], qualifier=NDArrayIndex, selectors=[], type_arguments=None)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=INDArrayIndex, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=all, postfix_operators=[], prefix_operators=[], qualifier=NDArrayIndex, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=all, postfix_operators=[], prefix_operators=[], qualifier=NDArrayIndex, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=all, postfix_operators=[], prefix_operators=[], qualifier=NDArrayIndex, selectors=[], type_arguments=None)], member=get, postfix_operators=[], prefix_operators=[], qualifier=currentD, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unsupported MultiPageMode: "), operandr=MemberReference(member=multiPageMode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UnsupportedOperationException, sub_type=None)), label=None)])], expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=multiPageMode, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), label=None)
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=pix, postfix_operators=[], prefix_operators=[], qualifier=pixa, selectors=[], type_arguments=None), name=pix)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=PIX, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=currentD, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=pix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=convert, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=asMatrix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=pix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=pixDestroy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), SwitchStatement(cases=[SwitchStatementCase(case=['MINIBATCH'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=point, postfix_operators=[], prefix_operators=[], qualifier=NDArrayIndex, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=all, postfix_operators=[], prefix_operators=[], qualifier=NDArrayIndex, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=all, postfix_operators=[], prefix_operators=[], qualifier=NDArrayIndex, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=all, postfix_operators=[], prefix_operators=[], qualifier=NDArrayIndex, selectors=[], type_arguments=None)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=INDArrayIndex, sub_type=None))), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['CHANNELS'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MethodInvocation(arguments=[], member=all, postfix_operators=[], prefix_operators=[], qualifier=NDArrayIndex, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=point, postfix_operators=[], prefix_operators=[], qualifier=NDArrayIndex, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=all, postfix_operators=[], prefix_operators=[], qualifier=NDArrayIndex, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=all, postfix_operators=[], prefix_operators=[], qualifier=NDArrayIndex, selectors=[], type_arguments=None)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=INDArrayIndex, sub_type=None))), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unsupported MultiPageMode: "), operandr=MemberReference(member=multiPageMode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UnsupportedOperationException, sub_type=None)), label=None)])], expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=multiPageMode, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=all, postfix_operators=[], prefix_operators=[], qualifier=NDArrayIndex, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=all, postfix_operators=[], prefix_operators=[], qualifier=NDArrayIndex, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=all, postfix_operators=[], prefix_operators=[], qualifier=NDArrayIndex, selectors=[], type_arguments=None)], member=get, postfix_operators=[], prefix_operators=[], qualifier=currentD, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=n, postfix_operators=[], prefix_operators=[], qualifier=pixa, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.data]]
end[}]
END[}] | Keyword[private] identifier[INDArray] identifier[asMatrix] operator[SEP] identifier[BytePointer] identifier[bytes] , Keyword[long] identifier[length] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[PIXA] identifier[pixa] operator[SEP] identifier[pixa] operator[=] identifier[pixaReadMemMultipageTiff] operator[SEP] identifier[bytes] , identifier[length] operator[SEP] operator[SEP] identifier[INDArray] identifier[data] operator[SEP] identifier[INDArray] identifier[currentD] operator[SEP] identifier[INDArrayIndex] operator[SEP] operator[SEP] identifier[index] operator[=] Other[null] operator[SEP] Keyword[switch] operator[SEP] Keyword[this] operator[SEP] identifier[multiPageMode] operator[SEP] {
Keyword[case] identifier[MINIBATCH] operator[:] identifier[data] operator[=] identifier[Nd4j] operator[SEP] identifier[create] operator[SEP] identifier[pixa] operator[SEP] identifier[n] operator[SEP] operator[SEP] , Other[1] , identifier[pixa] operator[SEP] identifier[pix] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[h] operator[SEP] operator[SEP] , identifier[pixa] operator[SEP] identifier[pix] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[w] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[CHANNELS] operator[:] identifier[data] operator[=] identifier[Nd4j] operator[SEP] identifier[create] operator[SEP] Other[1] , identifier[pixa] operator[SEP] identifier[n] operator[SEP] operator[SEP] , identifier[pixa] operator[SEP] identifier[pix] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[h] operator[SEP] operator[SEP] , identifier[pixa] operator[SEP] identifier[pix] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[w] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[FIRST] operator[:] identifier[data] operator[=] identifier[Nd4j] operator[SEP] identifier[create] operator[SEP] Other[1] , Other[1] , identifier[pixa] operator[SEP] identifier[pix] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[h] operator[SEP] operator[SEP] , identifier[pixa] operator[SEP] identifier[pix] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[w] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[PIX] identifier[pix] operator[=] identifier[pixa] operator[SEP] identifier[pix] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[currentD] operator[=] identifier[asMatrix] operator[SEP] identifier[convert] operator[SEP] identifier[pix] operator[SEP] operator[SEP] operator[SEP] identifier[pixDestroy] operator[SEP] identifier[pix] operator[SEP] operator[SEP] identifier[index] operator[=] Keyword[new] identifier[INDArrayIndex] operator[SEP] operator[SEP] {
identifier[NDArrayIndex] operator[SEP] identifier[point] operator[SEP] Other[0] operator[SEP] , identifier[NDArrayIndex] operator[SEP] identifier[point] operator[SEP] Other[0] operator[SEP] , identifier[NDArrayIndex] operator[SEP] identifier[all] operator[SEP] operator[SEP] , identifier[NDArrayIndex] operator[SEP] identifier[all] operator[SEP] operator[SEP]
} operator[SEP] identifier[data] operator[SEP] identifier[put] operator[SEP] identifier[index] , identifier[currentD] operator[SEP] identifier[get] operator[SEP] identifier[NDArrayIndex] operator[SEP] identifier[all] operator[SEP] operator[SEP] , identifier[NDArrayIndex] operator[SEP] identifier[all] operator[SEP] operator[SEP] , identifier[NDArrayIndex] operator[SEP] identifier[all] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[data] operator[SEP] Keyword[default] operator[:] Keyword[throw] Keyword[new] identifier[UnsupportedOperationException] operator[SEP] literal[String] operator[+] identifier[multiPageMode] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[pixa] operator[SEP] identifier[n] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[PIX] identifier[pix] operator[=] identifier[pixa] operator[SEP] identifier[pix] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[currentD] operator[=] identifier[asMatrix] operator[SEP] identifier[convert] operator[SEP] identifier[pix] operator[SEP] operator[SEP] operator[SEP] identifier[pixDestroy] operator[SEP] identifier[pix] operator[SEP] operator[SEP] Keyword[switch] operator[SEP] Keyword[this] operator[SEP] identifier[multiPageMode] operator[SEP] {
Keyword[case] identifier[MINIBATCH] operator[:] identifier[index] operator[=] Keyword[new] identifier[INDArrayIndex] operator[SEP] operator[SEP] {
identifier[NDArrayIndex] operator[SEP] identifier[point] operator[SEP] identifier[i] operator[SEP] , identifier[NDArrayIndex] operator[SEP] identifier[all] operator[SEP] operator[SEP] , identifier[NDArrayIndex] operator[SEP] identifier[all] operator[SEP] operator[SEP] , identifier[NDArrayIndex] operator[SEP] identifier[all] operator[SEP] operator[SEP]
} operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[CHANNELS] operator[:] identifier[index] operator[=] Keyword[new] identifier[INDArrayIndex] operator[SEP] operator[SEP] {
identifier[NDArrayIndex] operator[SEP] identifier[all] operator[SEP] operator[SEP] , identifier[NDArrayIndex] operator[SEP] identifier[point] operator[SEP] identifier[i] operator[SEP] , identifier[NDArrayIndex] operator[SEP] identifier[all] operator[SEP] operator[SEP] , identifier[NDArrayIndex] operator[SEP] identifier[all] operator[SEP] operator[SEP]
} operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[throw] Keyword[new] identifier[UnsupportedOperationException] operator[SEP] literal[String] operator[+] identifier[multiPageMode] operator[SEP] operator[SEP]
}
identifier[data] operator[SEP] identifier[put] operator[SEP] identifier[index] , identifier[currentD] operator[SEP] identifier[get] operator[SEP] identifier[NDArrayIndex] operator[SEP] identifier[all] operator[SEP] operator[SEP] , identifier[NDArrayIndex] operator[SEP] identifier[all] operator[SEP] operator[SEP] , identifier[NDArrayIndex] operator[SEP] identifier[all] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[data] operator[SEP]
}
|
@Override
public ORecordIteratorCluster<REC> begin() {
browsedRecords = 0;
updateRangesOnLiveUpdate();
resetCurrentPosition();
currentRecord = readCurrentRecord(getRecord(), +1);
return this;
} | class class_name[name] begin[{]
method[begin, return_type[type[ORecordIteratorCluster]], modifier[public], parameter[]] begin[{]
assign[member[.browsedRecords], literal[0]]
call[.updateRangesOnLiveUpdate, parameter[]]
call[.resetCurrentPosition, parameter[]]
assign[member[.currentRecord], call[.readCurrentRecord, parameter[call[.getRecord, parameter[]], literal[1]]]]
return[THIS[]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[ORecordIteratorCluster] operator[<] identifier[REC] operator[>] identifier[begin] operator[SEP] operator[SEP] {
identifier[browsedRecords] operator[=] Other[0] operator[SEP] identifier[updateRangesOnLiveUpdate] operator[SEP] operator[SEP] operator[SEP] identifier[resetCurrentPosition] operator[SEP] operator[SEP] operator[SEP] identifier[currentRecord] operator[=] identifier[readCurrentRecord] operator[SEP] identifier[getRecord] operator[SEP] operator[SEP] , operator[+] Other[1] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public static base_response add(nitro_service client, dnssoarec resource) throws Exception {
dnssoarec addresource = new dnssoarec();
addresource.domain = resource.domain;
addresource.originserver = resource.originserver;
addresource.contact = resource.contact;
addresource.serial = resource.serial;
addresource.refresh = resource.refresh;
addresource.retry = resource.retry;
addresource.expire = resource.expire;
addresource.minimum = resource.minimum;
addresource.ttl = resource.ttl;
return addresource.add_resource(client);
} | class class_name[name] begin[{]
method[add, return_type[type[base_response]], modifier[public static], parameter[client, resource]] begin[{]
local_variable[type[dnssoarec], addresource]
assign[member[addresource.domain], member[resource.domain]]
assign[member[addresource.originserver], member[resource.originserver]]
assign[member[addresource.contact], member[resource.contact]]
assign[member[addresource.serial], member[resource.serial]]
assign[member[addresource.refresh], member[resource.refresh]]
assign[member[addresource.retry], member[resource.retry]]
assign[member[addresource.expire], member[resource.expire]]
assign[member[addresource.minimum], member[resource.minimum]]
assign[member[addresource.ttl], member[resource.ttl]]
return[call[addresource.add_resource, parameter[member[.client]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[base_response] identifier[add] operator[SEP] identifier[nitro_service] identifier[client] , identifier[dnssoarec] identifier[resource] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[dnssoarec] identifier[addresource] operator[=] Keyword[new] identifier[dnssoarec] operator[SEP] operator[SEP] operator[SEP] identifier[addresource] operator[SEP] identifier[domain] operator[=] identifier[resource] operator[SEP] identifier[domain] operator[SEP] identifier[addresource] operator[SEP] identifier[originserver] operator[=] identifier[resource] operator[SEP] identifier[originserver] operator[SEP] identifier[addresource] operator[SEP] identifier[contact] operator[=] identifier[resource] operator[SEP] identifier[contact] operator[SEP] identifier[addresource] operator[SEP] identifier[serial] operator[=] identifier[resource] operator[SEP] identifier[serial] operator[SEP] identifier[addresource] operator[SEP] identifier[refresh] operator[=] identifier[resource] operator[SEP] identifier[refresh] operator[SEP] identifier[addresource] operator[SEP] identifier[retry] operator[=] identifier[resource] operator[SEP] identifier[retry] operator[SEP] identifier[addresource] operator[SEP] identifier[expire] operator[=] identifier[resource] operator[SEP] identifier[expire] operator[SEP] identifier[addresource] operator[SEP] identifier[minimum] operator[=] identifier[resource] operator[SEP] identifier[minimum] operator[SEP] identifier[addresource] operator[SEP] identifier[ttl] operator[=] identifier[resource] operator[SEP] identifier[ttl] operator[SEP] Keyword[return] identifier[addresource] operator[SEP] identifier[add_resource] operator[SEP] identifier[client] operator[SEP] operator[SEP]
}
|
private String encode(Object value) {
return BaseEncoding.base16().encode(valueSerializer.encode(value));
} | class class_name[name] begin[{]
method[encode, return_type[type[String]], modifier[private], parameter[value]] begin[{]
return[call[BaseEncoding.base16, parameter[]]]
end[}]
END[}] | Keyword[private] identifier[String] identifier[encode] operator[SEP] identifier[Object] identifier[value] operator[SEP] {
Keyword[return] identifier[BaseEncoding] operator[SEP] identifier[base16] operator[SEP] operator[SEP] operator[SEP] identifier[encode] operator[SEP] identifier[valueSerializer] operator[SEP] identifier[encode] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP]
}
|
public static void phase( ImageInterleaved transform , GrayF phase ) {
if( transform instanceof InterleavedF32 ) {
DiscreteFourierTransformOps.phase((InterleavedF32) transform, (GrayF32) phase);
} else if( transform instanceof InterleavedF64 ) {
DiscreteFourierTransformOps.phase((InterleavedF64) transform, (GrayF64) phase);
} else {
throw new IllegalArgumentException("Unknown image type");
}
} | class class_name[name] begin[{]
method[phase, return_type[void], modifier[public static], parameter[transform, phase]] begin[{]
if[binary_operation[member[.transform], instanceof, type[InterleavedF32]]] begin[{]
call[DiscreteFourierTransformOps.phase, parameter[Cast(expression=MemberReference(member=transform, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=InterleavedF32, sub_type=None)), Cast(expression=MemberReference(member=phase, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=GrayF32, sub_type=None))]]
else begin[{]
if[binary_operation[member[.transform], instanceof, type[InterleavedF64]]] begin[{]
call[DiscreteFourierTransformOps.phase, parameter[Cast(expression=MemberReference(member=transform, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=InterleavedF64, sub_type=None)), Cast(expression=MemberReference(member=phase, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=GrayF64, sub_type=None))]]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unknown image type")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[phase] operator[SEP] identifier[ImageInterleaved] identifier[transform] , identifier[GrayF] identifier[phase] operator[SEP] {
Keyword[if] operator[SEP] identifier[transform] Keyword[instanceof] identifier[InterleavedF32] operator[SEP] {
identifier[DiscreteFourierTransformOps] operator[SEP] identifier[phase] operator[SEP] operator[SEP] identifier[InterleavedF32] operator[SEP] identifier[transform] , operator[SEP] identifier[GrayF32] operator[SEP] identifier[phase] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[transform] Keyword[instanceof] identifier[InterleavedF64] operator[SEP] {
identifier[DiscreteFourierTransformOps] operator[SEP] identifier[phase] operator[SEP] operator[SEP] identifier[InterleavedF64] operator[SEP] identifier[transform] , operator[SEP] identifier[GrayF64] operator[SEP] identifier[phase] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
|
public void parse(byte[] data) throws ParseException {
Text text = new Text();
text.strain(data, 0, data.length);
init(text);
} | class class_name[name] begin[{]
method[parse, return_type[void], modifier[public], parameter[data]] begin[{]
local_variable[type[Text], text]
call[text.strain, parameter[member[.data], literal[0], member[data.length]]]
call[.init, parameter[member[.text]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[parse] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[data] operator[SEP] Keyword[throws] identifier[ParseException] {
identifier[Text] identifier[text] operator[=] Keyword[new] identifier[Text] operator[SEP] operator[SEP] operator[SEP] identifier[text] operator[SEP] identifier[strain] operator[SEP] identifier[data] , Other[0] , identifier[data] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[init] operator[SEP] identifier[text] operator[SEP] operator[SEP]
}
|
public ManagedInstanceInner getByResourceGroup(String resourceGroupName, String managedInstanceName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, managedInstanceName).toBlocking().single().body();
} | class class_name[name] begin[{]
method[getByResourceGroup, return_type[type[ManagedInstanceInner]], modifier[public], parameter[resourceGroupName, managedInstanceName]] begin[{]
return[call[.getByResourceGroupWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.managedInstanceName]]]]
end[}]
END[}] | Keyword[public] identifier[ManagedInstanceInner] identifier[getByResourceGroup] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[managedInstanceName] operator[SEP] {
Keyword[return] identifier[getByResourceGroupWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[managedInstanceName] operator[SEP] operator[SEP] identifier[toBlocking] operator[SEP] operator[SEP] operator[SEP] identifier[single] operator[SEP] operator[SEP] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
|
public static List<double[]> op(@javax.annotation.Nonnull final List<double[]> a, @javax.annotation.Nonnull final List<double[]> b, @javax.annotation.Nonnull final DoubleBinaryOperator fn) {
assert a.size() == b.size();
return IntStream.range(0, a.size()).parallel().mapToObj(i -> {
assert a.get(i).length == b.get(i).length;
@javax.annotation.Nonnull final double[] c = new double[a.get(i).length];
for (int j = 0; j < a.get(i).length; j++) {
c[j] = fn.applyAsDouble(a.get(i)[j], b.get(i)[j]);
}
return c;
}).collect(Collectors.toList());
} | class class_name[name] begin[{]
method[op, return_type[type[List]], modifier[public static], parameter[a, b, fn]] begin[{]
AssertStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=a, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=b, selectors=[], type_arguments=None), operator===), label=None, value=None)
return[call[IntStream.range, parameter[literal[0], call[a.size, parameter[]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[List] operator[<] Keyword[double] operator[SEP] operator[SEP] operator[>] identifier[op] operator[SEP] annotation[@] identifier[javax] operator[SEP] identifier[annotation] operator[SEP] identifier[Nonnull] Keyword[final] identifier[List] operator[<] Keyword[double] operator[SEP] operator[SEP] operator[>] identifier[a] , annotation[@] identifier[javax] operator[SEP] identifier[annotation] operator[SEP] identifier[Nonnull] Keyword[final] identifier[List] operator[<] Keyword[double] operator[SEP] operator[SEP] operator[>] identifier[b] , annotation[@] identifier[javax] operator[SEP] identifier[annotation] operator[SEP] identifier[Nonnull] Keyword[final] identifier[DoubleBinaryOperator] identifier[fn] operator[SEP] {
Keyword[assert] identifier[a] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] identifier[b] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[IntStream] operator[SEP] identifier[range] operator[SEP] Other[0] , identifier[a] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[parallel] operator[SEP] operator[SEP] operator[SEP] identifier[mapToObj] operator[SEP] identifier[i] operator[->] {
Keyword[assert] identifier[a] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[length] operator[==] identifier[b] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[length] operator[SEP] annotation[@] identifier[javax] operator[SEP] identifier[annotation] operator[SEP] identifier[Nonnull] Keyword[final] Keyword[double] operator[SEP] operator[SEP] identifier[c] operator[=] Keyword[new] Keyword[double] operator[SEP] identifier[a] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] Other[0] operator[SEP] identifier[j] operator[<] identifier[a] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[length] operator[SEP] identifier[j] operator[++] operator[SEP] {
identifier[c] operator[SEP] identifier[j] operator[SEP] operator[=] identifier[fn] operator[SEP] identifier[applyAsDouble] operator[SEP] identifier[a] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[j] operator[SEP] , identifier[b] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[j] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[c] operator[SEP]
} operator[SEP] operator[SEP] identifier[collect] operator[SEP] identifier[Collectors] operator[SEP] identifier[toList] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private static Optional<Class> resolveSingleTypeArgument(Type genericType) {
if (genericType instanceof ParameterizedType) {
ParameterizedType pt = (ParameterizedType) genericType;
Type[] actualTypeArguments = pt.getActualTypeArguments();
if (actualTypeArguments.length == 1) {
Type actualTypeArgument = actualTypeArguments[0];
return resolveParameterizedTypeArgument(actualTypeArgument);
}
}
return Optional.empty();
} | class class_name[name] begin[{]
method[resolveSingleTypeArgument, return_type[type[Optional]], modifier[private static], parameter[genericType]] begin[{]
if[binary_operation[member[.genericType], instanceof, type[ParameterizedType]]] begin[{]
local_variable[type[ParameterizedType], pt]
local_variable[type[Type], actualTypeArguments]
if[binary_operation[member[actualTypeArguments.length], ==, literal[1]]] begin[{]
local_variable[type[Type], actualTypeArgument]
return[call[.resolveParameterizedTypeArgument, parameter[member[.actualTypeArgument]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[call[Optional.empty, parameter[]]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[Optional] operator[<] identifier[Class] operator[>] identifier[resolveSingleTypeArgument] operator[SEP] identifier[Type] identifier[genericType] operator[SEP] {
Keyword[if] operator[SEP] identifier[genericType] Keyword[instanceof] identifier[ParameterizedType] operator[SEP] {
identifier[ParameterizedType] identifier[pt] operator[=] operator[SEP] identifier[ParameterizedType] operator[SEP] identifier[genericType] operator[SEP] identifier[Type] operator[SEP] operator[SEP] identifier[actualTypeArguments] operator[=] identifier[pt] operator[SEP] identifier[getActualTypeArguments] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[actualTypeArguments] operator[SEP] identifier[length] operator[==] Other[1] operator[SEP] {
identifier[Type] identifier[actualTypeArgument] operator[=] identifier[actualTypeArguments] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[return] identifier[resolveParameterizedTypeArgument] operator[SEP] identifier[actualTypeArgument] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[Optional] operator[SEP] identifier[empty] operator[SEP] operator[SEP] operator[SEP]
}
|
public WrappedByteBuffer putLongAt(int index, long v) {
_checkForWriteAt(index, 8);
_buf.putLong(index, v);
return this;
} | class class_name[name] begin[{]
method[putLongAt, return_type[type[WrappedByteBuffer]], modifier[public], parameter[index, v]] begin[{]
call[._checkForWriteAt, parameter[member[.index], literal[8]]]
call[_buf.putLong, parameter[member[.index], member[.v]]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[WrappedByteBuffer] identifier[putLongAt] operator[SEP] Keyword[int] identifier[index] , Keyword[long] identifier[v] operator[SEP] {
identifier[_checkForWriteAt] operator[SEP] identifier[index] , Other[8] operator[SEP] operator[SEP] identifier[_buf] operator[SEP] identifier[putLong] operator[SEP] identifier[index] , identifier[v] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
@Nonnull
public static <T1, T2> LToFltBiFunctionBuilder<T1, T2> toFltBiFunction(Consumer<LToFltBiFunction<T1, T2>> consumer) {
return new LToFltBiFunctionBuilder(consumer);
} | class class_name[name] begin[{]
method[toFltBiFunction, return_type[type[LToFltBiFunctionBuilder]], modifier[public static], parameter[consumer]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=consumer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LToFltBiFunctionBuilder, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[Nonnull] Keyword[public] Keyword[static] operator[<] identifier[T1] , identifier[T2] operator[>] identifier[LToFltBiFunctionBuilder] operator[<] identifier[T1] , identifier[T2] operator[>] identifier[toFltBiFunction] operator[SEP] identifier[Consumer] operator[<] identifier[LToFltBiFunction] operator[<] identifier[T1] , identifier[T2] operator[>] operator[>] identifier[consumer] operator[SEP] {
Keyword[return] Keyword[new] identifier[LToFltBiFunctionBuilder] operator[SEP] identifier[consumer] operator[SEP] operator[SEP]
}
|
public static AOL getAOL(final MavenProject project, final String architecture, final String os, final Linker linker,
final String aol, final Log log) throws MojoFailureException, MojoExecutionException {
/*
To support a linker that is not the default linker specified in the aol.properties
* */
String aol_linker;
if(linker != null & linker.getName() != null)
{
log.debug("linker original name: " + linker.getName());
aol_linker = linker.getName();
}
else
{
log.debug("linker original name not exist ");
aol_linker = getLinkerName(project, architecture, os,linker, log);
}
log.debug("aol_linker: " + aol_linker);
return aol == null ? new AOL(getArchitecture(architecture), getOS(os), aol_linker) : new AOL(aol);
} | class class_name[name] begin[{]
method[getAOL, return_type[type[AOL]], modifier[public static], parameter[project, architecture, os, linker, aol, log]] begin[{]
local_variable[type[String], aol_linker]
if[binary_operation[binary_operation[member[.linker], !=, literal[null]], &, binary_operation[call[linker.getName, parameter[]], !=, literal[null]]]] begin[{]
call[log.debug, parameter[binary_operation[literal["linker original name: "], +, call[linker.getName, parameter[]]]]]
assign[member[.aol_linker], call[linker.getName, parameter[]]]
else begin[{]
call[log.debug, parameter[literal["linker original name not exist "]]]
assign[member[.aol_linker], call[.getLinkerName, parameter[member[.project], member[.architecture], member[.os], member[.linker], member[.log]]]]
end[}]
call[log.debug, parameter[binary_operation[literal["aol_linker: "], +, member[.aol_linker]]]]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=aol, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=ClassCreator(arguments=[MemberReference(member=aol, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AOL, sub_type=None)), if_true=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=architecture, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getArchitecture, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=os, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getOS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=aol_linker, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AOL, sub_type=None)))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[AOL] identifier[getAOL] operator[SEP] Keyword[final] identifier[MavenProject] identifier[project] , Keyword[final] identifier[String] identifier[architecture] , Keyword[final] identifier[String] identifier[os] , Keyword[final] identifier[Linker] identifier[linker] , Keyword[final] identifier[String] identifier[aol] , Keyword[final] identifier[Log] identifier[log] operator[SEP] Keyword[throws] identifier[MojoFailureException] , identifier[MojoExecutionException] {
identifier[String] identifier[aol_linker] operator[SEP] Keyword[if] operator[SEP] identifier[linker] operator[!=] Other[null] operator[&] identifier[linker] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[linker] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[aol_linker] operator[=] identifier[linker] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[aol_linker] operator[=] identifier[getLinkerName] operator[SEP] identifier[project] , identifier[architecture] , identifier[os] , identifier[linker] , identifier[log] operator[SEP] operator[SEP]
}
identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[aol_linker] operator[SEP] operator[SEP] Keyword[return] identifier[aol] operator[==] Other[null] operator[?] Keyword[new] identifier[AOL] operator[SEP] identifier[getArchitecture] operator[SEP] identifier[architecture] operator[SEP] , identifier[getOS] operator[SEP] identifier[os] operator[SEP] , identifier[aol_linker] operator[SEP] operator[:] Keyword[new] identifier[AOL] operator[SEP] identifier[aol] operator[SEP] operator[SEP]
}
|
public Observable<ServiceResponseWithHeaders<InputInner, InputsCreateOrReplaceHeaders>> createOrReplaceWithServiceResponseAsync(String resourceGroupName, String jobName, String inputName, InputInner input) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (jobName == null) {
throw new IllegalArgumentException("Parameter jobName is required and cannot be null.");
}
if (inputName == null) {
throw new IllegalArgumentException("Parameter inputName is required and cannot be null.");
}
if (input == null) {
throw new IllegalArgumentException("Parameter input is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
Validator.validate(input);
final String ifMatch = null;
final String ifNoneMatch = null;
return service.createOrReplace(this.client.subscriptionId(), resourceGroupName, jobName, inputName, input, ifMatch, ifNoneMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<InputInner, InputsCreateOrReplaceHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<InputInner, InputsCreateOrReplaceHeaders>> call(Response<ResponseBody> response) {
try {
ServiceResponseWithHeaders<InputInner, InputsCreateOrReplaceHeaders> clientResponse = createOrReplaceDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} | class class_name[name] begin[{]
method[createOrReplaceWithServiceResponseAsync, return_type[type[Observable]], modifier[public], parameter[resourceGroupName, jobName, inputName, input]] begin[{]
if[binary_operation[THIS[member[None.client]call[None.subscriptionId, parameter[]]], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter this.client.subscriptionId() is required and cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.resourceGroupName], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter resourceGroupName is required and cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.jobName], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter jobName is required and cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.inputName], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter inputName is required and cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.input], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter input is required and cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[THIS[member[None.client]call[None.apiVersion, parameter[]]], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter this.client.apiVersion() is required and cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[Validator.validate, parameter[member[.input]]]
local_variable[type[String], ifMatch]
local_variable[type[String], ifNoneMatch]
return[call[service.createOrReplace, parameter[THIS[member[None.client]call[None.subscriptionId, parameter[]]], member[.resourceGroupName], member[.jobName], member[.inputName], member[.input], member[.ifMatch], member[.ifNoneMatch], THIS[member[None.client]call[None.apiVersion, parameter[]]], THIS[member[None.client]call[None.acceptLanguage, parameter[]]], THIS[member[None.client]call[None.userAgent, parameter[]]]]]]
end[}]
END[}] | Keyword[public] identifier[Observable] operator[<] identifier[ServiceResponseWithHeaders] operator[<] identifier[InputInner] , identifier[InputsCreateOrReplaceHeaders] operator[>] operator[>] identifier[createOrReplaceWithServiceResponseAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[jobName] , identifier[String] identifier[inputName] , identifier[InputInner] identifier[input] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[subscriptionId] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[resourceGroupName] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[jobName] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[inputName] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[input] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[apiVersion] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[Validator] operator[SEP] identifier[validate] operator[SEP] identifier[input] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[ifMatch] operator[=] Other[null] operator[SEP] Keyword[final] identifier[String] identifier[ifNoneMatch] operator[=] Other[null] operator[SEP] Keyword[return] identifier[service] operator[SEP] identifier[createOrReplace] operator[SEP] Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[subscriptionId] operator[SEP] operator[SEP] , identifier[resourceGroupName] , identifier[jobName] , identifier[inputName] , identifier[input] , identifier[ifMatch] , identifier[ifNoneMatch] , Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[apiVersion] operator[SEP] operator[SEP] , Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[acceptLanguage] operator[SEP] operator[SEP] , Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[userAgent] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[flatMap] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[Response] operator[<] identifier[ResponseBody] operator[>] , identifier[Observable] operator[<] identifier[ServiceResponseWithHeaders] operator[<] identifier[InputInner] , identifier[InputsCreateOrReplaceHeaders] operator[>] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Observable] operator[<] identifier[ServiceResponseWithHeaders] operator[<] identifier[InputInner] , identifier[InputsCreateOrReplaceHeaders] operator[>] operator[>] identifier[call] operator[SEP] identifier[Response] operator[<] identifier[ResponseBody] operator[>] identifier[response] operator[SEP] {
Keyword[try] {
identifier[ServiceResponseWithHeaders] operator[<] identifier[InputInner] , identifier[InputsCreateOrReplaceHeaders] operator[>] identifier[clientResponse] operator[=] identifier[createOrReplaceDelegate] operator[SEP] identifier[response] operator[SEP] operator[SEP] Keyword[return] identifier[Observable] operator[SEP] identifier[just] operator[SEP] identifier[clientResponse] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
Keyword[return] identifier[Observable] operator[SEP] identifier[error] operator[SEP] identifier[t] operator[SEP] operator[SEP]
}
}
} operator[SEP] operator[SEP]
}
|
public String getPublicationString() {
byte[] imprint = publicationHash.getImprint();
byte[] data = new byte[imprint.length + 8];
System.arraycopy(Util.toByteArray(publicationTime.getTime() / 1000), 0, data, 0, 8);
System.arraycopy(imprint, 0, data, 8, imprint.length);
return Base32.encodeWithDashes(Util.addCrc32(data));
} | class class_name[name] begin[{]
method[getPublicationString, return_type[type[String]], modifier[public], parameter[]] begin[{]
local_variable[type[byte], imprint]
local_variable[type[byte], data]
call[System.arraycopy, parameter[call[Util.toByteArray, parameter[binary_operation[call[publicationTime.getTime, parameter[]], /, literal[1000]]]], literal[0], member[.data], literal[0], literal[8]]]
call[System.arraycopy, parameter[member[.imprint], literal[0], member[.data], literal[8], member[imprint.length]]]
return[call[Base32.encodeWithDashes, parameter[call[Util.addCrc32, parameter[member[.data]]]]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getPublicationString] operator[SEP] operator[SEP] {
Keyword[byte] operator[SEP] operator[SEP] identifier[imprint] operator[=] identifier[publicationHash] operator[SEP] identifier[getImprint] operator[SEP] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[data] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[imprint] operator[SEP] identifier[length] operator[+] Other[8] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[Util] operator[SEP] identifier[toByteArray] operator[SEP] identifier[publicationTime] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] operator[/] Other[1000] operator[SEP] , Other[0] , identifier[data] , Other[0] , Other[8] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[imprint] , Other[0] , identifier[data] , Other[8] , identifier[imprint] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[return] identifier[Base32] operator[SEP] identifier[encodeWithDashes] operator[SEP] identifier[Util] operator[SEP] identifier[addCrc32] operator[SEP] identifier[data] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
@SuppressWarnings("unchecked")
public <E> Matcher<E> getMatcher() {
Matcher<E> localMatcher = (Matcher<E>) MatcherHolder.get();
Assert.state(localMatcher != null || matcher != null,
"A reference to a Matcher used by this Searcher ({0}) for searching and matching elements in the collection was not properly configured!",
getClass().getName());
return ObjectUtils.defaultIfNull(localMatcher, matcher);
} | class class_name[name] begin[{]
method[getMatcher, return_type[type[Matcher]], modifier[public], parameter[]] begin[{]
local_variable[type[Matcher], localMatcher]
call[Assert.state, parameter[binary_operation[binary_operation[member[.localMatcher], !=, literal[null]], ||, binary_operation[member[.matcher], !=, literal[null]]], literal["A reference to a Matcher used by this Searcher ({0}) for searching and matching elements in the collection was not properly configured!"], call[.getClass, parameter[]]]]
return[call[ObjectUtils.defaultIfNull, parameter[member[.localMatcher], member[.matcher]]]]
end[}]
END[}] | annotation[@] identifier[Override] annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] operator[<] identifier[E] operator[>] identifier[Matcher] operator[<] identifier[E] operator[>] identifier[getMatcher] operator[SEP] operator[SEP] {
identifier[Matcher] operator[<] identifier[E] operator[>] identifier[localMatcher] operator[=] operator[SEP] identifier[Matcher] operator[<] identifier[E] operator[>] operator[SEP] identifier[MatcherHolder] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[Assert] operator[SEP] identifier[state] operator[SEP] identifier[localMatcher] operator[!=] Other[null] operator[||] identifier[matcher] operator[!=] Other[null] , literal[String] , identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[ObjectUtils] operator[SEP] identifier[defaultIfNull] operator[SEP] identifier[localMatcher] , identifier[matcher] operator[SEP] operator[SEP]
}
|
@Override
public CompressionInputStream createInputStream(InputStream in,
Decompressor decompressor) throws IOException {
if (!isNativeSnappyLoaded(conf)) {
throw new RuntimeException("native snappy library not available");
}
return new BlockDecompressorStream(in, decompressor, conf.getInt(
IO_COMPRESSION_CODEC_SNAPPY_BUFFERSIZE_KEY,
IO_COMPRESSION_CODEC_SNAPPY_BUFFERSIZE_DEFAULT));
} | class class_name[name] begin[{]
method[createInputStream, return_type[type[CompressionInputStream]], modifier[public], parameter[in, decompressor]] begin[{]
if[call[.isNativeSnappyLoaded, parameter[member[.conf]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="native snappy library not available")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=decompressor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=IO_COMPRESSION_CODEC_SNAPPY_BUFFERSIZE_KEY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=IO_COMPRESSION_CODEC_SNAPPY_BUFFERSIZE_DEFAULT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getInt, postfix_operators=[], prefix_operators=[], qualifier=conf, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BlockDecompressorStream, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[CompressionInputStream] identifier[createInputStream] operator[SEP] identifier[InputStream] identifier[in] , identifier[Decompressor] identifier[decompressor] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] operator[!] identifier[isNativeSnappyLoaded] operator[SEP] identifier[conf] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[BlockDecompressorStream] operator[SEP] identifier[in] , identifier[decompressor] , identifier[conf] operator[SEP] identifier[getInt] operator[SEP] identifier[IO_COMPRESSION_CODEC_SNAPPY_BUFFERSIZE_KEY] , identifier[IO_COMPRESSION_CODEC_SNAPPY_BUFFERSIZE_DEFAULT] operator[SEP] operator[SEP] operator[SEP]
}
|
public byte[] getDataBytes() throws IOException {
byte[] retVal = new byte[length];
synchronized (data) {
data.reset();
data.getBytes(retVal);
}
return retVal;
} | class class_name[name] begin[{]
method[getDataBytes, return_type[type[byte]], modifier[public], parameter[]] begin[{]
local_variable[type[byte], retVal]
SYNCHRONIZED[member[.data]] BEGIN[{]
call[data.reset, parameter[]]
call[data.getBytes, parameter[member[.retVal]]]
END[}]
return[member[.retVal]]
end[}]
END[}] | Keyword[public] Keyword[byte] operator[SEP] operator[SEP] identifier[getDataBytes] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[byte] operator[SEP] operator[SEP] identifier[retVal] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[synchronized] operator[SEP] identifier[data] operator[SEP] {
identifier[data] operator[SEP] identifier[reset] operator[SEP] operator[SEP] operator[SEP] identifier[data] operator[SEP] identifier[getBytes] operator[SEP] identifier[retVal] operator[SEP] operator[SEP]
}
Keyword[return] identifier[retVal] operator[SEP]
}
|
public static List<DeltaError> applyDelta(Object source, List<Delta> commands, final ID idFetcher, DeltaProcessor deltaProcessor, boolean ... failFast)
{
// Index all objects in source graph
final Map srcMap = new HashMap();
Traverser.traverse(source, new Traverser.Visitor()
{
public void process(Object o)
{
if (isIdObject(o, idFetcher))
{
srcMap.put(idFetcher.getId(o), o);
}
}
});
List<DeltaError> errors = new ArrayList<>();
boolean failQuick = failFast != null && failFast.length == 1 && failFast[0];
for (Delta delta : commands)
{
if (failQuick && errors.size() == 1)
{
return errors;
}
Object srcValue = srcMap.get(delta.id);
if (srcValue == null)
{
errors.add(new DeltaError(delta.cmd + " failed, source object not found, obj id: " + delta.id, delta));
continue;
}
Map<String, Field> fields = ReflectionUtils.getDeepDeclaredFieldMap(srcValue.getClass());
Field field = fields.get(delta.fieldName);
if (field == null && OBJECT_ORPHAN != delta.cmd)
{
errors.add(new DeltaError(delta.cmd + " failed, field name missing: " + delta.fieldName + ", obj id: " + delta.id, delta));
continue;
}
// if (LOG.isDebugEnabled())
// {
// LOG.debug(delta.toString());
// }
try
{
switch (delta.cmd)
{
case ARRAY_SET_ELEMENT:
deltaProcessor.processArraySetElement(srcValue, field, delta);
break;
case ARRAY_RESIZE:
deltaProcessor.processArrayResize(srcValue, field, delta);
break;
case OBJECT_ASSIGN_FIELD:
deltaProcessor.processObjectAssignField(srcValue, field, delta);
break;
case OBJECT_ORPHAN:
deltaProcessor.processObjectOrphan(srcValue, field, delta);
break;
case OBJECT_FIELD_TYPE_CHANGED:
deltaProcessor.processObjectTypeChanged(srcValue, field, delta);
break;
case SET_ADD:
deltaProcessor.processSetAdd(srcValue, field, delta);
break;
case SET_REMOVE:
deltaProcessor.processSetRemove(srcValue, field, delta);
break;
case MAP_PUT:
deltaProcessor.processMapPut(srcValue, field, delta);
break;
case MAP_REMOVE:
deltaProcessor.processMapRemove(srcValue, field, delta);
break;
case LIST_RESIZE:
deltaProcessor.processListResize(srcValue, field, delta);
break;
case LIST_SET_ELEMENT:
deltaProcessor.processListSetElement(srcValue, field, delta);
break;
default:
errors.add(new DeltaError("Unknown command: " + delta.cmd, delta));
break;
}
}
catch(Exception e)
{
StringBuilder str = new StringBuilder();
Throwable t = e;
do
{
str.append(t.getMessage());
t = t.getCause();
if (t != null)
{
str.append(", caused by: ");
}
} while (t != null);
errors.add(new DeltaError(str.toString(), delta));
}
}
return errors;
} | class class_name[name] begin[{]
method[applyDelta, return_type[type[List]], modifier[public static], parameter[source, commands, idFetcher, deltaProcessor, failFast]] begin[{]
local_variable[type[Map], srcMap]
call[Traverser.traverse, parameter[member[.source], ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[], body=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=idFetcher, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isIdObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getId, postfix_operators=[], prefix_operators=[], qualifier=idFetcher, selectors=[], type_arguments=None), MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=srcMap, selectors=[], type_arguments=None), label=None)]))], documentation=None, modifiers={'public'}, name=process, parameters=[FormalParameter(annotations=[], modifiers=set(), name=o, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Traverser, sub_type=ReferenceType(arguments=None, dimensions=None, name=Visitor, sub_type=None)))]]
local_variable[type[List], errors]
local_variable[type[boolean], failQuick]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=failQuick, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=errors, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator===), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=errors, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=delta, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=srcMap, selectors=[], type_arguments=None), name=srcValue)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=srcValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=cmd, postfix_operators=[], prefix_operators=[], qualifier=delta, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" failed, source object not found, obj id: "), operator=+), operandr=MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=delta, selectors=[]), operator=+), MemberReference(member=delta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DeltaError, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=errors, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=srcValue, selectors=[], type_arguments=None)], member=getDeepDeclaredFieldMap, postfix_operators=[], prefix_operators=[], qualifier=ReflectionUtils, selectors=[], type_arguments=None), name=fields)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Field, sub_type=None))], dimensions=[], name=Map, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=fieldName, postfix_operators=[], prefix_operators=[], qualifier=delta, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=fields, selectors=[], type_arguments=None), name=field)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Field, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operandr=BinaryOperation(operandl=MemberReference(member=OBJECT_ORPHAN, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=cmd, postfix_operators=[], prefix_operators=[], qualifier=delta, selectors=[]), operator=!=), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=cmd, postfix_operators=[], prefix_operators=[], qualifier=delta, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" failed, field name missing: "), operator=+), operandr=MemberReference(member=fieldName, postfix_operators=[], prefix_operators=[], qualifier=delta, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", obj id: "), operator=+), operandr=MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=delta, selectors=[]), operator=+), MemberReference(member=delta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DeltaError, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=errors, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=None, label=None)])), TryStatement(block=[SwitchStatement(cases=[SwitchStatementCase(case=['ARRAY_SET_ELEMENT'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=srcValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=delta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=processArraySetElement, postfix_operators=[], prefix_operators=[], qualifier=deltaProcessor, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['ARRAY_RESIZE'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=srcValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=delta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=processArrayResize, postfix_operators=[], prefix_operators=[], qualifier=deltaProcessor, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['OBJECT_ASSIGN_FIELD'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=srcValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=delta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=processObjectAssignField, postfix_operators=[], prefix_operators=[], qualifier=deltaProcessor, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['OBJECT_ORPHAN'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=srcValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=delta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=processObjectOrphan, postfix_operators=[], prefix_operators=[], qualifier=deltaProcessor, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['OBJECT_FIELD_TYPE_CHANGED'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=srcValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=delta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=processObjectTypeChanged, postfix_operators=[], prefix_operators=[], qualifier=deltaProcessor, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['SET_ADD'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=srcValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=delta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=processSetAdd, postfix_operators=[], prefix_operators=[], qualifier=deltaProcessor, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['SET_REMOVE'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=srcValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=delta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=processSetRemove, postfix_operators=[], prefix_operators=[], qualifier=deltaProcessor, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['MAP_PUT'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=srcValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=delta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=processMapPut, postfix_operators=[], prefix_operators=[], qualifier=deltaProcessor, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['MAP_REMOVE'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=srcValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=delta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=processMapRemove, postfix_operators=[], prefix_operators=[], qualifier=deltaProcessor, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['LIST_RESIZE'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=srcValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=delta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=processListResize, postfix_operators=[], prefix_operators=[], qualifier=deltaProcessor, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['LIST_SET_ELEMENT'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=srcValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=delta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=processListSetElement, postfix_operators=[], prefix_operators=[], qualifier=deltaProcessor, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unknown command: "), operandr=MemberReference(member=cmd, postfix_operators=[], prefix_operators=[], qualifier=delta, selectors=[]), operator=+), MemberReference(member=delta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DeltaError, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=errors, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)])], expression=MemberReference(member=cmd, postfix_operators=[], prefix_operators=[], qualifier=delta, selectors=[]), label=None)], catches=[CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StringBuilder, sub_type=None)), name=str)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=StringBuilder, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=t)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Throwable, sub_type=None)), DoStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=t, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=str, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getCause, postfix_operators=[], prefix_operators=[], qualifier=t, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", caused by: ")], member=append, postfix_operators=[], prefix_operators=[], qualifier=str, selectors=[], type_arguments=None), label=None)]))]), condition=BinaryOperation(operandl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=str, selectors=[], type_arguments=None), MemberReference(member=delta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DeltaError, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=errors, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)]), control=EnhancedForControl(iterable=MemberReference(member=commands, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=delta)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Delta, sub_type=None))), label=None)
return[member[.errors]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[List] operator[<] identifier[DeltaError] operator[>] identifier[applyDelta] operator[SEP] identifier[Object] identifier[source] , identifier[List] operator[<] identifier[Delta] operator[>] identifier[commands] , Keyword[final] identifier[ID] identifier[idFetcher] , identifier[DeltaProcessor] identifier[deltaProcessor] , Keyword[boolean] operator[...] identifier[failFast] operator[SEP] {
Keyword[final] identifier[Map] identifier[srcMap] operator[=] Keyword[new] identifier[HashMap] operator[SEP] operator[SEP] operator[SEP] identifier[Traverser] operator[SEP] identifier[traverse] operator[SEP] identifier[source] , Keyword[new] identifier[Traverser] operator[SEP] identifier[Visitor] operator[SEP] operator[SEP] {
Keyword[public] Keyword[void] identifier[process] operator[SEP] identifier[Object] identifier[o] operator[SEP] {
Keyword[if] operator[SEP] identifier[isIdObject] operator[SEP] identifier[o] , identifier[idFetcher] operator[SEP] operator[SEP] {
identifier[srcMap] operator[SEP] identifier[put] operator[SEP] identifier[idFetcher] operator[SEP] identifier[getId] operator[SEP] identifier[o] operator[SEP] , identifier[o] operator[SEP] operator[SEP]
}
}
} operator[SEP] operator[SEP] identifier[List] operator[<] identifier[DeltaError] operator[>] identifier[errors] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[failQuick] operator[=] identifier[failFast] operator[!=] Other[null] operator[&&] identifier[failFast] operator[SEP] identifier[length] operator[==] Other[1] operator[&&] identifier[failFast] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Delta] identifier[delta] operator[:] identifier[commands] operator[SEP] {
Keyword[if] operator[SEP] identifier[failQuick] operator[&&] identifier[errors] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[1] operator[SEP] {
Keyword[return] identifier[errors] operator[SEP]
}
identifier[Object] identifier[srcValue] operator[=] identifier[srcMap] operator[SEP] identifier[get] operator[SEP] identifier[delta] operator[SEP] identifier[id] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[srcValue] operator[==] Other[null] operator[SEP] {
identifier[errors] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[DeltaError] operator[SEP] identifier[delta] operator[SEP] identifier[cmd] operator[+] literal[String] operator[+] identifier[delta] operator[SEP] identifier[id] , identifier[delta] operator[SEP] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
identifier[Map] operator[<] identifier[String] , identifier[Field] operator[>] identifier[fields] operator[=] identifier[ReflectionUtils] operator[SEP] identifier[getDeepDeclaredFieldMap] operator[SEP] identifier[srcValue] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Field] identifier[field] operator[=] identifier[fields] operator[SEP] identifier[get] operator[SEP] identifier[delta] operator[SEP] identifier[fieldName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[field] operator[==] Other[null] operator[&&] identifier[OBJECT_ORPHAN] operator[!=] identifier[delta] operator[SEP] identifier[cmd] operator[SEP] {
identifier[errors] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[DeltaError] operator[SEP] identifier[delta] operator[SEP] identifier[cmd] operator[+] literal[String] operator[+] identifier[delta] operator[SEP] identifier[fieldName] operator[+] literal[String] operator[+] identifier[delta] operator[SEP] identifier[id] , identifier[delta] operator[SEP] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
Keyword[try] {
Keyword[switch] operator[SEP] identifier[delta] operator[SEP] identifier[cmd] operator[SEP] {
Keyword[case] identifier[ARRAY_SET_ELEMENT] operator[:] identifier[deltaProcessor] operator[SEP] identifier[processArraySetElement] operator[SEP] identifier[srcValue] , identifier[field] , identifier[delta] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[ARRAY_RESIZE] operator[:] identifier[deltaProcessor] operator[SEP] identifier[processArrayResize] operator[SEP] identifier[srcValue] , identifier[field] , identifier[delta] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[OBJECT_ASSIGN_FIELD] operator[:] identifier[deltaProcessor] operator[SEP] identifier[processObjectAssignField] operator[SEP] identifier[srcValue] , identifier[field] , identifier[delta] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[OBJECT_ORPHAN] operator[:] identifier[deltaProcessor] operator[SEP] identifier[processObjectOrphan] operator[SEP] identifier[srcValue] , identifier[field] , identifier[delta] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[OBJECT_FIELD_TYPE_CHANGED] operator[:] identifier[deltaProcessor] operator[SEP] identifier[processObjectTypeChanged] operator[SEP] identifier[srcValue] , identifier[field] , identifier[delta] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[SET_ADD] operator[:] identifier[deltaProcessor] operator[SEP] identifier[processSetAdd] operator[SEP] identifier[srcValue] , identifier[field] , identifier[delta] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[SET_REMOVE] operator[:] identifier[deltaProcessor] operator[SEP] identifier[processSetRemove] operator[SEP] identifier[srcValue] , identifier[field] , identifier[delta] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[MAP_PUT] operator[:] identifier[deltaProcessor] operator[SEP] identifier[processMapPut] operator[SEP] identifier[srcValue] , identifier[field] , identifier[delta] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[MAP_REMOVE] operator[:] identifier[deltaProcessor] operator[SEP] identifier[processMapRemove] operator[SEP] identifier[srcValue] , identifier[field] , identifier[delta] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[LIST_RESIZE] operator[:] identifier[deltaProcessor] operator[SEP] identifier[processListResize] operator[SEP] identifier[srcValue] , identifier[field] , identifier[delta] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[LIST_SET_ELEMENT] operator[:] identifier[deltaProcessor] operator[SEP] identifier[processListSetElement] operator[SEP] identifier[srcValue] , identifier[field] , identifier[delta] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] identifier[errors] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[DeltaError] operator[SEP] literal[String] operator[+] identifier[delta] operator[SEP] identifier[cmd] , identifier[delta] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[StringBuilder] identifier[str] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[Throwable] identifier[t] operator[=] identifier[e] operator[SEP] Keyword[do] {
identifier[str] operator[SEP] identifier[append] operator[SEP] identifier[t] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[t] operator[=] identifier[t] operator[SEP] identifier[getCause] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[t] operator[!=] Other[null] operator[SEP] {
identifier[str] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[while] operator[SEP] identifier[t] operator[!=] Other[null] operator[SEP] operator[SEP] identifier[errors] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[DeltaError] operator[SEP] identifier[str] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[delta] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[errors] operator[SEP]
}
|
public Observable<AvailableProvidersListInner> listAvailableProvidersAsync(String resourceGroupName, String networkWatcherName, AvailableProvidersListParameters parameters) {
return listAvailableProvidersWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).map(new Func1<ServiceResponse<AvailableProvidersListInner>, AvailableProvidersListInner>() {
@Override
public AvailableProvidersListInner call(ServiceResponse<AvailableProvidersListInner> response) {
return response.body();
}
});
} | class class_name[name] begin[{]
method[listAvailableProvidersAsync, return_type[type[Observable]], modifier[public], parameter[resourceGroupName, networkWatcherName, parameters]] begin[{]
return[call[.listAvailableProvidersWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.networkWatcherName], member[.parameters]]]]
end[}]
END[}] | Keyword[public] identifier[Observable] operator[<] identifier[AvailableProvidersListInner] operator[>] identifier[listAvailableProvidersAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[networkWatcherName] , identifier[AvailableProvidersListParameters] identifier[parameters] operator[SEP] {
Keyword[return] identifier[listAvailableProvidersWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[networkWatcherName] , identifier[parameters] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[ServiceResponse] operator[<] identifier[AvailableProvidersListInner] operator[>] , identifier[AvailableProvidersListInner] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[AvailableProvidersListInner] identifier[call] operator[SEP] identifier[ServiceResponse] operator[<] identifier[AvailableProvidersListInner] operator[>] identifier[response] operator[SEP] {
Keyword[return] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
public static boolean isListedAsParametrisation(JClass classToCheck, JType type) {
return type instanceof JClass && ((JClass) type).getTypeParameters().contains(classToCheck);
} | class class_name[name] begin[{]
method[isListedAsParametrisation, return_type[type[boolean]], modifier[public static], parameter[classToCheck, type]] begin[{]
return[binary_operation[binary_operation[member[.type], instanceof, type[JClass]], &&, Cast(expression=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=JClass, sub_type=None))]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[isListedAsParametrisation] operator[SEP] identifier[JClass] identifier[classToCheck] , identifier[JType] identifier[type] operator[SEP] {
Keyword[return] identifier[type] Keyword[instanceof] identifier[JClass] operator[&&] operator[SEP] operator[SEP] identifier[JClass] operator[SEP] identifier[type] operator[SEP] operator[SEP] identifier[getTypeParameters] operator[SEP] operator[SEP] operator[SEP] identifier[contains] operator[SEP] identifier[classToCheck] operator[SEP] operator[SEP]
}
|
public boolean checkError() {
if (out != null)
flush();
if (out instanceof java.io.PrintStream) {
PrintStream ps = (PrintStream) out;
return ps.checkError();
}
return trouble;
} | class class_name[name] begin[{]
method[checkError, return_type[type[boolean]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.out], !=, literal[null]]] begin[{]
call[.flush, parameter[]]
else begin[{]
None
end[}]
if[binary_operation[member[.out], instanceof, type[java]]] begin[{]
local_variable[type[PrintStream], ps]
return[call[ps.checkError, parameter[]]]
else begin[{]
None
end[}]
return[member[.trouble]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[checkError] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[out] operator[!=] Other[null] operator[SEP] identifier[flush] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[out] Keyword[instanceof] identifier[java] operator[SEP] identifier[io] operator[SEP] identifier[PrintStream] operator[SEP] {
identifier[PrintStream] identifier[ps] operator[=] operator[SEP] identifier[PrintStream] operator[SEP] identifier[out] operator[SEP] Keyword[return] identifier[ps] operator[SEP] identifier[checkError] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[trouble] operator[SEP]
}
|
private Map<String, Integer> getTargetColumnType(Connection conn, MappingConfig config) {
DbMapping dbMapping = config.getDbMapping();
String cacheKey = config.getDestination() + "." + dbMapping.getDatabase() + "." + dbMapping.getTable();
Map<String, Integer> columnType = columnsTypeCache.get(cacheKey);
if (columnType == null) {
synchronized (RdbSyncService.class) {
columnType = columnsTypeCache.get(cacheKey);
if (columnType == null) {
columnType = new LinkedHashMap<>();
final Map<String, Integer> columnTypeTmp = columnType;
String sql = "SELECT * FROM " + SyncUtil.getDbTableName(dbMapping) + " WHERE 1=2";
Util.sqlRS(conn, sql, rs -> {
try {
ResultSetMetaData rsd = rs.getMetaData();
int columnCount = rsd.getColumnCount();
for (int i = 1; i <= columnCount; i++) {
columnTypeTmp.put(rsd.getColumnName(i).toLowerCase(), rsd.getColumnType(i));
}
columnsTypeCache.put(cacheKey, columnTypeTmp);
} catch (SQLException e) {
logger.error(e.getMessage(), e);
}
});
}
}
}
return columnType;
} | class class_name[name] begin[{]
method[getTargetColumnType, return_type[type[Map]], modifier[private], parameter[conn, config]] begin[{]
local_variable[type[DbMapping], dbMapping]
local_variable[type[String], cacheKey]
local_variable[type[Map], columnType]
if[binary_operation[member[.columnType], ==, literal[null]]] begin[{]
SYNCHRONIZED[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RdbSyncService, sub_type=None))] BEGIN[{]
assign[member[.columnType], call[columnsTypeCache.get, parameter[member[.cacheKey]]]]
if[binary_operation[member[.columnType], ==, literal[null]]] begin[{]
assign[member[.columnType], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=LinkedHashMap, sub_type=None))]
local_variable[type[Map], columnTypeTmp]
local_variable[type[String], sql]
call[Util.sqlRS, parameter[member[.conn], member[.sql], LambdaExpression(body=[TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getMetaData, postfix_operators=[], prefix_operators=[], qualifier=rs, selectors=[], type_arguments=None), name=rsd)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ResultSetMetaData, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getColumnCount, postfix_operators=[], prefix_operators=[], qualifier=rsd, selectors=[], type_arguments=None), name=columnCount)], modifiers=set(), type=BasicType(dimensions=[], name=int)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getColumnName, postfix_operators=[], prefix_operators=[], qualifier=rsd, selectors=[MethodInvocation(arguments=[], member=toLowerCase, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getColumnType, postfix_operators=[], prefix_operators=[], qualifier=rsd, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=columnTypeTmp, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=columnCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=cacheKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=columnTypeTmp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=columnsTypeCache, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SQLException']))], finally_block=None, label=None, resources=None)], parameters=[MemberReference(member=rs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]
else begin[{]
None
end[}]
END[}]
else begin[{]
None
end[}]
return[member[.columnType]]
end[}]
END[}] | Keyword[private] identifier[Map] operator[<] identifier[String] , identifier[Integer] operator[>] identifier[getTargetColumnType] operator[SEP] identifier[Connection] identifier[conn] , identifier[MappingConfig] identifier[config] operator[SEP] {
identifier[DbMapping] identifier[dbMapping] operator[=] identifier[config] operator[SEP] identifier[getDbMapping] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[cacheKey] operator[=] identifier[config] operator[SEP] identifier[getDestination] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[dbMapping] operator[SEP] identifier[getDatabase] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[dbMapping] operator[SEP] identifier[getTable] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Integer] operator[>] identifier[columnType] operator[=] identifier[columnsTypeCache] operator[SEP] identifier[get] operator[SEP] identifier[cacheKey] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[columnType] operator[==] Other[null] operator[SEP] {
Keyword[synchronized] operator[SEP] identifier[RdbSyncService] operator[SEP] Keyword[class] operator[SEP] {
identifier[columnType] operator[=] identifier[columnsTypeCache] operator[SEP] identifier[get] operator[SEP] identifier[cacheKey] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[columnType] operator[==] Other[null] operator[SEP] {
identifier[columnType] operator[=] Keyword[new] identifier[LinkedHashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[Integer] operator[>] identifier[columnTypeTmp] operator[=] identifier[columnType] operator[SEP] identifier[String] identifier[sql] operator[=] literal[String] operator[+] identifier[SyncUtil] operator[SEP] identifier[getDbTableName] operator[SEP] identifier[dbMapping] operator[SEP] operator[+] literal[String] operator[SEP] identifier[Util] operator[SEP] identifier[sqlRS] operator[SEP] identifier[conn] , identifier[sql] , identifier[rs] operator[->] {
Keyword[try] {
identifier[ResultSetMetaData] identifier[rsd] operator[=] identifier[rs] operator[SEP] identifier[getMetaData] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[columnCount] operator[=] identifier[rsd] operator[SEP] identifier[getColumnCount] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[1] operator[SEP] identifier[i] operator[<=] identifier[columnCount] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[columnTypeTmp] operator[SEP] identifier[put] operator[SEP] identifier[rsd] operator[SEP] identifier[getColumnName] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] , identifier[rsd] operator[SEP] identifier[getColumnType] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
identifier[columnsTypeCache] operator[SEP] identifier[put] operator[SEP] identifier[cacheKey] , identifier[columnTypeTmp] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[SQLException] identifier[e] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[columnType] operator[SEP]
}
|
public <OUT> DataStreamSource<OUT> fromCollection(Collection<OUT> data) {
Preconditions.checkNotNull(data, "Collection must not be null");
if (data.isEmpty()) {
throw new IllegalArgumentException("Collection must not be empty");
}
OUT first = data.iterator().next();
if (first == null) {
throw new IllegalArgumentException("Collection must not contain null elements");
}
TypeInformation<OUT> typeInfo;
try {
typeInfo = TypeExtractor.getForObject(first);
}
catch (Exception e) {
throw new RuntimeException("Could not create TypeInformation for type " + first.getClass()
+ "; please specify the TypeInformation manually via "
+ "StreamExecutionEnvironment#fromElements(Collection, TypeInformation)", e);
}
return fromCollection(data, typeInfo);
} | class class_name[name] begin[{]
method[fromCollection, return_type[type[DataStreamSource]], modifier[public], parameter[data]] begin[{]
call[Preconditions.checkNotNull, parameter[member[.data], literal["Collection must not be null"]]]
if[call[data.isEmpty, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Collection must not be empty")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[OUT], first]
if[binary_operation[member[.first], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Collection must not contain null elements")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[TypeInformation], typeInfo]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=typeInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=first, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getForObject, postfix_operators=[], prefix_operators=[], qualifier=TypeExtractor, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Could not create TypeInformation for type "), operandr=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=first, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="; please specify the TypeInformation manually via "), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="StreamExecutionEnvironment#fromElements(Collection, TypeInformation)"), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
return[call[.fromCollection, parameter[member[.data], member[.typeInfo]]]]
end[}]
END[}] | Keyword[public] operator[<] identifier[OUT] operator[>] identifier[DataStreamSource] operator[<] identifier[OUT] operator[>] identifier[fromCollection] operator[SEP] identifier[Collection] operator[<] identifier[OUT] operator[>] identifier[data] operator[SEP] {
identifier[Preconditions] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[data] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[data] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[OUT] identifier[first] operator[=] identifier[data] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[first] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[TypeInformation] operator[<] identifier[OUT] operator[>] identifier[typeInfo] operator[SEP] Keyword[try] {
identifier[typeInfo] operator[=] identifier[TypeExtractor] operator[SEP] identifier[getForObject] operator[SEP] identifier[first] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[+] identifier[first] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[return] identifier[fromCollection] operator[SEP] identifier[data] , identifier[typeInfo] operator[SEP] operator[SEP]
}
|
public boolean replaceIn(final StrBuilder source) {
if (source == null) {
return false;
}
return substitute(source, 0, source.length());
} | class class_name[name] begin[{]
method[replaceIn, return_type[type[boolean]], modifier[public], parameter[source]] begin[{]
if[binary_operation[member[.source], ==, literal[null]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
return[call[.substitute, parameter[member[.source], literal[0], call[source.length, parameter[]]]]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[replaceIn] operator[SEP] Keyword[final] identifier[StrBuilder] identifier[source] operator[SEP] {
Keyword[if] operator[SEP] identifier[source] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] identifier[substitute] operator[SEP] identifier[source] , Other[0] , identifier[source] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static void putAt(DefaultTableModel self, int index, Object row) {
if (row == null) {
// adds an empty row
self.insertRow(index, (Object[]) null);
return;
}
self.insertRow(index, buildRowData(self, row));
} | class class_name[name] begin[{]
method[putAt, return_type[void], modifier[public static], parameter[self, index, row]] begin[{]
if[binary_operation[member[.row], ==, literal[null]]] begin[{]
call[self.insertRow, parameter[member[.index], Cast(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), type=ReferenceType(arguments=None, dimensions=[None], name=Object, sub_type=None))]]
return[None]
else begin[{]
None
end[}]
call[self.insertRow, parameter[member[.index], call[.buildRowData, parameter[member[.self], member[.row]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[putAt] operator[SEP] identifier[DefaultTableModel] identifier[self] , Keyword[int] identifier[index] , identifier[Object] identifier[row] operator[SEP] {
Keyword[if] operator[SEP] identifier[row] operator[==] Other[null] operator[SEP] {
identifier[self] operator[SEP] identifier[insertRow] operator[SEP] identifier[index] , operator[SEP] identifier[Object] operator[SEP] operator[SEP] operator[SEP] Other[null] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
identifier[self] operator[SEP] identifier[insertRow] operator[SEP] identifier[index] , identifier[buildRowData] operator[SEP] identifier[self] , identifier[row] operator[SEP] operator[SEP] operator[SEP]
}
|
public void eventProcessingFailed(FailureReason failureReason) {
raEntity.getResourceAdaptorObject().eventProcessingFailed(activityHandle, fireableEventType,
failureReason, address, receivableService, eventFlags,
failureReason);
} | class class_name[name] begin[{]
method[eventProcessingFailed, return_type[void], modifier[public], parameter[failureReason]] begin[{]
call[raEntity.getResourceAdaptorObject, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[eventProcessingFailed] operator[SEP] identifier[FailureReason] identifier[failureReason] operator[SEP] {
identifier[raEntity] operator[SEP] identifier[getResourceAdaptorObject] operator[SEP] operator[SEP] operator[SEP] identifier[eventProcessingFailed] operator[SEP] identifier[activityHandle] , identifier[fireableEventType] , identifier[failureReason] , identifier[address] , identifier[receivableService] , identifier[eventFlags] , identifier[failureReason] operator[SEP] operator[SEP]
}
|
private int resolveFlats( int pitsCount ) {
int stillPitsCount;
currentPitsCount = pitsCount;
do {
if (pm.isCanceled()) {
return -1;
}
pitsCount = currentPitsCount;
currentPitsCount = 0;
for( int ip = 1; ip <= pitsCount; ip++ ) {
dn[ip] = 0;
}
for( int k = 1; k <= 8; k++ ) {
for( int pitIndex = 1; pitIndex <= pitsCount; pitIndex++ ) {
double elevDelta = pitIter.getSampleDouble(currentPitCols[pitIndex], currentPitRows[pitIndex], 0)
- pitIter.getSampleDouble(currentPitCols[pitIndex] + DIR_WITHFLOW_EXITING_INVERTED[k][0],
currentPitRows[pitIndex] + DIR_WITHFLOW_EXITING_INVERTED[k][1], 0);
if ((elevDelta >= 0.)
&& ((dir[currentPitCols[pitIndex] + DIR_WITHFLOW_EXITING_INVERTED[k][0]][currentPitRows[pitIndex]
+ DIR_WITHFLOW_EXITING_INVERTED[k][1]] != 0) && (dn[pitIndex] == 0)))
dn[pitIndex] = k;
}
}
stillPitsCount = 1; /* location of point on stack with lowest elevation */
for( int pitIndex = 1; pitIndex <= pitsCount; pitIndex++ ) {
if (dn[pitIndex] > 0) {
dir[currentPitCols[pitIndex]][currentPitRows[pitIndex]] = dn[pitIndex];
} else {
currentPitsCount++;
currentPitRows[currentPitsCount] = currentPitRows[pitIndex];
currentPitCols[currentPitsCount] = currentPitCols[pitIndex];
if (pitIter.getSampleDouble(currentPitCols[currentPitsCount], currentPitRows[currentPitsCount], 0) < pitIter
.getSampleDouble(currentPitCols[stillPitsCount], currentPitRows[stillPitsCount], 0))
stillPitsCount = currentPitsCount;
}
}
// out.println("vdn n = " + n + "nis = " + nis);
} while( currentPitsCount < pitsCount );
return stillPitsCount;
} | class class_name[name] begin[{]
method[resolveFlats, return_type[type[int]], modifier[private], parameter[pitsCount]] begin[{]
local_variable[type[int], stillPitsCount]
assign[member[.currentPitsCount], member[.pitsCount]]
do[binary_operation[member[.currentPitsCount], <, member[.pitsCount]]] begin[{]
if[call[pm.isCanceled, parameter[]]] begin[{]
return[literal[1]]
else begin[{]
None
end[}]
assign[member[.pitsCount], member[.currentPitsCount]]
assign[member[.currentPitsCount], literal[0]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=dn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=ip, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=ip, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=pitsCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), name=ip)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=ip, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=currentPitCols, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=pitIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MemberReference(member=currentPitRows, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=pitIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=getSampleDouble, postfix_operators=[], prefix_operators=[], qualifier=pitIter, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=currentPitCols, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=pitIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=DIR_WITHFLOW_EXITING_INVERTED, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), operator=+), BinaryOperation(operandl=MemberReference(member=currentPitRows, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=pitIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=DIR_WITHFLOW_EXITING_INVERTED, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))]), operator=+), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=getSampleDouble, postfix_operators=[], prefix_operators=[], qualifier=pitIter, selectors=[], type_arguments=None), operator=-), name=elevDelta)], modifiers=set(), type=BasicType(dimensions=[], name=double)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=elevDelta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0.), operator=>=), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=dir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=currentPitCols, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=pitIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=DIR_WITHFLOW_EXITING_INVERTED, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), operator=+)), ArraySelector(index=BinaryOperation(operandl=MemberReference(member=currentPitRows, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=pitIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=DIR_WITHFLOW_EXITING_INVERTED, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))]), operator=+))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=dn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=pitIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), operator=&&), operator=&&), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=dn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=pitIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=pitIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=pitsCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), name=pitIndex)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=pitIndex, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8), operator=<=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), name=k)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=k, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
assign[member[.stillPitsCount], literal[1]]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=dn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=pitIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=currentPitsCount, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=currentPitRows, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=currentPitsCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=currentPitRows, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=pitIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=currentPitCols, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=currentPitsCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=currentPitCols, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=pitIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=currentPitCols, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=currentPitsCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MemberReference(member=currentPitRows, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=currentPitsCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=getSampleDouble, postfix_operators=[], prefix_operators=[], qualifier=pitIter, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=currentPitCols, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=stillPitsCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MemberReference(member=currentPitRows, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=stillPitsCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=getSampleDouble, postfix_operators=[], prefix_operators=[], qualifier=pitIter, selectors=[], type_arguments=None), operator=<), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=stillPitsCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=currentPitsCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None))]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=dir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=currentPitCols, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=pitIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), ArraySelector(index=MemberReference(member=currentPitRows, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=pitIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]))]), type==, value=MemberReference(member=dn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=pitIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=pitIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=pitsCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), name=pitIndex)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=pitIndex, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
return[member[.stillPitsCount]]
end[}]
END[}] | Keyword[private] Keyword[int] identifier[resolveFlats] operator[SEP] Keyword[int] identifier[pitsCount] operator[SEP] {
Keyword[int] identifier[stillPitsCount] operator[SEP] identifier[currentPitsCount] operator[=] identifier[pitsCount] operator[SEP] Keyword[do] {
Keyword[if] operator[SEP] identifier[pm] operator[SEP] identifier[isCanceled] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] operator[-] Other[1] operator[SEP]
}
identifier[pitsCount] operator[=] identifier[currentPitsCount] operator[SEP] identifier[currentPitsCount] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[ip] operator[=] Other[1] operator[SEP] identifier[ip] operator[<=] identifier[pitsCount] operator[SEP] identifier[ip] operator[++] operator[SEP] {
identifier[dn] operator[SEP] identifier[ip] operator[SEP] operator[=] Other[0] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[k] operator[=] Other[1] operator[SEP] identifier[k] operator[<=] Other[8] operator[SEP] identifier[k] operator[++] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[pitIndex] operator[=] Other[1] operator[SEP] identifier[pitIndex] operator[<=] identifier[pitsCount] operator[SEP] identifier[pitIndex] operator[++] operator[SEP] {
Keyword[double] identifier[elevDelta] operator[=] identifier[pitIter] operator[SEP] identifier[getSampleDouble] operator[SEP] identifier[currentPitCols] operator[SEP] identifier[pitIndex] operator[SEP] , identifier[currentPitRows] operator[SEP] identifier[pitIndex] operator[SEP] , Other[0] operator[SEP] operator[-] identifier[pitIter] operator[SEP] identifier[getSampleDouble] operator[SEP] identifier[currentPitCols] operator[SEP] identifier[pitIndex] operator[SEP] operator[+] identifier[DIR_WITHFLOW_EXITING_INVERTED] operator[SEP] identifier[k] operator[SEP] operator[SEP] Other[0] operator[SEP] , identifier[currentPitRows] operator[SEP] identifier[pitIndex] operator[SEP] operator[+] identifier[DIR_WITHFLOW_EXITING_INVERTED] operator[SEP] identifier[k] operator[SEP] operator[SEP] Other[1] operator[SEP] , Other[0] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[elevDelta] operator[>=] literal[Float] operator[SEP] operator[&&] operator[SEP] operator[SEP] identifier[dir] operator[SEP] identifier[currentPitCols] operator[SEP] identifier[pitIndex] operator[SEP] operator[+] identifier[DIR_WITHFLOW_EXITING_INVERTED] operator[SEP] identifier[k] operator[SEP] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] identifier[currentPitRows] operator[SEP] identifier[pitIndex] operator[SEP] operator[+] identifier[DIR_WITHFLOW_EXITING_INVERTED] operator[SEP] identifier[k] operator[SEP] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[!=] Other[0] operator[SEP] operator[&&] operator[SEP] identifier[dn] operator[SEP] identifier[pitIndex] operator[SEP] operator[==] Other[0] operator[SEP] operator[SEP] operator[SEP] identifier[dn] operator[SEP] identifier[pitIndex] operator[SEP] operator[=] identifier[k] operator[SEP]
}
}
identifier[stillPitsCount] operator[=] Other[1] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[pitIndex] operator[=] Other[1] operator[SEP] identifier[pitIndex] operator[<=] identifier[pitsCount] operator[SEP] identifier[pitIndex] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[dn] operator[SEP] identifier[pitIndex] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[dir] operator[SEP] identifier[currentPitCols] operator[SEP] identifier[pitIndex] operator[SEP] operator[SEP] operator[SEP] identifier[currentPitRows] operator[SEP] identifier[pitIndex] operator[SEP] operator[SEP] operator[=] identifier[dn] operator[SEP] identifier[pitIndex] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[currentPitsCount] operator[++] operator[SEP] identifier[currentPitRows] operator[SEP] identifier[currentPitsCount] operator[SEP] operator[=] identifier[currentPitRows] operator[SEP] identifier[pitIndex] operator[SEP] operator[SEP] identifier[currentPitCols] operator[SEP] identifier[currentPitsCount] operator[SEP] operator[=] identifier[currentPitCols] operator[SEP] identifier[pitIndex] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[pitIter] operator[SEP] identifier[getSampleDouble] operator[SEP] identifier[currentPitCols] operator[SEP] identifier[currentPitsCount] operator[SEP] , identifier[currentPitRows] operator[SEP] identifier[currentPitsCount] operator[SEP] , Other[0] operator[SEP] operator[<] identifier[pitIter] operator[SEP] identifier[getSampleDouble] operator[SEP] identifier[currentPitCols] operator[SEP] identifier[stillPitsCount] operator[SEP] , identifier[currentPitRows] operator[SEP] identifier[stillPitsCount] operator[SEP] , Other[0] operator[SEP] operator[SEP] identifier[stillPitsCount] operator[=] identifier[currentPitsCount] operator[SEP]
}
}
}
Keyword[while] operator[SEP] identifier[currentPitsCount] operator[<] identifier[pitsCount] operator[SEP] operator[SEP] Keyword[return] identifier[stillPitsCount] operator[SEP]
}
|
public void addRootPackageOf(final Class actionClass, final String mapping) {
addRootPackage(actionClass.getPackage().getName(), mapping);
} | class class_name[name] begin[{]
method[addRootPackageOf, return_type[void], modifier[public], parameter[actionClass, mapping]] begin[{]
call[.addRootPackage, parameter[call[actionClass.getPackage, parameter[]], member[.mapping]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addRootPackageOf] operator[SEP] Keyword[final] identifier[Class] identifier[actionClass] , Keyword[final] identifier[String] identifier[mapping] operator[SEP] {
identifier[addRootPackage] operator[SEP] identifier[actionClass] operator[SEP] identifier[getPackage] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[mapping] operator[SEP] operator[SEP]
}
|
public @Nonnull Iterable<JsonArray> arrays() {
final JsonArray parent=this;
return () -> {
final Iterator<JsonElement> iterator = parent.iterator();
return new Iterator<JsonArray>() {
@Override
public boolean hasNext() {
return iterator.hasNext();
}
@Override
public JsonArray next() {
return iterator.next().asArray();
}
@Override
public void remove() {
iterator.remove();
}
};
};
} | class class_name[name] begin[{]
method[arrays, return_type[type[Iterable]], modifier[public], parameter[]] begin[{]
local_variable[type[JsonArray], parent]
return[LambdaExpression(body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=iterator, postfix_operators=[], prefix_operators=[], qualifier=parent, selectors=[], type_arguments=None), name=iterator)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=JsonElement, sub_type=None))], dimensions=[], name=Iterator, sub_type=None)), ReturnStatement(expression=ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=iterator, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=hasNext, parameters=[], return_type=BasicType(dimensions=[], name=boolean), throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=iterator, selectors=[MethodInvocation(arguments=[], member=asArray, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=next, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=JsonArray, sub_type=None), throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[], member=remove, postfix_operators=[], prefix_operators=[], qualifier=iterator, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=remove, parameters=[], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=JsonArray, sub_type=None))], dimensions=None, name=Iterator, sub_type=None)), label=None)], parameters=[])]
end[}]
END[}] | Keyword[public] annotation[@] identifier[Nonnull] identifier[Iterable] operator[<] identifier[JsonArray] operator[>] identifier[arrays] operator[SEP] operator[SEP] {
Keyword[final] identifier[JsonArray] identifier[parent] operator[=] Keyword[this] operator[SEP] Keyword[return] operator[SEP] operator[SEP] operator[->] {
Keyword[final] identifier[Iterator] operator[<] identifier[JsonElement] operator[>] identifier[iterator] operator[=] identifier[parent] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[Iterator] operator[<] identifier[JsonArray] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[hasNext] operator[SEP] operator[SEP] {
Keyword[return] identifier[iterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] identifier[JsonArray] identifier[next] operator[SEP] operator[SEP] {
Keyword[return] identifier[iterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[asArray] operator[SEP] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[remove] operator[SEP] operator[SEP] {
identifier[iterator] operator[SEP] identifier[remove] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP]
} operator[SEP]
}
|
@Override public JCTree visitVariable(VariableTree node, Void p) {
JCVariableDecl original = node instanceof JCVariableDecl ? (JCVariableDecl) node : null;
JCVariableDecl copy = (JCVariableDecl) super.visitVariable(node, p);
if (original == null) return copy;
copy.sym = original.sym;
if (copy.sym != null) copy.type = original.type;
if (copy.type != null) {
boolean wipeSymAndType = copy.type.isErroneous();
if (!wipeSymAndType) {
TypeTag typeTag = TypeTag.typeTag(copy.type);
wipeSymAndType = (CTC_NONE.equals(typeTag) || CTC_ERROR.equals(typeTag) || CTC_UNKNOWN.equals(typeTag) || CTC_UNDETVAR.equals(typeTag));
}
if (wipeSymAndType) {
copy.sym = null;
copy.type = null;
}
}
return copy;
} | class class_name[name] begin[{]
method[visitVariable, return_type[type[JCTree]], modifier[public], parameter[node, p]] begin[{]
local_variable[type[JCVariableDecl], original]
local_variable[type[JCVariableDecl], copy]
if[binary_operation[member[.original], ==, literal[null]]] begin[{]
return[member[.copy]]
else begin[{]
None
end[}]
assign[member[copy.sym], member[original.sym]]
if[binary_operation[member[copy.sym], !=, literal[null]]] begin[{]
assign[member[copy.type], member[original.type]]
else begin[{]
None
end[}]
if[binary_operation[member[copy.type], !=, literal[null]]] begin[{]
local_variable[type[boolean], wipeSymAndType]
if[member[.wipeSymAndType]] begin[{]
local_variable[type[TypeTag], typeTag]
assign[member[.wipeSymAndType], binary_operation[binary_operation[binary_operation[call[CTC_NONE.equals, parameter[member[.typeTag]]], ||, call[CTC_ERROR.equals, parameter[member[.typeTag]]]], ||, call[CTC_UNKNOWN.equals, parameter[member[.typeTag]]]], ||, call[CTC_UNDETVAR.equals, parameter[member[.typeTag]]]]]
else begin[{]
None
end[}]
if[member[.wipeSymAndType]] begin[{]
assign[member[copy.sym], literal[null]]
assign[member[copy.type], literal[null]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[member[.copy]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[JCTree] identifier[visitVariable] operator[SEP] identifier[VariableTree] identifier[node] , identifier[Void] identifier[p] operator[SEP] {
identifier[JCVariableDecl] identifier[original] operator[=] identifier[node] Keyword[instanceof] identifier[JCVariableDecl] operator[?] operator[SEP] identifier[JCVariableDecl] operator[SEP] identifier[node] operator[:] Other[null] operator[SEP] identifier[JCVariableDecl] identifier[copy] operator[=] operator[SEP] identifier[JCVariableDecl] operator[SEP] Keyword[super] operator[SEP] identifier[visitVariable] operator[SEP] identifier[node] , identifier[p] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[original] operator[==] Other[null] operator[SEP] Keyword[return] identifier[copy] operator[SEP] identifier[copy] operator[SEP] identifier[sym] operator[=] identifier[original] operator[SEP] identifier[sym] operator[SEP] Keyword[if] operator[SEP] identifier[copy] operator[SEP] identifier[sym] operator[!=] Other[null] operator[SEP] identifier[copy] operator[SEP] identifier[type] operator[=] identifier[original] operator[SEP] identifier[type] operator[SEP] Keyword[if] operator[SEP] identifier[copy] operator[SEP] identifier[type] operator[!=] Other[null] operator[SEP] {
Keyword[boolean] identifier[wipeSymAndType] operator[=] identifier[copy] operator[SEP] identifier[type] operator[SEP] identifier[isErroneous] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[wipeSymAndType] operator[SEP] {
identifier[TypeTag] identifier[typeTag] operator[=] identifier[TypeTag] operator[SEP] identifier[typeTag] operator[SEP] identifier[copy] operator[SEP] identifier[type] operator[SEP] operator[SEP] identifier[wipeSymAndType] operator[=] operator[SEP] identifier[CTC_NONE] operator[SEP] identifier[equals] operator[SEP] identifier[typeTag] operator[SEP] operator[||] identifier[CTC_ERROR] operator[SEP] identifier[equals] operator[SEP] identifier[typeTag] operator[SEP] operator[||] identifier[CTC_UNKNOWN] operator[SEP] identifier[equals] operator[SEP] identifier[typeTag] operator[SEP] operator[||] identifier[CTC_UNDETVAR] operator[SEP] identifier[equals] operator[SEP] identifier[typeTag] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[wipeSymAndType] operator[SEP] {
identifier[copy] operator[SEP] identifier[sym] operator[=] Other[null] operator[SEP] identifier[copy] operator[SEP] identifier[type] operator[=] Other[null] operator[SEP]
}
}
Keyword[return] identifier[copy] operator[SEP]
}
|
public JsonLdModule configure(ConfigParam param, String value) {
Objects.requireNonNull(param);
configuration.set(param, value);
return this;
} | class class_name[name] begin[{]
method[configure, return_type[type[JsonLdModule]], modifier[public], parameter[param, value]] begin[{]
call[Objects.requireNonNull, parameter[member[.param]]]
call[configuration.set, parameter[member[.param], member[.value]]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[JsonLdModule] identifier[configure] operator[SEP] identifier[ConfigParam] identifier[param] , identifier[String] identifier[value] operator[SEP] {
identifier[Objects] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[param] operator[SEP] operator[SEP] identifier[configuration] operator[SEP] identifier[set] operator[SEP] identifier[param] , identifier[value] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
@Nullable
public ExpressionTreeElement addTreeElement(@Nonnull final ExpressionTreeElement element) {
assertNotEmptySlot();
assertNotNull("The element is null", element);
final int newElementPriority = element.getPriority();
ExpressionTreeElement result = this;
final ExpressionTreeElement parentTreeElement = this.parentTreeElement;
final int currentPriority = getPriority();
if (newElementPriority < currentPriority) {
if (parentTreeElement == null) {
element.addTreeElement(this);
result = element;
} else {
result = parentTreeElement.addTreeElement(element);
}
} else if (newElementPriority == currentPriority) {
if (parentTreeElement != null) {
parentTreeElement.replaceElement(this, element);
}
if (element.nextChildSlot >= element.childElements.length) {
throw new PreprocessorException("[Expression]Can't process expression item, may be wrong number of arguments", this.sourceString, this.includeStack, null);
}
element.childElements[element.nextChildSlot] = this;
element.nextChildSlot++;
this.parentTreeElement = element;
result = element;
} else if (isFull()) {
final int lastElementIndex = getArity() - 1;
final ExpressionTreeElement lastElement = childElements[lastElementIndex];
if (lastElement.getPriority() > newElementPriority) {
element.addElementToNextFreeSlot(lastElement);
childElements[lastElementIndex] = element;
element.parentTreeElement = this;
result = element;
}
} else {
addElementToNextFreeSlot(element);
result = element;
}
return result;
} | class class_name[name] begin[{]
method[addTreeElement, return_type[type[ExpressionTreeElement]], modifier[public], parameter[element]] begin[{]
call[.assertNotEmptySlot, parameter[]]
call[.assertNotNull, parameter[literal["The element is null"], member[.element]]]
local_variable[type[int], newElementPriority]
local_variable[type[ExpressionTreeElement], result]
local_variable[type[ExpressionTreeElement], parentTreeElement]
local_variable[type[int], currentPriority]
if[binary_operation[member[.newElementPriority], <, member[.currentPriority]]] begin[{]
if[binary_operation[member[.parentTreeElement], ==, literal[null]]] begin[{]
call[element.addTreeElement, parameter[THIS[]]]
assign[member[.result], member[.element]]
else begin[{]
assign[member[.result], call[parentTreeElement.addTreeElement, parameter[member[.element]]]]
end[}]
else begin[{]
if[binary_operation[member[.newElementPriority], ==, member[.currentPriority]]] begin[{]
if[binary_operation[member[.parentTreeElement], !=, literal[null]]] begin[{]
call[parentTreeElement.replaceElement, parameter[THIS[], member[.element]]]
else begin[{]
None
end[}]
if[binary_operation[member[element.nextChildSlot], >=, member[element.childElements.length]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="[Expression]Can't process expression item, may be wrong number of arguments"), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=sourceString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=includeStack, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PreprocessorException, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[member[element.childElements], THIS[]]
member[element.nextChildSlot]
assign[THIS[member[None.parentTreeElement]], member[.element]]
assign[member[.result], member[.element]]
else begin[{]
if[call[.isFull, parameter[]]] begin[{]
local_variable[type[int], lastElementIndex]
local_variable[type[ExpressionTreeElement], lastElement]
if[binary_operation[call[lastElement.getPriority, parameter[]], >, member[.newElementPriority]]] begin[{]
call[element.addElementToNextFreeSlot, parameter[member[.lastElement]]]
assign[member[.childElements], member[.element]]
assign[member[element.parentTreeElement], THIS[]]
assign[member[.result], member[.element]]
else begin[{]
None
end[}]
else begin[{]
call[.addElementToNextFreeSlot, parameter[member[.element]]]
assign[member[.result], member[.element]]
end[}]
end[}]
end[}]
return[member[.result]]
end[}]
END[}] | annotation[@] identifier[Nullable] Keyword[public] identifier[ExpressionTreeElement] identifier[addTreeElement] operator[SEP] annotation[@] identifier[Nonnull] Keyword[final] identifier[ExpressionTreeElement] identifier[element] operator[SEP] {
identifier[assertNotEmptySlot] operator[SEP] operator[SEP] operator[SEP] identifier[assertNotNull] operator[SEP] literal[String] , identifier[element] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[newElementPriority] operator[=] identifier[element] operator[SEP] identifier[getPriority] operator[SEP] operator[SEP] operator[SEP] identifier[ExpressionTreeElement] identifier[result] operator[=] Keyword[this] operator[SEP] Keyword[final] identifier[ExpressionTreeElement] identifier[parentTreeElement] operator[=] Keyword[this] operator[SEP] identifier[parentTreeElement] operator[SEP] Keyword[final] Keyword[int] identifier[currentPriority] operator[=] identifier[getPriority] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[newElementPriority] operator[<] identifier[currentPriority] operator[SEP] {
Keyword[if] operator[SEP] identifier[parentTreeElement] operator[==] Other[null] operator[SEP] {
identifier[element] operator[SEP] identifier[addTreeElement] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[result] operator[=] identifier[element] operator[SEP]
}
Keyword[else] {
identifier[result] operator[=] identifier[parentTreeElement] operator[SEP] identifier[addTreeElement] operator[SEP] identifier[element] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[newElementPriority] operator[==] identifier[currentPriority] operator[SEP] {
Keyword[if] operator[SEP] identifier[parentTreeElement] operator[!=] Other[null] operator[SEP] {
identifier[parentTreeElement] operator[SEP] identifier[replaceElement] operator[SEP] Keyword[this] , identifier[element] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[element] operator[SEP] identifier[nextChildSlot] operator[>=] identifier[element] operator[SEP] identifier[childElements] operator[SEP] identifier[length] operator[SEP] {
Keyword[throw] Keyword[new] identifier[PreprocessorException] operator[SEP] literal[String] , Keyword[this] operator[SEP] identifier[sourceString] , Keyword[this] operator[SEP] identifier[includeStack] , Other[null] operator[SEP] operator[SEP]
}
identifier[element] operator[SEP] identifier[childElements] operator[SEP] identifier[element] operator[SEP] identifier[nextChildSlot] operator[SEP] operator[=] Keyword[this] operator[SEP] identifier[element] operator[SEP] identifier[nextChildSlot] operator[++] operator[SEP] Keyword[this] operator[SEP] identifier[parentTreeElement] operator[=] identifier[element] operator[SEP] identifier[result] operator[=] identifier[element] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[isFull] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] Keyword[int] identifier[lastElementIndex] operator[=] identifier[getArity] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] Keyword[final] identifier[ExpressionTreeElement] identifier[lastElement] operator[=] identifier[childElements] operator[SEP] identifier[lastElementIndex] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[lastElement] operator[SEP] identifier[getPriority] operator[SEP] operator[SEP] operator[>] identifier[newElementPriority] operator[SEP] {
identifier[element] operator[SEP] identifier[addElementToNextFreeSlot] operator[SEP] identifier[lastElement] operator[SEP] operator[SEP] identifier[childElements] operator[SEP] identifier[lastElementIndex] operator[SEP] operator[=] identifier[element] operator[SEP] identifier[element] operator[SEP] identifier[parentTreeElement] operator[=] Keyword[this] operator[SEP] identifier[result] operator[=] identifier[element] operator[SEP]
}
}
Keyword[else] {
identifier[addElementToNextFreeSlot] operator[SEP] identifier[element] operator[SEP] operator[SEP] identifier[result] operator[=] identifier[element] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public static <T> TypeSerializer<T> tryReadSerializer(DataInputView in, ClassLoader userCodeClassLoader) throws IOException {
return tryReadSerializer(in, userCodeClassLoader, false);
} | class class_name[name] begin[{]
method[tryReadSerializer, return_type[type[TypeSerializer]], modifier[public static], parameter[in, userCodeClassLoader]] begin[{]
return[call[.tryReadSerializer, parameter[member[.in], member[.userCodeClassLoader], literal[false]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[TypeSerializer] operator[<] identifier[T] operator[>] identifier[tryReadSerializer] operator[SEP] identifier[DataInputView] identifier[in] , identifier[ClassLoader] identifier[userCodeClassLoader] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[return] identifier[tryReadSerializer] operator[SEP] identifier[in] , identifier[userCodeClassLoader] , literal[boolean] operator[SEP] operator[SEP]
}
|
public static byte optByte(@Nullable Bundle bundle, @Nullable String key, byte fallback) {
if (bundle == null) {
return fallback;
}
return bundle.getByte(key, fallback);
} | class class_name[name] begin[{]
method[optByte, return_type[type[byte]], modifier[public static], parameter[bundle, key, fallback]] begin[{]
if[binary_operation[member[.bundle], ==, literal[null]]] begin[{]
return[member[.fallback]]
else begin[{]
None
end[}]
return[call[bundle.getByte, parameter[member[.key], member[.fallback]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[byte] identifier[optByte] operator[SEP] annotation[@] identifier[Nullable] identifier[Bundle] identifier[bundle] , annotation[@] identifier[Nullable] identifier[String] identifier[key] , Keyword[byte] identifier[fallback] operator[SEP] {
Keyword[if] operator[SEP] identifier[bundle] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[fallback] operator[SEP]
}
Keyword[return] identifier[bundle] operator[SEP] identifier[getByte] operator[SEP] identifier[key] , identifier[fallback] operator[SEP] operator[SEP]
}
|
private void fetchAllOutstanding() {
// Start by retrieving our shared state within a synchronized block.
String[] blockIdsToFetch;
int numRetries;
RetryingBlockFetchListener myListener;
synchronized (this) {
blockIdsToFetch = outstandingBlocksIds.toArray(new String[outstandingBlocksIds.size()]);
numRetries = retryCount;
myListener = currentListener;
}
// Now initiate the fetch on all outstanding blocks, possibly initiating a retry if that fails.
try {
fetchStarter.createAndStart(blockIdsToFetch, myListener);
} catch (Exception e) {
logger.error(String.format("Exception while beginning fetch of %s outstanding blocks %s",
blockIdsToFetch.length, numRetries > 0 ? "(after " + numRetries + " retries)" : ""), e);
if (shouldRetry(e)) {
initiateRetry();
} else {
for (String bid : blockIdsToFetch) {
listener.onBlockFetchFailure(bid, e);
}
}
}
} | class class_name[name] begin[{]
method[fetchAllOutstanding, return_type[void], modifier[private], parameter[]] begin[{]
local_variable[type[String], blockIdsToFetch]
local_variable[type[int], numRetries]
local_variable[type[RetryingBlockFetchListener], myListener]
SYNCHRONIZED[THIS[]] BEGIN[{]
assign[member[.blockIdsToFetch], call[outstandingBlocksIds.toArray, parameter[ArrayCreator(dimensions=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=outstandingBlocksIds, selectors=[], type_arguments=None)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))]]]
assign[member[.numRetries], member[.retryCount]]
assign[member[.myListener], member[.currentListener]]
END[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=blockIdsToFetch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=myListener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createAndStart, postfix_operators=[], prefix_operators=[], qualifier=fetchStarter, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Exception while beginning fetch of %s outstanding blocks %s"), MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=blockIdsToFetch, selectors=[]), TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=numRetries, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), if_true=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="(after "), operandr=MemberReference(member=numRetries, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" retries)"), operator=+))], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=shouldRetry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=bid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=onBlockFetchFailure, postfix_operators=[], prefix_operators=[], qualifier=listener, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=blockIdsToFetch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=bid)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=initiateRetry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[fetchAllOutstanding] operator[SEP] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] identifier[blockIdsToFetch] operator[SEP] Keyword[int] identifier[numRetries] operator[SEP] identifier[RetryingBlockFetchListener] identifier[myListener] operator[SEP] Keyword[synchronized] operator[SEP] Keyword[this] operator[SEP] {
identifier[blockIdsToFetch] operator[=] identifier[outstandingBlocksIds] operator[SEP] identifier[toArray] operator[SEP] Keyword[new] identifier[String] operator[SEP] identifier[outstandingBlocksIds] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[numRetries] operator[=] identifier[retryCount] operator[SEP] identifier[myListener] operator[=] identifier[currentListener] operator[SEP]
}
Keyword[try] {
identifier[fetchStarter] operator[SEP] identifier[createAndStart] operator[SEP] identifier[blockIdsToFetch] , identifier[myListener] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[blockIdsToFetch] operator[SEP] identifier[length] , identifier[numRetries] operator[>] Other[0] operator[?] literal[String] operator[+] identifier[numRetries] operator[+] literal[String] operator[:] literal[String] operator[SEP] , identifier[e] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[shouldRetry] operator[SEP] identifier[e] operator[SEP] operator[SEP] {
identifier[initiateRetry] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[for] operator[SEP] identifier[String] identifier[bid] operator[:] identifier[blockIdsToFetch] operator[SEP] {
identifier[listener] operator[SEP] identifier[onBlockFetchFailure] operator[SEP] identifier[bid] , identifier[e] operator[SEP] operator[SEP]
}
}
}
}
|
public void setType(String type)
throws JspException
{
_type = setRequiredValueAttribute(type, "type");
if (_type != null) {
if (!type.equals("number") && !type.equals("currency") && !type.equals("percent")) {
String s = Bundle.getString("Tags_NumberFormatWrongType");
registerTagError(s, null);
}
}
} | class class_name[name] begin[{]
method[setType, return_type[void], modifier[public], parameter[type]] begin[{]
assign[member[._type], call[.setRequiredValueAttribute, parameter[member[.type], literal["type"]]]]
if[binary_operation[member[._type], !=, literal[null]]] begin[{]
if[binary_operation[binary_operation[call[type.equals, parameter[literal["number"]]], &&, call[type.equals, parameter[literal["currency"]]]], &&, call[type.equals, parameter[literal["percent"]]]]] begin[{]
local_variable[type[String], s]
call[.registerTagError, parameter[member[.s], literal[null]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setType] operator[SEP] identifier[String] identifier[type] operator[SEP] Keyword[throws] identifier[JspException] {
identifier[_type] operator[=] identifier[setRequiredValueAttribute] operator[SEP] identifier[type] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[_type] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[type] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[&&] operator[!] identifier[type] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[&&] operator[!] identifier[type] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[String] identifier[s] operator[=] identifier[Bundle] operator[SEP] identifier[getString] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[registerTagError] operator[SEP] identifier[s] , Other[null] operator[SEP] operator[SEP]
}
}
}
|
@Override
public void setDeploymentDatacenter(String value) {
super.setDeploymentDatacenter(value);
setValueInConfig(DEPLOYMENT_DATACENTER_PROPERTY, value);
setValueInConfig(ContextKey.datacenter.getKey(), value);
} | class class_name[name] begin[{]
method[setDeploymentDatacenter, return_type[void], modifier[public], parameter[value]] begin[{]
SuperMethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setDeploymentDatacenter, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
call[.setValueInConfig, parameter[member[.DEPLOYMENT_DATACENTER_PROPERTY], member[.value]]]
call[.setValueInConfig, parameter[call[ContextKey.datacenter.getKey, parameter[]], member[.value]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[setDeploymentDatacenter] operator[SEP] identifier[String] identifier[value] operator[SEP] {
Keyword[super] operator[SEP] identifier[setDeploymentDatacenter] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[setValueInConfig] operator[SEP] identifier[DEPLOYMENT_DATACENTER_PROPERTY] , identifier[value] operator[SEP] operator[SEP] identifier[setValueInConfig] operator[SEP] identifier[ContextKey] operator[SEP] identifier[datacenter] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[value] operator[SEP] operator[SEP]
}
|
public static HashingInputStream createHashingStream( String digestName,
InputStream inputStream ) throws NoSuchAlgorithmException {
MessageDigest digest = MessageDigest.getInstance(digestName);
return new HashingInputStream(digest, inputStream);
} | class class_name[name] begin[{]
method[createHashingStream, return_type[type[HashingInputStream]], modifier[public static], parameter[digestName, inputStream]] begin[{]
local_variable[type[MessageDigest], digest]
return[ClassCreator(arguments=[MemberReference(member=digest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=inputStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=HashingInputStream, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[HashingInputStream] identifier[createHashingStream] operator[SEP] identifier[String] identifier[digestName] , identifier[InputStream] identifier[inputStream] operator[SEP] Keyword[throws] identifier[NoSuchAlgorithmException] {
identifier[MessageDigest] identifier[digest] operator[=] identifier[MessageDigest] operator[SEP] identifier[getInstance] operator[SEP] identifier[digestName] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[HashingInputStream] operator[SEP] identifier[digest] , identifier[inputStream] operator[SEP] operator[SEP]
}
|
private static Mirror getMirror(FeatureProvider provider, Collision collision)
{
if (collision.hasMirror() && provider.hasFeature(Mirrorable.class))
{
return provider.getFeature(Mirrorable.class).getMirror();
}
return Mirror.NONE;
} | class class_name[name] begin[{]
method[getMirror, return_type[type[Mirror]], modifier[private static], parameter[provider, collision]] begin[{]
if[binary_operation[call[collision.hasMirror, parameter[]], &&, call[provider.hasFeature, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Mirrorable, sub_type=None))]]]] begin[{]
return[call[provider.getFeature, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Mirrorable, sub_type=None))]]]
else begin[{]
None
end[}]
return[member[Mirror.NONE]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[Mirror] identifier[getMirror] operator[SEP] identifier[FeatureProvider] identifier[provider] , identifier[Collision] identifier[collision] operator[SEP] {
Keyword[if] operator[SEP] identifier[collision] operator[SEP] identifier[hasMirror] operator[SEP] operator[SEP] operator[&&] identifier[provider] operator[SEP] identifier[hasFeature] operator[SEP] identifier[Mirrorable] operator[SEP] Keyword[class] operator[SEP] operator[SEP] {
Keyword[return] identifier[provider] operator[SEP] identifier[getFeature] operator[SEP] identifier[Mirrorable] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[getMirror] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[Mirror] operator[SEP] identifier[NONE] operator[SEP]
}
|
public void newRound(Context context) {
this.context = context;
this.log = Log.instance(context);
clearRoundState();
} | class class_name[name] begin[{]
method[newRound, return_type[void], modifier[public], parameter[context]] begin[{]
assign[THIS[member[None.context]], member[.context]]
assign[THIS[member[None.log]], call[Log.instance, parameter[member[.context]]]]
call[.clearRoundState, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[newRound] operator[SEP] identifier[Context] identifier[context] operator[SEP] {
Keyword[this] operator[SEP] identifier[context] operator[=] identifier[context] operator[SEP] Keyword[this] operator[SEP] identifier[log] operator[=] identifier[Log] operator[SEP] identifier[instance] operator[SEP] identifier[context] operator[SEP] operator[SEP] identifier[clearRoundState] operator[SEP] operator[SEP] operator[SEP]
}
|
public EClass getIfcColourOrFactor() {
if (ifcColourOrFactorEClass == null) {
ifcColourOrFactorEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(943);
}
return ifcColourOrFactorEClass;
} | class class_name[name] begin[{]
method[getIfcColourOrFactor, return_type[type[EClass]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.ifcColourOrFactorEClass], ==, literal[null]]] begin[{]
assign[member[.ifcColourOrFactorEClass], Cast(expression=MethodInvocation(arguments=[MemberReference(member=eNS_URI, postfix_operators=[], prefix_operators=[], qualifier=Ifc2x3tc1Package, selectors=[])], member=getEPackage, postfix_operators=[], prefix_operators=[], qualifier=EPackage.Registry.INSTANCE, selectors=[MethodInvocation(arguments=[], member=getEClassifiers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=943)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=EClass, sub_type=None))]
else begin[{]
None
end[}]
return[member[.ifcColourOrFactorEClass]]
end[}]
END[}] | Keyword[public] identifier[EClass] identifier[getIfcColourOrFactor] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[ifcColourOrFactorEClass] operator[==] Other[null] operator[SEP] {
identifier[ifcColourOrFactorEClass] operator[=] operator[SEP] identifier[EClass] operator[SEP] identifier[EPackage] operator[SEP] identifier[Registry] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[getEPackage] operator[SEP] identifier[Ifc2x3tc1Package] operator[SEP] identifier[eNS_URI] operator[SEP] operator[SEP] identifier[getEClassifiers] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[943] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ifcColourOrFactorEClass] operator[SEP]
}
|
public static void printCode(String code, String desc) {
System.out.println("--------------------------" + desc + " begin--------------------------");
System.out.println(code);
System.out.println("--------------------------" + desc + " end--------------------------");
} | class class_name[name] begin[{]
method[printCode, return_type[void], modifier[public static], parameter[code, desc]] begin[{]
call[System.out.println, parameter[binary_operation[binary_operation[literal["--------------------------"], +, member[.desc]], +, literal[" begin--------------------------"]]]]
call[System.out.println, parameter[member[.code]]]
call[System.out.println, parameter[binary_operation[binary_operation[literal["--------------------------"], +, member[.desc]], +, literal[" end--------------------------"]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[printCode] operator[SEP] identifier[String] identifier[code] , identifier[String] identifier[desc] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[desc] operator[+] literal[String] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] identifier[code] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[desc] operator[+] literal[String] operator[SEP] operator[SEP]
}
|
public ApiResponse<ApiSuccessResponse> supervisorRemoteOperationWithHttpInfo(String operationName, String dbid) throws ApiException {
com.squareup.okhttp.Call call = supervisorRemoteOperationValidateBeforeCall(operationName, dbid, null, null);
Type localVarReturnType = new TypeToken<ApiSuccessResponse>(){}.getType();
return apiClient.execute(call, localVarReturnType);
} | class class_name[name] begin[{]
method[supervisorRemoteOperationWithHttpInfo, return_type[type[ApiResponse]], modifier[public], parameter[operationName, dbid]] begin[{]
local_variable[type[com], call]
local_variable[type[Type], localVarReturnType]
return[call[apiClient.execute, parameter[member[.call], member[.localVarReturnType]]]]
end[}]
END[}] | Keyword[public] identifier[ApiResponse] operator[<] identifier[ApiSuccessResponse] operator[>] identifier[supervisorRemoteOperationWithHttpInfo] operator[SEP] identifier[String] identifier[operationName] , identifier[String] identifier[dbid] operator[SEP] Keyword[throws] identifier[ApiException] {
identifier[com] operator[SEP] identifier[squareup] operator[SEP] identifier[okhttp] operator[SEP] identifier[Call] identifier[call] operator[=] identifier[supervisorRemoteOperationValidateBeforeCall] operator[SEP] identifier[operationName] , identifier[dbid] , Other[null] , Other[null] operator[SEP] operator[SEP] identifier[Type] identifier[localVarReturnType] operator[=] Keyword[new] identifier[TypeToken] operator[<] identifier[ApiSuccessResponse] operator[>] operator[SEP] operator[SEP] {
} operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[apiClient] operator[SEP] identifier[execute] operator[SEP] identifier[call] , identifier[localVarReturnType] operator[SEP] operator[SEP]
}
|
public void setPeriod(ReadableInstant start, ReadableInstant end) {
if (start == end) {
setPeriod(0L);
} else {
long startMillis = DateTimeUtils.getInstantMillis(start);
long endMillis = DateTimeUtils.getInstantMillis(end);
Chronology chrono = DateTimeUtils.getIntervalChronology(start, end);
setPeriod(startMillis, endMillis, chrono);
}
} | class class_name[name] begin[{]
method[setPeriod, return_type[void], modifier[public], parameter[start, end]] begin[{]
if[binary_operation[member[.start], ==, member[.end]]] begin[{]
call[.setPeriod, parameter[literal[0L]]]
else begin[{]
local_variable[type[long], startMillis]
local_variable[type[long], endMillis]
local_variable[type[Chronology], chrono]
call[.setPeriod, parameter[member[.startMillis], member[.endMillis], member[.chrono]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setPeriod] operator[SEP] identifier[ReadableInstant] identifier[start] , identifier[ReadableInstant] identifier[end] operator[SEP] {
Keyword[if] operator[SEP] identifier[start] operator[==] identifier[end] operator[SEP] {
identifier[setPeriod] operator[SEP] Other[0L] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[long] identifier[startMillis] operator[=] identifier[DateTimeUtils] operator[SEP] identifier[getInstantMillis] operator[SEP] identifier[start] operator[SEP] operator[SEP] Keyword[long] identifier[endMillis] operator[=] identifier[DateTimeUtils] operator[SEP] identifier[getInstantMillis] operator[SEP] identifier[end] operator[SEP] operator[SEP] identifier[Chronology] identifier[chrono] operator[=] identifier[DateTimeUtils] operator[SEP] identifier[getIntervalChronology] operator[SEP] identifier[start] , identifier[end] operator[SEP] operator[SEP] identifier[setPeriod] operator[SEP] identifier[startMillis] , identifier[endMillis] , identifier[chrono] operator[SEP] operator[SEP]
}
}
|
public LifecycleCallbackType<WebFragmentDescriptor> getOrCreatePostConstruct()
{
List<Node> nodeList = model.get("post-construct");
if (nodeList != null && nodeList.size() > 0)
{
return new LifecycleCallbackTypeImpl<WebFragmentDescriptor>(this, "post-construct", model, nodeList.get(0));
}
return createPostConstruct();
} | class class_name[name] begin[{]
method[getOrCreatePostConstruct, return_type[type[LifecycleCallbackType]], modifier[public], parameter[]] begin[{]
local_variable[type[List], nodeList]
if[binary_operation[binary_operation[member[.nodeList], !=, literal[null]], &&, binary_operation[call[nodeList.size, parameter[]], >, literal[0]]]] begin[{]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="post-construct"), MemberReference(member=model, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=get, postfix_operators=[], prefix_operators=[], qualifier=nodeList, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=WebFragmentDescriptor, sub_type=None))], dimensions=None, name=LifecycleCallbackTypeImpl, sub_type=None))]
else begin[{]
None
end[}]
return[call[.createPostConstruct, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[LifecycleCallbackType] operator[<] identifier[WebFragmentDescriptor] operator[>] identifier[getOrCreatePostConstruct] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[Node] operator[>] identifier[nodeList] operator[=] identifier[model] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[nodeList] operator[!=] Other[null] operator[&&] identifier[nodeList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
Keyword[return] Keyword[new] identifier[LifecycleCallbackTypeImpl] operator[<] identifier[WebFragmentDescriptor] operator[>] operator[SEP] Keyword[this] , literal[String] , identifier[model] , identifier[nodeList] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[createPostConstruct] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
protected void processChildElement(XMLObject parentObject, XMLObject childObject) throws UnmarshallingException {
CurrentAddressStructuredType address = (CurrentAddressStructuredType) parentObject;
if (childObject instanceof PoBox) {
address.setPoBox(((PoBox) childObject).getValue());
}
else if (childObject instanceof LocatorDesignator) {
address.setLocatorDesignator(((LocatorDesignator) childObject).getValue());
}
else if (childObject instanceof LocatorName) {
address.setLocatorName(((LocatorName) childObject).getValue());
}
else if (childObject instanceof CvaddressArea) {
address.setCvaddressArea(((CvaddressArea) childObject).getValue());
}
else if (childObject instanceof Thoroughfare) {
address.setThoroughfare(((Thoroughfare)childObject).getValue());
}
else if (childObject instanceof PostName) {
address.setPostName(((PostName)childObject).getValue());
}
else if (childObject instanceof AdminunitFirstline) {
address.setAdminunitFirstline(((AdminunitFirstline)childObject).getValue());
}
else if (childObject instanceof AdminunitSecondline) {
address.setAdminunitSecondline(((AdminunitSecondline)childObject).getValue());
}
else if (childObject instanceof PostCode) {
address.setPostCode(((PostCode)childObject).getValue());
}
else {
super.processChildElement(parentObject, childObject);
}
} | class class_name[name] begin[{]
method[processChildElement, return_type[void], modifier[protected], parameter[parentObject, childObject]] begin[{]
local_variable[type[CurrentAddressStructuredType], address]
if[binary_operation[member[.childObject], instanceof, type[PoBox]]] begin[{]
call[address.setPoBox, parameter[Cast(expression=MemberReference(member=childObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=PoBox, sub_type=None))]]
else begin[{]
if[binary_operation[member[.childObject], instanceof, type[LocatorDesignator]]] begin[{]
call[address.setLocatorDesignator, parameter[Cast(expression=MemberReference(member=childObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=LocatorDesignator, sub_type=None))]]
else begin[{]
if[binary_operation[member[.childObject], instanceof, type[LocatorName]]] begin[{]
call[address.setLocatorName, parameter[Cast(expression=MemberReference(member=childObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=LocatorName, sub_type=None))]]
else begin[{]
if[binary_operation[member[.childObject], instanceof, type[CvaddressArea]]] begin[{]
call[address.setCvaddressArea, parameter[Cast(expression=MemberReference(member=childObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=CvaddressArea, sub_type=None))]]
else begin[{]
if[binary_operation[member[.childObject], instanceof, type[Thoroughfare]]] begin[{]
call[address.setThoroughfare, parameter[Cast(expression=MemberReference(member=childObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Thoroughfare, sub_type=None))]]
else begin[{]
if[binary_operation[member[.childObject], instanceof, type[PostName]]] begin[{]
call[address.setPostName, parameter[Cast(expression=MemberReference(member=childObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=PostName, sub_type=None))]]
else begin[{]
if[binary_operation[member[.childObject], instanceof, type[AdminunitFirstline]]] begin[{]
call[address.setAdminunitFirstline, parameter[Cast(expression=MemberReference(member=childObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=AdminunitFirstline, sub_type=None))]]
else begin[{]
if[binary_operation[member[.childObject], instanceof, type[AdminunitSecondline]]] begin[{]
call[address.setAdminunitSecondline, parameter[Cast(expression=MemberReference(member=childObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=AdminunitSecondline, sub_type=None))]]
else begin[{]
if[binary_operation[member[.childObject], instanceof, type[PostCode]]] begin[{]
call[address.setPostCode, parameter[Cast(expression=MemberReference(member=childObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=PostCode, sub_type=None))]]
else begin[{]
SuperMethodInvocation(arguments=[MemberReference(member=parentObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=childObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=processChildElement, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[processChildElement] operator[SEP] identifier[XMLObject] identifier[parentObject] , identifier[XMLObject] identifier[childObject] operator[SEP] Keyword[throws] identifier[UnmarshallingException] {
identifier[CurrentAddressStructuredType] identifier[address] operator[=] operator[SEP] identifier[CurrentAddressStructuredType] operator[SEP] identifier[parentObject] operator[SEP] Keyword[if] operator[SEP] identifier[childObject] Keyword[instanceof] identifier[PoBox] operator[SEP] {
identifier[address] operator[SEP] identifier[setPoBox] operator[SEP] operator[SEP] operator[SEP] identifier[PoBox] operator[SEP] identifier[childObject] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[childObject] Keyword[instanceof] identifier[LocatorDesignator] operator[SEP] {
identifier[address] operator[SEP] identifier[setLocatorDesignator] operator[SEP] operator[SEP] operator[SEP] identifier[LocatorDesignator] operator[SEP] identifier[childObject] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[childObject] Keyword[instanceof] identifier[LocatorName] operator[SEP] {
identifier[address] operator[SEP] identifier[setLocatorName] operator[SEP] operator[SEP] operator[SEP] identifier[LocatorName] operator[SEP] identifier[childObject] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[childObject] Keyword[instanceof] identifier[CvaddressArea] operator[SEP] {
identifier[address] operator[SEP] identifier[setCvaddressArea] operator[SEP] operator[SEP] operator[SEP] identifier[CvaddressArea] operator[SEP] identifier[childObject] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[childObject] Keyword[instanceof] identifier[Thoroughfare] operator[SEP] {
identifier[address] operator[SEP] identifier[setThoroughfare] operator[SEP] operator[SEP] operator[SEP] identifier[Thoroughfare] operator[SEP] identifier[childObject] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[childObject] Keyword[instanceof] identifier[PostName] operator[SEP] {
identifier[address] operator[SEP] identifier[setPostName] operator[SEP] operator[SEP] operator[SEP] identifier[PostName] operator[SEP] identifier[childObject] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[childObject] Keyword[instanceof] identifier[AdminunitFirstline] operator[SEP] {
identifier[address] operator[SEP] identifier[setAdminunitFirstline] operator[SEP] operator[SEP] operator[SEP] identifier[AdminunitFirstline] operator[SEP] identifier[childObject] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[childObject] Keyword[instanceof] identifier[AdminunitSecondline] operator[SEP] {
identifier[address] operator[SEP] identifier[setAdminunitSecondline] operator[SEP] operator[SEP] operator[SEP] identifier[AdminunitSecondline] operator[SEP] identifier[childObject] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[childObject] Keyword[instanceof] identifier[PostCode] operator[SEP] {
identifier[address] operator[SEP] identifier[setPostCode] operator[SEP] operator[SEP] operator[SEP] identifier[PostCode] operator[SEP] identifier[childObject] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[super] operator[SEP] identifier[processChildElement] operator[SEP] identifier[parentObject] , identifier[childObject] operator[SEP] operator[SEP]
}
}
|
public void deleteCookie(Cookie cookie) {
cookies.remove(cookie.name());
deletePersistedCookie(cookie.name());
} | class class_name[name] begin[{]
method[deleteCookie, return_type[void], modifier[public], parameter[cookie]] begin[{]
call[cookies.remove, parameter[call[cookie.name, parameter[]]]]
call[.deletePersistedCookie, parameter[call[cookie.name, parameter[]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[deleteCookie] operator[SEP] identifier[Cookie] identifier[cookie] operator[SEP] {
identifier[cookies] operator[SEP] identifier[remove] operator[SEP] identifier[cookie] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[deletePersistedCookie] operator[SEP] identifier[cookie] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public List<StepExecution> getStepThreadExecutionsRunning(PersistenceServiceUnit psu, final long jobExecutionId) {
final EntityManager em = psu.createEntityManager();
try {
List<StepExecution> exec = new TranRequest<List<StepExecution>>(em) {
@Override
public List<StepExecution> call() throws Exception {
TypedQuery<StepExecution> query = em.createNamedQuery(StepThreadExecutionEntity.GET_STEP_THREAD_EXECUTIONIDS_BY_JOB_EXEC_AND_STATUSES_QUERY,
StepExecution.class);
query.setParameter("jobExecutionId", jobExecutionId);
query.setParameter("status", RUNNING_STATUSES);
List<StepExecution> result = query.getResultList();
if (result == null) {
return new ArrayList<StepExecution>();
}
return result;
}
}.runInNewOrExistingGlobalTran();
return exec;
} finally {
em.close();
}
} | class class_name[name] begin[{]
method[getStepThreadExecutionsRunning, return_type[type[List]], modifier[public], parameter[psu, jobExecutionId]] begin[{]
local_variable[type[EntityManager], em]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=em, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=GET_STEP_THREAD_EXECUTIONIDS_BY_JOB_EXEC_AND_STATUSES_QUERY, postfix_operators=[], prefix_operators=[], qualifier=StepThreadExecutionEntity, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StepExecution, sub_type=None))], member=createNamedQuery, postfix_operators=[], prefix_operators=[], qualifier=em, selectors=[], type_arguments=None), name=query)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=StepExecution, sub_type=None))], dimensions=[], name=TypedQuery, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="jobExecutionId"), MemberReference(member=jobExecutionId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setParameter, postfix_operators=[], prefix_operators=[], qualifier=query, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="status"), MemberReference(member=RUNNING_STATUSES, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setParameter, postfix_operators=[], prefix_operators=[], qualifier=query, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getResultList, postfix_operators=[], prefix_operators=[], qualifier=query, selectors=[], type_arguments=None), name=result)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=StepExecution, sub_type=None))], dimensions=[], name=List, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=StepExecution, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None)), label=None)])), ReturnStatement(expression=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], documentation=None, modifiers={'public'}, name=call, parameters=[], return_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=StepExecution, sub_type=None))], dimensions=[], name=List, sub_type=None), throws=['Exception'], type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=runInNewOrExistingGlobalTran, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=StepExecution, sub_type=None))], dimensions=[], name=List, sub_type=None))], dimensions=None, name=TranRequest, sub_type=None)), name=exec)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=StepExecution, sub_type=None))], dimensions=[], name=List, sub_type=None)), ReturnStatement(expression=MemberReference(member=exec, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=em, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[StepExecution] operator[>] identifier[getStepThreadExecutionsRunning] operator[SEP] identifier[PersistenceServiceUnit] identifier[psu] , Keyword[final] Keyword[long] identifier[jobExecutionId] operator[SEP] {
Keyword[final] identifier[EntityManager] identifier[em] operator[=] identifier[psu] operator[SEP] identifier[createEntityManager] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[List] operator[<] identifier[StepExecution] operator[>] identifier[exec] operator[=] Keyword[new] identifier[TranRequest] operator[<] identifier[List] operator[<] identifier[StepExecution] operator[>] operator[>] operator[SEP] identifier[em] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[List] operator[<] identifier[StepExecution] operator[>] identifier[call] operator[SEP] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[TypedQuery] operator[<] identifier[StepExecution] operator[>] identifier[query] operator[=] identifier[em] operator[SEP] identifier[createNamedQuery] operator[SEP] identifier[StepThreadExecutionEntity] operator[SEP] identifier[GET_STEP_THREAD_EXECUTIONIDS_BY_JOB_EXEC_AND_STATUSES_QUERY] , identifier[StepExecution] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[query] operator[SEP] identifier[setParameter] operator[SEP] literal[String] , identifier[jobExecutionId] operator[SEP] operator[SEP] identifier[query] operator[SEP] identifier[setParameter] operator[SEP] literal[String] , identifier[RUNNING_STATUSES] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[StepExecution] operator[>] identifier[result] operator[=] identifier[query] operator[SEP] identifier[getResultList] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[==] Other[null] operator[SEP] {
Keyword[return] Keyword[new] identifier[ArrayList] operator[<] identifier[StepExecution] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
} operator[SEP] identifier[runInNewOrExistingGlobalTran] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[exec] operator[SEP]
}
Keyword[finally] {
identifier[em] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static final <T extends UIObject> void removeAnimationOnEnd(final T widget, final String animation) {
if (widget != null && animation != null) {
removeAnimationOnEnd(widget.getElement(), animation);
}
} | class class_name[name] begin[{]
method[removeAnimationOnEnd, return_type[void], modifier[final public static], parameter[widget, animation]] begin[{]
if[binary_operation[binary_operation[member[.widget], !=, literal[null]], &&, binary_operation[member[.animation], !=, literal[null]]]] begin[{]
call[.removeAnimationOnEnd, parameter[call[widget.getElement, parameter[]], member[.animation]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[final] operator[<] identifier[T] Keyword[extends] identifier[UIObject] operator[>] Keyword[void] identifier[removeAnimationOnEnd] operator[SEP] Keyword[final] identifier[T] identifier[widget] , Keyword[final] identifier[String] identifier[animation] operator[SEP] {
Keyword[if] operator[SEP] identifier[widget] operator[!=] Other[null] operator[&&] identifier[animation] operator[!=] Other[null] operator[SEP] {
identifier[removeAnimationOnEnd] operator[SEP] identifier[widget] operator[SEP] identifier[getElement] operator[SEP] operator[SEP] , identifier[animation] operator[SEP] operator[SEP]
}
}
|
public int getShowYear() {
Calendar cal = Calendar.getInstance();
cal.setTime(getDate());
return cal.get(Calendar.YEAR);
} | class class_name[name] begin[{]
method[getShowYear, return_type[type[int]], modifier[public], parameter[]] begin[{]
local_variable[type[Calendar], cal]
call[cal.setTime, parameter[call[.getDate, parameter[]]]]
return[call[cal.get, parameter[member[Calendar.YEAR]]]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[getShowYear] operator[SEP] operator[SEP] {
identifier[Calendar] identifier[cal] operator[=] identifier[Calendar] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] identifier[cal] operator[SEP] identifier[setTime] operator[SEP] identifier[getDate] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[cal] operator[SEP] identifier[get] operator[SEP] identifier[Calendar] operator[SEP] identifier[YEAR] operator[SEP] operator[SEP]
}
|
private static Set<String> getHopByHopHeaders(HttpSession session) {
List<String> connectionHeaders = session.getReadHeaders(HEADER_CONNECTION);
if (connectionHeaders == null) {
connectionHeaders = Collections.emptyList();
}
Set<String> hopByHopHeaders = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
for (String conHeader : connectionHeaders) {
hopByHopHeaders.add(conHeader);
}
hopByHopHeaders.add(HEADER_CONNECTION);
return hopByHopHeaders;
} | class class_name[name] begin[{]
method[getHopByHopHeaders, return_type[type[Set]], modifier[private static], parameter[session]] begin[{]
local_variable[type[List], connectionHeaders]
if[binary_operation[member[.connectionHeaders], ==, literal[null]]] begin[{]
assign[member[.connectionHeaders], call[Collections.emptyList, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[Set], hopByHopHeaders]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=conHeader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=hopByHopHeaders, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=connectionHeaders, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=conHeader)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
call[hopByHopHeaders.add, parameter[member[.HEADER_CONNECTION]]]
return[member[.hopByHopHeaders]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[Set] operator[<] identifier[String] operator[>] identifier[getHopByHopHeaders] operator[SEP] identifier[HttpSession] identifier[session] operator[SEP] {
identifier[List] operator[<] identifier[String] operator[>] identifier[connectionHeaders] operator[=] identifier[session] operator[SEP] identifier[getReadHeaders] operator[SEP] identifier[HEADER_CONNECTION] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[connectionHeaders] operator[==] Other[null] operator[SEP] {
identifier[connectionHeaders] operator[=] identifier[Collections] operator[SEP] identifier[emptyList] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Set] operator[<] identifier[String] operator[>] identifier[hopByHopHeaders] operator[=] Keyword[new] identifier[TreeSet] operator[<] operator[>] operator[SEP] identifier[String] operator[SEP] identifier[CASE_INSENSITIVE_ORDER] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[conHeader] operator[:] identifier[connectionHeaders] operator[SEP] {
identifier[hopByHopHeaders] operator[SEP] identifier[add] operator[SEP] identifier[conHeader] operator[SEP] operator[SEP]
}
identifier[hopByHopHeaders] operator[SEP] identifier[add] operator[SEP] identifier[HEADER_CONNECTION] operator[SEP] operator[SEP] Keyword[return] identifier[hopByHopHeaders] operator[SEP]
}
|
private void shrink() {
int oldCapacity = data.length;
if (oldCapacity == 1)
return;
E[] oldData = data;
int newCapacity = oldCapacity >> 1;
@SuppressWarnings("unchecked")
E[] newData = (E[]) new Object[newCapacity];
for (int i = 0; i < oldCapacity; i++) {
E e = oldData[i];
if (e != null)
LinearProbing.add(newData, e);
}
this.data = newData;
} | class class_name[name] begin[{]
method[shrink, return_type[void], modifier[private], parameter[]] begin[{]
local_variable[type[int], oldCapacity]
if[binary_operation[member[.oldCapacity], ==, literal[1]]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[E], oldData]
local_variable[type[int], newCapacity]
local_variable[type[E], newData]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=oldData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=e)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=E, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=newData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=LinearProbing, selectors=[], type_arguments=None), label=None))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=oldCapacity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
assign[THIS[member[None.data]], member[.newData]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[shrink] operator[SEP] operator[SEP] {
Keyword[int] identifier[oldCapacity] operator[=] identifier[data] operator[SEP] identifier[length] operator[SEP] Keyword[if] operator[SEP] identifier[oldCapacity] operator[==] Other[1] operator[SEP] Keyword[return] operator[SEP] identifier[E] operator[SEP] operator[SEP] identifier[oldData] operator[=] identifier[data] operator[SEP] Keyword[int] identifier[newCapacity] operator[=] identifier[oldCapacity] operator[>] operator[>] Other[1] operator[SEP] annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] identifier[E] operator[SEP] operator[SEP] identifier[newData] operator[=] operator[SEP] identifier[E] operator[SEP] operator[SEP] operator[SEP] Keyword[new] identifier[Object] operator[SEP] identifier[newCapacity] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[oldCapacity] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[E] identifier[e] operator[=] identifier[oldData] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[e] operator[!=] Other[null] operator[SEP] identifier[LinearProbing] operator[SEP] identifier[add] operator[SEP] identifier[newData] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[data] operator[=] identifier[newData] operator[SEP]
}
|
public static AVUser signUpOrLoginByMobilePhone(String mobilePhoneNumber, String smsCode) {
return signUpOrLoginByMobilePhone(mobilePhoneNumber, smsCode, internalUserClazz());
} | class class_name[name] begin[{]
method[signUpOrLoginByMobilePhone, return_type[type[AVUser]], modifier[public static], parameter[mobilePhoneNumber, smsCode]] begin[{]
return[call[.signUpOrLoginByMobilePhone, parameter[member[.mobilePhoneNumber], member[.smsCode], call[.internalUserClazz, parameter[]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[AVUser] identifier[signUpOrLoginByMobilePhone] operator[SEP] identifier[String] identifier[mobilePhoneNumber] , identifier[String] identifier[smsCode] operator[SEP] {
Keyword[return] identifier[signUpOrLoginByMobilePhone] operator[SEP] identifier[mobilePhoneNumber] , identifier[smsCode] , identifier[internalUserClazz] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public synchronized void moveCursor(Cursor cursor)
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "moveCursor", new Object[] { cursor });
checkEntryParent();
synchronized(parentList)
{
//make sure that the cursor is pointing to an entry in the same list
if(cursor != null && cursor.parentList == parentList)
{
//if we are already pointing to the same entry, we may not have to
//do anything
if(cursor.current != current)
{
if(cursor.atTop)
{
//if the new cursor is at the top, move this one to the top
moveToTop();
}
else if(cursor.atBottom)
{
//if the new cursor is at the bottom, move this one to the bottom
moveToBottom();
}
else
{
//otherwise just move this cursor to point to the same entry as the
//one pointed to by the given cursor
moveCursor(cursor.current);
}
}
else //it is possible that the current entries are both null if they are both
{ //at the top or bottom on the list
if(cursor.current == null)
{
if(cursor.atTop && atBottom)
{
//if the given cursor is at the top but we are at the bottom, move to the top
moveToTop();
}
else if(cursor.atBottom && atTop)
{
//if the given cursor is at the bottom but we are at the top, move to the bottom
moveToBottom();
}
}
}
}
else //if the new entry is not in this list, throw a runtime exception
{
SIErrorException e = new SIErrorException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.utils.linkedlist.Cursor",
"1:541:1.15" },
null));
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.utils.linkedlist.Cursor.moveCursor",
"1:547:1.15",
this);
SibTr.exception(tc, e);
if (tc.isEntryEnabled())
SibTr.exit(tc, "moveCursor", e);
throw e;
}
}
if (tc.isEntryEnabled())
SibTr.exit(tc, "moveCursor");
} | class class_name[name] begin[{]
method[moveCursor, return_type[void], modifier[synchronized public], parameter[cursor]] begin[{]
if[call[tc.isEntryEnabled, parameter[]]] begin[{]
call[SibTr.entry, parameter[member[.tc], literal["moveCursor"], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=cursor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
else begin[{]
None
end[}]
call[.checkEntryParent, parameter[]]
SYNCHRONIZED[member[.parentList]] BEGIN[{]
if[binary_operation[binary_operation[member[.cursor], !=, literal[null]], &&, binary_operation[member[cursor.parentList], ==, member[.parentList]]]] begin[{]
if[binary_operation[member[cursor.current], !=, member[.current]]] begin[{]
if[member[cursor.atTop]] begin[{]
call[.moveToTop, parameter[]]
else begin[{]
if[member[cursor.atBottom]] begin[{]
call[.moveToBottom, parameter[]]
else begin[{]
call[.moveCursor, parameter[member[cursor.current]]]
end[}]
end[}]
else begin[{]
if[binary_operation[member[cursor.current], ==, literal[null]]] begin[{]
if[binary_operation[member[cursor.atTop], &&, member[.atBottom]]] begin[{]
call[.moveToTop, parameter[]]
else begin[{]
if[binary_operation[member[cursor.atBottom], &&, member[.atTop]]] begin[{]
call[.moveToBottom, parameter[]]
else begin[{]
None
end[}]
end[}]
else begin[{]
None
end[}]
end[}]
else begin[{]
local_variable[type[SIErrorException], e]
call[FFDCFilter.processException, parameter[member[.e], literal["com.ibm.ws.sib.processor.utils.linkedlist.Cursor.moveCursor"], literal["1:547:1.15"], THIS[]]]
call[SibTr.exception, parameter[member[.tc], member[.e]]]
if[call[tc.isEntryEnabled, parameter[]]] begin[{]
call[SibTr.exit, parameter[member[.tc], literal["moveCursor"], member[.e]]]
else begin[{]
None
end[}]
ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
end[}]
END[}]
if[call[tc.isEntryEnabled, parameter[]]] begin[{]
call[SibTr.exit, parameter[member[.tc], literal["moveCursor"]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[synchronized] Keyword[void] identifier[moveCursor] operator[SEP] identifier[Cursor] identifier[cursor] operator[SEP] {
Keyword[if] operator[SEP] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] identifier[tc] , literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[cursor]
} operator[SEP] operator[SEP] identifier[checkEntryParent] operator[SEP] operator[SEP] operator[SEP] Keyword[synchronized] operator[SEP] identifier[parentList] operator[SEP] {
Keyword[if] operator[SEP] identifier[cursor] operator[!=] Other[null] operator[&&] identifier[cursor] operator[SEP] identifier[parentList] operator[==] identifier[parentList] operator[SEP] {
Keyword[if] operator[SEP] identifier[cursor] operator[SEP] identifier[current] operator[!=] identifier[current] operator[SEP] {
Keyword[if] operator[SEP] identifier[cursor] operator[SEP] identifier[atTop] operator[SEP] {
identifier[moveToTop] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[cursor] operator[SEP] identifier[atBottom] operator[SEP] {
identifier[moveToBottom] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[moveCursor] operator[SEP] identifier[cursor] operator[SEP] identifier[current] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[cursor] operator[SEP] identifier[current] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[cursor] operator[SEP] identifier[atTop] operator[&&] identifier[atBottom] operator[SEP] {
identifier[moveToTop] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[cursor] operator[SEP] identifier[atBottom] operator[&&] identifier[atTop] operator[SEP] {
identifier[moveToBottom] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
Keyword[else] {
identifier[SIErrorException] identifier[e] operator[=] Keyword[new] identifier[SIErrorException] operator[SEP] identifier[nls] operator[SEP] identifier[getFormattedMessage] operator[SEP] literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
literal[String] , literal[String]
} , Other[null] operator[SEP] operator[SEP] operator[SEP] identifier[FFDCFilter] operator[SEP] identifier[processException] operator[SEP] identifier[e] , literal[String] , literal[String] , Keyword[this] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exception] operator[SEP] identifier[tc] , identifier[e] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] identifier[e] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
|
private static HashSet<String> parseExcludeFilter(List<Filter> customFilters) {
HashSet<String> excludeKeys = new HashSet<String>();
if (CommonUtils.isNotEmpty(customFilters)) {
for (Filter filter : customFilters) {
if (filter instanceof ExcludeFilter) {
// 存在需要排除的过滤器
ExcludeFilter excludeFilter = (ExcludeFilter) filter;
String excludeName = excludeFilter.getExcludeName();
if (StringUtils.isNotEmpty(excludeName)) {
String excludeFilterName = startsWithExcludePrefix(excludeName) ?
excludeName.substring(1)
: excludeName;
if (StringUtils.isNotEmpty(excludeFilterName)) {
excludeKeys.add(excludeFilterName);
}
}
customFilters.remove(filter);
}
}
}
if (!excludeKeys.isEmpty()) {
if (LOGGER.isInfoEnabled()) {
LOGGER.info("Find exclude filters: {}", excludeKeys);
}
}
return excludeKeys;
} | class class_name[name] begin[{]
method[parseExcludeFilter, return_type[type[HashSet]], modifier[private static], parameter[customFilters]] begin[{]
local_variable[type[HashSet], excludeKeys]
if[call[CommonUtils.isNotEmpty, parameter[member[.customFilters]]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=filter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=ExcludeFilter, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=filter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ExcludeFilter, sub_type=None)), name=excludeFilter)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ExcludeFilter, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getExcludeName, postfix_operators=[], prefix_operators=[], qualifier=excludeFilter, selectors=[], type_arguments=None), name=excludeName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=excludeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isNotEmpty, postfix_operators=[], prefix_operators=[], qualifier=StringUtils, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=TernaryExpression(condition=MethodInvocation(arguments=[MemberReference(member=excludeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=startsWithExcludePrefix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), if_false=MemberReference(member=excludeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=excludeName, selectors=[], type_arguments=None)), name=excludeFilterName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=excludeFilterName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isNotEmpty, postfix_operators=[], prefix_operators=[], qualifier=StringUtils, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=excludeFilterName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=excludeKeys, selectors=[], type_arguments=None), label=None)]))])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=filter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=customFilters, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=customFilters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=filter)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Filter, sub_type=None))), label=None)
else begin[{]
None
end[}]
if[call[excludeKeys.isEmpty, parameter[]]] begin[{]
if[call[LOGGER.isInfoEnabled, parameter[]]] begin[{]
call[LOGGER.info, parameter[literal["Find exclude filters: {}"], member[.excludeKeys]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[member[.excludeKeys]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[HashSet] operator[<] identifier[String] operator[>] identifier[parseExcludeFilter] operator[SEP] identifier[List] operator[<] identifier[Filter] operator[>] identifier[customFilters] operator[SEP] {
identifier[HashSet] operator[<] identifier[String] operator[>] identifier[excludeKeys] operator[=] Keyword[new] identifier[HashSet] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[CommonUtils] operator[SEP] identifier[isNotEmpty] operator[SEP] identifier[customFilters] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[Filter] identifier[filter] operator[:] identifier[customFilters] operator[SEP] {
Keyword[if] operator[SEP] identifier[filter] Keyword[instanceof] identifier[ExcludeFilter] operator[SEP] {
identifier[ExcludeFilter] identifier[excludeFilter] operator[=] operator[SEP] identifier[ExcludeFilter] operator[SEP] identifier[filter] operator[SEP] identifier[String] identifier[excludeName] operator[=] identifier[excludeFilter] operator[SEP] identifier[getExcludeName] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isNotEmpty] operator[SEP] identifier[excludeName] operator[SEP] operator[SEP] {
identifier[String] identifier[excludeFilterName] operator[=] identifier[startsWithExcludePrefix] operator[SEP] identifier[excludeName] operator[SEP] operator[?] identifier[excludeName] operator[SEP] identifier[substring] operator[SEP] Other[1] operator[SEP] operator[:] identifier[excludeName] operator[SEP] Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isNotEmpty] operator[SEP] identifier[excludeFilterName] operator[SEP] operator[SEP] {
identifier[excludeKeys] operator[SEP] identifier[add] operator[SEP] identifier[excludeFilterName] operator[SEP] operator[SEP]
}
}
identifier[customFilters] operator[SEP] identifier[remove] operator[SEP] identifier[filter] operator[SEP] operator[SEP]
}
}
}
Keyword[if] operator[SEP] operator[!] identifier[excludeKeys] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[LOGGER] operator[SEP] identifier[isInfoEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[excludeKeys] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[excludeKeys] operator[SEP]
}
|
public String encode(String text) {
Assert.notNull(text, "Text should not be null.");
text = text.toUpperCase();
final StringBuilder morseBuilder = new StringBuilder();
final int len = text.codePointCount(0, text.length());
for (int i = 0; i < len; i++) {
int codePoint = text.codePointAt(i);
String word = alphabets.get(codePoint);
if (word == null) {
word = Integer.toBinaryString(codePoint);
}
morseBuilder.append(word.replace('0', dit).replace('1', dah)).append(split);
}
return morseBuilder.toString();
} | class class_name[name] begin[{]
method[encode, return_type[type[String]], modifier[public], parameter[text]] begin[{]
call[Assert.notNull, parameter[member[.text], literal["Text should not be null."]]]
assign[member[.text], call[text.toUpperCase, parameter[]]]
local_variable[type[StringBuilder], morseBuilder]
local_variable[type[int], len]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=codePointAt, postfix_operators=[], prefix_operators=[], qualifier=text, selectors=[], type_arguments=None), name=codePoint)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=codePoint, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=alphabets, selectors=[], type_arguments=None), name=word)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=word, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=word, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=codePoint, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toBinaryString, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='0'), MemberReference(member=dit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=replace, postfix_operators=[], prefix_operators=[], qualifier=word, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='1'), MemberReference(member=dah, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=replace, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=morseBuilder, selectors=[MethodInvocation(arguments=[MemberReference(member=split, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=len, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[call[morseBuilder.toString, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[encode] operator[SEP] identifier[String] identifier[text] operator[SEP] {
identifier[Assert] operator[SEP] identifier[notNull] operator[SEP] identifier[text] , literal[String] operator[SEP] operator[SEP] identifier[text] operator[=] identifier[text] operator[SEP] identifier[toUpperCase] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[StringBuilder] identifier[morseBuilder] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[len] operator[=] identifier[text] operator[SEP] identifier[codePointCount] operator[SEP] Other[0] , identifier[text] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[len] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[int] identifier[codePoint] operator[=] identifier[text] operator[SEP] identifier[codePointAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[String] identifier[word] operator[=] identifier[alphabets] operator[SEP] identifier[get] operator[SEP] identifier[codePoint] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[word] operator[==] Other[null] operator[SEP] {
identifier[word] operator[=] identifier[Integer] operator[SEP] identifier[toBinaryString] operator[SEP] identifier[codePoint] operator[SEP] operator[SEP]
}
identifier[morseBuilder] operator[SEP] identifier[append] operator[SEP] identifier[word] operator[SEP] identifier[replace] operator[SEP] literal[String] , identifier[dit] operator[SEP] operator[SEP] identifier[replace] operator[SEP] literal[String] , identifier[dah] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[split] operator[SEP] operator[SEP]
}
Keyword[return] identifier[morseBuilder] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public <T extends Pointer> T getHelperWorkspace(String key){
return helperWorkspacePointers == null ? null : (T)helperWorkspacePointers.get(key);
} | class class_name[name] begin[{]
method[getHelperWorkspace, return_type[type[T]], modifier[public], parameter[key]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=helperWorkspacePointers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=Cast(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=helperWorkspacePointers, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None)), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
end[}]
END[}] | Keyword[public] operator[<] identifier[T] Keyword[extends] identifier[Pointer] operator[>] identifier[T] identifier[getHelperWorkspace] operator[SEP] identifier[String] identifier[key] operator[SEP] {
Keyword[return] identifier[helperWorkspacePointers] operator[==] Other[null] operator[?] Other[null] operator[:] operator[SEP] identifier[T] operator[SEP] identifier[helperWorkspacePointers] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP]
}
|
public synchronized void setBlob(String parameterName,
Blob x) throws SQLException {
super.setBlob(findParameterIndex(parameterName), x);
} | class class_name[name] begin[{]
method[setBlob, return_type[void], modifier[synchronized public], parameter[parameterName, x]] begin[{]
SuperMethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=parameterName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=findParameterIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setBlob, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
end[}]
END[}] | Keyword[public] Keyword[synchronized] Keyword[void] identifier[setBlob] operator[SEP] identifier[String] identifier[parameterName] , identifier[Blob] identifier[x] operator[SEP] Keyword[throws] identifier[SQLException] {
Keyword[super] operator[SEP] identifier[setBlob] operator[SEP] identifier[findParameterIndex] operator[SEP] identifier[parameterName] operator[SEP] , identifier[x] operator[SEP] operator[SEP]
}
|
public int updateExpirationTime(Object id, long oldExpirationTime, int size, long newExpirationTime, long newValidatorExpirationTime) {
int returnCode = this.htod.updateExpirationTime(id, oldExpirationTime, size, newExpirationTime, newValidatorExpirationTime);
if (returnCode == HTODDynacache.DISK_EXCEPTION) {
stopOnError(this.htod.diskCacheException);
}
return returnCode;
} | class class_name[name] begin[{]
method[updateExpirationTime, return_type[type[int]], modifier[public], parameter[id, oldExpirationTime, size, newExpirationTime, newValidatorExpirationTime]] begin[{]
local_variable[type[int], returnCode]
if[binary_operation[member[.returnCode], ==, member[HTODDynacache.DISK_EXCEPTION]]] begin[{]
call[.stopOnError, parameter[THIS[member[None.htod]member[None.diskCacheException]]]]
else begin[{]
None
end[}]
return[member[.returnCode]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[updateExpirationTime] operator[SEP] identifier[Object] identifier[id] , Keyword[long] identifier[oldExpirationTime] , Keyword[int] identifier[size] , Keyword[long] identifier[newExpirationTime] , Keyword[long] identifier[newValidatorExpirationTime] operator[SEP] {
Keyword[int] identifier[returnCode] operator[=] Keyword[this] operator[SEP] identifier[htod] operator[SEP] identifier[updateExpirationTime] operator[SEP] identifier[id] , identifier[oldExpirationTime] , identifier[size] , identifier[newExpirationTime] , identifier[newValidatorExpirationTime] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[returnCode] operator[==] identifier[HTODDynacache] operator[SEP] identifier[DISK_EXCEPTION] operator[SEP] {
identifier[stopOnError] operator[SEP] Keyword[this] operator[SEP] identifier[htod] operator[SEP] identifier[diskCacheException] operator[SEP] operator[SEP]
}
Keyword[return] identifier[returnCode] operator[SEP]
}
|
public Observable<Page<SyncMemberInner>> listBySyncGroupAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName) {
return listBySyncGroupWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName)
.map(new Func1<ServiceResponse<Page<SyncMemberInner>>, Page<SyncMemberInner>>() {
@Override
public Page<SyncMemberInner> call(ServiceResponse<Page<SyncMemberInner>> response) {
return response.body();
}
});
} | class class_name[name] begin[{]
method[listBySyncGroupAsync, return_type[type[Observable]], modifier[public], parameter[resourceGroupName, serverName, databaseName, syncGroupName]] begin[{]
return[call[.listBySyncGroupWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.serverName], member[.databaseName], member[.syncGroupName]]]]
end[}]
END[}] | Keyword[public] identifier[Observable] operator[<] identifier[Page] operator[<] identifier[SyncMemberInner] operator[>] operator[>] identifier[listBySyncGroupAsync] operator[SEP] Keyword[final] identifier[String] identifier[resourceGroupName] , Keyword[final] identifier[String] identifier[serverName] , Keyword[final] identifier[String] identifier[databaseName] , Keyword[final] identifier[String] identifier[syncGroupName] operator[SEP] {
Keyword[return] identifier[listBySyncGroupWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[serverName] , identifier[databaseName] , identifier[syncGroupName] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[SyncMemberInner] operator[>] operator[>] , identifier[Page] operator[<] identifier[SyncMemberInner] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Page] operator[<] identifier[SyncMemberInner] operator[>] identifier[call] operator[SEP] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[SyncMemberInner] operator[>] operator[>] identifier[response] operator[SEP] {
Keyword[return] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
public static Set<Currency> getAvailableCurrencies() {
Set<Currency> result = new LinkedHashSet<Currency>();
for (String currencyCode : availableCurrencyCodes) {
result.add(Currency.getInstance(currencyCode));
}
return result;
} | class class_name[name] begin[{]
method[getAvailableCurrencies, return_type[type[Set]], modifier[public static], parameter[]] begin[{]
local_variable[type[Set], result]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=currencyCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getInstance, postfix_operators=[], prefix_operators=[], qualifier=Currency, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=availableCurrencyCodes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=currencyCode)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[member[.result]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Set] operator[<] identifier[Currency] operator[>] identifier[getAvailableCurrencies] operator[SEP] operator[SEP] {
identifier[Set] operator[<] identifier[Currency] operator[>] identifier[result] operator[=] Keyword[new] identifier[LinkedHashSet] operator[<] identifier[Currency] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[currencyCode] operator[:] identifier[availableCurrencyCodes] operator[SEP] {
identifier[result] operator[SEP] identifier[add] operator[SEP] identifier[Currency] operator[SEP] identifier[getInstance] operator[SEP] identifier[currencyCode] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public QiniuBlockResponseData createBlockInQiniu(int blockSize, int firstChunkSize,
final byte[] firstChunkData, int retry) {
try {
String endPoint = String.format(QINIU_CREATE_BLOCK_EP, this.uploadUrl, blockSize);
Request.Builder builder = new Request.Builder();
builder.url(endPoint);
builder.addHeader(HEAD_CONTENT_TYPE, DEFAULT_CONTENT_TYPE);
builder.addHeader(HEAD_CONTENT_LENGTH, String.valueOf(firstChunkSize));
builder.addHeader(HEAD_AUTHORIZATION, "UpToken " + this.uploadToken);
LOGGER.d("createBlockInQiniu with uploadUrl: " + endPoint);
RequestBody requestBody = RequestBody.create(MediaType.parse(DEFAULT_CONTENT_TYPE), firstChunkData, 0, firstChunkSize);
builder = builder.post(requestBody);
Response response = this.client.newCall(builder.build()).execute();
return parseQiniuResponse(response, QiniuBlockResponseData.class);
} catch (Exception e) {
if (retry-- > 0) {
return createBlockInQiniu(blockSize, firstChunkSize, firstChunkData, retry);
} else {
LOGGER.w(e);
}
}
return null;
} | class class_name[name] begin[{]
method[createBlockInQiniu, return_type[type[QiniuBlockResponseData]], modifier[public], parameter[blockSize, firstChunkSize, firstChunkData, retry]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=QINIU_CREATE_BLOCK_EP, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=uploadUrl, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), MemberReference(member=blockSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None), name=endPoint)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Request, sub_type=ReferenceType(arguments=None, dimensions=None, name=Builder, sub_type=None))), name=builder)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Request, sub_type=ReferenceType(arguments=None, dimensions=None, name=Builder, sub_type=None))), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=endPoint, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=url, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=HEAD_CONTENT_TYPE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=DEFAULT_CONTENT_TYPE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addHeader, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=HEAD_CONTENT_LENGTH, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=firstChunkSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], member=addHeader, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=HEAD_AUTHORIZATION, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="UpToken "), operandr=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=uploadToken, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), operator=+)], member=addHeader, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="createBlockInQiniu with uploadUrl: "), operandr=MemberReference(member=endPoint, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=d, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=DEFAULT_CONTENT_TYPE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parse, postfix_operators=[], prefix_operators=[], qualifier=MediaType, selectors=[], type_arguments=None), MemberReference(member=firstChunkData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=firstChunkSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=create, postfix_operators=[], prefix_operators=[], qualifier=RequestBody, selectors=[], type_arguments=None), name=requestBody)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=RequestBody, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=builder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=requestBody, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=post, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None)), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=client, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=build, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None)], member=newCall, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=execute, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), name=response)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Response, sub_type=None)), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=QiniuBlockResponseData, sub_type=None))], member=parseQiniuResponse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=retry, postfix_operators=['--'], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=w, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=blockSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=firstChunkSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=firstChunkData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=retry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createBlockInQiniu, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
return[literal[null]]
end[}]
END[}] | Keyword[public] identifier[QiniuBlockResponseData] identifier[createBlockInQiniu] operator[SEP] Keyword[int] identifier[blockSize] , Keyword[int] identifier[firstChunkSize] , Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[firstChunkData] , Keyword[int] identifier[retry] operator[SEP] {
Keyword[try] {
identifier[String] identifier[endPoint] operator[=] identifier[String] operator[SEP] identifier[format] operator[SEP] identifier[QINIU_CREATE_BLOCK_EP] , Keyword[this] operator[SEP] identifier[uploadUrl] , identifier[blockSize] operator[SEP] operator[SEP] identifier[Request] operator[SEP] identifier[Builder] identifier[builder] operator[=] Keyword[new] identifier[Request] operator[SEP] identifier[Builder] operator[SEP] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[url] operator[SEP] identifier[endPoint] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[addHeader] operator[SEP] identifier[HEAD_CONTENT_TYPE] , identifier[DEFAULT_CONTENT_TYPE] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[addHeader] operator[SEP] identifier[HEAD_CONTENT_LENGTH] , identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[firstChunkSize] operator[SEP] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[addHeader] operator[SEP] identifier[HEAD_AUTHORIZATION] , literal[String] operator[+] Keyword[this] operator[SEP] identifier[uploadToken] operator[SEP] operator[SEP] identifier[LOGGER] operator[SEP] identifier[d] operator[SEP] literal[String] operator[+] identifier[endPoint] operator[SEP] operator[SEP] identifier[RequestBody] identifier[requestBody] operator[=] identifier[RequestBody] operator[SEP] identifier[create] operator[SEP] identifier[MediaType] operator[SEP] identifier[parse] operator[SEP] identifier[DEFAULT_CONTENT_TYPE] operator[SEP] , identifier[firstChunkData] , Other[0] , identifier[firstChunkSize] operator[SEP] operator[SEP] identifier[builder] operator[=] identifier[builder] operator[SEP] identifier[post] operator[SEP] identifier[requestBody] operator[SEP] operator[SEP] identifier[Response] identifier[response] operator[=] Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[newCall] operator[SEP] identifier[builder] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[execute] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[parseQiniuResponse] operator[SEP] identifier[response] , identifier[QiniuBlockResponseData] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[retry] operator[--] operator[>] Other[0] operator[SEP] {
Keyword[return] identifier[createBlockInQiniu] operator[SEP] identifier[blockSize] , identifier[firstChunkSize] , identifier[firstChunkData] , identifier[retry] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[LOGGER] operator[SEP] identifier[w] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[return] Other[null] operator[SEP]
}
|
private static Field.Index getIndexParameter(int flags)
{
if ((flags & INDEXED_FLAG) == 0)
{
return Field.Index.NO;
}
else if ((flags & TOKENIZED_FLAG) > 0)
{
return Field.Index.ANALYZED;
}
else
{
return Field.Index.NOT_ANALYZED;
}
} | class class_name[name] begin[{]
method[getIndexParameter, return_type[type[Field]], modifier[private static], parameter[flags]] begin[{]
if[binary_operation[binary_operation[member[.flags], &, member[.INDEXED_FLAG]], ==, literal[0]]] begin[{]
return[member[Field.Index.NO]]
else begin[{]
if[binary_operation[binary_operation[member[.flags], &, member[.TOKENIZED_FLAG]], >, literal[0]]] begin[{]
return[member[Field.Index.ANALYZED]]
else begin[{]
return[member[Field.Index.NOT_ANALYZED]]
end[}]
end[}]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[Field] operator[SEP] identifier[Index] identifier[getIndexParameter] operator[SEP] Keyword[int] identifier[flags] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[flags] operator[&] identifier[INDEXED_FLAG] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[return] identifier[Field] operator[SEP] identifier[Index] operator[SEP] identifier[NO] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] operator[SEP] identifier[flags] operator[&] identifier[TOKENIZED_FLAG] operator[SEP] operator[>] Other[0] operator[SEP] {
Keyword[return] identifier[Field] operator[SEP] identifier[Index] operator[SEP] identifier[ANALYZED] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[Field] operator[SEP] identifier[Index] operator[SEP] identifier[NOT_ANALYZED] operator[SEP]
}
}
|
@Lorsque("Si '(.*)' vérifie '(.*)', je fais '(.*)' fois:")
@Then("If '(.*)' matches '(.*)', I do '(.*)' times:")
public void loop(String actual, String expected, int times, List<GherkinConditionedLoopedStep> steps) {
try {
if (new GherkinStepCondition("loopKey", expected, actual).checkCondition()) {
for (int i = 0; i < times; i++) {
runAllStepsInLoop(steps);
}
}
} catch (final TechnicalException e) {
throw new AssertError(Messages.getMessage(TechnicalException.TECHNICAL_SUBSTEP_ERROR_MESSAGE) + e.getMessage());
}
} | class class_name[name] begin[{]
method[loop, return_type[void], modifier[public], parameter[actual, expected, times, steps]] begin[{]
TryStatement(block=[IfStatement(condition=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="loopKey"), MemberReference(member=expected, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=actual, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=checkCondition, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=GherkinStepCondition, sub_type=None)), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=steps, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=runAllStepsInLoop, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=times, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)]))], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=TECHNICAL_SUBSTEP_ERROR_MESSAGE, postfix_operators=[], prefix_operators=[], qualifier=TechnicalException, selectors=[])], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AssertError, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['TechnicalException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Lorsque] operator[SEP] literal[String] operator[SEP] annotation[@] identifier[Then] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[void] identifier[loop] operator[SEP] identifier[String] identifier[actual] , identifier[String] identifier[expected] , Keyword[int] identifier[times] , identifier[List] operator[<] identifier[GherkinConditionedLoopedStep] operator[>] identifier[steps] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] Keyword[new] identifier[GherkinStepCondition] operator[SEP] literal[String] , identifier[expected] , identifier[actual] operator[SEP] operator[SEP] identifier[checkCondition] operator[SEP] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[times] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[runAllStepsInLoop] operator[SEP] identifier[steps] operator[SEP] operator[SEP]
}
}
}
Keyword[catch] operator[SEP] Keyword[final] identifier[TechnicalException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[AssertError] operator[SEP] identifier[Messages] operator[SEP] identifier[getMessage] operator[SEP] identifier[TechnicalException] operator[SEP] identifier[TECHNICAL_SUBSTEP_ERROR_MESSAGE] operator[SEP] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@Deprecated
public PackageDoc[] importedPackages() {
// information is not available for binary classfiles
if (tsym.sourcefile == null) return new PackageDoc[0];
ListBuffer<PackageDocImpl> importedPackages = new ListBuffer<>();
//### Add the implicit "import java.lang.*" to the result
Names names = tsym.name.table.names;
importedPackages.append(env.getPackageDoc(env.syms.enterPackage(env.syms.java_base, names.java_lang)));
Env<AttrContext> compenv = env.enter.getEnv(tsym);
if (compenv == null) return new PackageDocImpl[0];
for (JCTree t : compenv.toplevel.defs) {
if (t.hasTag(IMPORT)) {
JCTree imp = ((JCImport) t).qualid;
if (TreeInfo.name(imp) == names.asterisk) {
JCFieldAccess sel = (JCFieldAccess)imp;
Symbol s = sel.selected.type.tsym;
PackageDocImpl pdoc = env.getPackageDoc(s.packge());
if (!importedPackages.contains(pdoc))
importedPackages.append(pdoc);
}
}
}
return importedPackages.toArray(new PackageDocImpl[importedPackages.length()]);
} | class class_name[name] begin[{]
method[importedPackages, return_type[type[PackageDoc]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[tsym.sourcefile], ==, literal[null]]] begin[{]
return[ArrayCreator(dimensions=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PackageDoc, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[ListBuffer], importedPackages]
local_variable[type[Names], names]
call[importedPackages.append, parameter[call[env.getPackageDoc, parameter[call[env.syms.enterPackage, parameter[member[env.syms.java_base], member[names.java_lang]]]]]]]
local_variable[type[Env], compenv]
if[binary_operation[member[.compenv], ==, literal[null]]] begin[{]
return[ArrayCreator(dimensions=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PackageDocImpl, sub_type=None))]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=IMPORT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=hasTag, postfix_operators=[], prefix_operators=[], qualifier=t, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=JCImport, sub_type=None)), name=imp)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JCTree, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=imp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=name, postfix_operators=[], prefix_operators=[], qualifier=TreeInfo, selectors=[], type_arguments=None), operandr=MemberReference(member=asterisk, postfix_operators=[], prefix_operators=[], qualifier=names, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=imp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=JCFieldAccess, sub_type=None)), name=sel)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JCFieldAccess, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=tsym, postfix_operators=[], prefix_operators=[], qualifier=sel.selected.type, selectors=[]), name=s)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Symbol, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=packge, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None)], member=getPackageDoc, postfix_operators=[], prefix_operators=[], qualifier=env, selectors=[], type_arguments=None), name=pdoc)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=PackageDocImpl, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=pdoc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=[], prefix_operators=['!'], qualifier=importedPackages, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=pdoc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=importedPackages, selectors=[], type_arguments=None), label=None))]))]))]), control=EnhancedForControl(iterable=MemberReference(member=defs, postfix_operators=[], prefix_operators=[], qualifier=compenv.toplevel, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=t)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JCTree, sub_type=None))), label=None)
return[call[importedPackages.toArray, parameter[ArrayCreator(dimensions=[MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=importedPackages, selectors=[], type_arguments=None)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PackageDocImpl, sub_type=None))]]]
end[}]
END[}] | annotation[@] identifier[Deprecated] Keyword[public] identifier[PackageDoc] operator[SEP] operator[SEP] identifier[importedPackages] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[tsym] operator[SEP] identifier[sourcefile] operator[==] Other[null] operator[SEP] Keyword[return] Keyword[new] identifier[PackageDoc] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[ListBuffer] operator[<] identifier[PackageDocImpl] operator[>] identifier[importedPackages] operator[=] Keyword[new] identifier[ListBuffer] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Names] identifier[names] operator[=] identifier[tsym] operator[SEP] identifier[name] operator[SEP] identifier[table] operator[SEP] identifier[names] operator[SEP] identifier[importedPackages] operator[SEP] identifier[append] operator[SEP] identifier[env] operator[SEP] identifier[getPackageDoc] operator[SEP] identifier[env] operator[SEP] identifier[syms] operator[SEP] identifier[enterPackage] operator[SEP] identifier[env] operator[SEP] identifier[syms] operator[SEP] identifier[java_base] , identifier[names] operator[SEP] identifier[java_lang] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Env] operator[<] identifier[AttrContext] operator[>] identifier[compenv] operator[=] identifier[env] operator[SEP] identifier[enter] operator[SEP] identifier[getEnv] operator[SEP] identifier[tsym] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[compenv] operator[==] Other[null] operator[SEP] Keyword[return] Keyword[new] identifier[PackageDocImpl] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[JCTree] identifier[t] operator[:] identifier[compenv] operator[SEP] identifier[toplevel] operator[SEP] identifier[defs] operator[SEP] {
Keyword[if] operator[SEP] identifier[t] operator[SEP] identifier[hasTag] operator[SEP] identifier[IMPORT] operator[SEP] operator[SEP] {
identifier[JCTree] identifier[imp] operator[=] operator[SEP] operator[SEP] identifier[JCImport] operator[SEP] identifier[t] operator[SEP] operator[SEP] identifier[qualid] operator[SEP] Keyword[if] operator[SEP] identifier[TreeInfo] operator[SEP] identifier[name] operator[SEP] identifier[imp] operator[SEP] operator[==] identifier[names] operator[SEP] identifier[asterisk] operator[SEP] {
identifier[JCFieldAccess] identifier[sel] operator[=] operator[SEP] identifier[JCFieldAccess] operator[SEP] identifier[imp] operator[SEP] identifier[Symbol] identifier[s] operator[=] identifier[sel] operator[SEP] identifier[selected] operator[SEP] identifier[type] operator[SEP] identifier[tsym] operator[SEP] identifier[PackageDocImpl] identifier[pdoc] operator[=] identifier[env] operator[SEP] identifier[getPackageDoc] operator[SEP] identifier[s] operator[SEP] identifier[packge] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[importedPackages] operator[SEP] identifier[contains] operator[SEP] identifier[pdoc] operator[SEP] operator[SEP] identifier[importedPackages] operator[SEP] identifier[append] operator[SEP] identifier[pdoc] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[importedPackages] operator[SEP] identifier[toArray] operator[SEP] Keyword[new] identifier[PackageDocImpl] operator[SEP] identifier[importedPackages] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void sawOpcode(int seen) {
switch (state) {
case IN_CLINIT:
sawCLInitOpcode(seen);
break;
case IN_INIT:
sawInitOpcode(seen);
break;
case IN_METHOD:
sawMethodOpcode(seen);
break;
}
} | class class_name[name] begin[{]
method[sawOpcode, return_type[void], modifier[public], parameter[seen]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=['IN_CLINIT'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=seen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=sawCLInitOpcode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['IN_INIT'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=seen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=sawInitOpcode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['IN_METHOD'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=seen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=sawMethodOpcode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)])], expression=MemberReference(member=state, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[sawOpcode] operator[SEP] Keyword[int] identifier[seen] operator[SEP] {
Keyword[switch] operator[SEP] identifier[state] operator[SEP] {
Keyword[case] identifier[IN_CLINIT] operator[:] identifier[sawCLInitOpcode] operator[SEP] identifier[seen] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[IN_INIT] operator[:] identifier[sawInitOpcode] operator[SEP] identifier[seen] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[IN_METHOD] operator[:] identifier[sawMethodOpcode] operator[SEP] identifier[seen] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
}
|
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public static synchronized void register(android.app.Application application) {
if (application == null) {
Logger.i("Application instance is null/system API is too old");
return;
}
if (registered) {
Logger.v("Lifecycle callbacks have already been registered");
return;
}
registered = true;
application.registerActivityLifecycleCallbacks(
new android.app.Application.ActivityLifecycleCallbacks() {
@Override
public void onActivityCreated(Activity activity, Bundle bundle) {
CleverTapAPI.onActivityCreated(activity);
}
@Override
public void onActivityStarted(Activity activity) {}
@Override
public void onActivityResumed(Activity activity) {
CleverTapAPI.onActivityResumed(activity);
}
@Override
public void onActivityPaused(Activity activity) {
CleverTapAPI.onActivityPaused();
}
@Override
public void onActivityStopped(Activity activity) {}
@Override
public void onActivitySaveInstanceState(Activity activity, Bundle bundle) {}
@Override
public void onActivityDestroyed(Activity activity) {}
}
);
Logger.i("Activity Lifecycle Callback successfully registered");
} | class class_name[name] begin[{]
method[register, return_type[void], modifier[synchronized public static], parameter[application]] begin[{]
if[binary_operation[member[.application], ==, literal[null]]] begin[{]
call[Logger.i, parameter[literal["Application instance is null/system API is too old"]]]
return[None]
else begin[{]
None
end[}]
if[member[.registered]] begin[{]
call[Logger.v, parameter[literal["Lifecycle callbacks have already been registered"]]]
return[None]
else begin[{]
None
end[}]
assign[member[.registered], literal[true]]
call[application.registerActivityLifecycleCallbacks, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=activity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=onActivityCreated, postfix_operators=[], prefix_operators=[], qualifier=CleverTapAPI, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=onActivityCreated, parameters=[FormalParameter(annotations=[], modifiers=set(), name=activity, type=ReferenceType(arguments=None, dimensions=[], name=Activity, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=bundle, type=ReferenceType(arguments=None, dimensions=[], name=Bundle, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[], documentation=None, modifiers={'public'}, name=onActivityStarted, parameters=[FormalParameter(annotations=[], modifiers=set(), name=activity, type=ReferenceType(arguments=None, dimensions=[], name=Activity, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=activity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=onActivityResumed, postfix_operators=[], prefix_operators=[], qualifier=CleverTapAPI, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=onActivityResumed, parameters=[FormalParameter(annotations=[], modifiers=set(), name=activity, type=ReferenceType(arguments=None, dimensions=[], name=Activity, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[], member=onActivityPaused, postfix_operators=[], prefix_operators=[], qualifier=CleverTapAPI, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=onActivityPaused, parameters=[FormalParameter(annotations=[], modifiers=set(), name=activity, type=ReferenceType(arguments=None, dimensions=[], name=Activity, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[], documentation=None, modifiers={'public'}, name=onActivityStopped, parameters=[FormalParameter(annotations=[], modifiers=set(), name=activity, type=ReferenceType(arguments=None, dimensions=[], name=Activity, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[], documentation=None, modifiers={'public'}, name=onActivitySaveInstanceState, parameters=[FormalParameter(annotations=[], modifiers=set(), name=activity, type=ReferenceType(arguments=None, dimensions=[], name=Activity, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=bundle, type=ReferenceType(arguments=None, dimensions=[], name=Bundle, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[], documentation=None, modifiers={'public'}, name=onActivityDestroyed, parameters=[FormalParameter(annotations=[], modifiers=set(), name=activity, type=ReferenceType(arguments=None, dimensions=[], name=Activity, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=android, sub_type=ReferenceType(arguments=None, dimensions=None, name=app, sub_type=ReferenceType(arguments=None, dimensions=None, name=Application, sub_type=ReferenceType(arguments=None, dimensions=None, name=ActivityLifecycleCallbacks, sub_type=None)))))]]
call[Logger.i, parameter[literal["Activity Lifecycle Callback successfully registered"]]]
end[}]
END[}] | annotation[@] identifier[TargetApi] operator[SEP] identifier[Build] operator[SEP] identifier[VERSION_CODES] operator[SEP] identifier[ICE_CREAM_SANDWICH] operator[SEP] Keyword[public] Keyword[static] Keyword[synchronized] Keyword[void] identifier[register] operator[SEP] identifier[android] operator[SEP] identifier[app] operator[SEP] identifier[Application] identifier[application] operator[SEP] {
Keyword[if] operator[SEP] identifier[application] operator[==] Other[null] operator[SEP] {
identifier[Logger] operator[SEP] identifier[i] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[registered] operator[SEP] {
identifier[Logger] operator[SEP] identifier[v] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
identifier[registered] operator[=] literal[boolean] operator[SEP] identifier[application] operator[SEP] identifier[registerActivityLifecycleCallbacks] operator[SEP] Keyword[new] identifier[android] operator[SEP] identifier[app] operator[SEP] identifier[Application] operator[SEP] identifier[ActivityLifecycleCallbacks] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onActivityCreated] operator[SEP] identifier[Activity] identifier[activity] , identifier[Bundle] identifier[bundle] operator[SEP] {
identifier[CleverTapAPI] operator[SEP] identifier[onActivityCreated] operator[SEP] identifier[activity] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onActivityStarted] operator[SEP] identifier[Activity] identifier[activity] operator[SEP] {
} annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onActivityResumed] operator[SEP] identifier[Activity] identifier[activity] operator[SEP] {
identifier[CleverTapAPI] operator[SEP] identifier[onActivityResumed] operator[SEP] identifier[activity] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onActivityPaused] operator[SEP] identifier[Activity] identifier[activity] operator[SEP] {
identifier[CleverTapAPI] operator[SEP] identifier[onActivityPaused] operator[SEP] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onActivityStopped] operator[SEP] identifier[Activity] identifier[activity] operator[SEP] {
} annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onActivitySaveInstanceState] operator[SEP] identifier[Activity] identifier[activity] , identifier[Bundle] identifier[bundle] operator[SEP] {
} annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onActivityDestroyed] operator[SEP] identifier[Activity] identifier[activity] operator[SEP] {
}
} operator[SEP] operator[SEP] identifier[Logger] operator[SEP] identifier[i] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
public static RoaringBitmap naive_xor(Iterator<? extends RoaringBitmap> bitmaps) {
RoaringBitmap answer = new RoaringBitmap();
while (bitmaps.hasNext()) {
answer.xor(bitmaps.next());
}
return answer;
} | class class_name[name] begin[{]
method[naive_xor, return_type[type[RoaringBitmap]], modifier[public static], parameter[bitmaps]] begin[{]
local_variable[type[RoaringBitmap], answer]
while[call[bitmaps.hasNext, parameter[]]] begin[{]
call[answer.xor, parameter[call[bitmaps.next, parameter[]]]]
end[}]
return[member[.answer]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[RoaringBitmap] identifier[naive_xor] operator[SEP] identifier[Iterator] operator[<] operator[?] Keyword[extends] identifier[RoaringBitmap] operator[>] identifier[bitmaps] operator[SEP] {
identifier[RoaringBitmap] identifier[answer] operator[=] Keyword[new] identifier[RoaringBitmap] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[bitmaps] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[answer] operator[SEP] identifier[xor] operator[SEP] identifier[bitmaps] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[answer] operator[SEP]
}
|
@Override
public void addListener(Runnable listener, Executor executor) {
checkNotNull(listener, "Runnable was null.");
checkNotNull(executor, "Executor was null.");
// Checking isDone and listeners != TOMBSTONE may seem redundant, but our contract for
// addListener says that listeners execute 'immediate' if the future isDone(). However, our
// protocol for completing a future is to assign the value field (which sets isDone to true) and
// then to release waiters, followed by executing afterDone(), followed by releasing listeners.
// That means that it is possible to observe that the future isDone and that your listeners
// don't execute 'immediately'. By checking isDone here we avoid that.
// A corollary to all that is that we don't need to check isDone inside the loop because if we
// get into the loop we know that we weren't done when we entered and therefore we aren't under
// an obligation to execute 'immediately'.
if (!isDone()) {
Listener oldHead = listeners;
if (oldHead != Listener.TOMBSTONE) {
Listener newNode = new Listener(listener, executor);
do {
newNode.next = oldHead;
if (ATOMIC_HELPER.casListeners(this, oldHead, newNode)) {
return;
}
oldHead = listeners; // re-read
} while (oldHead != Listener.TOMBSTONE);
}
}
// If we get here then the Listener TOMBSTONE was set, which means the future is done, call
// the listener.
executeListener(listener, executor);
} | class class_name[name] begin[{]
method[addListener, return_type[void], modifier[public], parameter[listener, executor]] begin[{]
call[.checkNotNull, parameter[member[.listener], literal["Runnable was null."]]]
call[.checkNotNull, parameter[member[.executor], literal["Executor was null."]]]
if[call[.isDone, parameter[]]] begin[{]
local_variable[type[Listener], oldHead]
if[binary_operation[member[.oldHead], !=, member[Listener.TOMBSTONE]]] begin[{]
local_variable[type[Listener], newNode]
do[binary_operation[member[.oldHead], !=, member[Listener.TOMBSTONE]]] begin[{]
assign[member[newNode.next], member[.oldHead]]
if[call[ATOMIC_HELPER.casListeners, parameter[THIS[], member[.oldHead], member[.newNode]]]] begin[{]
return[None]
else begin[{]
None
end[}]
assign[member[.oldHead], member[.listeners]]
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
call[.executeListener, parameter[member[.listener], member[.executor]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[addListener] operator[SEP] identifier[Runnable] identifier[listener] , identifier[Executor] identifier[executor] operator[SEP] {
identifier[checkNotNull] operator[SEP] identifier[listener] , literal[String] operator[SEP] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[executor] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[isDone] operator[SEP] operator[SEP] operator[SEP] {
identifier[Listener] identifier[oldHead] operator[=] identifier[listeners] operator[SEP] Keyword[if] operator[SEP] identifier[oldHead] operator[!=] identifier[Listener] operator[SEP] identifier[TOMBSTONE] operator[SEP] {
identifier[Listener] identifier[newNode] operator[=] Keyword[new] identifier[Listener] operator[SEP] identifier[listener] , identifier[executor] operator[SEP] operator[SEP] Keyword[do] {
identifier[newNode] operator[SEP] identifier[next] operator[=] identifier[oldHead] operator[SEP] Keyword[if] operator[SEP] identifier[ATOMIC_HELPER] operator[SEP] identifier[casListeners] operator[SEP] Keyword[this] , identifier[oldHead] , identifier[newNode] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[oldHead] operator[=] identifier[listeners] operator[SEP]
}
Keyword[while] operator[SEP] identifier[oldHead] operator[!=] identifier[Listener] operator[SEP] identifier[TOMBSTONE] operator[SEP] operator[SEP]
}
}
identifier[executeListener] operator[SEP] identifier[listener] , identifier[executor] operator[SEP] operator[SEP]
}
|
public static List<Connector> createDefaultConnectors(Map<String, Object> properties) {
List<Connector> connectors = Lists.newArrayList();
Map<String, Map<String, String>> propertiesMap = Maps.newLinkedHashMap();
for (String key : properties.keySet()) {
if (key.startsWith(Connector.CONNECTOR_CONF_PREFIX)) {
String oKey = key;
key = key.substring(Connector.CONNECTOR_CONF_PREFIX.length());
int index = key.indexOf(".");
if (index == -1) {
throw new ConfigErrorException("connector configure error, format connector.{connectorName}.{property}");
}
String name = key.substring(0, index);
Map<String, String> pr = propertiesMap.get(name);
if (pr == null) {
pr = Maps.newLinkedHashMap();
propertiesMap.put(name, pr);
pr.put("name", name);
}
pr.put(key.substring(index + 1), String.valueOf(properties.get(oKey)));
}
}
connectors.addAll(propertiesMap.values().stream().map(Connector::createDefault).collect(Collectors.toList()));
return connectors;
} | class class_name[name] begin[{]
method[createDefaultConnectors, return_type[type[List]], modifier[public static], parameter[properties]] begin[{]
local_variable[type[List], connectors]
local_variable[type[Map], propertiesMap]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=CONNECTOR_CONF_PREFIX, postfix_operators=[], prefix_operators=[], qualifier=Connector, selectors=[])], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=key, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=oKey)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=Connector.CONNECTOR_CONF_PREFIX, selectors=[], type_arguments=None)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=key, selectors=[], type_arguments=None)), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".")], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=key, selectors=[], type_arguments=None), name=index)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="connector configure error, format connector.{connectorName}.{property}")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ConfigErrorException, sub_type=None)), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=substring, postfix_operators=[], prefix_operators=[], qualifier=key, selectors=[], type_arguments=None), name=name)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=propertiesMap, selectors=[], type_arguments=None), name=pr)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=Map, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=pr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=pr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=newLinkedHashMap, postfix_operators=[], prefix_operators=[], qualifier=Maps, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=pr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=propertiesMap, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="name"), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=pr, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=key, selectors=[], type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=oKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=properties, selectors=[], type_arguments=None)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=pr, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=properties, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=key)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
call[connectors.addAll, parameter[call[propertiesMap.values, parameter[]]]]
return[member[.connectors]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[List] operator[<] identifier[Connector] operator[>] identifier[createDefaultConnectors] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[properties] operator[SEP] {
identifier[List] operator[<] identifier[Connector] operator[>] identifier[connectors] operator[=] identifier[Lists] operator[SEP] identifier[newArrayList] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] operator[>] identifier[propertiesMap] operator[=] identifier[Maps] operator[SEP] identifier[newLinkedHashMap] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[key] operator[:] identifier[properties] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[key] operator[SEP] identifier[startsWith] operator[SEP] identifier[Connector] operator[SEP] identifier[CONNECTOR_CONF_PREFIX] operator[SEP] operator[SEP] {
identifier[String] identifier[oKey] operator[=] identifier[key] operator[SEP] identifier[key] operator[=] identifier[key] operator[SEP] identifier[substring] operator[SEP] identifier[Connector] operator[SEP] identifier[CONNECTOR_CONF_PREFIX] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[index] operator[=] identifier[key] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[index] operator[==] operator[-] Other[1] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ConfigErrorException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[String] identifier[name] operator[=] identifier[key] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[index] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[pr] operator[=] identifier[propertiesMap] operator[SEP] identifier[get] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[pr] operator[==] Other[null] operator[SEP] {
identifier[pr] operator[=] identifier[Maps] operator[SEP] identifier[newLinkedHashMap] operator[SEP] operator[SEP] operator[SEP] identifier[propertiesMap] operator[SEP] identifier[put] operator[SEP] identifier[name] , identifier[pr] operator[SEP] operator[SEP] identifier[pr] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[name] operator[SEP] operator[SEP]
}
identifier[pr] operator[SEP] identifier[put] operator[SEP] identifier[key] operator[SEP] identifier[substring] operator[SEP] identifier[index] operator[+] Other[1] operator[SEP] , identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[properties] operator[SEP] identifier[get] operator[SEP] identifier[oKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[connectors] operator[SEP] identifier[addAll] operator[SEP] identifier[propertiesMap] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[Connector] operator[::] identifier[createDefault] operator[SEP] operator[SEP] identifier[collect] operator[SEP] identifier[Collectors] operator[SEP] identifier[toList] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[connectors] operator[SEP]
}
|
@Override protected void initGraphics() {
super.initGraphics();
matrix = PixelMatrixBuilder.create()
.pixelShape(PixelShape.SQUARE)
.useSpacer(true)
.squarePixels(false)
.colsAndRows(tile.getMatrixSize())
.pixelOnColor(tile.getBarColor())
.pixelOffColor(Helper.isDark(tile.getBackgroundColor()) ? tile.getBackgroundColor().brighter() : tile.getBackgroundColor().darker())
.build();
if (!tile.getChartData().isEmpty() && tile.getChartData().size() > 2) {
matrix.setColsAndRows(tile.getChartData().size(), matrix.getRows());
}
chartEventListener = e -> updateMatrixWithChartData();
tile.getChartData().forEach(chartData -> chartData.addChartDataEventListener(chartEventListener));
chartDataListener = c -> {
while (c.next()) {
if (c.wasAdded()) {
c.getAddedSubList().forEach(addedItem -> addedItem.addChartDataEventListener(chartEventListener));
if (!tile.getChartData().isEmpty() && tile.getChartData().size() > 2) {
matrix.setColsAndRows(tile.getChartData().size(), matrix.getRows());
}
} else if (c.wasRemoved()) {
c.getRemoved().forEach(removedItem -> removedItem.removeChartDataEventListener(chartEventListener));
if (!tile.getChartData().isEmpty() && tile.getChartData().size() > 2) {
matrix.setColsAndRows(tile.getChartData().size(), matrix.getRows());
}
}
}
updateMatrixWithChartData();
};
matrixListener = e -> {
if (tile.getChartData().isEmpty()) { return; }
int column = e.getX();
ChartData data = tile.getChartData().get(column);
String tooltipText = new StringBuilder(data.getName()).append("\n").append(String.format(locale, formatString, data.getValue())).toString();
Point2D popupLocation = new Point2D(e.getMouseScreenX() - selectionTooltip.getWidth() * 0.5, e.getMouseScreenY() - size * 0.025 - selectionTooltip.getHeight());
selectionTooltip.setText(tooltipText);
selectionTooltip.setX(popupLocation.getX());
selectionTooltip.setY(popupLocation.getY());
selectionTooltip.show(tile.getScene().getWindow());
tile.fireTileEvent(new TileEvent(EventType.SELECTED_CHART_DATA, data));
};
mouseHandler = e -> {
final javafx.event.EventType<? extends MouseEvent> TYPE = e.getEventType();
if (MouseEvent.MOUSE_CLICKED.equals(TYPE)) {
matrix.checkForClick(e);
} else if (MouseEvent.MOUSE_MOVED.equals(TYPE)) {
selectionTooltip.hide();
} else if (MouseEvent.MOUSE_EXITED.equals(TYPE)) {
selectionTooltip.hide();
}
};
titleText = new Text();
titleText.setFill(tile.getTitleColor());
Helper.enableNode(titleText, !tile.getTitle().isEmpty());
text = new Text(tile.getText());
text.setFill(tile.getTextColor());
Helper.enableNode(text, tile.isTextVisible());
selectionTooltip = new Tooltip("");
selectionTooltip.setWidth(60);
selectionTooltip.setHeight(48);
Tooltip.install(matrix, selectionTooltip);
getPane().getChildren().addAll(titleText, matrix, text);
} | class class_name[name] begin[{]
method[initGraphics, return_type[void], modifier[protected], parameter[]] begin[{]
SuperMethodInvocation(arguments=[], member=initGraphics, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
assign[member[.matrix], call[PixelMatrixBuilder.create, parameter[]]]
if[binary_operation[call[tile.getChartData, parameter[]], &&, binary_operation[call[tile.getChartData, parameter[]], >, literal[2]]]] begin[{]
call[matrix.setColsAndRows, parameter[call[tile.getChartData, parameter[]], call[matrix.getRows, parameter[]]]]
else begin[{]
None
end[}]
assign[member[.chartEventListener], LambdaExpression(body=MethodInvocation(arguments=[], member=updateMatrixWithChartData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), parameters=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]
call[tile.getChartData, parameter[]]
assign[member[.chartDataListener], LambdaExpression(body=[WhileStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=wasAdded, postfix_operators=[], prefix_operators=[], qualifier=c, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[], member=wasRemoved, postfix_operators=[], prefix_operators=[], qualifier=c, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=getRemoved, postfix_operators=[], prefix_operators=[], qualifier=c, selectors=[MethodInvocation(arguments=[LambdaExpression(body=MethodInvocation(arguments=[MemberReference(member=chartEventListener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=removeChartDataEventListener, postfix_operators=[], prefix_operators=[], qualifier=removedItem, selectors=[], type_arguments=None), parameters=[MemberReference(member=removedItem, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])], member=forEach, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getChartData, postfix_operators=[], prefix_operators=['!'], qualifier=tile, selectors=[MethodInvocation(arguments=[], member=isEmpty, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getChartData, postfix_operators=[], prefix_operators=[], qualifier=tile, selectors=[MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=>), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getChartData, postfix_operators=[], prefix_operators=[], qualifier=tile, selectors=[MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MethodInvocation(arguments=[], member=getRows, postfix_operators=[], prefix_operators=[], qualifier=matrix, selectors=[], type_arguments=None)], member=setColsAndRows, postfix_operators=[], prefix_operators=[], qualifier=matrix, selectors=[], type_arguments=None), label=None)]))])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=getAddedSubList, postfix_operators=[], prefix_operators=[], qualifier=c, selectors=[MethodInvocation(arguments=[LambdaExpression(body=MethodInvocation(arguments=[MemberReference(member=chartEventListener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addChartDataEventListener, postfix_operators=[], prefix_operators=[], qualifier=addedItem, selectors=[], type_arguments=None), parameters=[MemberReference(member=addedItem, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])], member=forEach, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getChartData, postfix_operators=[], prefix_operators=['!'], qualifier=tile, selectors=[MethodInvocation(arguments=[], member=isEmpty, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getChartData, postfix_operators=[], prefix_operators=[], qualifier=tile, selectors=[MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=>), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getChartData, postfix_operators=[], prefix_operators=[], qualifier=tile, selectors=[MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MethodInvocation(arguments=[], member=getRows, postfix_operators=[], prefix_operators=[], qualifier=matrix, selectors=[], type_arguments=None)], member=setColsAndRows, postfix_operators=[], prefix_operators=[], qualifier=matrix, selectors=[], type_arguments=None), label=None)]))]))]), condition=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=c, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=updateMatrixWithChartData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], parameters=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]
assign[member[.matrixListener], LambdaExpression(body=[IfStatement(condition=MethodInvocation(arguments=[], member=getChartData, postfix_operators=[], prefix_operators=[], qualifier=tile, selectors=[MethodInvocation(arguments=[], member=isEmpty, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getX, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), name=column)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getChartData, postfix_operators=[], prefix_operators=[], qualifier=tile, selectors=[MethodInvocation(arguments=[MemberReference(member=column, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=data)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ChartData, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\n")], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=locale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=formatString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[], type_arguments=None)], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=StringBuilder, sub_type=None)), name=tooltipText)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[BinaryOperation(operandl=MethodInvocation(arguments=[], member=getMouseScreenX, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getWidth, postfix_operators=[], prefix_operators=[], qualifier=selectionTooltip, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0.5), operator=*), operator=-), BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getMouseScreenY, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operandr=BinaryOperation(operandl=MemberReference(member=size, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0.025), operator=*), operator=-), operandr=MethodInvocation(arguments=[], member=getHeight, postfix_operators=[], prefix_operators=[], qualifier=selectionTooltip, selectors=[], type_arguments=None), operator=-)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Point2D, sub_type=None)), name=popupLocation)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Point2D, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tooltipText, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setText, postfix_operators=[], prefix_operators=[], qualifier=selectionTooltip, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getX, postfix_operators=[], prefix_operators=[], qualifier=popupLocation, selectors=[], type_arguments=None)], member=setX, postfix_operators=[], prefix_operators=[], qualifier=selectionTooltip, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getY, postfix_operators=[], prefix_operators=[], qualifier=popupLocation, selectors=[], type_arguments=None)], member=setY, postfix_operators=[], prefix_operators=[], qualifier=selectionTooltip, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getScene, postfix_operators=[], prefix_operators=[], qualifier=tile, selectors=[MethodInvocation(arguments=[], member=getWindow, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=show, postfix_operators=[], prefix_operators=[], qualifier=selectionTooltip, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=SELECTED_CHART_DATA, postfix_operators=[], prefix_operators=[], qualifier=EventType, selectors=[]), MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TileEvent, sub_type=None))], member=fireTileEvent, postfix_operators=[], prefix_operators=[], qualifier=tile, selectors=[], type_arguments=None), label=None)], parameters=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]
assign[member[.mouseHandler], LambdaExpression(body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getEventType, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), name=TYPE)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=javafx, sub_type=ReferenceType(arguments=None, dimensions=None, name=event, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=extends, type=ReferenceType(arguments=None, dimensions=[], name=MouseEvent, sub_type=None))], dimensions=None, name=EventType, sub_type=None)))), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=TYPE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=MouseEvent.MOUSE_CLICKED, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=TYPE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=MouseEvent.MOUSE_MOVED, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=TYPE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=MouseEvent.MOUSE_EXITED, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=hide, postfix_operators=[], prefix_operators=[], qualifier=selectionTooltip, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=hide, postfix_operators=[], prefix_operators=[], qualifier=selectionTooltip, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkForClick, postfix_operators=[], prefix_operators=[], qualifier=matrix, selectors=[], type_arguments=None), label=None)]))], parameters=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]
assign[member[.titleText], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Text, sub_type=None))]
call[titleText.setFill, parameter[call[tile.getTitleColor, parameter[]]]]
call[Helper.enableNode, parameter[member[.titleText], call[tile.getTitle, parameter[]]]]
assign[member[.text], ClassCreator(arguments=[MethodInvocation(arguments=[], member=getText, postfix_operators=[], prefix_operators=[], qualifier=tile, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Text, sub_type=None))]
call[text.setFill, parameter[call[tile.getTextColor, parameter[]]]]
call[Helper.enableNode, parameter[member[.text], call[tile.isTextVisible, parameter[]]]]
assign[member[.selectionTooltip], ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Tooltip, sub_type=None))]
call[selectionTooltip.setWidth, parameter[literal[60]]]
call[selectionTooltip.setHeight, parameter[literal[48]]]
call[Tooltip.install, parameter[member[.matrix], member[.selectionTooltip]]]
call[.getPane, parameter[]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[initGraphics] operator[SEP] operator[SEP] {
Keyword[super] operator[SEP] identifier[initGraphics] operator[SEP] operator[SEP] operator[SEP] identifier[matrix] operator[=] identifier[PixelMatrixBuilder] operator[SEP] identifier[create] operator[SEP] operator[SEP] operator[SEP] identifier[pixelShape] operator[SEP] identifier[PixelShape] operator[SEP] identifier[SQUARE] operator[SEP] operator[SEP] identifier[useSpacer] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[squarePixels] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[colsAndRows] operator[SEP] identifier[tile] operator[SEP] identifier[getMatrixSize] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[pixelOnColor] operator[SEP] identifier[tile] operator[SEP] identifier[getBarColor] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[pixelOffColor] operator[SEP] identifier[Helper] operator[SEP] identifier[isDark] operator[SEP] identifier[tile] operator[SEP] identifier[getBackgroundColor] operator[SEP] operator[SEP] operator[SEP] operator[?] identifier[tile] operator[SEP] identifier[getBackgroundColor] operator[SEP] operator[SEP] operator[SEP] identifier[brighter] operator[SEP] operator[SEP] operator[:] identifier[tile] operator[SEP] identifier[getBackgroundColor] operator[SEP] operator[SEP] operator[SEP] identifier[darker] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[tile] operator[SEP] identifier[getChartData] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[&&] identifier[tile] operator[SEP] identifier[getChartData] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[2] operator[SEP] {
identifier[matrix] operator[SEP] identifier[setColsAndRows] operator[SEP] identifier[tile] operator[SEP] identifier[getChartData] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] , identifier[matrix] operator[SEP] identifier[getRows] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[chartEventListener] operator[=] identifier[e] operator[->] identifier[updateMatrixWithChartData] operator[SEP] operator[SEP] operator[SEP] identifier[tile] operator[SEP] identifier[getChartData] operator[SEP] operator[SEP] operator[SEP] identifier[forEach] operator[SEP] identifier[chartData] operator[->] identifier[chartData] operator[SEP] identifier[addChartDataEventListener] operator[SEP] identifier[chartEventListener] operator[SEP] operator[SEP] operator[SEP] identifier[chartDataListener] operator[=] identifier[c] operator[->] {
Keyword[while] operator[SEP] identifier[c] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[c] operator[SEP] identifier[wasAdded] operator[SEP] operator[SEP] operator[SEP] {
identifier[c] operator[SEP] identifier[getAddedSubList] operator[SEP] operator[SEP] operator[SEP] identifier[forEach] operator[SEP] identifier[addedItem] operator[->] identifier[addedItem] operator[SEP] identifier[addChartDataEventListener] operator[SEP] identifier[chartEventListener] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[tile] operator[SEP] identifier[getChartData] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[&&] identifier[tile] operator[SEP] identifier[getChartData] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[2] operator[SEP] {
identifier[matrix] operator[SEP] identifier[setColsAndRows] operator[SEP] identifier[tile] operator[SEP] identifier[getChartData] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] , identifier[matrix] operator[SEP] identifier[getRows] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[c] operator[SEP] identifier[wasRemoved] operator[SEP] operator[SEP] operator[SEP] {
identifier[c] operator[SEP] identifier[getRemoved] operator[SEP] operator[SEP] operator[SEP] identifier[forEach] operator[SEP] identifier[removedItem] operator[->] identifier[removedItem] operator[SEP] identifier[removeChartDataEventListener] operator[SEP] identifier[chartEventListener] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[tile] operator[SEP] identifier[getChartData] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[&&] identifier[tile] operator[SEP] identifier[getChartData] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[2] operator[SEP] {
identifier[matrix] operator[SEP] identifier[setColsAndRows] operator[SEP] identifier[tile] operator[SEP] identifier[getChartData] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] , identifier[matrix] operator[SEP] identifier[getRows] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
identifier[updateMatrixWithChartData] operator[SEP] operator[SEP] operator[SEP]
} operator[SEP] identifier[matrixListener] operator[=] identifier[e] operator[->] {
Keyword[if] operator[SEP] identifier[tile] operator[SEP] identifier[getChartData] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[int] identifier[column] operator[=] identifier[e] operator[SEP] identifier[getX] operator[SEP] operator[SEP] operator[SEP] identifier[ChartData] identifier[data] operator[=] identifier[tile] operator[SEP] identifier[getChartData] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[column] operator[SEP] operator[SEP] identifier[String] identifier[tooltipText] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] identifier[data] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] identifier[locale] , identifier[formatString] , identifier[data] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[Point2D] identifier[popupLocation] operator[=] Keyword[new] identifier[Point2D] operator[SEP] identifier[e] operator[SEP] identifier[getMouseScreenX] operator[SEP] operator[SEP] operator[-] identifier[selectionTooltip] operator[SEP] identifier[getWidth] operator[SEP] operator[SEP] operator[*] literal[Float] , identifier[e] operator[SEP] identifier[getMouseScreenY] operator[SEP] operator[SEP] operator[-] identifier[size] operator[*] literal[Float] operator[-] identifier[selectionTooltip] operator[SEP] identifier[getHeight] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[selectionTooltip] operator[SEP] identifier[setText] operator[SEP] identifier[tooltipText] operator[SEP] operator[SEP] identifier[selectionTooltip] operator[SEP] identifier[setX] operator[SEP] identifier[popupLocation] operator[SEP] identifier[getX] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[selectionTooltip] operator[SEP] identifier[setY] operator[SEP] identifier[popupLocation] operator[SEP] identifier[getY] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[selectionTooltip] operator[SEP] identifier[show] operator[SEP] identifier[tile] operator[SEP] identifier[getScene] operator[SEP] operator[SEP] operator[SEP] identifier[getWindow] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[tile] operator[SEP] identifier[fireTileEvent] operator[SEP] Keyword[new] identifier[TileEvent] operator[SEP] identifier[EventType] operator[SEP] identifier[SELECTED_CHART_DATA] , identifier[data] operator[SEP] operator[SEP] operator[SEP]
} operator[SEP] identifier[mouseHandler] operator[=] identifier[e] operator[->] {
Keyword[final] identifier[javafx] operator[SEP] identifier[event] operator[SEP] identifier[EventType] operator[<] operator[?] Keyword[extends] identifier[MouseEvent] operator[>] identifier[TYPE] operator[=] identifier[e] operator[SEP] identifier[getEventType] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[MouseEvent] operator[SEP] identifier[MOUSE_CLICKED] operator[SEP] identifier[equals] operator[SEP] identifier[TYPE] operator[SEP] operator[SEP] {
identifier[matrix] operator[SEP] identifier[checkForClick] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[MouseEvent] operator[SEP] identifier[MOUSE_MOVED] operator[SEP] identifier[equals] operator[SEP] identifier[TYPE] operator[SEP] operator[SEP] {
identifier[selectionTooltip] operator[SEP] identifier[hide] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[MouseEvent] operator[SEP] identifier[MOUSE_EXITED] operator[SEP] identifier[equals] operator[SEP] identifier[TYPE] operator[SEP] operator[SEP] {
identifier[selectionTooltip] operator[SEP] identifier[hide] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] identifier[titleText] operator[=] Keyword[new] identifier[Text] operator[SEP] operator[SEP] operator[SEP] identifier[titleText] operator[SEP] identifier[setFill] operator[SEP] identifier[tile] operator[SEP] identifier[getTitleColor] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Helper] operator[SEP] identifier[enableNode] operator[SEP] identifier[titleText] , operator[!] identifier[tile] operator[SEP] identifier[getTitle] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[text] operator[=] Keyword[new] identifier[Text] operator[SEP] identifier[tile] operator[SEP] identifier[getText] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[text] operator[SEP] identifier[setFill] operator[SEP] identifier[tile] operator[SEP] identifier[getTextColor] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Helper] operator[SEP] identifier[enableNode] operator[SEP] identifier[text] , identifier[tile] operator[SEP] identifier[isTextVisible] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[selectionTooltip] operator[=] Keyword[new] identifier[Tooltip] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[selectionTooltip] operator[SEP] identifier[setWidth] operator[SEP] Other[60] operator[SEP] operator[SEP] identifier[selectionTooltip] operator[SEP] identifier[setHeight] operator[SEP] Other[48] operator[SEP] operator[SEP] identifier[Tooltip] operator[SEP] identifier[install] operator[SEP] identifier[matrix] , identifier[selectionTooltip] operator[SEP] operator[SEP] identifier[getPane] operator[SEP] operator[SEP] operator[SEP] identifier[getChildren] operator[SEP] operator[SEP] operator[SEP] identifier[addAll] operator[SEP] identifier[titleText] , identifier[matrix] , identifier[text] operator[SEP] operator[SEP]
}
|
public NetworkSecurityGroupInner updateTags(String resourceGroupName, String networkSecurityGroupName, Map<String, String> tags) {
return updateTagsWithServiceResponseAsync(resourceGroupName, networkSecurityGroupName, tags).toBlocking().last().body();
} | class class_name[name] begin[{]
method[updateTags, return_type[type[NetworkSecurityGroupInner]], modifier[public], parameter[resourceGroupName, networkSecurityGroupName, tags]] begin[{]
return[call[.updateTagsWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.networkSecurityGroupName], member[.tags]]]]
end[}]
END[}] | Keyword[public] identifier[NetworkSecurityGroupInner] identifier[updateTags] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[networkSecurityGroupName] , identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[tags] operator[SEP] {
Keyword[return] identifier[updateTagsWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[networkSecurityGroupName] , identifier[tags] operator[SEP] operator[SEP] identifier[toBlocking] operator[SEP] operator[SEP] operator[SEP] identifier[last] operator[SEP] operator[SEP] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
|
private MembershipByUserGroupTypeWrapper findMembership(Session session, String id) throws Exception
{
IdComponents ids;
try
{
ids = utils.splitId(id);
}
catch (IndexOutOfBoundsException e)
{
throw new ItemNotFoundException("Can not find membership by id=" + id, e);
}
Node groupNode = session.getNodeByUUID(ids.groupNodeId);
Node refUserNode = groupNode.getNode(JCROrganizationServiceImpl.JOS_MEMBERSHIP).getNode(ids.userName);
Node refTypeNode =
refUserNode.getNode(ids.type.equals(MembershipTypeHandler.ANY_MEMBERSHIP_TYPE)
? JCROrganizationServiceImpl.JOS_MEMBERSHIP_TYPE_ANY : ids.type);
String groupId = utils.getGroupIds(groupNode).groupId;
MembershipImpl membership = new MembershipImpl();
membership.setId(id);
membership.setGroupId(groupId);
membership.setMembershipType(ids.type);
membership.setUserName(ids.userName);
putInCache(membership);
return new MembershipByUserGroupTypeWrapper(membership, refUserNode, refTypeNode);
} | class class_name[name] begin[{]
method[findMembership, return_type[type[MembershipByUserGroupTypeWrapper]], modifier[private], parameter[session, id]] begin[{]
local_variable[type[IdComponents], ids]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=ids, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=splitId, postfix_operators=[], prefix_operators=[], qualifier=utils, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Can not find membership by id="), operandr=MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ItemNotFoundException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IndexOutOfBoundsException']))], finally_block=None, label=None, resources=None)
local_variable[type[Node], groupNode]
local_variable[type[Node], refUserNode]
local_variable[type[Node], refTypeNode]
local_variable[type[String], groupId]
local_variable[type[MembershipImpl], membership]
call[membership.setId, parameter[member[.id]]]
call[membership.setGroupId, parameter[member[.groupId]]]
call[membership.setMembershipType, parameter[member[ids.type]]]
call[membership.setUserName, parameter[member[ids.userName]]]
call[.putInCache, parameter[member[.membership]]]
return[ClassCreator(arguments=[MemberReference(member=membership, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=refUserNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=refTypeNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MembershipByUserGroupTypeWrapper, sub_type=None))]
end[}]
END[}] | Keyword[private] identifier[MembershipByUserGroupTypeWrapper] identifier[findMembership] operator[SEP] identifier[Session] identifier[session] , identifier[String] identifier[id] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[IdComponents] identifier[ids] operator[SEP] Keyword[try] {
identifier[ids] operator[=] identifier[utils] operator[SEP] identifier[splitId] operator[SEP] identifier[id] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IndexOutOfBoundsException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ItemNotFoundException] operator[SEP] literal[String] operator[+] identifier[id] , identifier[e] operator[SEP] operator[SEP]
}
identifier[Node] identifier[groupNode] operator[=] identifier[session] operator[SEP] identifier[getNodeByUUID] operator[SEP] identifier[ids] operator[SEP] identifier[groupNodeId] operator[SEP] operator[SEP] identifier[Node] identifier[refUserNode] operator[=] identifier[groupNode] operator[SEP] identifier[getNode] operator[SEP] identifier[JCROrganizationServiceImpl] operator[SEP] identifier[JOS_MEMBERSHIP] operator[SEP] operator[SEP] identifier[getNode] operator[SEP] identifier[ids] operator[SEP] identifier[userName] operator[SEP] operator[SEP] identifier[Node] identifier[refTypeNode] operator[=] identifier[refUserNode] operator[SEP] identifier[getNode] operator[SEP] identifier[ids] operator[SEP] identifier[type] operator[SEP] identifier[equals] operator[SEP] identifier[MembershipTypeHandler] operator[SEP] identifier[ANY_MEMBERSHIP_TYPE] operator[SEP] operator[?] identifier[JCROrganizationServiceImpl] operator[SEP] identifier[JOS_MEMBERSHIP_TYPE_ANY] operator[:] identifier[ids] operator[SEP] identifier[type] operator[SEP] operator[SEP] identifier[String] identifier[groupId] operator[=] identifier[utils] operator[SEP] identifier[getGroupIds] operator[SEP] identifier[groupNode] operator[SEP] operator[SEP] identifier[groupId] operator[SEP] identifier[MembershipImpl] identifier[membership] operator[=] Keyword[new] identifier[MembershipImpl] operator[SEP] operator[SEP] operator[SEP] identifier[membership] operator[SEP] identifier[setId] operator[SEP] identifier[id] operator[SEP] operator[SEP] identifier[membership] operator[SEP] identifier[setGroupId] operator[SEP] identifier[groupId] operator[SEP] operator[SEP] identifier[membership] operator[SEP] identifier[setMembershipType] operator[SEP] identifier[ids] operator[SEP] identifier[type] operator[SEP] operator[SEP] identifier[membership] operator[SEP] identifier[setUserName] operator[SEP] identifier[ids] operator[SEP] identifier[userName] operator[SEP] operator[SEP] identifier[putInCache] operator[SEP] identifier[membership] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[MembershipByUserGroupTypeWrapper] operator[SEP] identifier[membership] , identifier[refUserNode] , identifier[refTypeNode] operator[SEP] operator[SEP]
}
|
public static String decrypt(String c, String key) {
try {
SecretKeySpec skeySpec = new SecretKeySpec(Hex.decodeHex(key.toCharArray()), "AES");
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.DECRYPT_MODE, skeySpec);
byte[] decoded = cipher.doFinal(Hex.decodeHex(c.toCharArray()));
return new String(decoded);
} catch (final Exception e) {
logger.warn("Could not decrypt string", e);
return null;
}
} | class class_name[name] begin[{]
method[decrypt, return_type[type[String]], modifier[public static], parameter[c, key]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toCharArray, postfix_operators=[], prefix_operators=[], qualifier=key, selectors=[], type_arguments=None)], member=decodeHex, postfix_operators=[], prefix_operators=[], qualifier=Hex, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="AES")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SecretKeySpec, sub_type=None)), name=skeySpec)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SecretKeySpec, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="AES")], member=getInstance, postfix_operators=[], prefix_operators=[], qualifier=Cipher, selectors=[], type_arguments=None), name=cipher)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Cipher, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=DECRYPT_MODE, postfix_operators=[], prefix_operators=[], qualifier=Cipher, selectors=[]), MemberReference(member=skeySpec, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=init, postfix_operators=[], prefix_operators=[], qualifier=cipher, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toCharArray, postfix_operators=[], prefix_operators=[], qualifier=c, selectors=[], type_arguments=None)], member=decodeHex, postfix_operators=[], prefix_operators=[], qualifier=Hex, selectors=[], type_arguments=None)], member=doFinal, postfix_operators=[], prefix_operators=[], qualifier=cipher, selectors=[], type_arguments=None), name=decoded)], modifiers=set(), type=BasicType(dimensions=[None], name=byte)), ReturnStatement(expression=ClassCreator(arguments=[MemberReference(member=decoded, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Could not decrypt string"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=warn, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[decrypt] operator[SEP] identifier[String] identifier[c] , identifier[String] identifier[key] operator[SEP] {
Keyword[try] {
identifier[SecretKeySpec] identifier[skeySpec] operator[=] Keyword[new] identifier[SecretKeySpec] operator[SEP] identifier[Hex] operator[SEP] identifier[decodeHex] operator[SEP] identifier[key] operator[SEP] identifier[toCharArray] operator[SEP] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP] identifier[Cipher] identifier[cipher] operator[=] identifier[Cipher] operator[SEP] identifier[getInstance] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[cipher] operator[SEP] identifier[init] operator[SEP] identifier[Cipher] operator[SEP] identifier[DECRYPT_MODE] , identifier[skeySpec] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[decoded] operator[=] identifier[cipher] operator[SEP] identifier[doFinal] operator[SEP] identifier[Hex] operator[SEP] identifier[decodeHex] operator[SEP] identifier[c] operator[SEP] identifier[toCharArray] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[String] operator[SEP] identifier[decoded] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[Exception] identifier[e] operator[SEP] {
identifier[logger] operator[SEP] identifier[warn] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
}
|
public void processAnnotations(DescriptorPolicy descriptorPolicy) {
processEntityAnnotations(descriptorPolicy);
declaredGenuineVariableDescriptorMap = new LinkedHashMap<>();
declaredShadowVariableDescriptorMap = new LinkedHashMap<>();
declaredPinEntityFilterList = new ArrayList<>(2);
// Only iterate declared fields and methods, not inherited members, to avoid registering the same one twice
List<Member> memberList = ConfigUtils.getDeclaredMembers(entityClass);
for (Member member : memberList) {
processValueRangeProviderAnnotation(descriptorPolicy, member);
processPlanningVariableAnnotation(descriptorPolicy, member);
processPlanningPinAnnotation(descriptorPolicy, member);
}
if (declaredGenuineVariableDescriptorMap.isEmpty() && declaredShadowVariableDescriptorMap.isEmpty()) {
throw new IllegalStateException("The entityClass (" + entityClass
+ ") should have at least 1 getter method or 1 field with a "
+ PlanningVariable.class.getSimpleName() + " annotation or a shadow variable annotation.");
}
processVariableAnnotations(descriptorPolicy);
} | class class_name[name] begin[{]
method[processAnnotations, return_type[void], modifier[public], parameter[descriptorPolicy]] begin[{]
call[.processEntityAnnotations, parameter[member[.descriptorPolicy]]]
assign[member[.declaredGenuineVariableDescriptorMap], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=LinkedHashMap, sub_type=None))]
assign[member[.declaredShadowVariableDescriptorMap], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=LinkedHashMap, sub_type=None))]
assign[member[.declaredPinEntityFilterList], ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ArrayList, sub_type=None))]
local_variable[type[List], memberList]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=descriptorPolicy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=member, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=processValueRangeProviderAnnotation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=descriptorPolicy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=member, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=processPlanningVariableAnnotation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=descriptorPolicy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=member, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=processPlanningPinAnnotation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=memberList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=member)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Member, sub_type=None))), label=None)
if[binary_operation[call[declaredGenuineVariableDescriptorMap.isEmpty, parameter[]], &&, call[declaredShadowVariableDescriptorMap.isEmpty, parameter[]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The entityClass ("), operandr=MemberReference(member=entityClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=") should have at least 1 getter method or 1 field with a "), operator=+), operandr=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getSimpleName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=PlanningVariable, sub_type=None)), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" annotation or a shadow variable annotation."), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[.processVariableAnnotations, parameter[member[.descriptorPolicy]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[processAnnotations] operator[SEP] identifier[DescriptorPolicy] identifier[descriptorPolicy] operator[SEP] {
identifier[processEntityAnnotations] operator[SEP] identifier[descriptorPolicy] operator[SEP] operator[SEP] identifier[declaredGenuineVariableDescriptorMap] operator[=] Keyword[new] identifier[LinkedHashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[declaredShadowVariableDescriptorMap] operator[=] Keyword[new] identifier[LinkedHashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[declaredPinEntityFilterList] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] Other[2] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Member] operator[>] identifier[memberList] operator[=] identifier[ConfigUtils] operator[SEP] identifier[getDeclaredMembers] operator[SEP] identifier[entityClass] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Member] identifier[member] operator[:] identifier[memberList] operator[SEP] {
identifier[processValueRangeProviderAnnotation] operator[SEP] identifier[descriptorPolicy] , identifier[member] operator[SEP] operator[SEP] identifier[processPlanningVariableAnnotation] operator[SEP] identifier[descriptorPolicy] , identifier[member] operator[SEP] operator[SEP] identifier[processPlanningPinAnnotation] operator[SEP] identifier[descriptorPolicy] , identifier[member] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[declaredGenuineVariableDescriptorMap] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[&&] identifier[declaredShadowVariableDescriptorMap] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] identifier[entityClass] operator[+] literal[String] operator[+] identifier[PlanningVariable] operator[SEP] Keyword[class] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[processVariableAnnotations] operator[SEP] identifier[descriptorPolicy] operator[SEP] operator[SEP]
}
|
private void printTimeOfMapMatchQuery(final GraphHopper hopper, final MapMatching mapMatching) {
// pick random start/end points to create a route, then pick random points from the route,
// and then run the random points through map-matching.
final double latDelta = bbox.maxLat - bbox.minLat;
final double lonDelta = bbox.maxLon - bbox.minLon;
final Random rand = new Random(seed);
MiniPerfTest miniPerf = new MiniPerfTest() {
@Override
public int doCalc(boolean warmup, int run) {
// keep going until we find a path (which we may not for certain start/end points)
while (true) {
// create random points and find route between:
double lat0 = bbox.minLat + rand.nextDouble() * latDelta;
double lon0 = bbox.minLon + rand.nextDouble() * lonDelta;
double lat1 = bbox.minLat + rand.nextDouble() * latDelta;
double lon1 = bbox.minLon + rand.nextDouble() * lonDelta;
GHResponse r = hopper.route(new GHRequest(lat0, lon0, lat1, lon1));
// if found, use it for map matching:
if (!r.hasErrors()) {
double sampleProportion = rand.nextDouble();
GHPoint prev = null;
List<Observation> mock = new ArrayList<>();
PointList points = r.getBest().getPoints();
// loop through points and add (approximately) sampleProportion of them:
for (GHPoint p : points) {
if (null != prev && rand.nextDouble() < sampleProportion) {
// randomise the point lat/lon (i.e. so it's not
// exactly on the route):
GHPoint randomised = distCalc.projectCoordinate(p.lat, p.lon,
20 * rand.nextDouble(), 360 * rand.nextDouble());
mock.add(new Observation(randomised));
}
prev = p;
}
// now match, provided there are enough points
if (mock.size() > 2) {
MatchResult match = mapMatching.doWork(mock);
// return something non-trivial, to avoid JVM optimizing away
return match.getEdgeMatches().size();
}
}
}
}
}.setIterations(count).start();
print("map_match", miniPerf);
} | class class_name[name] begin[{]
method[printTimeOfMapMatchQuery, return_type[void], modifier[private], parameter[hopper, mapMatching]] begin[{]
local_variable[type[double], latDelta]
local_variable[type[double], lonDelta]
local_variable[type[Random], rand]
local_variable[type[MiniPerfTest], miniPerf]
call[.print, parameter[literal["map_match"], member[.miniPerf]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[printTimeOfMapMatchQuery] operator[SEP] Keyword[final] identifier[GraphHopper] identifier[hopper] , Keyword[final] identifier[MapMatching] identifier[mapMatching] operator[SEP] {
Keyword[final] Keyword[double] identifier[latDelta] operator[=] identifier[bbox] operator[SEP] identifier[maxLat] operator[-] identifier[bbox] operator[SEP] identifier[minLat] operator[SEP] Keyword[final] Keyword[double] identifier[lonDelta] operator[=] identifier[bbox] operator[SEP] identifier[maxLon] operator[-] identifier[bbox] operator[SEP] identifier[minLon] operator[SEP] Keyword[final] identifier[Random] identifier[rand] operator[=] Keyword[new] identifier[Random] operator[SEP] identifier[seed] operator[SEP] operator[SEP] identifier[MiniPerfTest] identifier[miniPerf] operator[=] Keyword[new] identifier[MiniPerfTest] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[int] identifier[doCalc] operator[SEP] Keyword[boolean] identifier[warmup] , Keyword[int] identifier[run] operator[SEP] {
Keyword[while] operator[SEP] literal[boolean] operator[SEP] {
Keyword[double] identifier[lat0] operator[=] identifier[bbox] operator[SEP] identifier[minLat] operator[+] identifier[rand] operator[SEP] identifier[nextDouble] operator[SEP] operator[SEP] operator[*] identifier[latDelta] operator[SEP] Keyword[double] identifier[lon0] operator[=] identifier[bbox] operator[SEP] identifier[minLon] operator[+] identifier[rand] operator[SEP] identifier[nextDouble] operator[SEP] operator[SEP] operator[*] identifier[lonDelta] operator[SEP] Keyword[double] identifier[lat1] operator[=] identifier[bbox] operator[SEP] identifier[minLat] operator[+] identifier[rand] operator[SEP] identifier[nextDouble] operator[SEP] operator[SEP] operator[*] identifier[latDelta] operator[SEP] Keyword[double] identifier[lon1] operator[=] identifier[bbox] operator[SEP] identifier[minLon] operator[+] identifier[rand] operator[SEP] identifier[nextDouble] operator[SEP] operator[SEP] operator[*] identifier[lonDelta] operator[SEP] identifier[GHResponse] identifier[r] operator[=] identifier[hopper] operator[SEP] identifier[route] operator[SEP] Keyword[new] identifier[GHRequest] operator[SEP] identifier[lat0] , identifier[lon0] , identifier[lat1] , identifier[lon1] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[r] operator[SEP] identifier[hasErrors] operator[SEP] operator[SEP] operator[SEP] {
Keyword[double] identifier[sampleProportion] operator[=] identifier[rand] operator[SEP] identifier[nextDouble] operator[SEP] operator[SEP] operator[SEP] identifier[GHPoint] identifier[prev] operator[=] Other[null] operator[SEP] identifier[List] operator[<] identifier[Observation] operator[>] identifier[mock] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[PointList] identifier[points] operator[=] identifier[r] operator[SEP] identifier[getBest] operator[SEP] operator[SEP] operator[SEP] identifier[getPoints] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[GHPoint] identifier[p] operator[:] identifier[points] operator[SEP] {
Keyword[if] operator[SEP] Other[null] operator[!=] identifier[prev] operator[&&] identifier[rand] operator[SEP] identifier[nextDouble] operator[SEP] operator[SEP] operator[<] identifier[sampleProportion] operator[SEP] {
identifier[GHPoint] identifier[randomised] operator[=] identifier[distCalc] operator[SEP] identifier[projectCoordinate] operator[SEP] identifier[p] operator[SEP] identifier[lat] , identifier[p] operator[SEP] identifier[lon] , Other[20] operator[*] identifier[rand] operator[SEP] identifier[nextDouble] operator[SEP] operator[SEP] , Other[360] operator[*] identifier[rand] operator[SEP] identifier[nextDouble] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[mock] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[Observation] operator[SEP] identifier[randomised] operator[SEP] operator[SEP] operator[SEP]
}
identifier[prev] operator[=] identifier[p] operator[SEP]
}
Keyword[if] operator[SEP] identifier[mock] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[2] operator[SEP] {
identifier[MatchResult] identifier[match] operator[=] identifier[mapMatching] operator[SEP] identifier[doWork] operator[SEP] identifier[mock] operator[SEP] operator[SEP] Keyword[return] identifier[match] operator[SEP] identifier[getEdgeMatches] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
} operator[SEP] identifier[setIterations] operator[SEP] identifier[count] operator[SEP] operator[SEP] identifier[start] operator[SEP] operator[SEP] operator[SEP] identifier[print] operator[SEP] literal[String] , identifier[miniPerf] operator[SEP] operator[SEP]
}
|
@SuppressWarnings("ReferenceEquality")
private void logImpl(String message, Object... args) {
this.args = args;
// Evaluate any (rare) LazyArg instances early. This may throw exceptions from user code, but
// it seems reasonable to propagate them in this case (they would have been thrown if the
// argument was evaluated at the call site anyway).
for (int n = 0; n < args.length; n++) {
if (args[n] instanceof LazyArg) {
args[n] = ((LazyArg<?>) args[n]).evaluate();
}
}
// Using "!=" is fast and sufficient here because the only real case this should be skipping
// is when we called log(String) or log(), which should not result in a template being created.
// DO NOT replace this with a string instance which can be interned, or use equals() here,
// since that could mistakenly treat other calls to log(String, Object...) incorrectly.
if (message != LITERAL_VALUE_MESSAGE) {
this.templateContext = new TemplateContext(getMessageParser(), message);
}
getLogger().write(this);
} | class class_name[name] begin[{]
method[logImpl, return_type[void], modifier[private], parameter[message, args]] begin[{]
assign[THIS[member[None.args]], member[.args]]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=ReferenceType(arguments=None, dimensions=[], name=LazyArg, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=Cast(expression=MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=LazyArg, sub_type=None))), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=args, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=n)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=n, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
if[binary_operation[member[.message], !=, member[.LITERAL_VALUE_MESSAGE]]] begin[{]
assign[THIS[member[None.templateContext]], ClassCreator(arguments=[MethodInvocation(arguments=[], member=getMessageParser, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TemplateContext, sub_type=None))]
else begin[{]
None
end[}]
call[.getLogger, parameter[]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[private] Keyword[void] identifier[logImpl] operator[SEP] identifier[String] identifier[message] , identifier[Object] operator[...] identifier[args] operator[SEP] {
Keyword[this] operator[SEP] identifier[args] operator[=] identifier[args] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[n] operator[=] Other[0] operator[SEP] identifier[n] operator[<] identifier[args] operator[SEP] identifier[length] operator[SEP] identifier[n] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[args] operator[SEP] identifier[n] operator[SEP] Keyword[instanceof] identifier[LazyArg] operator[SEP] {
identifier[args] operator[SEP] identifier[n] operator[SEP] operator[=] operator[SEP] operator[SEP] identifier[LazyArg] operator[<] operator[?] operator[>] operator[SEP] identifier[args] operator[SEP] identifier[n] operator[SEP] operator[SEP] operator[SEP] identifier[evaluate] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[message] operator[!=] identifier[LITERAL_VALUE_MESSAGE] operator[SEP] {
Keyword[this] operator[SEP] identifier[templateContext] operator[=] Keyword[new] identifier[TemplateContext] operator[SEP] identifier[getMessageParser] operator[SEP] operator[SEP] , identifier[message] operator[SEP] operator[SEP]
}
identifier[getLogger] operator[SEP] operator[SEP] operator[SEP] identifier[write] operator[SEP] Keyword[this] operator[SEP] operator[SEP]
}
|
public static ReservationFetcher fetcher(final String pathWorkspaceSid,
final String pathTaskSid,
final String pathSid) {
return new ReservationFetcher(pathWorkspaceSid, pathTaskSid, pathSid);
} | class class_name[name] begin[{]
method[fetcher, return_type[type[ReservationFetcher]], modifier[public static], parameter[pathWorkspaceSid, pathTaskSid, pathSid]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=pathWorkspaceSid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=pathTaskSid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=pathSid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ReservationFetcher, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[ReservationFetcher] identifier[fetcher] operator[SEP] Keyword[final] identifier[String] identifier[pathWorkspaceSid] , Keyword[final] identifier[String] identifier[pathTaskSid] , Keyword[final] identifier[String] identifier[pathSid] operator[SEP] {
Keyword[return] Keyword[new] identifier[ReservationFetcher] operator[SEP] identifier[pathWorkspaceSid] , identifier[pathTaskSid] , identifier[pathSid] operator[SEP] operator[SEP]
}
|
@Override
public final Object getValueAt(final int row, final int col) {
TableTreeNode rowNode = getNodeAtLine(row);
return getValueAt(rowNode, col);
} | class class_name[name] begin[{]
method[getValueAt, return_type[type[Object]], modifier[final public], parameter[row, col]] begin[{]
local_variable[type[TableTreeNode], rowNode]
return[call[.getValueAt, parameter[member[.rowNode], member[.col]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[final] identifier[Object] identifier[getValueAt] operator[SEP] Keyword[final] Keyword[int] identifier[row] , Keyword[final] Keyword[int] identifier[col] operator[SEP] {
identifier[TableTreeNode] identifier[rowNode] operator[=] identifier[getNodeAtLine] operator[SEP] identifier[row] operator[SEP] operator[SEP] Keyword[return] identifier[getValueAt] operator[SEP] identifier[rowNode] , identifier[col] operator[SEP] operator[SEP]
}
|
@Override
@Nullable
public String getSubCenterName(int subcenter) {
if (nwsoSubCenter == null)
nwsoSubCenter = readNwsoSubCenter("resources/grib1/noaa_rfc/tableC.txt");
if (nwsoSubCenter == null) return null;
return nwsoSubCenter.get(subcenter);
} | class class_name[name] begin[{]
method[getSubCenterName, return_type[type[String]], modifier[public], parameter[subcenter]] begin[{]
if[binary_operation[member[.nwsoSubCenter], ==, literal[null]]] begin[{]
assign[member[.nwsoSubCenter], call[.readNwsoSubCenter, parameter[literal["resources/grib1/noaa_rfc/tableC.txt"]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.nwsoSubCenter], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
return[call[nwsoSubCenter.get, parameter[member[.subcenter]]]]
end[}]
END[}] | annotation[@] identifier[Override] annotation[@] identifier[Nullable] Keyword[public] identifier[String] identifier[getSubCenterName] operator[SEP] Keyword[int] identifier[subcenter] operator[SEP] {
Keyword[if] operator[SEP] identifier[nwsoSubCenter] operator[==] Other[null] operator[SEP] identifier[nwsoSubCenter] operator[=] identifier[readNwsoSubCenter] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[nwsoSubCenter] operator[==] Other[null] operator[SEP] Keyword[return] Other[null] operator[SEP] Keyword[return] identifier[nwsoSubCenter] operator[SEP] identifier[get] operator[SEP] identifier[subcenter] operator[SEP] operator[SEP]
}
|
public java.util.List<EnvironmentLink> getEnvironmentLinks() {
if (environmentLinks == null) {
environmentLinks = new com.amazonaws.internal.SdkInternalList<EnvironmentLink>();
}
return environmentLinks;
} | class class_name[name] begin[{]
method[getEnvironmentLinks, return_type[type[java]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.environmentLinks], ==, literal[null]]] begin[{]
assign[member[.environmentLinks], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=com, sub_type=ReferenceType(arguments=None, dimensions=None, name=amazonaws, sub_type=ReferenceType(arguments=None, dimensions=None, name=internal, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=EnvironmentLink, sub_type=None))], dimensions=None, name=SdkInternalList, sub_type=None)))))]
else begin[{]
None
end[}]
return[member[.environmentLinks]]
end[}]
END[}] | Keyword[public] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[List] operator[<] identifier[EnvironmentLink] operator[>] identifier[getEnvironmentLinks] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[environmentLinks] operator[==] Other[null] operator[SEP] {
identifier[environmentLinks] operator[=] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[EnvironmentLink] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[environmentLinks] operator[SEP]
}
|
public Vector3f set(int index, ByteBuffer buffer) {
MemUtil.INSTANCE.get(this, index, buffer);
return this;
} | class class_name[name] begin[{]
method[set, return_type[type[Vector3f]], modifier[public], parameter[index, buffer]] begin[{]
call[MemUtil.INSTANCE.get, parameter[THIS[], member[.index], member[.buffer]]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[Vector3f] identifier[set] operator[SEP] Keyword[int] identifier[index] , identifier[ByteBuffer] identifier[buffer] operator[SEP] {
identifier[MemUtil] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[get] operator[SEP] Keyword[this] , identifier[index] , identifier[buffer] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
@Nullable
public <P> P getListener(Class<P> type) {
if (mListener != null) {
return type.cast(mListener);
}
return null;
} | class class_name[name] begin[{]
method[getListener, return_type[type[P]], modifier[public], parameter[type]] begin[{]
if[binary_operation[member[.mListener], !=, literal[null]]] begin[{]
return[call[type.cast, parameter[member[.mListener]]]]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}] | annotation[@] identifier[Nullable] Keyword[public] operator[<] identifier[P] operator[>] identifier[P] identifier[getListener] operator[SEP] identifier[Class] operator[<] identifier[P] operator[>] identifier[type] operator[SEP] {
Keyword[if] operator[SEP] identifier[mListener] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[type] operator[SEP] identifier[cast] operator[SEP] identifier[mListener] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
@SuppressWarnings("unchecked")
public void distributedProcess(ResponseBuilder rb, ComponentFields mtasFields)
throws IOException {
// rewrite
NamedList<Object> mtasResponse = null;
try {
mtasResponse = (NamedList<Object>) rb.rsp.getValues().get("mtas");
} catch (ClassCastException e) {
log.debug(e);
mtasResponse = null;
}
if (mtasResponse != null) {
ArrayList<Object> mtasResponsePrefix;
try {
mtasResponsePrefix = (ArrayList<Object>) mtasResponse.get(NAME);
if (mtasResponsePrefix != null) {
NamedList<Object> mtasResponsePrefixItem;
for (Object mtasResponsePrefixItemRaw : mtasResponsePrefix) {
mtasResponsePrefixItem = (NamedList<Object>) mtasResponsePrefixItemRaw;
repairPrefixItems(mtasResponsePrefixItem);
MtasSolrResultUtil.rewrite(mtasResponsePrefixItem, searchComponent);
}
}
} catch (ClassCastException e) {
log.debug(e);
mtasResponse.remove(NAME);
}
}
} | class class_name[name] begin[{]
method[distributedProcess, return_type[void], modifier[public], parameter[rb, mtasFields]] begin[{]
local_variable[type[NamedList], mtasResponse]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=mtasResponse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MethodInvocation(arguments=[], member=getValues, postfix_operators=[], prefix_operators=[], qualifier=rb.rsp, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="mtas")], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=[], name=NamedList, sub_type=None))), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debug, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=mtasResponse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ClassCastException']))], finally_block=None, label=None, resources=None)
if[binary_operation[member[.mtasResponse], !=, literal[null]]] begin[{]
local_variable[type[ArrayList], mtasResponsePrefix]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=mtasResponsePrefix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MethodInvocation(arguments=[MemberReference(member=NAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=mtasResponse, selectors=[], type_arguments=None), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=[], name=ArrayList, sub_type=None))), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=mtasResponsePrefix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=mtasResponsePrefixItem)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=[], name=NamedList, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=mtasResponsePrefixItem, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MemberReference(member=mtasResponsePrefixItemRaw, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=[], name=NamedList, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=mtasResponsePrefixItem, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=repairPrefixItems, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=mtasResponsePrefixItem, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=searchComponent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=rewrite, postfix_operators=[], prefix_operators=[], qualifier=MtasSolrResultUtil, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=mtasResponsePrefix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=mtasResponsePrefixItemRaw)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debug, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=NAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=mtasResponse, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ClassCastException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[void] identifier[distributedProcess] operator[SEP] identifier[ResponseBuilder] identifier[rb] , identifier[ComponentFields] identifier[mtasFields] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[NamedList] operator[<] identifier[Object] operator[>] identifier[mtasResponse] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[mtasResponse] operator[=] operator[SEP] identifier[NamedList] operator[<] identifier[Object] operator[>] operator[SEP] identifier[rb] operator[SEP] identifier[rsp] operator[SEP] identifier[getValues] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ClassCastException] identifier[e] operator[SEP] {
identifier[log] operator[SEP] identifier[debug] operator[SEP] identifier[e] operator[SEP] operator[SEP] identifier[mtasResponse] operator[=] Other[null] operator[SEP]
}
Keyword[if] operator[SEP] identifier[mtasResponse] operator[!=] Other[null] operator[SEP] {
identifier[ArrayList] operator[<] identifier[Object] operator[>] identifier[mtasResponsePrefix] operator[SEP] Keyword[try] {
identifier[mtasResponsePrefix] operator[=] operator[SEP] identifier[ArrayList] operator[<] identifier[Object] operator[>] operator[SEP] identifier[mtasResponse] operator[SEP] identifier[get] operator[SEP] identifier[NAME] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[mtasResponsePrefix] operator[!=] Other[null] operator[SEP] {
identifier[NamedList] operator[<] identifier[Object] operator[>] identifier[mtasResponsePrefixItem] operator[SEP] Keyword[for] operator[SEP] identifier[Object] identifier[mtasResponsePrefixItemRaw] operator[:] identifier[mtasResponsePrefix] operator[SEP] {
identifier[mtasResponsePrefixItem] operator[=] operator[SEP] identifier[NamedList] operator[<] identifier[Object] operator[>] operator[SEP] identifier[mtasResponsePrefixItemRaw] operator[SEP] identifier[repairPrefixItems] operator[SEP] identifier[mtasResponsePrefixItem] operator[SEP] operator[SEP] identifier[MtasSolrResultUtil] operator[SEP] identifier[rewrite] operator[SEP] identifier[mtasResponsePrefixItem] , identifier[searchComponent] operator[SEP] operator[SEP]
}
}
}
Keyword[catch] operator[SEP] identifier[ClassCastException] identifier[e] operator[SEP] {
identifier[log] operator[SEP] identifier[debug] operator[SEP] identifier[e] operator[SEP] operator[SEP] identifier[mtasResponse] operator[SEP] identifier[remove] operator[SEP] identifier[NAME] operator[SEP] operator[SEP]
}
}
}
|
private void startRevive() {
bot.setRunning(true);
Thread thread = new Thread(new ChatLoop(bot));
thread.setName("wechat-listener");
thread.setDaemon(true);
thread.start();
} | class class_name[name] begin[{]
method[startRevive, return_type[void], modifier[private], parameter[]] begin[{]
call[bot.setRunning, parameter[literal[true]]]
local_variable[type[Thread], thread]
call[thread.setName, parameter[literal["wechat-listener"]]]
call[thread.setDaemon, parameter[literal[true]]]
call[thread.start, parameter[]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[startRevive] operator[SEP] operator[SEP] {
identifier[bot] operator[SEP] identifier[setRunning] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[Thread] identifier[thread] operator[=] Keyword[new] identifier[Thread] operator[SEP] Keyword[new] identifier[ChatLoop] operator[SEP] identifier[bot] operator[SEP] operator[SEP] operator[SEP] identifier[thread] operator[SEP] identifier[setName] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[thread] operator[SEP] identifier[setDaemon] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[thread] operator[SEP] identifier[start] operator[SEP] operator[SEP] operator[SEP]
}
|
protected void processDump(HttpServerExchange exchange) throws IOException {
final String data = processDumpString();
exchange.getResponseHeaders().add(Headers.SERVER, MOD_CLUSTER_EXPOSED_VERSION);
sendResponse(exchange, data);
} | class class_name[name] begin[{]
method[processDump, return_type[void], modifier[protected], parameter[exchange]] begin[{]
local_variable[type[String], data]
call[exchange.getResponseHeaders, parameter[]]
call[.sendResponse, parameter[member[.exchange], member[.data]]]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[processDump] operator[SEP] identifier[HttpServerExchange] identifier[exchange] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[final] identifier[String] identifier[data] operator[=] identifier[processDumpString] operator[SEP] operator[SEP] operator[SEP] identifier[exchange] operator[SEP] identifier[getResponseHeaders] operator[SEP] operator[SEP] operator[SEP] identifier[add] operator[SEP] identifier[Headers] operator[SEP] identifier[SERVER] , identifier[MOD_CLUSTER_EXPOSED_VERSION] operator[SEP] operator[SEP] identifier[sendResponse] operator[SEP] identifier[exchange] , identifier[data] operator[SEP] operator[SEP]
}
|
public int getRabbitMqPort() {
String portValue = this.envVars.get(RabbitMqEnvVar.NODE_PORT.getEnvVarName());
if (portValue == null) {
return RabbitMqEnvVar.DEFAULT_NODE_PORT;
} else {
return Integer.parseInt(portValue);
}
} | class class_name[name] begin[{]
method[getRabbitMqPort, return_type[type[int]], modifier[public], parameter[]] begin[{]
local_variable[type[String], portValue]
if[binary_operation[member[.portValue], ==, literal[null]]] begin[{]
return[member[RabbitMqEnvVar.DEFAULT_NODE_PORT]]
else begin[{]
return[call[Integer.parseInt, parameter[member[.portValue]]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[getRabbitMqPort] operator[SEP] operator[SEP] {
identifier[String] identifier[portValue] operator[=] Keyword[this] operator[SEP] identifier[envVars] operator[SEP] identifier[get] operator[SEP] identifier[RabbitMqEnvVar] operator[SEP] identifier[NODE_PORT] operator[SEP] identifier[getEnvVarName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[portValue] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[RabbitMqEnvVar] operator[SEP] identifier[DEFAULT_NODE_PORT] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[portValue] operator[SEP] operator[SEP]
}
}
|
private Collection<Map<String, Object>> getActiveSsoSessions(final SsoSessionReportOptions option) {
val activeSessions = new ArrayList<Map<String, Object>>();
val dateFormat = new ISOStandardDateFormat();
getNonExpiredTicketGrantingTickets().stream().map(TicketGrantingTicket.class::cast)
.filter(tgt -> !(option == SsoSessionReportOptions.DIRECT && tgt.getProxiedBy() != null))
.forEach(tgt -> {
val authentication = tgt.getAuthentication();
val principal = authentication.getPrincipal();
val sso = new HashMap<String, Object>(SsoSessionAttributeKeys.values().length);
sso.put(SsoSessionAttributeKeys.AUTHENTICATED_PRINCIPAL.toString(), principal.getId());
sso.put(SsoSessionAttributeKeys.AUTHENTICATION_DATE.toString(), authentication.getAuthenticationDate());
sso.put(SsoSessionAttributeKeys.AUTHENTICATION_DATE_FORMATTED.toString(),
dateFormat.format(DateTimeUtils.dateOf(authentication.getAuthenticationDate())));
sso.put(SsoSessionAttributeKeys.NUMBER_OF_USES.toString(), tgt.getCountOfUses());
sso.put(SsoSessionAttributeKeys.TICKET_GRANTING_TICKET.toString(), tgt.getId());
sso.put(SsoSessionAttributeKeys.PRINCIPAL_ATTRIBUTES.toString(), principal.getAttributes());
sso.put(SsoSessionAttributeKeys.AUTHENTICATION_ATTRIBUTES.toString(), authentication.getAttributes());
if (option != SsoSessionReportOptions.DIRECT) {
if (tgt.getProxiedBy() != null) {
sso.put(SsoSessionAttributeKeys.IS_PROXIED.toString(), Boolean.TRUE);
sso.put(SsoSessionAttributeKeys.PROXIED_BY.toString(), tgt.getProxiedBy().getId());
} else {
sso.put(SsoSessionAttributeKeys.IS_PROXIED.toString(), Boolean.FALSE);
}
}
sso.put(SsoSessionAttributeKeys.AUTHENTICATED_SERVICES.toString(), tgt.getServices());
activeSessions.add(sso);
});
return activeSessions;
} | class class_name[name] begin[{]
method[getActiveSsoSessions, return_type[type[Collection]], modifier[private], parameter[option]] begin[{]
local_variable[type[val], activeSessions]
local_variable[type[val], dateFormat]
call[.getNonExpiredTicketGrantingTickets, parameter[]]
return[member[.activeSessions]]
end[}]
END[}] | Keyword[private] identifier[Collection] operator[<] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] operator[>] identifier[getActiveSsoSessions] operator[SEP] Keyword[final] identifier[SsoSessionReportOptions] identifier[option] operator[SEP] {
identifier[val] identifier[activeSessions] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[val] identifier[dateFormat] operator[=] Keyword[new] identifier[ISOStandardDateFormat] operator[SEP] operator[SEP] operator[SEP] identifier[getNonExpiredTicketGrantingTickets] operator[SEP] operator[SEP] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[TicketGrantingTicket] operator[SEP] Keyword[class] operator[::] identifier[cast] operator[SEP] operator[SEP] identifier[filter] operator[SEP] identifier[tgt] operator[->] operator[!] operator[SEP] identifier[option] operator[==] identifier[SsoSessionReportOptions] operator[SEP] identifier[DIRECT] operator[&&] identifier[tgt] operator[SEP] identifier[getProxiedBy] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] operator[SEP] operator[SEP] identifier[forEach] operator[SEP] identifier[tgt] operator[->] {
identifier[val] identifier[authentication] operator[=] identifier[tgt] operator[SEP] identifier[getAuthentication] operator[SEP] operator[SEP] operator[SEP] identifier[val] identifier[principal] operator[=] identifier[authentication] operator[SEP] identifier[getPrincipal] operator[SEP] operator[SEP] operator[SEP] identifier[val] identifier[sso] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[Object] operator[>] operator[SEP] identifier[SsoSessionAttributeKeys] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[sso] operator[SEP] identifier[put] operator[SEP] identifier[SsoSessionAttributeKeys] operator[SEP] identifier[AUTHENTICATED_PRINCIPAL] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[principal] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[sso] operator[SEP] identifier[put] operator[SEP] identifier[SsoSessionAttributeKeys] operator[SEP] identifier[AUTHENTICATION_DATE] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[authentication] operator[SEP] identifier[getAuthenticationDate] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[sso] operator[SEP] identifier[put] operator[SEP] identifier[SsoSessionAttributeKeys] operator[SEP] identifier[AUTHENTICATION_DATE_FORMATTED] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[dateFormat] operator[SEP] identifier[format] operator[SEP] identifier[DateTimeUtils] operator[SEP] identifier[dateOf] operator[SEP] identifier[authentication] operator[SEP] identifier[getAuthenticationDate] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[sso] operator[SEP] identifier[put] operator[SEP] identifier[SsoSessionAttributeKeys] operator[SEP] identifier[NUMBER_OF_USES] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[tgt] operator[SEP] identifier[getCountOfUses] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[sso] operator[SEP] identifier[put] operator[SEP] identifier[SsoSessionAttributeKeys] operator[SEP] identifier[TICKET_GRANTING_TICKET] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[tgt] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[sso] operator[SEP] identifier[put] operator[SEP] identifier[SsoSessionAttributeKeys] operator[SEP] identifier[PRINCIPAL_ATTRIBUTES] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[principal] operator[SEP] identifier[getAttributes] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[sso] operator[SEP] identifier[put] operator[SEP] identifier[SsoSessionAttributeKeys] operator[SEP] identifier[AUTHENTICATION_ATTRIBUTES] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[authentication] operator[SEP] identifier[getAttributes] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[option] operator[!=] identifier[SsoSessionReportOptions] operator[SEP] identifier[DIRECT] operator[SEP] {
Keyword[if] operator[SEP] identifier[tgt] operator[SEP] identifier[getProxiedBy] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[sso] operator[SEP] identifier[put] operator[SEP] identifier[SsoSessionAttributeKeys] operator[SEP] identifier[IS_PROXIED] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[Boolean] operator[SEP] identifier[TRUE] operator[SEP] operator[SEP] identifier[sso] operator[SEP] identifier[put] operator[SEP] identifier[SsoSessionAttributeKeys] operator[SEP] identifier[PROXIED_BY] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[tgt] operator[SEP] identifier[getProxiedBy] operator[SEP] operator[SEP] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[sso] operator[SEP] identifier[put] operator[SEP] identifier[SsoSessionAttributeKeys] operator[SEP] identifier[IS_PROXIED] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[Boolean] operator[SEP] identifier[FALSE] operator[SEP] operator[SEP]
}
}
identifier[sso] operator[SEP] identifier[put] operator[SEP] identifier[SsoSessionAttributeKeys] operator[SEP] identifier[AUTHENTICATED_SERVICES] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[tgt] operator[SEP] identifier[getServices] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[activeSessions] operator[SEP] identifier[add] operator[SEP] identifier[sso] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP] Keyword[return] identifier[activeSessions] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.