code
stringlengths 63
466k
| code_sememe
stringlengths 141
3.79M
| token_type
stringlengths 274
1.23M
|
---|---|---|
public boolean isServerStarted() {
String thisMethodName = CLASS_NAME + ".isServerStarted()";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, this);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName, new Boolean(_serverStarted));
}
return _serverStarted;
} | class class_name[name] begin[{]
method[isServerStarted, return_type[type[boolean]], modifier[public], parameter[]] begin[{]
local_variable[type[String], thisMethodName]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[member[.tc], member[.thisMethodName], THIS[]]]
else begin[{]
None
end[}]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[member[.tc], member[.thisMethodName], ClassCreator(arguments=[MemberReference(member=_serverStarted, 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=Boolean, sub_type=None))]]
else begin[{]
None
end[}]
return[member[._serverStarted]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[isServerStarted] operator[SEP] operator[SEP] {
identifier[String] identifier[thisMethodName] operator[=] identifier[CLASS_NAME] operator[+] literal[String] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] identifier[tc] , identifier[thisMethodName] , Keyword[this] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , identifier[thisMethodName] , Keyword[new] identifier[Boolean] operator[SEP] identifier[_serverStarted] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[_serverStarted] operator[SEP]
}
|
public SnackbarBuilder timeoutDismissCallback(final SnackbarTimeoutDismissCallback callback) {
callbacks.add(new SnackbarCallback() {
public void onSnackbarTimedOut(Snackbar snackbar) {
callback.onSnackbarTimedOut(snackbar);
}
});
return this;
} | class class_name[name] begin[{]
method[timeoutDismissCallback, return_type[type[SnackbarBuilder]], modifier[public], parameter[callback]] begin[{]
call[callbacks.add, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[], body=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=snackbar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=onSnackbarTimedOut, postfix_operators=[], prefix_operators=[], qualifier=callback, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=onSnackbarTimedOut, parameters=[FormalParameter(annotations=[], modifiers=set(), name=snackbar, type=ReferenceType(arguments=None, dimensions=[], name=Snackbar, 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=SnackbarCallback, sub_type=None))]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[SnackbarBuilder] identifier[timeoutDismissCallback] operator[SEP] Keyword[final] identifier[SnackbarTimeoutDismissCallback] identifier[callback] operator[SEP] {
identifier[callbacks] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[SnackbarCallback] operator[SEP] operator[SEP] {
Keyword[public] Keyword[void] identifier[onSnackbarTimedOut] operator[SEP] identifier[Snackbar] identifier[snackbar] operator[SEP] {
identifier[callback] operator[SEP] identifier[onSnackbarTimedOut] operator[SEP] identifier[snackbar] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public final <R> Ix<R> lift(IxFunction<? super Iterator<T>, ? extends Iterator<R>> lifter) {
return new IxLift<T, R>(this, nullCheck(lifter, "lifter is null"));
} | class class_name[name] begin[{]
method[lift, return_type[type[Ix]], modifier[final public], parameter[lifter]] begin[{]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MethodInvocation(arguments=[MemberReference(member=lifter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="lifter is null")], member=nullCheck, postfix_operators=[], prefix_operators=[], qualifier=, 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=T, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=R, sub_type=None))], dimensions=None, name=IxLift, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[final] operator[<] identifier[R] operator[>] identifier[Ix] operator[<] identifier[R] operator[>] identifier[lift] operator[SEP] identifier[IxFunction] operator[<] operator[?] Keyword[super] identifier[Iterator] operator[<] identifier[T] operator[>] , operator[?] Keyword[extends] identifier[Iterator] operator[<] identifier[R] operator[>] operator[>] identifier[lifter] operator[SEP] {
Keyword[return] Keyword[new] identifier[IxLift] operator[<] identifier[T] , identifier[R] operator[>] operator[SEP] Keyword[this] , identifier[nullCheck] operator[SEP] identifier[lifter] , literal[String] operator[SEP] operator[SEP] operator[SEP]
}
|
protected void doPaint(Graphics2D g, JComponent c, int width, int height, Object[] extendedCacheKeys) {
switch (state) {
case FIND_ICON_ENABLED:
paintSearchGlass(g, 0, 0, width, height, false);
break;
case FIND_ICON_ENABLED_POPUP:
paintSearchGlass(g, 0, 0, width, height, true);
break;
case CANCEL_ICON_ENABLED:
paintCancelIcon(g, 0, 0, width, height, cancelIconColor);
break;
case CANCEL_ICON_PRESSED:
paintCancelIcon(g, 0, 0, width, height, cancelIconPressedColor);
break;
}
} | class class_name[name] begin[{]
method[doPaint, return_type[void], modifier[protected], parameter[g, c, width, height, extendedCacheKeys]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=['FIND_ICON_ENABLED'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=g, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=width, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=height, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=paintSearchGlass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['FIND_ICON_ENABLED_POPUP'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=g, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=width, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=height, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=paintSearchGlass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['CANCEL_ICON_ENABLED'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=g, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=width, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=height, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=cancelIconColor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=paintCancelIcon, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['CANCEL_ICON_PRESSED'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=g, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=width, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=height, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=cancelIconPressedColor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=paintCancelIcon, 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[}] | Keyword[protected] Keyword[void] identifier[doPaint] operator[SEP] identifier[Graphics2D] identifier[g] , identifier[JComponent] identifier[c] , Keyword[int] identifier[width] , Keyword[int] identifier[height] , identifier[Object] operator[SEP] operator[SEP] identifier[extendedCacheKeys] operator[SEP] {
Keyword[switch] operator[SEP] identifier[state] operator[SEP] {
Keyword[case] identifier[FIND_ICON_ENABLED] operator[:] identifier[paintSearchGlass] operator[SEP] identifier[g] , Other[0] , Other[0] , identifier[width] , identifier[height] , literal[boolean] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[FIND_ICON_ENABLED_POPUP] operator[:] identifier[paintSearchGlass] operator[SEP] identifier[g] , Other[0] , Other[0] , identifier[width] , identifier[height] , literal[boolean] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[CANCEL_ICON_ENABLED] operator[:] identifier[paintCancelIcon] operator[SEP] identifier[g] , Other[0] , Other[0] , identifier[width] , identifier[height] , identifier[cancelIconColor] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[CANCEL_ICON_PRESSED] operator[:] identifier[paintCancelIcon] operator[SEP] identifier[g] , Other[0] , Other[0] , identifier[width] , identifier[height] , identifier[cancelIconPressedColor] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
}
|
public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions)
{
if ((MenuConstants.FORM.equalsIgnoreCase(strCommand))
|| (MenuConstants.FORMLINK.equalsIgnoreCase(strCommand)))
{
return this.handleCommand(UserInfo.VERBOSE_MAINT_SCREEN, sourceSField, iCommandOptions);
}
return super.doCommand(strCommand, sourceSField, iCommandOptions);
} | class class_name[name] begin[{]
method[doCommand, return_type[type[boolean]], modifier[public], parameter[strCommand, sourceSField, iCommandOptions]] begin[{]
if[binary_operation[call[MenuConstants.FORM.equalsIgnoreCase, parameter[member[.strCommand]]], ||, call[MenuConstants.FORMLINK.equalsIgnoreCase, parameter[member[.strCommand]]]]] begin[{]
return[THIS[call[None.handleCommand, parameter[member[UserInfo.VERBOSE_MAINT_SCREEN], member[.sourceSField], member[.iCommandOptions]]]]]
else begin[{]
None
end[}]
return[SuperMethodInvocation(arguments=[MemberReference(member=strCommand, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=sourceSField, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=iCommandOptions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=doCommand, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[doCommand] operator[SEP] identifier[String] identifier[strCommand] , identifier[ScreenField] identifier[sourceSField] , Keyword[int] identifier[iCommandOptions] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[MenuConstants] operator[SEP] identifier[FORM] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[strCommand] operator[SEP] operator[SEP] operator[||] operator[SEP] identifier[MenuConstants] operator[SEP] identifier[FORMLINK] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[strCommand] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP] identifier[handleCommand] operator[SEP] identifier[UserInfo] operator[SEP] identifier[VERBOSE_MAINT_SCREEN] , identifier[sourceSField] , identifier[iCommandOptions] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[super] operator[SEP] identifier[doCommand] operator[SEP] identifier[strCommand] , identifier[sourceSField] , identifier[iCommandOptions] operator[SEP] operator[SEP]
}
|
void add(CacheDisposable<T> consumer) {
for (;;) {
CacheDisposable<T>[] current = observers.get();
if (current == TERMINATED) {
return;
}
int n = current.length;
@SuppressWarnings("unchecked")
CacheDisposable<T>[] next = new CacheDisposable[n + 1];
System.arraycopy(current, 0, next, 0, n);
next[n] = consumer;
if (observers.compareAndSet(current, next)) {
return;
}
}
} | class class_name[name] begin[{]
method[add, return_type[void], modifier[default], parameter[consumer]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=observers, selectors=[], type_arguments=None), name=current)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[None], name=CacheDisposable, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=current, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=TERMINATED, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=current, selectors=[]), name=n)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[Annotation(element=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="unchecked"), name=SuppressWarnings)], declarators=[VariableDeclarator(dimensions=[], initializer=ArrayCreator(dimensions=[BinaryOperation(operandl=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CacheDisposable, sub_type=None)), name=next)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[None], name=CacheDisposable, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=current, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=next, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=arraycopy, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=next, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=consumer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=current, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=next, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=compareAndSet, postfix_operators=[], prefix_operators=[], qualifier=observers, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=None, label=None)]))]), control=ForControl(condition=None, init=None, update=None), label=None)
end[}]
END[}] | Keyword[void] identifier[add] operator[SEP] identifier[CacheDisposable] operator[<] identifier[T] operator[>] identifier[consumer] operator[SEP] {
Keyword[for] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[CacheDisposable] operator[<] identifier[T] operator[>] operator[SEP] operator[SEP] identifier[current] operator[=] identifier[observers] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[current] operator[==] identifier[TERMINATED] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[int] identifier[n] operator[=] identifier[current] operator[SEP] identifier[length] operator[SEP] annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] identifier[CacheDisposable] operator[<] identifier[T] operator[>] operator[SEP] operator[SEP] identifier[next] operator[=] Keyword[new] identifier[CacheDisposable] operator[SEP] identifier[n] operator[+] Other[1] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[current] , Other[0] , identifier[next] , Other[0] , identifier[n] operator[SEP] operator[SEP] identifier[next] operator[SEP] identifier[n] operator[SEP] operator[=] identifier[consumer] operator[SEP] Keyword[if] operator[SEP] identifier[observers] operator[SEP] identifier[compareAndSet] operator[SEP] identifier[current] , identifier[next] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
}
}
|
public static base_response disable(nitro_service client, service resource) throws Exception {
service disableresource = new service();
disableresource.name = resource.name;
disableresource.delay = resource.delay;
disableresource.graceful = resource.graceful;
return disableresource.perform_operation(client,"disable");
} | class class_name[name] begin[{]
method[disable, return_type[type[base_response]], modifier[public static], parameter[client, resource]] begin[{]
local_variable[type[service], disableresource]
assign[member[disableresource.name], member[resource.name]]
assign[member[disableresource.delay], member[resource.delay]]
assign[member[disableresource.graceful], member[resource.graceful]]
return[call[disableresource.perform_operation, parameter[member[.client], literal["disable"]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[base_response] identifier[disable] operator[SEP] identifier[nitro_service] identifier[client] , identifier[service] identifier[resource] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[service] identifier[disableresource] operator[=] Keyword[new] identifier[service] operator[SEP] operator[SEP] operator[SEP] identifier[disableresource] operator[SEP] identifier[name] operator[=] identifier[resource] operator[SEP] identifier[name] operator[SEP] identifier[disableresource] operator[SEP] identifier[delay] operator[=] identifier[resource] operator[SEP] identifier[delay] operator[SEP] identifier[disableresource] operator[SEP] identifier[graceful] operator[=] identifier[resource] operator[SEP] identifier[graceful] operator[SEP] Keyword[return] identifier[disableresource] operator[SEP] identifier[perform_operation] operator[SEP] identifier[client] , literal[String] operator[SEP] operator[SEP]
}
|
@Override
public Step resolveExtJsonFile(Step thisStep) {
try {
if (!checkDigNeeded(thisStep)) {
return thisStep;
}
JsonNode stepNode = objectMapper.convertValue(thisStep, JsonNode.class);
Map<String, Object> stepMap = objectMapper.readValue(stepNode.toString(), new TypeReference<Map<String, Object>>() {
});
digReplaceContent(stepMap);
JsonNode jsonStepNode = objectMapper.valueToTree(stepMap);
return objectMapper.treeToValue(jsonStepNode, Step.class);
} catch (Exception exx) {
LOGGER.error("External file reading exception - {}", exx.getMessage());
throw new RuntimeException("External file reading exception. Details - " + exx);
}
} | class class_name[name] begin[{]
method[resolveExtJsonFile, return_type[type[Step]], modifier[public], parameter[thisStep]] begin[{]
TryStatement(block=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=thisStep, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkDigNeeded, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=thisStep, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=thisStep, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JsonNode, sub_type=None))], member=convertValue, postfix_operators=[], prefix_operators=[], qualifier=objectMapper, selectors=[], type_arguments=None), name=stepNode)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JsonNode, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=stepNode, selectors=[], type_arguments=None), ClassCreator(arguments=[], body=[], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, 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=Object, sub_type=None))], dimensions=[], name=Map, sub_type=None))], dimensions=None, name=TypeReference, sub_type=None))], member=readValue, postfix_operators=[], prefix_operators=[], qualifier=objectMapper, selectors=[], type_arguments=None), name=stepMap)], 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=Object, sub_type=None))], dimensions=[], name=Map, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=stepMap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=digReplaceContent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=stepMap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueToTree, postfix_operators=[], prefix_operators=[], qualifier=objectMapper, selectors=[], type_arguments=None), name=jsonStepNode)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JsonNode, sub_type=None)), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=jsonStepNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Step, sub_type=None))], member=treeToValue, postfix_operators=[], prefix_operators=[], qualifier=objectMapper, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="External file reading exception - {}"), MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=exx, selectors=[], type_arguments=None)], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="External file reading exception. Details - "), operandr=MemberReference(member=exx, 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=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=exx, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Step] identifier[resolveExtJsonFile] operator[SEP] identifier[Step] identifier[thisStep] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] operator[!] identifier[checkDigNeeded] operator[SEP] identifier[thisStep] operator[SEP] operator[SEP] {
Keyword[return] identifier[thisStep] operator[SEP]
}
identifier[JsonNode] identifier[stepNode] operator[=] identifier[objectMapper] operator[SEP] identifier[convertValue] operator[SEP] identifier[thisStep] , identifier[JsonNode] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[stepMap] operator[=] identifier[objectMapper] operator[SEP] identifier[readValue] operator[SEP] identifier[stepNode] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , Keyword[new] identifier[TypeReference] operator[<] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] operator[>] operator[SEP] operator[SEP] {
} operator[SEP] operator[SEP] identifier[digReplaceContent] operator[SEP] identifier[stepMap] operator[SEP] operator[SEP] identifier[JsonNode] identifier[jsonStepNode] operator[=] identifier[objectMapper] operator[SEP] identifier[valueToTree] operator[SEP] identifier[stepMap] operator[SEP] operator[SEP] Keyword[return] identifier[objectMapper] operator[SEP] identifier[treeToValue] operator[SEP] identifier[jsonStepNode] , identifier[Step] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[exx] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[exx] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[+] identifier[exx] operator[SEP] operator[SEP]
}
}
|
public VarSetBuilder varSetAtPath( String[] path)
{
VarSet varSet = null;
if( path != null && path.length > 0)
{
varSet = new VarSet( path[0]);
varSet_.addMember( varSet);
for( int i = 1; i < path.length; i++)
{
VarSet child = new VarSet( path[i]);
varSet.addMember( child);
varSet = child;
}
}
return
varSet == null
? null
: new VarSetBuilder( varSet);
} | class class_name[name] begin[{]
method[varSetAtPath, return_type[type[VarSetBuilder]], modifier[public], parameter[path]] begin[{]
local_variable[type[VarSet], varSet]
if[binary_operation[binary_operation[member[.path], !=, literal[null]], &&, binary_operation[member[path.length], >, literal[0]]]] begin[{]
assign[member[.varSet], ClassCreator(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=VarSet, sub_type=None))]
call[varSet_.addMember, parameter[member[.varSet]]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, 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=VarSet, sub_type=None)), name=child)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=VarSet, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=child, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addMember, postfix_operators=[], prefix_operators=[], qualifier=varSet, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=varSet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=child, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=path, 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)
else begin[{]
None
end[}]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=varSet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=ClassCreator(arguments=[MemberReference(member=varSet, 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=VarSetBuilder, sub_type=None)), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
end[}]
END[}] | Keyword[public] identifier[VarSetBuilder] identifier[varSetAtPath] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[path] operator[SEP] {
identifier[VarSet] identifier[varSet] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[path] operator[!=] Other[null] operator[&&] identifier[path] operator[SEP] identifier[length] operator[>] Other[0] operator[SEP] {
identifier[varSet] operator[=] Keyword[new] identifier[VarSet] operator[SEP] identifier[path] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] identifier[varSet_] operator[SEP] identifier[addMember] operator[SEP] identifier[varSet] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[1] operator[SEP] identifier[i] operator[<] identifier[path] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[VarSet] identifier[child] operator[=] Keyword[new] identifier[VarSet] operator[SEP] identifier[path] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] identifier[varSet] operator[SEP] identifier[addMember] operator[SEP] identifier[child] operator[SEP] operator[SEP] identifier[varSet] operator[=] identifier[child] operator[SEP]
}
}
Keyword[return] identifier[varSet] operator[==] Other[null] operator[?] Other[null] operator[:] Keyword[new] identifier[VarSetBuilder] operator[SEP] identifier[varSet] operator[SEP] operator[SEP]
}
|
public static String toHalfWidthString(CharSequence str) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < str.length(); i++) {
sb.append(toHalfWidthCharacter(str.charAt(i)));
}
return sb.toString();
} | class class_name[name] begin[{]
method[toHalfWidthString, return_type[type[String]], modifier[public static], parameter[str]] begin[{]
local_variable[type[StringBuilder], sb]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=str, selectors=[], type_arguments=None)], member=toHalfWidthCharacter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=str, 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[call[sb.toString, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[toHalfWidthString] operator[SEP] identifier[CharSequence] identifier[str] operator[SEP] {
identifier[StringBuilder] identifier[sb] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[str] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[toHalfWidthCharacter] operator[SEP] identifier[str] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public void writeNameValuePair(String name, double value) throws IOException
{
internalWriteNameValuePair(name, Double.toString(value));
} | class class_name[name] begin[{]
method[writeNameValuePair, return_type[void], modifier[public], parameter[name, value]] begin[{]
call[.internalWriteNameValuePair, parameter[member[.name], call[Double.toString, parameter[member[.value]]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[writeNameValuePair] operator[SEP] identifier[String] identifier[name] , Keyword[double] identifier[value] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[internalWriteNameValuePair] operator[SEP] identifier[name] , identifier[Double] operator[SEP] identifier[toString] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP]
}
|
public void setScalingPlans(java.util.Collection<ScalingPlan> scalingPlans) {
if (scalingPlans == null) {
this.scalingPlans = null;
return;
}
this.scalingPlans = new java.util.ArrayList<ScalingPlan>(scalingPlans);
} | class class_name[name] begin[{]
method[setScalingPlans, return_type[void], modifier[public], parameter[scalingPlans]] begin[{]
if[binary_operation[member[.scalingPlans], ==, literal[null]]] begin[{]
assign[THIS[member[None.scalingPlans]], literal[null]]
return[None]
else begin[{]
None
end[}]
assign[THIS[member[None.scalingPlans]], ClassCreator(arguments=[MemberReference(member=scalingPlans, 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=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=util, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=ScalingPlan, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))))]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setScalingPlans] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Collection] operator[<] identifier[ScalingPlan] operator[>] identifier[scalingPlans] operator[SEP] {
Keyword[if] operator[SEP] identifier[scalingPlans] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[scalingPlans] operator[=] Other[null] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[this] operator[SEP] identifier[scalingPlans] operator[=] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[ScalingPlan] operator[>] operator[SEP] identifier[scalingPlans] operator[SEP] operator[SEP]
}
|
public List<V> removeAll(K key) {
key = sanitizeKey(key);
List<V> removed = map.remove(key);
if (removed == null) {
return Collections.emptyList();
}
List<V> unmodifiableCopy = Collections.unmodifiableList(new ArrayList<V>(removed));
removed.clear();
return unmodifiableCopy;
} | class class_name[name] begin[{]
method[removeAll, return_type[type[List]], modifier[public], parameter[key]] begin[{]
assign[member[.key], call[.sanitizeKey, parameter[member[.key]]]]
local_variable[type[List], removed]
if[binary_operation[member[.removed], ==, literal[null]]] begin[{]
return[call[Collections.emptyList, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[List], unmodifiableCopy]
call[removed.clear, parameter[]]
return[member[.unmodifiableCopy]]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[V] operator[>] identifier[removeAll] operator[SEP] identifier[K] identifier[key] operator[SEP] {
identifier[key] operator[=] identifier[sanitizeKey] operator[SEP] identifier[key] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[V] operator[>] identifier[removed] operator[=] identifier[map] operator[SEP] identifier[remove] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[removed] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[Collections] operator[SEP] identifier[emptyList] operator[SEP] operator[SEP] operator[SEP]
}
identifier[List] operator[<] identifier[V] operator[>] identifier[unmodifiableCopy] operator[=] identifier[Collections] operator[SEP] identifier[unmodifiableList] operator[SEP] Keyword[new] identifier[ArrayList] operator[<] identifier[V] operator[>] operator[SEP] identifier[removed] operator[SEP] operator[SEP] operator[SEP] identifier[removed] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[unmodifiableCopy] operator[SEP]
}
|
protected void appendWhereClause(FieldDescriptor[] fields, StringBuffer stmt) throws PersistenceBrokerException
{
stmt.append(" WHERE ");
for(int i = 0; i < fields.length; i++)
{
FieldDescriptor fmd = fields[i];
stmt.append(fmd.getColumnName());
stmt.append(" = ? ");
if(i < fields.length - 1)
{
stmt.append(" AND ");
}
}
} | class class_name[name] begin[{]
method[appendWhereClause, return_type[void], modifier[protected], parameter[fields, stmt]] begin[{]
call[stmt.append, parameter[literal[" WHERE "]]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=fields, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=fmd)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FieldDescriptor, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getColumnName, postfix_operators=[], prefix_operators=[], qualifier=fmd, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=stmt, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" = ? ")], member=append, postfix_operators=[], prefix_operators=[], qualifier=stmt, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=fields, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), 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=" AND ")], member=append, postfix_operators=[], prefix_operators=[], qualifier=stmt, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=fields, 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)
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[appendWhereClause] operator[SEP] identifier[FieldDescriptor] operator[SEP] operator[SEP] identifier[fields] , identifier[StringBuffer] identifier[stmt] operator[SEP] Keyword[throws] identifier[PersistenceBrokerException] {
identifier[stmt] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[fields] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[FieldDescriptor] identifier[fmd] operator[=] identifier[fields] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[stmt] operator[SEP] identifier[append] operator[SEP] identifier[fmd] operator[SEP] identifier[getColumnName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[stmt] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[i] operator[<] identifier[fields] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] {
identifier[stmt] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
}
|
@Override
public X509Certificate[] extract(final HttpServletRequest request) {
val certHeaderValue = getCertFromHeader(request);
if (StringUtils.isBlank(certHeaderValue)) {
LOGGER.debug("No header [{}] found in request (or value was null)", sslClientCertHeader);
return null;
}
if (certHeaderValue.length() < X509_HEADER.length()) {
LOGGER.debug("Header [{}] found but it is too short to parse. Header value: [{}]", sslClientCertHeader, certHeaderValue);
return null;
}
val body = sanitizeCertificateBody(certHeaderValue);
try (InputStream input = new ByteArrayInputStream(body.getBytes(StandardCharsets.ISO_8859_1))) {
val cert = CertUtils.readCertificate(input);
LOGGER.debug("Certificate extracted from header [{}] with subject: [{}]", sslClientCertHeader, cert.getSubjectDN());
return new X509Certificate[]{cert};
} catch (final Exception e) {
LOGGER.warn("Error parsing the certificate in header: [{}] value: [{}] with error msg: [{}]", sslClientCertHeader, body, e.getMessage());
LOGGER.debug("Error parsing the certificate in header: [{}] value: [{}]", sslClientCertHeader, body, e);
}
return null;
} | class class_name[name] begin[{]
method[extract, return_type[type[X509Certificate]], modifier[public], parameter[request]] begin[{]
local_variable[type[val], certHeaderValue]
if[call[StringUtils.isBlank, parameter[member[.certHeaderValue]]]] begin[{]
call[LOGGER.debug, parameter[literal["No header [{}] found in request (or value was null)"], member[.sslClientCertHeader]]]
return[literal[null]]
else begin[{]
None
end[}]
if[binary_operation[call[certHeaderValue.length, parameter[]], <, call[X509_HEADER.length, parameter[]]]] begin[{]
call[LOGGER.debug, parameter[literal["Header [{}] found but it is too short to parse. Header value: [{}]"], member[.sslClientCertHeader], member[.certHeaderValue]]]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[val], body]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readCertificate, postfix_operators=[], prefix_operators=[], qualifier=CertUtils, selectors=[], type_arguments=None), name=cert)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=val, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Certificate extracted from header [{}] with subject: [{}]"), MemberReference(member=sslClientCertHeader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getSubjectDN, postfix_operators=[], prefix_operators=[], qualifier=cert, selectors=[], type_arguments=None)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=cert, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=X509Certificate, sub_type=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error parsing the certificate in header: [{}] value: [{}] with error msg: [{}]"), MemberReference(member=sslClientCertHeader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=body, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], member=warn, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error parsing the certificate in header: [{}] value: [{}]"), MemberReference(member=sslClientCertHeader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=body, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debug, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=input, type=ReferenceType(arguments=None, dimensions=[], name=InputStream, sub_type=None), value=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=ISO_8859_1, postfix_operators=[], prefix_operators=[], qualifier=StandardCharsets, selectors=[])], member=getBytes, postfix_operators=[], prefix_operators=[], qualifier=body, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ByteArrayInputStream, sub_type=None)))])
return[literal[null]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[X509Certificate] operator[SEP] operator[SEP] identifier[extract] operator[SEP] Keyword[final] identifier[HttpServletRequest] identifier[request] operator[SEP] {
identifier[val] identifier[certHeaderValue] operator[=] identifier[getCertFromHeader] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isBlank] operator[SEP] identifier[certHeaderValue] operator[SEP] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[sslClientCertHeader] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
Keyword[if] operator[SEP] identifier[certHeaderValue] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[<] identifier[X509_HEADER] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[sslClientCertHeader] , identifier[certHeaderValue] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
identifier[val] identifier[body] operator[=] identifier[sanitizeCertificateBody] operator[SEP] identifier[certHeaderValue] operator[SEP] operator[SEP] Keyword[try] operator[SEP] identifier[InputStream] identifier[input] operator[=] Keyword[new] identifier[ByteArrayInputStream] operator[SEP] identifier[body] operator[SEP] identifier[getBytes] operator[SEP] identifier[StandardCharsets] operator[SEP] identifier[ISO_8859_1] operator[SEP] operator[SEP] operator[SEP] {
identifier[val] identifier[cert] operator[=] identifier[CertUtils] operator[SEP] identifier[readCertificate] operator[SEP] identifier[input] operator[SEP] operator[SEP] identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[sslClientCertHeader] , identifier[cert] operator[SEP] identifier[getSubjectDN] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[X509Certificate] operator[SEP] operator[SEP] {
identifier[cert]
} 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[sslClientCertHeader] , identifier[body] , identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[sslClientCertHeader] , identifier[body] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
@Pure
public IntegerProperty minXProperty() {
if (this.minX == null) {
this.minX = new SimpleIntegerProperty(this, MathFXAttributeNames.MINIMUM_X) {
@Override
protected void invalidated() {
final int currentMin = get();
final int currentMax = getMaxX();
if (currentMax < currentMin) {
// min-max constrain is broken
maxXProperty().set(currentMin);
}
}
};
}
return this.minX;
} | class class_name[name] begin[{]
method[minXProperty, return_type[type[IntegerProperty]], modifier[public], parameter[]] begin[{]
if[binary_operation[THIS[member[None.minX]], ==, literal[null]]] begin[{]
assign[THIS[member[None.minX]], ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=MINIMUM_X, postfix_operators=[], prefix_operators=[], qualifier=MathFXAttributeNames, selectors=[])], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=currentMin)], modifiers={'final'}, type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getMaxX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=currentMax)], modifiers={'final'}, type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=currentMax, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=currentMin, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=maxXProperty, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=currentMin, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=set, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]))], documentation=None, modifiers={'protected'}, name=invalidated, parameters=[], 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=SimpleIntegerProperty, sub_type=None))]
else begin[{]
None
end[}]
return[THIS[member[None.minX]]]
end[}]
END[}] | annotation[@] identifier[Pure] Keyword[public] identifier[IntegerProperty] identifier[minXProperty] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[minX] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[minX] operator[=] Keyword[new] identifier[SimpleIntegerProperty] operator[SEP] Keyword[this] , identifier[MathFXAttributeNames] operator[SEP] identifier[MINIMUM_X] operator[SEP] {
annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[invalidated] operator[SEP] operator[SEP] {
Keyword[final] Keyword[int] identifier[currentMin] operator[=] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[currentMax] operator[=] identifier[getMaxX] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[currentMax] operator[<] identifier[currentMin] operator[SEP] {
identifier[maxXProperty] operator[SEP] operator[SEP] operator[SEP] identifier[set] operator[SEP] identifier[currentMin] operator[SEP] operator[SEP]
}
}
} operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP] identifier[minX] operator[SEP]
}
|
public static boolean isValid(
int yearOfEra,
int month,
int dayOfMonth
) {
return CALSYS.isValid(JucheEra.JUCHE, yearOfEra, month, dayOfMonth);
} | class class_name[name] begin[{]
method[isValid, return_type[type[boolean]], modifier[public static], parameter[yearOfEra, month, dayOfMonth]] begin[{]
return[call[CALSYS.isValid, parameter[member[JucheEra.JUCHE], member[.yearOfEra], member[.month], member[.dayOfMonth]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[isValid] operator[SEP] Keyword[int] identifier[yearOfEra] , Keyword[int] identifier[month] , Keyword[int] identifier[dayOfMonth] operator[SEP] {
Keyword[return] identifier[CALSYS] operator[SEP] identifier[isValid] operator[SEP] identifier[JucheEra] operator[SEP] identifier[JUCHE] , identifier[yearOfEra] , identifier[month] , identifier[dayOfMonth] operator[SEP] operator[SEP]
}
|
private void doFlush() throws SQLException {
if (batchCount > 0) {
try {
statement.executeBatch();
batchCount = 0;
} catch (SQLException ex) {
resetConnection();
throw ex;
}
}
} | class class_name[name] begin[{]
method[doFlush, return_type[void], modifier[private], parameter[]] begin[{]
if[binary_operation[member[.batchCount], >, literal[0]]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=executeBatch, postfix_operators=[], prefix_operators=[], qualifier=statement, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=batchCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=resetConnection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['SQLException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[doFlush] operator[SEP] operator[SEP] Keyword[throws] identifier[SQLException] {
Keyword[if] operator[SEP] identifier[batchCount] operator[>] Other[0] operator[SEP] {
Keyword[try] {
identifier[statement] operator[SEP] identifier[executeBatch] operator[SEP] operator[SEP] operator[SEP] identifier[batchCount] operator[=] Other[0] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[SQLException] identifier[ex] operator[SEP] {
identifier[resetConnection] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] identifier[ex] operator[SEP]
}
}
}
|
public void setLocal(Object key, Object value) {
if (data == null) {
data = new HashMap();
}
data.put(key, value);
} | class class_name[name] begin[{]
method[setLocal, return_type[void], modifier[public], parameter[key, value]] begin[{]
if[binary_operation[member[.data], ==, literal[null]]] begin[{]
assign[member[.data], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=HashMap, sub_type=None))]
else begin[{]
None
end[}]
call[data.put, parameter[member[.key], member[.value]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setLocal] operator[SEP] identifier[Object] identifier[key] , identifier[Object] identifier[value] operator[SEP] {
Keyword[if] operator[SEP] identifier[data] operator[==] Other[null] operator[SEP] {
identifier[data] operator[=] Keyword[new] identifier[HashMap] operator[SEP] operator[SEP] operator[SEP]
}
identifier[data] operator[SEP] identifier[put] operator[SEP] identifier[key] , identifier[value] operator[SEP] operator[SEP]
}
|
private int checkVariants(String variants, String sep) {
StringTokenIterator itr = new StringTokenIterator(variants, sep);
while (!itr.isDone()) {
String s = itr.current();
if (!LanguageTag.isVariant(s)) {
return itr.currentStart();
}
itr.next();
}
return -1;
} | class class_name[name] begin[{]
method[checkVariants, return_type[type[int]], modifier[private], parameter[variants, sep]] begin[{]
local_variable[type[StringTokenIterator], itr]
while[call[itr.isDone, parameter[]]] begin[{]
local_variable[type[String], s]
if[call[LanguageTag.isVariant, parameter[member[.s]]]] begin[{]
return[call[itr.currentStart, parameter[]]]
else begin[{]
None
end[}]
call[itr.next, parameter[]]
end[}]
return[literal[1]]
end[}]
END[}] | Keyword[private] Keyword[int] identifier[checkVariants] operator[SEP] identifier[String] identifier[variants] , identifier[String] identifier[sep] operator[SEP] {
identifier[StringTokenIterator] identifier[itr] operator[=] Keyword[new] identifier[StringTokenIterator] operator[SEP] identifier[variants] , identifier[sep] operator[SEP] operator[SEP] Keyword[while] operator[SEP] operator[!] identifier[itr] operator[SEP] identifier[isDone] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[s] operator[=] identifier[itr] operator[SEP] identifier[current] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[LanguageTag] operator[SEP] identifier[isVariant] operator[SEP] identifier[s] operator[SEP] operator[SEP] {
Keyword[return] identifier[itr] operator[SEP] identifier[currentStart] operator[SEP] operator[SEP] operator[SEP]
}
identifier[itr] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] operator[-] Other[1] operator[SEP]
}
|
public java.lang.String getKernelName() {
java.lang.Object ref = kernelName_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
kernelName_ = s;
return s;
}
} | class class_name[name] begin[{]
method[getKernelName, return_type[type[java]], modifier[public], parameter[]] begin[{]
local_variable[type[java], ref]
if[binary_operation[member[.ref], instanceof, type[java]]] begin[{]
return[Cast(expression=MemberReference(member=ref, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=lang, sub_type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))))]
else begin[{]
local_variable[type[com], bs]
local_variable[type[java], s]
assign[member[.kernelName_], member[.s]]
return[member[.s]]
end[}]
end[}]
END[}] | Keyword[public] identifier[java] operator[SEP] identifier[lang] operator[SEP] identifier[String] identifier[getKernelName] operator[SEP] operator[SEP] {
identifier[java] operator[SEP] identifier[lang] operator[SEP] identifier[Object] identifier[ref] operator[=] identifier[kernelName_] operator[SEP] Keyword[if] operator[SEP] identifier[ref] Keyword[instanceof] identifier[java] operator[SEP] identifier[lang] operator[SEP] identifier[String] operator[SEP] {
Keyword[return] operator[SEP] identifier[java] operator[SEP] identifier[lang] operator[SEP] identifier[String] operator[SEP] identifier[ref] operator[SEP]
}
Keyword[else] {
identifier[com] operator[SEP] identifier[google] operator[SEP] identifier[protobuf] operator[SEP] identifier[ByteString] identifier[bs] operator[=] operator[SEP] identifier[com] operator[SEP] identifier[google] operator[SEP] identifier[protobuf] operator[SEP] identifier[ByteString] operator[SEP] identifier[ref] operator[SEP] identifier[java] operator[SEP] identifier[lang] operator[SEP] identifier[String] identifier[s] operator[=] identifier[bs] operator[SEP] identifier[toStringUtf8] operator[SEP] operator[SEP] operator[SEP] identifier[kernelName_] operator[=] identifier[s] operator[SEP] Keyword[return] identifier[s] operator[SEP]
}
}
|
public void readFields(DataInput in) throws IOException {
byte version = in.readByte(); // read version
if (version != getVersion())
throw new VersionMismatchException(getVersion(), version);
} | class class_name[name] begin[{]
method[readFields, return_type[void], modifier[public], parameter[in]] begin[{]
local_variable[type[byte], version]
if[binary_operation[member[.version], !=, call[.getVersion, parameter[]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getVersion, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=version, 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=VersionMismatchException, sub_type=None)), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[readFields] operator[SEP] identifier[DataInput] identifier[in] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[byte] identifier[version] operator[=] identifier[in] operator[SEP] identifier[readByte] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[version] operator[!=] identifier[getVersion] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[VersionMismatchException] operator[SEP] identifier[getVersion] operator[SEP] operator[SEP] , identifier[version] operator[SEP] operator[SEP]
}
|
final public void andExpression() throws ParseException {
equalityExpression();
label_6:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 13:
case 14:
;
break;
default:
jj_la1[11] = jj_gen;
break label_6;
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 13:
jj_consume_token(13);
break;
case 14:
jj_consume_token(14);
break;
default:
jj_la1[12] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
ASTBitAnd jjtn001 = new ASTBitAnd(JJTBITAND);
boolean jjtc001 = true;
jjtree.openNodeScope(jjtn001);
try {
equalityExpression();
} catch (Throwable jjte001) {
if (jjtc001) {
jjtree.clearNodeScope(jjtn001);
jjtc001 = false;
} else {
jjtree.popNode();
}
if (jjte001 instanceof RuntimeException) {
{if (true) throw (RuntimeException)jjte001;}
}
if (jjte001 instanceof ParseException) {
{if (true) throw (ParseException)jjte001;}
}
{if (true) throw (Error)jjte001;}
} finally {
if (jjtc001) {
jjtree.closeNodeScope(jjtn001, 2);
}
}
}
} | class class_name[name] begin[{]
method[andExpression, return_type[void], modifier[final public], parameter[]] begin[{]
call[.equalityExpression, parameter[]]
while[literal[true]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=13), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=14)], statements=[Statement(label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=jj_la1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=11))]), type==, value=MemberReference(member=jj_gen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), BreakStatement(goto=label_6, label=None)])], expression=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=jj_ntk, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator===), if_false=MemberReference(member=jj_ntk, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MethodInvocation(arguments=[], member=jj_ntk, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)
SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=13)], statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=13)], member=jj_consume_token, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=14)], statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=14)], member=jj_consume_token, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=jj_la1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=12))]), type==, value=MemberReference(member=jj_gen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1)], member=jj_consume_token, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ParseException, sub_type=None)), label=None)])], expression=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=jj_ntk, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator===), if_false=MemberReference(member=jj_ntk, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MethodInvocation(arguments=[], member=jj_ntk, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)
local_variable[type[ASTBitAnd], jjtn001]
local_variable[type[boolean], jjtc001]
call[jjtree.openNodeScope, parameter[member[.jjtn001]]]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=equalityExpression, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[IfStatement(condition=MemberReference(member=jjtc001, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=popNode, postfix_operators=[], prefix_operators=[], qualifier=jjtree, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=jjtn001, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=clearNodeScope, postfix_operators=[], prefix_operators=[], qualifier=jjtree, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=jjtc001, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=jjte001, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=RuntimeException, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[BlockStatement(label=None, statements=[IfStatement(condition=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), else_statement=None, label=None, then_statement=ThrowStatement(expression=Cast(expression=MemberReference(member=jjte001, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=RuntimeException, sub_type=None)), label=None))])])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=jjte001, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=ParseException, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[BlockStatement(label=None, statements=[IfStatement(condition=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), else_statement=None, label=None, then_statement=ThrowStatement(expression=Cast(expression=MemberReference(member=jjte001, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ParseException, sub_type=None)), label=None))])])), BlockStatement(label=None, statements=[IfStatement(condition=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), else_statement=None, label=None, then_statement=ThrowStatement(expression=Cast(expression=MemberReference(member=jjte001, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Error, sub_type=None)), label=None))])], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=jjte001, types=['Throwable']))], finally_block=[IfStatement(condition=MemberReference(member=jjtc001, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=jjtn001, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], member=closeNodeScope, postfix_operators=[], prefix_operators=[], qualifier=jjtree, selectors=[], type_arguments=None), label=None)]))], label=None, resources=None)
end[}]
end[}]
END[}] | Keyword[final] Keyword[public] Keyword[void] identifier[andExpression] operator[SEP] operator[SEP] Keyword[throws] identifier[ParseException] {
identifier[equalityExpression] operator[SEP] operator[SEP] operator[SEP] identifier[label_6] operator[:] Keyword[while] operator[SEP] literal[boolean] operator[SEP] {
Keyword[switch] operator[SEP] operator[SEP] identifier[jj_ntk] operator[==] operator[-] Other[1] operator[SEP] operator[?] identifier[jj_ntk] operator[SEP] operator[SEP] operator[:] identifier[jj_ntk] operator[SEP] {
Keyword[case] Other[13] operator[:] Keyword[case] Other[14] operator[:] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] identifier[jj_la1] operator[SEP] Other[11] operator[SEP] operator[=] identifier[jj_gen] operator[SEP] Keyword[break] identifier[label_6] operator[SEP]
}
Keyword[switch] operator[SEP] operator[SEP] identifier[jj_ntk] operator[==] operator[-] Other[1] operator[SEP] operator[?] identifier[jj_ntk] operator[SEP] operator[SEP] operator[:] identifier[jj_ntk] operator[SEP] {
Keyword[case] Other[13] operator[:] identifier[jj_consume_token] operator[SEP] Other[13] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] Other[14] operator[:] identifier[jj_consume_token] operator[SEP] Other[14] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] identifier[jj_la1] operator[SEP] Other[12] operator[SEP] operator[=] identifier[jj_gen] operator[SEP] identifier[jj_consume_token] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[ParseException] operator[SEP] operator[SEP] operator[SEP]
}
identifier[ASTBitAnd] identifier[jjtn001] operator[=] Keyword[new] identifier[ASTBitAnd] operator[SEP] identifier[JJTBITAND] operator[SEP] operator[SEP] Keyword[boolean] identifier[jjtc001] operator[=] literal[boolean] operator[SEP] identifier[jjtree] operator[SEP] identifier[openNodeScope] operator[SEP] identifier[jjtn001] operator[SEP] operator[SEP] Keyword[try] {
identifier[equalityExpression] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[jjte001] operator[SEP] {
Keyword[if] operator[SEP] identifier[jjtc001] operator[SEP] {
identifier[jjtree] operator[SEP] identifier[clearNodeScope] operator[SEP] identifier[jjtn001] operator[SEP] operator[SEP] identifier[jjtc001] operator[=] literal[boolean] operator[SEP]
}
Keyword[else] {
identifier[jjtree] operator[SEP] identifier[popNode] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[jjte001] Keyword[instanceof] identifier[RuntimeException] operator[SEP] {
{
Keyword[if] operator[SEP] literal[boolean] operator[SEP] Keyword[throw] operator[SEP] identifier[RuntimeException] operator[SEP] identifier[jjte001] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[jjte001] Keyword[instanceof] identifier[ParseException] operator[SEP] {
{
Keyword[if] operator[SEP] literal[boolean] operator[SEP] Keyword[throw] operator[SEP] identifier[ParseException] operator[SEP] identifier[jjte001] operator[SEP]
}
} {
Keyword[if] operator[SEP] literal[boolean] operator[SEP] Keyword[throw] operator[SEP] identifier[Error] operator[SEP] identifier[jjte001] operator[SEP]
}
}
Keyword[finally] {
Keyword[if] operator[SEP] identifier[jjtc001] operator[SEP] {
identifier[jjtree] operator[SEP] identifier[closeNodeScope] operator[SEP] identifier[jjtn001] , Other[2] operator[SEP] operator[SEP]
}
}
}
}
|
public final Operation updateField(Field field) {
UpdateFieldRequest request = UpdateFieldRequest.newBuilder().setField(field).build();
return updateField(request);
} | class class_name[name] begin[{]
method[updateField, return_type[type[Operation]], modifier[final public], parameter[field]] begin[{]
local_variable[type[UpdateFieldRequest], request]
return[call[.updateField, parameter[member[.request]]]]
end[}]
END[}] | Keyword[public] Keyword[final] identifier[Operation] identifier[updateField] operator[SEP] identifier[Field] identifier[field] operator[SEP] {
identifier[UpdateFieldRequest] identifier[request] operator[=] identifier[UpdateFieldRequest] operator[SEP] identifier[newBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[setField] operator[SEP] identifier[field] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[updateField] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
public final void ruleXDoWhileExpression() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalXbase.g:1046:2: ( ( ( rule__XDoWhileExpression__Group__0 ) ) )
// InternalXbase.g:1047:2: ( ( rule__XDoWhileExpression__Group__0 ) )
{
// InternalXbase.g:1047:2: ( ( rule__XDoWhileExpression__Group__0 ) )
// InternalXbase.g:1048:3: ( rule__XDoWhileExpression__Group__0 )
{
if ( state.backtracking==0 ) {
before(grammarAccess.getXDoWhileExpressionAccess().getGroup());
}
// InternalXbase.g:1049:3: ( rule__XDoWhileExpression__Group__0 )
// InternalXbase.g:1049:4: rule__XDoWhileExpression__Group__0
{
pushFollow(FOLLOW_2);
rule__XDoWhileExpression__Group__0();
state._fsp--;
if (state.failed) return ;
}
if ( state.backtracking==0 ) {
after(grammarAccess.getXDoWhileExpressionAccess().getGroup());
}
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
} | class class_name[name] begin[{]
method[ruleXDoWhileExpression, return_type[void], modifier[final public], parameter[]] begin[{]
local_variable[type[int], stackSize]
TryStatement(block=[BlockStatement(label=None, statements=[BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=backtracking, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getXDoWhileExpressionAccess, postfix_operators=[], prefix_operators=[], qualifier=grammarAccess, selectors=[MethodInvocation(arguments=[], member=getGroup, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=before, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])), BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=FOLLOW_2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=pushFollow, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=rule__XDoWhileExpression__Group__0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MemberReference(member=_fsp, postfix_operators=['--'], prefix_operators=[], qualifier=state, selectors=[]), label=None), IfStatement(condition=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), else_statement=None, label=None, then_statement=ReturnStatement(expression=None, label=None))]), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=backtracking, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getXDoWhileExpressionAccess, postfix_operators=[], prefix_operators=[], qualifier=grammarAccess, selectors=[MethodInvocation(arguments=[], member=getGroup, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=after, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))])])], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=re, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=reportError, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=re, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=recover, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=re, types=['RecognitionException']))], finally_block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=stackSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=restoreStackSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
return[None]
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[void] identifier[ruleXDoWhileExpression] operator[SEP] operator[SEP] Keyword[throws] identifier[RecognitionException] {
Keyword[int] identifier[stackSize] operator[=] identifier[keepStackSize] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
{
{
Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[backtracking] operator[==] Other[0] operator[SEP] {
identifier[before] operator[SEP] identifier[grammarAccess] operator[SEP] identifier[getXDoWhileExpressionAccess] operator[SEP] operator[SEP] operator[SEP] identifier[getGroup] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
} {
identifier[pushFollow] operator[SEP] identifier[FOLLOW_2] operator[SEP] operator[SEP] identifier[rule__XDoWhileExpression__Group__0] operator[SEP] operator[SEP] operator[SEP] identifier[state] operator[SEP] identifier[_fsp] operator[--] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[failed] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[backtracking] operator[==] Other[0] operator[SEP] {
identifier[after] operator[SEP] identifier[grammarAccess] operator[SEP] identifier[getXDoWhileExpressionAccess] operator[SEP] operator[SEP] operator[SEP] identifier[getGroup] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
Keyword[catch] operator[SEP] identifier[RecognitionException] identifier[re] operator[SEP] {
identifier[reportError] operator[SEP] identifier[re] operator[SEP] operator[SEP] identifier[recover] operator[SEP] identifier[input] , identifier[re] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[restoreStackSize] operator[SEP] identifier[stackSize] operator[SEP] operator[SEP]
}
Keyword[return] operator[SEP]
}
|
public static void quote(StringBuilder buf, String str) {
buf.append('"');
escape(buf, str);
buf.append('"');
} | class class_name[name] begin[{]
method[quote, return_type[void], modifier[public static], parameter[buf, str]] begin[{]
call[buf.append, parameter[literal['"']]]
call[.escape, parameter[member[.buf], member[.str]]]
call[buf.append, parameter[literal['"']]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[quote] operator[SEP] identifier[StringBuilder] identifier[buf] , identifier[String] identifier[str] operator[SEP] {
identifier[buf] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[escape] operator[SEP] identifier[buf] , identifier[str] operator[SEP] operator[SEP] identifier[buf] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
public synchronized UserAgent getUserAgent() {
if (this.userAgent == null) {
if (isService) {
this.userAgent =
new UserAgent(
this.serviceName,
this.projectId,
this.sslEnabled,
this.nfvoIp,
this.nfvoPort,
this.version,
this.serviceKey);
} else {
this.userAgent =
new UserAgent(
this.username,
this.password,
this.projectId,
this.sslEnabled,
this.nfvoIp,
this.nfvoPort,
this.version);
}
}
return this.userAgent;
} | class class_name[name] begin[{]
method[getUserAgent, return_type[type[UserAgent]], modifier[synchronized public], parameter[]] begin[{]
if[binary_operation[THIS[member[None.userAgent]], ==, literal[null]]] begin[{]
if[member[.isService]] begin[{]
assign[THIS[member[None.userAgent]], ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=serviceName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=projectId, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=sslEnabled, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=nfvoIp, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=nfvoPort, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=version, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=serviceKey, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UserAgent, sub_type=None))]
else begin[{]
assign[THIS[member[None.userAgent]], ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=username, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=password, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=projectId, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=sslEnabled, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=nfvoIp, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=nfvoPort, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=version, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UserAgent, sub_type=None))]
end[}]
else begin[{]
None
end[}]
return[THIS[member[None.userAgent]]]
end[}]
END[}] | Keyword[public] Keyword[synchronized] identifier[UserAgent] identifier[getUserAgent] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[userAgent] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[isService] operator[SEP] {
Keyword[this] operator[SEP] identifier[userAgent] operator[=] Keyword[new] identifier[UserAgent] operator[SEP] Keyword[this] operator[SEP] identifier[serviceName] , Keyword[this] operator[SEP] identifier[projectId] , Keyword[this] operator[SEP] identifier[sslEnabled] , Keyword[this] operator[SEP] identifier[nfvoIp] , Keyword[this] operator[SEP] identifier[nfvoPort] , Keyword[this] operator[SEP] identifier[version] , Keyword[this] operator[SEP] identifier[serviceKey] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[this] operator[SEP] identifier[userAgent] operator[=] Keyword[new] identifier[UserAgent] operator[SEP] Keyword[this] operator[SEP] identifier[username] , Keyword[this] operator[SEP] identifier[password] , Keyword[this] operator[SEP] identifier[projectId] , Keyword[this] operator[SEP] identifier[sslEnabled] , Keyword[this] operator[SEP] identifier[nfvoIp] , Keyword[this] operator[SEP] identifier[nfvoPort] , Keyword[this] operator[SEP] identifier[version] operator[SEP] operator[SEP]
}
}
Keyword[return] Keyword[this] operator[SEP] identifier[userAgent] operator[SEP]
}
|
static void interceptWritingFiles( Properties props, File outputDirectory ) throws IOException {
if( outputDirectory == null )
return;
Logger logger = Logger.getLogger( UserDataHelpers.class.getName());
Set<String> keys = props.stringPropertyNames();
for( final String key : keys ) {
if( ! key.startsWith( ENCODE_FILE_CONTENT_PREFIX ))
continue;
// Get the file content
String encodedFileContent = props.getProperty( key );
String realKey = key.substring( ENCODE_FILE_CONTENT_PREFIX.length());
if( encodedFileContent == null ) {
logger.fine( "No file content was provided for " + realKey + ". Skipping it..." );
continue;
}
byte[] fileContent = decodeFromBase64( encodedFileContent );
// Write it to the disk
String targetFile = props.getProperty( realKey );
if( targetFile == null ) {
logger.fine( "No property named " + realKey + " was found. Skipping it..." );
continue;
}
Utils.createDirectory( outputDirectory );
File output = new File( outputDirectory, new File( targetFile ).getName());
Utils.copyStream( new ByteArrayInputStream( fileContent ), output );
logger.finer( "Writing " + key + " from user data in " + output.getAbsolutePath());
// Update the properties
props.remove( key );
props.setProperty( realKey, output.getAbsolutePath());
}
} | class class_name[name] begin[{]
method[interceptWritingFiles, return_type[void], modifier[static], parameter[props, outputDirectory]] begin[{]
if[binary_operation[member[.outputDirectory], ==, literal[null]]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[Logger], logger]
local_variable[type[Set], keys]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=ENCODE_FILE_CONTENT_PREFIX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=startsWith, postfix_operators=[], prefix_operators=['!'], qualifier=key, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=ContinueStatement(goto=None, label=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getProperty, postfix_operators=[], prefix_operators=[], qualifier=props, selectors=[], type_arguments=None), name=encodedFileContent)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=ENCODE_FILE_CONTENT_PREFIX, selectors=[], type_arguments=None)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=key, selectors=[], type_arguments=None), name=realKey)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=encodedFileContent, 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=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="No file content was provided for "), operandr=MemberReference(member=realKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=". Skipping it..."), operator=+)], member=fine, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=encodedFileContent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=decodeFromBase64, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=fileContent)], modifiers=set(), type=BasicType(dimensions=[None], name=byte)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=realKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getProperty, postfix_operators=[], prefix_operators=[], qualifier=props, selectors=[], type_arguments=None), name=targetFile)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=targetFile, 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=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="No property named "), operandr=MemberReference(member=realKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" was found. Skipping it..."), operator=+)], member=fine, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=None, label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=outputDirectory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createDirectory, postfix_operators=[], prefix_operators=[], qualifier=Utils, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=outputDirectory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[MemberReference(member=targetFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=File, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=File, sub_type=None)), name=output)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=fileContent, 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=ByteArrayInputStream, sub_type=None)), MemberReference(member=output, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=copyStream, postfix_operators=[], prefix_operators=[], qualifier=Utils, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Writing "), operandr=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" from user data in "), operator=+), operandr=MethodInvocation(arguments=[], member=getAbsolutePath, postfix_operators=[], prefix_operators=[], qualifier=output, selectors=[], type_arguments=None), operator=+)], member=finer, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=props, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=realKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getAbsolutePath, postfix_operators=[], prefix_operators=[], qualifier=output, selectors=[], type_arguments=None)], member=setProperty, postfix_operators=[], prefix_operators=[], qualifier=props, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=keys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=key)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
end[}]
END[}] | Keyword[static] Keyword[void] identifier[interceptWritingFiles] operator[SEP] identifier[Properties] identifier[props] , identifier[File] identifier[outputDirectory] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[outputDirectory] operator[==] Other[null] operator[SEP] Keyword[return] operator[SEP] identifier[Logger] identifier[logger] operator[=] identifier[Logger] operator[SEP] identifier[getLogger] operator[SEP] identifier[UserDataHelpers] operator[SEP] Keyword[class] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Set] operator[<] identifier[String] operator[>] identifier[keys] operator[=] identifier[props] operator[SEP] identifier[stringPropertyNames] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[String] identifier[key] operator[:] identifier[keys] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[key] operator[SEP] identifier[startsWith] operator[SEP] identifier[ENCODE_FILE_CONTENT_PREFIX] operator[SEP] operator[SEP] Keyword[continue] operator[SEP] identifier[String] identifier[encodedFileContent] operator[=] identifier[props] operator[SEP] identifier[getProperty] operator[SEP] identifier[key] operator[SEP] operator[SEP] identifier[String] identifier[realKey] operator[=] identifier[key] operator[SEP] identifier[substring] operator[SEP] identifier[ENCODE_FILE_CONTENT_PREFIX] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[encodedFileContent] operator[==] Other[null] operator[SEP] {
identifier[logger] operator[SEP] identifier[fine] operator[SEP] literal[String] operator[+] identifier[realKey] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
Keyword[byte] operator[SEP] operator[SEP] identifier[fileContent] operator[=] identifier[decodeFromBase64] operator[SEP] identifier[encodedFileContent] operator[SEP] operator[SEP] identifier[String] identifier[targetFile] operator[=] identifier[props] operator[SEP] identifier[getProperty] operator[SEP] identifier[realKey] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[targetFile] operator[==] Other[null] operator[SEP] {
identifier[logger] operator[SEP] identifier[fine] operator[SEP] literal[String] operator[+] identifier[realKey] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
identifier[Utils] operator[SEP] identifier[createDirectory] operator[SEP] identifier[outputDirectory] operator[SEP] operator[SEP] identifier[File] identifier[output] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[outputDirectory] , Keyword[new] identifier[File] operator[SEP] identifier[targetFile] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Utils] operator[SEP] identifier[copyStream] operator[SEP] Keyword[new] identifier[ByteArrayInputStream] operator[SEP] identifier[fileContent] operator[SEP] , identifier[output] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[finer] operator[SEP] literal[String] operator[+] identifier[key] operator[+] literal[String] operator[+] identifier[output] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[props] operator[SEP] identifier[remove] operator[SEP] identifier[key] operator[SEP] operator[SEP] identifier[props] operator[SEP] identifier[setProperty] operator[SEP] identifier[realKey] , identifier[output] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@Override
protected boolean isValid() {
// Get the date we are validating.
WDateField dateField = (WDateField) this.getInputField();
Date date = dateField.getDate();
if (date == null) {
// No date, so nothing to validate.
return true;
}
// Determine the pivot date
Date pivot = null;
if (variablePivot != null) {
pivot = variablePivot.getDate();
if (pivot == null) {
// No pivot value, so default to true.
return true;
}
} else if (fixedPivot != null) {
pivot = fixedPivot;
}
// We take a null pivot date as meaning "today"
if (pivot == null) {
pivot = new Date();
}
// Round the dates to nearest day.
pivot = DateUtilities.roundToDay(pivot);
date = DateUtilities.roundToDay(date);
// Perform the comparison with the pivot
switch (operator) {
case BEFORE:
return date.before(pivot);
case BEFORE_OR_EQUAL:
return !pivot.before(date);
case EQUAL:
return date.equals(pivot);
case AFTER_OR_EQUAL:
return !pivot.after(date);
case AFTER:
return date.after(pivot);
default:
throw new SystemException("Unknown operator. [" + operator + "]");
}
} | class class_name[name] begin[{]
method[isValid, return_type[type[boolean]], modifier[protected], parameter[]] begin[{]
local_variable[type[WDateField], dateField]
local_variable[type[Date], date]
if[binary_operation[member[.date], ==, literal[null]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
local_variable[type[Date], pivot]
if[binary_operation[member[.variablePivot], !=, literal[null]]] begin[{]
assign[member[.pivot], call[variablePivot.getDate, parameter[]]]
if[binary_operation[member[.pivot], ==, literal[null]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
else begin[{]
if[binary_operation[member[.fixedPivot], !=, literal[null]]] begin[{]
assign[member[.pivot], member[.fixedPivot]]
else begin[{]
None
end[}]
end[}]
if[binary_operation[member[.pivot], ==, literal[null]]] begin[{]
assign[member[.pivot], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Date, sub_type=None))]
else begin[{]
None
end[}]
assign[member[.pivot], call[DateUtilities.roundToDay, parameter[member[.pivot]]]]
assign[member[.date], call[DateUtilities.roundToDay, parameter[member[.date]]]]
SwitchStatement(cases=[SwitchStatementCase(case=['BEFORE'], statements=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=pivot, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=before, postfix_operators=[], prefix_operators=[], qualifier=date, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=['BEFORE_OR_EQUAL'], statements=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=date, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=before, postfix_operators=[], prefix_operators=['!'], qualifier=pivot, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=['EQUAL'], statements=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=pivot, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=date, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=['AFTER_OR_EQUAL'], statements=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=date, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=after, postfix_operators=[], prefix_operators=['!'], qualifier=pivot, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=['AFTER'], statements=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=pivot, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=after, postfix_operators=[], prefix_operators=[], qualifier=date, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unknown operator. ["), operandr=MemberReference(member=operator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="]"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SystemException, sub_type=None)), label=None)])], expression=MemberReference(member=operator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] Keyword[boolean] identifier[isValid] operator[SEP] operator[SEP] {
identifier[WDateField] identifier[dateField] operator[=] operator[SEP] identifier[WDateField] operator[SEP] Keyword[this] operator[SEP] identifier[getInputField] operator[SEP] operator[SEP] operator[SEP] identifier[Date] identifier[date] operator[=] identifier[dateField] operator[SEP] identifier[getDate] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[date] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[Date] identifier[pivot] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[variablePivot] operator[!=] Other[null] operator[SEP] {
identifier[pivot] operator[=] identifier[variablePivot] operator[SEP] identifier[getDate] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[pivot] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[fixedPivot] operator[!=] Other[null] operator[SEP] {
identifier[pivot] operator[=] identifier[fixedPivot] operator[SEP]
}
Keyword[if] operator[SEP] identifier[pivot] operator[==] Other[null] operator[SEP] {
identifier[pivot] operator[=] Keyword[new] identifier[Date] operator[SEP] operator[SEP] operator[SEP]
}
identifier[pivot] operator[=] identifier[DateUtilities] operator[SEP] identifier[roundToDay] operator[SEP] identifier[pivot] operator[SEP] operator[SEP] identifier[date] operator[=] identifier[DateUtilities] operator[SEP] identifier[roundToDay] operator[SEP] identifier[date] operator[SEP] operator[SEP] Keyword[switch] operator[SEP] identifier[operator] operator[SEP] {
Keyword[case] identifier[BEFORE] operator[:] Keyword[return] identifier[date] operator[SEP] identifier[before] operator[SEP] identifier[pivot] operator[SEP] operator[SEP] Keyword[case] identifier[BEFORE_OR_EQUAL] operator[:] Keyword[return] operator[!] identifier[pivot] operator[SEP] identifier[before] operator[SEP] identifier[date] operator[SEP] operator[SEP] Keyword[case] identifier[EQUAL] operator[:] Keyword[return] identifier[date] operator[SEP] identifier[equals] operator[SEP] identifier[pivot] operator[SEP] operator[SEP] Keyword[case] identifier[AFTER_OR_EQUAL] operator[:] Keyword[return] operator[!] identifier[pivot] operator[SEP] identifier[after] operator[SEP] identifier[date] operator[SEP] operator[SEP] Keyword[case] identifier[AFTER] operator[:] Keyword[return] identifier[date] operator[SEP] identifier[after] operator[SEP] identifier[pivot] operator[SEP] operator[SEP] Keyword[default] operator[:] Keyword[throw] Keyword[new] identifier[SystemException] operator[SEP] literal[String] operator[+] identifier[operator] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
|
public void setAsText(String text)
{
ParseException pe = null;
for (int i = 0; i < formats.length; i++)
{
try
{
// try to parse the date
DateFormat df = formats[i];
Date date = df.parse(text);
// store the date in both forms
this.text = text;
super.setValue(date);
// done
return;
}
catch (ParseException e)
{
// remember the last seen exception
pe = e;
}
}
// couldn't parse
throw new NestedRuntimeException(pe);
} | class class_name[name] begin[{]
method[setAsText, return_type[void], modifier[public], parameter[text]] begin[{]
local_variable[type[ParseException], pe]
ForStatement(body=BlockStatement(label=None, statements=[TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=formats, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=df)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DateFormat, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=text, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parse, postfix_operators=[], prefix_operators=[], qualifier=df, selectors=[], type_arguments=None), name=date)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Date, sub_type=None)), StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=text, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=text, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=SuperMethodInvocation(arguments=[MemberReference(member=date, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setValue, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)], catches=[CatchClause(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=pe, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ParseException']))], finally_block=None, label=None, resources=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=formats, 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)
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=pe, 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=NestedRuntimeException, sub_type=None)), label=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setAsText] operator[SEP] identifier[String] identifier[text] operator[SEP] {
identifier[ParseException] identifier[pe] operator[=] Other[null] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[formats] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[try] {
identifier[DateFormat] identifier[df] operator[=] identifier[formats] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[Date] identifier[date] operator[=] identifier[df] operator[SEP] identifier[parse] operator[SEP] identifier[text] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[text] operator[=] identifier[text] operator[SEP] Keyword[super] operator[SEP] identifier[setValue] operator[SEP] identifier[date] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ParseException] identifier[e] operator[SEP] {
identifier[pe] operator[=] identifier[e] operator[SEP]
}
}
Keyword[throw] Keyword[new] identifier[NestedRuntimeException] operator[SEP] identifier[pe] operator[SEP] operator[SEP]
}
|
@Override
public void render(final ActionRequest actionRequest, final Object resultValue) {
final Chain chainResult;
if (resultValue == null) {
chainResult = Chain.to(StringPool.EMPTY);
} else {
if (resultValue instanceof String) {
chainResult = Chain.to((String)resultValue);
}
else {
chainResult = (Chain) resultValue;
}
}
final String resultBasePath = actionRequest.getActionRuntime().getResultBasePath();
final String resultPath = resultMapper.resolveResultPathString(resultBasePath, chainResult.path());
actionRequest.setNextActionPath(resultPath);
} | class class_name[name] begin[{]
method[render, return_type[void], modifier[public], parameter[actionRequest, resultValue]] begin[{]
local_variable[type[Chain], chainResult]
if[binary_operation[member[.resultValue], ==, literal[null]]] begin[{]
assign[member[.chainResult], call[Chain.to, parameter[member[StringPool.EMPTY]]]]
else begin[{]
if[binary_operation[member[.resultValue], instanceof, type[String]]] begin[{]
assign[member[.chainResult], call[Chain.to, parameter[Cast(expression=MemberReference(member=resultValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))]]]
else begin[{]
assign[member[.chainResult], Cast(expression=MemberReference(member=resultValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Chain, sub_type=None))]
end[}]
end[}]
local_variable[type[String], resultBasePath]
local_variable[type[String], resultPath]
call[actionRequest.setNextActionPath, parameter[member[.resultPath]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[render] operator[SEP] Keyword[final] identifier[ActionRequest] identifier[actionRequest] , Keyword[final] identifier[Object] identifier[resultValue] operator[SEP] {
Keyword[final] identifier[Chain] identifier[chainResult] operator[SEP] Keyword[if] operator[SEP] identifier[resultValue] operator[==] Other[null] operator[SEP] {
identifier[chainResult] operator[=] identifier[Chain] operator[SEP] identifier[to] operator[SEP] identifier[StringPool] operator[SEP] identifier[EMPTY] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[resultValue] Keyword[instanceof] identifier[String] operator[SEP] {
identifier[chainResult] operator[=] identifier[Chain] operator[SEP] identifier[to] operator[SEP] operator[SEP] identifier[String] operator[SEP] identifier[resultValue] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[chainResult] operator[=] operator[SEP] identifier[Chain] operator[SEP] identifier[resultValue] operator[SEP]
}
}
Keyword[final] identifier[String] identifier[resultBasePath] operator[=] identifier[actionRequest] operator[SEP] identifier[getActionRuntime] operator[SEP] operator[SEP] operator[SEP] identifier[getResultBasePath] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[resultPath] operator[=] identifier[resultMapper] operator[SEP] identifier[resolveResultPathString] operator[SEP] identifier[resultBasePath] , identifier[chainResult] operator[SEP] identifier[path] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[actionRequest] operator[SEP] identifier[setNextActionPath] operator[SEP] identifier[resultPath] operator[SEP] operator[SEP]
}
|
@Override
public String getCharacterEncoding() {
if (null == this.encoding) {
EncodingUtils encodingUtils = connection.getEncodingUtils();
this.encoding = encodingUtils.getEncodingFromLocale(this.locale);
if (null == this.encoding) {
this.encoding = encodingUtils.getDefaultEncoding();
}
}
return this.encoding;
} | class class_name[name] begin[{]
method[getCharacterEncoding, return_type[type[String]], modifier[public], parameter[]] begin[{]
if[binary_operation[literal[null], ==, THIS[member[None.encoding]]]] begin[{]
local_variable[type[EncodingUtils], encodingUtils]
assign[THIS[member[None.encoding]], call[encodingUtils.getEncodingFromLocale, parameter[THIS[member[None.locale]]]]]
if[binary_operation[literal[null], ==, THIS[member[None.encoding]]]] begin[{]
assign[THIS[member[None.encoding]], call[encodingUtils.getDefaultEncoding, parameter[]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[THIS[member[None.encoding]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[getCharacterEncoding] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] Other[null] operator[==] Keyword[this] operator[SEP] identifier[encoding] operator[SEP] {
identifier[EncodingUtils] identifier[encodingUtils] operator[=] identifier[connection] operator[SEP] identifier[getEncodingUtils] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[encoding] operator[=] identifier[encodingUtils] operator[SEP] identifier[getEncodingFromLocale] operator[SEP] Keyword[this] operator[SEP] identifier[locale] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[==] Keyword[this] operator[SEP] identifier[encoding] operator[SEP] {
Keyword[this] operator[SEP] identifier[encoding] operator[=] identifier[encodingUtils] operator[SEP] identifier[getDefaultEncoding] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] Keyword[this] operator[SEP] identifier[encoding] operator[SEP]
}
|
private static int asInteger(final long[] data, final int n) {
int t;
int cnt = 0;
long seed = 0;
if (n < 2) {
throw new SketchesArgumentException("Given value of n must be > 1.");
}
if (n > (1 << 30)) {
while (++cnt < 10000) {
final long[] h = MurmurHash3.hash(data, seed);
t = (int) (h[0] & INT_MASK);
if (t < n) {
return t;
}
t = (int) ((h[0] >>> 33));
if (t < n) {
return t;
}
t = (int) (h[1] & INT_MASK);
if (t < n) {
return t;
}
t = (int) ((h[1] >>> 33));
if (t < n) {
return t;
}
seed += PRIME;
} // end while
throw new SketchesStateException(
"Internal Error: Failed to find integer < n within 10000 iterations.");
}
final long mask = ceilingPowerOf2(n) - 1;
while (++cnt < 10000) {
final long[] h = MurmurHash3.hash(data, seed);
t = (int) (h[0] & mask);
if (t < n) {
return t;
}
t = (int) ((h[0] >>> 33) & mask);
if (t < n) {
return t;
}
t = (int) (h[1] & mask);
if (t < n) {
return t;
}
t = (int) ((h[1] >>> 33) & mask);
if (t < n) {
return t;
}
seed += PRIME;
} // end while
throw new SketchesStateException(
"Internal Error: Failed to find integer < n within 10000 iterations.");
} | class class_name[name] begin[{]
method[asInteger, return_type[type[int]], modifier[private static], parameter[data, n]] begin[{]
local_variable[type[int], t]
local_variable[type[int], cnt]
local_variable[type[long], seed]
if[binary_operation[member[.n], <, literal[2]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Given value of n must be > 1.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SketchesArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.n], >, binary_operation[literal[1], <<, literal[30]]]] begin[{]
while[binary_operation[member[.cnt], <, literal[10000]]] begin[{]
local_variable[type[long], h]
assign[member[.t], Cast(expression=BinaryOperation(operandl=MemberReference(member=h, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), operandr=MemberReference(member=INT_MASK, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=&), type=BasicType(dimensions=[], name=int))]
if[binary_operation[member[.t], <, member[.n]]] begin[{]
return[member[.t]]
else begin[{]
None
end[}]
assign[member[.t], Cast(expression=BinaryOperation(operandl=MemberReference(member=h, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=33), operator=>>>), type=BasicType(dimensions=[], name=int))]
if[binary_operation[member[.t], <, member[.n]]] begin[{]
return[member[.t]]
else begin[{]
None
end[}]
assign[member[.t], Cast(expression=BinaryOperation(operandl=MemberReference(member=h, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))]), operandr=MemberReference(member=INT_MASK, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=&), type=BasicType(dimensions=[], name=int))]
if[binary_operation[member[.t], <, member[.n]]] begin[{]
return[member[.t]]
else begin[{]
None
end[}]
assign[member[.t], Cast(expression=BinaryOperation(operandl=MemberReference(member=h, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=33), operator=>>>), type=BasicType(dimensions=[], name=int))]
if[binary_operation[member[.t], <, member[.n]]] begin[{]
return[member[.t]]
else begin[{]
None
end[}]
assign[member[.seed], member[.PRIME]]
end[}]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Internal Error: Failed to find integer < n within 10000 iterations.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SketchesStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[long], mask]
while[binary_operation[member[.cnt], <, literal[10000]]] begin[{]
local_variable[type[long], h]
assign[member[.t], Cast(expression=BinaryOperation(operandl=MemberReference(member=h, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), operandr=MemberReference(member=mask, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=&), type=BasicType(dimensions=[], name=int))]
if[binary_operation[member[.t], <, member[.n]]] begin[{]
return[member[.t]]
else begin[{]
None
end[}]
assign[member[.t], Cast(expression=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=h, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=33), operator=>>>), operandr=MemberReference(member=mask, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=&), type=BasicType(dimensions=[], name=int))]
if[binary_operation[member[.t], <, member[.n]]] begin[{]
return[member[.t]]
else begin[{]
None
end[}]
assign[member[.t], Cast(expression=BinaryOperation(operandl=MemberReference(member=h, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))]), operandr=MemberReference(member=mask, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=&), type=BasicType(dimensions=[], name=int))]
if[binary_operation[member[.t], <, member[.n]]] begin[{]
return[member[.t]]
else begin[{]
None
end[}]
assign[member[.t], Cast(expression=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=h, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=33), operator=>>>), operandr=MemberReference(member=mask, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=&), type=BasicType(dimensions=[], name=int))]
if[binary_operation[member[.t], <, member[.n]]] begin[{]
return[member[.t]]
else begin[{]
None
end[}]
assign[member[.seed], member[.PRIME]]
end[}]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Internal Error: Failed to find integer < n within 10000 iterations.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SketchesStateException, sub_type=None)), label=None)
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[int] identifier[asInteger] operator[SEP] Keyword[final] Keyword[long] operator[SEP] operator[SEP] identifier[data] , Keyword[final] Keyword[int] identifier[n] operator[SEP] {
Keyword[int] identifier[t] operator[SEP] Keyword[int] identifier[cnt] operator[=] Other[0] operator[SEP] Keyword[long] identifier[seed] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[n] operator[<] Other[2] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SketchesArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[n] operator[>] operator[SEP] Other[1] operator[<<] Other[30] operator[SEP] operator[SEP] {
Keyword[while] operator[SEP] operator[++] identifier[cnt] operator[<] Other[10000] operator[SEP] {
Keyword[final] Keyword[long] operator[SEP] operator[SEP] identifier[h] operator[=] identifier[MurmurHash3] operator[SEP] identifier[hash] operator[SEP] identifier[data] , identifier[seed] operator[SEP] operator[SEP] identifier[t] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[h] operator[SEP] Other[0] operator[SEP] operator[&] identifier[INT_MASK] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[t] operator[<] identifier[n] operator[SEP] {
Keyword[return] identifier[t] operator[SEP]
}
identifier[t] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] operator[SEP] identifier[h] operator[SEP] Other[0] operator[SEP] operator[>] operator[>] operator[>] Other[33] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[t] operator[<] identifier[n] operator[SEP] {
Keyword[return] identifier[t] operator[SEP]
}
identifier[t] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[h] operator[SEP] Other[1] operator[SEP] operator[&] identifier[INT_MASK] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[t] operator[<] identifier[n] operator[SEP] {
Keyword[return] identifier[t] operator[SEP]
}
identifier[t] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] operator[SEP] identifier[h] operator[SEP] Other[1] operator[SEP] operator[>] operator[>] operator[>] Other[33] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[t] operator[<] identifier[n] operator[SEP] {
Keyword[return] identifier[t] operator[SEP]
}
identifier[seed] operator[+=] identifier[PRIME] operator[SEP]
}
Keyword[throw] Keyword[new] identifier[SketchesStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[final] Keyword[long] identifier[mask] operator[=] identifier[ceilingPowerOf2] operator[SEP] identifier[n] operator[SEP] operator[-] Other[1] operator[SEP] Keyword[while] operator[SEP] operator[++] identifier[cnt] operator[<] Other[10000] operator[SEP] {
Keyword[final] Keyword[long] operator[SEP] operator[SEP] identifier[h] operator[=] identifier[MurmurHash3] operator[SEP] identifier[hash] operator[SEP] identifier[data] , identifier[seed] operator[SEP] operator[SEP] identifier[t] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[h] operator[SEP] Other[0] operator[SEP] operator[&] identifier[mask] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[t] operator[<] identifier[n] operator[SEP] {
Keyword[return] identifier[t] operator[SEP]
}
identifier[t] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] operator[SEP] identifier[h] operator[SEP] Other[0] operator[SEP] operator[>] operator[>] operator[>] Other[33] operator[SEP] operator[&] identifier[mask] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[t] operator[<] identifier[n] operator[SEP] {
Keyword[return] identifier[t] operator[SEP]
}
identifier[t] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[h] operator[SEP] Other[1] operator[SEP] operator[&] identifier[mask] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[t] operator[<] identifier[n] operator[SEP] {
Keyword[return] identifier[t] operator[SEP]
}
identifier[t] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] operator[SEP] identifier[h] operator[SEP] Other[1] operator[SEP] operator[>] operator[>] operator[>] Other[33] operator[SEP] operator[&] identifier[mask] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[t] operator[<] identifier[n] operator[SEP] {
Keyword[return] identifier[t] operator[SEP]
}
identifier[seed] operator[+=] identifier[PRIME] operator[SEP]
}
Keyword[throw] Keyword[new] identifier[SketchesStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
private static GeoPackageConnection connect(File file) {
String databaseUrl = "jdbc:sqlite:" + file.getPath();
// load the sqlite-JDBC driver using the current class loader
try {
Class.forName("org.sqlite.JDBC");
} catch (ClassNotFoundException e) {
throw new GeoPackageException(
"Failed to load the SQLite JDBC driver", e);
}
// create a database connection
Connection databaseConnection;
try {
databaseConnection = DriverManager.getConnection(databaseUrl);
} catch (SQLException e) {
throw new GeoPackageException(
"Failed to get connection to the SQLite file: "
+ file.getAbsolutePath(), e);
}
ConnectionSource connectionSource;
try {
connectionSource = new JdbcConnectionSource(databaseUrl);
} catch (SQLException e) {
throw new GeoPackageException(
"Failed to get connection source to the SQLite file: "
+ file.getAbsolutePath(), e);
}
// Create the GeoPackage Connection and table creator
GeoPackageConnection connection = new GeoPackageConnection(file,
databaseConnection, connectionSource);
return connection;
} | class class_name[name] begin[{]
method[connect, return_type[type[GeoPackageConnection]], modifier[private static], parameter[file]] begin[{]
local_variable[type[String], databaseUrl]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="org.sqlite.JDBC")], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Class, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to load the SQLite JDBC driver"), 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=GeoPackageException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ClassNotFoundException']))], finally_block=None, label=None, resources=None)
local_variable[type[Connection], databaseConnection]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=databaseConnection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=databaseUrl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getConnection, postfix_operators=[], prefix_operators=[], qualifier=DriverManager, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to get connection to the SQLite file: "), operandr=MethodInvocation(arguments=[], member=getAbsolutePath, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[], type_arguments=None), 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=GeoPackageException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SQLException']))], finally_block=None, label=None, resources=None)
local_variable[type[ConnectionSource], connectionSource]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=connectionSource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=databaseUrl, 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=JdbcConnectionSource, sub_type=None))), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to get connection source to the SQLite file: "), operandr=MethodInvocation(arguments=[], member=getAbsolutePath, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[], type_arguments=None), 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=GeoPackageException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SQLException']))], finally_block=None, label=None, resources=None)
local_variable[type[GeoPackageConnection], connection]
return[member[.connection]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[GeoPackageConnection] identifier[connect] operator[SEP] identifier[File] identifier[file] operator[SEP] {
identifier[String] identifier[databaseUrl] operator[=] literal[String] operator[+] identifier[file] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[Class] operator[SEP] identifier[forName] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ClassNotFoundException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[GeoPackageException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
identifier[Connection] identifier[databaseConnection] operator[SEP] Keyword[try] {
identifier[databaseConnection] operator[=] identifier[DriverManager] operator[SEP] identifier[getConnection] operator[SEP] identifier[databaseUrl] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[SQLException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[GeoPackageException] operator[SEP] literal[String] operator[+] identifier[file] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
identifier[ConnectionSource] identifier[connectionSource] operator[SEP] Keyword[try] {
identifier[connectionSource] operator[=] Keyword[new] identifier[JdbcConnectionSource] operator[SEP] identifier[databaseUrl] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[SQLException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[GeoPackageException] operator[SEP] literal[String] operator[+] identifier[file] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
identifier[GeoPackageConnection] identifier[connection] operator[=] Keyword[new] identifier[GeoPackageConnection] operator[SEP] identifier[file] , identifier[databaseConnection] , identifier[connectionSource] operator[SEP] operator[SEP] Keyword[return] identifier[connection] operator[SEP]
}
|
String readField() throws IOException {
int c;
while (true) {
c = reader.read();
if (c == -1) {
return "";
} else if (!Character.isWhitespace(c)) {
reader.unread(c);
break;
} else if (c == '\n') {
reader.unread(c);
return "";
}
}
if (c == QUOTE_CHAR) {
return readEscaped();
} else {
return readNonEscaped();
}
} | class class_name[name] begin[{]
method[readField, return_type[type[String]], modifier[default], parameter[]] begin[{]
local_variable[type[int], c]
while[literal[true]] begin[{]
assign[member[.c], call[reader.read, parameter[]]]
if[binary_operation[member[.c], ==, literal[1]]] begin[{]
return[literal[""]]
else begin[{]
if[call[Character.isWhitespace, parameter[member[.c]]]] begin[{]
call[reader.unread, parameter[member[.c]]]
BreakStatement(goto=None, label=None)
else begin[{]
if[binary_operation[member[.c], ==, literal['\n']]] begin[{]
call[reader.unread, parameter[member[.c]]]
return[literal[""]]
else begin[{]
None
end[}]
end[}]
end[}]
end[}]
if[binary_operation[member[.c], ==, member[.QUOTE_CHAR]]] begin[{]
return[call[.readEscaped, parameter[]]]
else begin[{]
return[call[.readNonEscaped, parameter[]]]
end[}]
end[}]
END[}] | identifier[String] identifier[readField] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[int] identifier[c] operator[SEP] Keyword[while] operator[SEP] literal[boolean] operator[SEP] {
identifier[c] operator[=] identifier[reader] operator[SEP] identifier[read] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[c] operator[==] operator[-] Other[1] operator[SEP] {
Keyword[return] literal[String] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] operator[!] identifier[Character] operator[SEP] identifier[isWhitespace] operator[SEP] identifier[c] operator[SEP] operator[SEP] {
identifier[reader] operator[SEP] identifier[unread] operator[SEP] identifier[c] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[c] operator[==] literal[String] operator[SEP] {
identifier[reader] operator[SEP] identifier[unread] operator[SEP] identifier[c] operator[SEP] operator[SEP] Keyword[return] literal[String] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[c] operator[==] identifier[QUOTE_CHAR] operator[SEP] {
Keyword[return] identifier[readEscaped] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[readNonEscaped] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public void setCrumbRequestField(String requestField) {
if (Util.fixEmptyAndTrim(requestField) == null) {
crumbRequestField = CrumbIssuer.DEFAULT_CRUMB_NAME;
} else {
crumbRequestField = requestField;
}
} | class class_name[name] begin[{]
method[setCrumbRequestField, return_type[void], modifier[public], parameter[requestField]] begin[{]
if[binary_operation[call[Util.fixEmptyAndTrim, parameter[member[.requestField]]], ==, literal[null]]] begin[{]
assign[member[.crumbRequestField], member[CrumbIssuer.DEFAULT_CRUMB_NAME]]
else begin[{]
assign[member[.crumbRequestField], member[.requestField]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setCrumbRequestField] operator[SEP] identifier[String] identifier[requestField] operator[SEP] {
Keyword[if] operator[SEP] identifier[Util] operator[SEP] identifier[fixEmptyAndTrim] operator[SEP] identifier[requestField] operator[SEP] operator[==] Other[null] operator[SEP] {
identifier[crumbRequestField] operator[=] identifier[CrumbIssuer] operator[SEP] identifier[DEFAULT_CRUMB_NAME] operator[SEP]
}
Keyword[else] {
identifier[crumbRequestField] operator[=] identifier[requestField] operator[SEP]
}
}
|
public static int numChunksForMessage(NDArrayMessage message, int chunkSize) {
int sizeOfMessage = NDArrayMessage.byteBufferSizeForMessage(message);
int numMessages = sizeOfMessage / chunkSize;
//increase by 1 for padding
if (numMessages * chunkSize < sizeOfMessage)
numMessages++;
return numMessages;
} | class class_name[name] begin[{]
method[numChunksForMessage, return_type[type[int]], modifier[public static], parameter[message, chunkSize]] begin[{]
local_variable[type[int], sizeOfMessage]
local_variable[type[int], numMessages]
if[binary_operation[binary_operation[member[.numMessages], *, member[.chunkSize]], <, member[.sizeOfMessage]]] begin[{]
member[.numMessages]
else begin[{]
None
end[}]
return[member[.numMessages]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[int] identifier[numChunksForMessage] operator[SEP] identifier[NDArrayMessage] identifier[message] , Keyword[int] identifier[chunkSize] operator[SEP] {
Keyword[int] identifier[sizeOfMessage] operator[=] identifier[NDArrayMessage] operator[SEP] identifier[byteBufferSizeForMessage] operator[SEP] identifier[message] operator[SEP] operator[SEP] Keyword[int] identifier[numMessages] operator[=] identifier[sizeOfMessage] operator[/] identifier[chunkSize] operator[SEP] Keyword[if] operator[SEP] identifier[numMessages] operator[*] identifier[chunkSize] operator[<] identifier[sizeOfMessage] operator[SEP] identifier[numMessages] operator[++] operator[SEP] Keyword[return] identifier[numMessages] operator[SEP]
}
|
public UserAttributeType<PortletAppType<T>> getOrCreateUserAttribute()
{
List<Node> nodeList = childNode.get("user-attribute");
if (nodeList != null && nodeList.size() > 0)
{
return new UserAttributeTypeImpl<PortletAppType<T>>(this, "user-attribute", childNode, nodeList.get(0));
}
return createUserAttribute();
} | class class_name[name] begin[{]
method[getOrCreateUserAttribute, return_type[type[UserAttributeType]], 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="user-attribute"), MemberReference(member=childNode, 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=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=PortletAppType, sub_type=None))], dimensions=None, name=UserAttributeTypeImpl, sub_type=None))]
else begin[{]
None
end[}]
return[call[.createUserAttribute, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[UserAttributeType] operator[<] identifier[PortletAppType] operator[<] identifier[T] operator[>] operator[>] identifier[getOrCreateUserAttribute] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[Node] operator[>] identifier[nodeList] operator[=] identifier[childNode] 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[UserAttributeTypeImpl] operator[<] identifier[PortletAppType] operator[<] identifier[T] operator[>] operator[>] operator[SEP] Keyword[this] , literal[String] , identifier[childNode] , identifier[nodeList] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[createUserAttribute] operator[SEP] operator[SEP] operator[SEP]
}
|
public void connect(String eventSourceUrl) throws IOException {
LOG.entering(CLASS_NAME, "connect", eventSourceUrl);
if (stream != null) {
LOG.warning("Reusing the same event source for a differnt URL, please create a new EventSource object");
throw new IllegalArgumentException(
"Reusing the same event source for a differnt URL, please create a new EventSource object");
}
stream = new SseEventStream(eventSourceUrl);
stream.setListener(eventStreamListener);
stream.connect();
} | class class_name[name] begin[{]
method[connect, return_type[void], modifier[public], parameter[eventSourceUrl]] begin[{]
call[LOG.entering, parameter[member[.CLASS_NAME], literal["connect"], member[.eventSourceUrl]]]
if[binary_operation[member[.stream], !=, literal[null]]] begin[{]
call[LOG.warning, parameter[literal["Reusing the same event source for a differnt URL, please create a new EventSource object"]]]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Reusing the same event source for a differnt URL, please create a new EventSource object")], 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[}]
assign[member[.stream], ClassCreator(arguments=[MemberReference(member=eventSourceUrl, 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=SseEventStream, sub_type=None))]
call[stream.setListener, parameter[member[.eventStreamListener]]]
call[stream.connect, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[connect] operator[SEP] identifier[String] identifier[eventSourceUrl] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[LOG] operator[SEP] identifier[entering] operator[SEP] identifier[CLASS_NAME] , literal[String] , identifier[eventSourceUrl] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[stream] operator[!=] Other[null] operator[SEP] {
identifier[LOG] operator[SEP] identifier[warning] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[stream] operator[=] Keyword[new] identifier[SseEventStream] operator[SEP] identifier[eventSourceUrl] operator[SEP] operator[SEP] identifier[stream] operator[SEP] identifier[setListener] operator[SEP] identifier[eventStreamListener] operator[SEP] operator[SEP] identifier[stream] operator[SEP] identifier[connect] operator[SEP] operator[SEP] operator[SEP]
}
|
public String getString(String key, String defaultValue) {
return configuration.getString(key, defaultValue);
} | class class_name[name] begin[{]
method[getString, return_type[type[String]], modifier[public], parameter[key, defaultValue]] begin[{]
return[call[configuration.getString, parameter[member[.key], member[.defaultValue]]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getString] operator[SEP] identifier[String] identifier[key] , identifier[String] identifier[defaultValue] operator[SEP] {
Keyword[return] identifier[configuration] operator[SEP] identifier[getString] operator[SEP] identifier[key] , identifier[defaultValue] operator[SEP] operator[SEP]
}
|
private static void checkMandatoryProperties( final Analyzer analyzer,
final Jar jar,
final String symbolicName )
{
final String importPackage = analyzer.getProperty( Analyzer.IMPORT_PACKAGE );
if( importPackage == null || importPackage.trim().length() == 0 )
{
analyzer.setProperty( Analyzer.IMPORT_PACKAGE, "*;resolution:=optional" );
}
final String exportPackage = analyzer.getProperty( Analyzer.EXPORT_PACKAGE );
if( exportPackage == null || exportPackage.trim().length() == 0 )
{
analyzer.setProperty( Analyzer.EXPORT_PACKAGE, "*" );
}
final String localSymbolicName = analyzer.getProperty( Analyzer.BUNDLE_SYMBOLICNAME, symbolicName );
analyzer.setProperty( Analyzer.BUNDLE_SYMBOLICNAME, generateSymbolicName( localSymbolicName ) );
} | class class_name[name] begin[{]
method[checkMandatoryProperties, return_type[void], modifier[private static], parameter[analyzer, jar, symbolicName]] begin[{]
local_variable[type[String], importPackage]
if[binary_operation[binary_operation[member[.importPackage], ==, literal[null]], ||, binary_operation[call[importPackage.trim, parameter[]], ==, literal[0]]]] begin[{]
call[analyzer.setProperty, parameter[member[Analyzer.IMPORT_PACKAGE], literal["*;resolution:=optional"]]]
else begin[{]
None
end[}]
local_variable[type[String], exportPackage]
if[binary_operation[binary_operation[member[.exportPackage], ==, literal[null]], ||, binary_operation[call[exportPackage.trim, parameter[]], ==, literal[0]]]] begin[{]
call[analyzer.setProperty, parameter[member[Analyzer.EXPORT_PACKAGE], literal["*"]]]
else begin[{]
None
end[}]
local_variable[type[String], localSymbolicName]
call[analyzer.setProperty, parameter[member[Analyzer.BUNDLE_SYMBOLICNAME], call[.generateSymbolicName, parameter[member[.localSymbolicName]]]]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[void] identifier[checkMandatoryProperties] operator[SEP] Keyword[final] identifier[Analyzer] identifier[analyzer] , Keyword[final] identifier[Jar] identifier[jar] , Keyword[final] identifier[String] identifier[symbolicName] operator[SEP] {
Keyword[final] identifier[String] identifier[importPackage] operator[=] identifier[analyzer] operator[SEP] identifier[getProperty] operator[SEP] identifier[Analyzer] operator[SEP] identifier[IMPORT_PACKAGE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[importPackage] operator[==] Other[null] operator[||] identifier[importPackage] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
identifier[analyzer] operator[SEP] identifier[setProperty] operator[SEP] identifier[Analyzer] operator[SEP] identifier[IMPORT_PACKAGE] , literal[String] operator[SEP] operator[SEP]
}
Keyword[final] identifier[String] identifier[exportPackage] operator[=] identifier[analyzer] operator[SEP] identifier[getProperty] operator[SEP] identifier[Analyzer] operator[SEP] identifier[EXPORT_PACKAGE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[exportPackage] operator[==] Other[null] operator[||] identifier[exportPackage] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
identifier[analyzer] operator[SEP] identifier[setProperty] operator[SEP] identifier[Analyzer] operator[SEP] identifier[EXPORT_PACKAGE] , literal[String] operator[SEP] operator[SEP]
}
Keyword[final] identifier[String] identifier[localSymbolicName] operator[=] identifier[analyzer] operator[SEP] identifier[getProperty] operator[SEP] identifier[Analyzer] operator[SEP] identifier[BUNDLE_SYMBOLICNAME] , identifier[symbolicName] operator[SEP] operator[SEP] identifier[analyzer] operator[SEP] identifier[setProperty] operator[SEP] identifier[Analyzer] operator[SEP] identifier[BUNDLE_SYMBOLICNAME] , identifier[generateSymbolicName] operator[SEP] identifier[localSymbolicName] operator[SEP] operator[SEP] operator[SEP]
}
|
public static <U extends Comparable<? super U>> int canonicalCompare(List<? extends U> o1, List<? extends U> o2) {
int siz1 = o1.size(), siz2 = o2.size();
if (siz1 != siz2) {
return siz1 - siz2;
}
return lexCompare(o1, o2);
} | class class_name[name] begin[{]
method[canonicalCompare, return_type[type[int]], modifier[public static], parameter[o1, o2]] begin[{]
local_variable[type[int], siz1]
if[binary_operation[member[.siz1], !=, member[.siz2]]] begin[{]
return[binary_operation[member[.siz1], -, member[.siz2]]]
else begin[{]
None
end[}]
return[call[.lexCompare, parameter[member[.o1], member[.o2]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[U] Keyword[extends] identifier[Comparable] operator[<] operator[?] Keyword[super] identifier[U] operator[>] operator[>] Keyword[int] identifier[canonicalCompare] operator[SEP] identifier[List] operator[<] operator[?] Keyword[extends] identifier[U] operator[>] identifier[o1] , identifier[List] operator[<] operator[?] Keyword[extends] identifier[U] operator[>] identifier[o2] operator[SEP] {
Keyword[int] identifier[siz1] operator[=] identifier[o1] operator[SEP] identifier[size] operator[SEP] operator[SEP] , identifier[siz2] operator[=] identifier[o2] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[siz1] operator[!=] identifier[siz2] operator[SEP] {
Keyword[return] identifier[siz1] operator[-] identifier[siz2] operator[SEP]
}
Keyword[return] identifier[lexCompare] operator[SEP] identifier[o1] , identifier[o2] operator[SEP] operator[SEP]
}
|
public com.google.api.ads.adwords.axis.v201809.cm.PolicyTopicEntryType getPolicyTopicEntryType() {
return policyTopicEntryType;
} | class class_name[name] begin[{]
method[getPolicyTopicEntryType, return_type[type[com]], modifier[public], parameter[]] begin[{]
return[member[.policyTopicEntryType]]
end[}]
END[}] | Keyword[public] identifier[com] operator[SEP] identifier[google] operator[SEP] identifier[api] operator[SEP] identifier[ads] operator[SEP] identifier[adwords] operator[SEP] identifier[axis] operator[SEP] identifier[v201809] operator[SEP] identifier[cm] operator[SEP] identifier[PolicyTopicEntryType] identifier[getPolicyTopicEntryType] operator[SEP] operator[SEP] {
Keyword[return] identifier[policyTopicEntryType] operator[SEP]
}
|
void draw(Canvas canvas) {
updateRadius();
drawRipple(canvas);
ViewInvalidator invalidator = getActionButton().getInvalidator();
if (isDrawingInProgress()) {
invalidator.requireInvalidation();
LOGGER.trace("Drawing Ripple Effect in progress, invalidating the Action Button");
} else if (isDrawingFinished() && !isPressed()) {
invalidator.requireDelayedInvalidation();
invalidator.setInvalidationDelay(POST_INVALIDATION_DELAY_MS);
LOGGER.trace("Completed Ripple Effect drawing, posting the last invalidate");
}
} | class class_name[name] begin[{]
method[draw, return_type[void], modifier[default], parameter[canvas]] begin[{]
call[.updateRadius, parameter[]]
call[.drawRipple, parameter[member[.canvas]]]
local_variable[type[ViewInvalidator], invalidator]
if[call[.isDrawingInProgress, parameter[]]] begin[{]
call[invalidator.requireInvalidation, parameter[]]
call[LOGGER.trace, parameter[literal["Drawing Ripple Effect in progress, invalidating the Action Button"]]]
else begin[{]
if[binary_operation[call[.isDrawingFinished, parameter[]], &&, call[.isPressed, parameter[]]]] begin[{]
call[invalidator.requireDelayedInvalidation, parameter[]]
call[invalidator.setInvalidationDelay, parameter[member[.POST_INVALIDATION_DELAY_MS]]]
call[LOGGER.trace, parameter[literal["Completed Ripple Effect drawing, posting the last invalidate"]]]
else begin[{]
None
end[}]
end[}]
end[}]
END[}] | Keyword[void] identifier[draw] operator[SEP] identifier[Canvas] identifier[canvas] operator[SEP] {
identifier[updateRadius] operator[SEP] operator[SEP] operator[SEP] identifier[drawRipple] operator[SEP] identifier[canvas] operator[SEP] operator[SEP] identifier[ViewInvalidator] identifier[invalidator] operator[=] identifier[getActionButton] operator[SEP] operator[SEP] operator[SEP] identifier[getInvalidator] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isDrawingInProgress] operator[SEP] operator[SEP] operator[SEP] {
identifier[invalidator] operator[SEP] identifier[requireInvalidation] operator[SEP] operator[SEP] operator[SEP] identifier[LOGGER] operator[SEP] identifier[trace] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[isDrawingFinished] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[isPressed] operator[SEP] operator[SEP] operator[SEP] {
identifier[invalidator] operator[SEP] identifier[requireDelayedInvalidation] operator[SEP] operator[SEP] operator[SEP] identifier[invalidator] operator[SEP] identifier[setInvalidationDelay] operator[SEP] identifier[POST_INVALIDATION_DELAY_MS] operator[SEP] operator[SEP] identifier[LOGGER] operator[SEP] identifier[trace] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
|
public static <L, R> Tuple<L, R> newTuple (L left, R right)
{
return new Tuple<L, R>(left, right);
} | class class_name[name] begin[{]
method[newTuple, return_type[type[Tuple]], modifier[public static], parameter[left, right]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=left, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=right, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], 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=L, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=R, sub_type=None))], dimensions=None, name=Tuple, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[L] , identifier[R] operator[>] identifier[Tuple] operator[<] identifier[L] , identifier[R] operator[>] identifier[newTuple] operator[SEP] identifier[L] identifier[left] , identifier[R] identifier[right] operator[SEP] {
Keyword[return] Keyword[new] identifier[Tuple] operator[<] identifier[L] , identifier[R] operator[>] operator[SEP] identifier[left] , identifier[right] operator[SEP] operator[SEP]
}
|
public static Request create(HttpMethod httpMethod,
String url,
Map<String, Collection<String>> headers,
Body body) {
return new Request(httpMethod, url, headers, body);
} | class class_name[name] begin[{]
method[create, return_type[type[Request]], modifier[public static], parameter[httpMethod, url, headers, body]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=httpMethod, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=url, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=headers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=body, 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=Request, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Request] identifier[create] operator[SEP] identifier[HttpMethod] identifier[httpMethod] , identifier[String] identifier[url] , identifier[Map] operator[<] identifier[String] , identifier[Collection] operator[<] identifier[String] operator[>] operator[>] identifier[headers] , identifier[Body] identifier[body] operator[SEP] {
Keyword[return] Keyword[new] identifier[Request] operator[SEP] identifier[httpMethod] , identifier[url] , identifier[headers] , identifier[body] operator[SEP] operator[SEP]
}
|
public void marshall(NotebookInstanceSummary notebookInstanceSummary, ProtocolMarshaller protocolMarshaller) {
if (notebookInstanceSummary == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(notebookInstanceSummary.getNotebookInstanceName(), NOTEBOOKINSTANCENAME_BINDING);
protocolMarshaller.marshall(notebookInstanceSummary.getNotebookInstanceArn(), NOTEBOOKINSTANCEARN_BINDING);
protocolMarshaller.marshall(notebookInstanceSummary.getNotebookInstanceStatus(), NOTEBOOKINSTANCESTATUS_BINDING);
protocolMarshaller.marshall(notebookInstanceSummary.getUrl(), URL_BINDING);
protocolMarshaller.marshall(notebookInstanceSummary.getInstanceType(), INSTANCETYPE_BINDING);
protocolMarshaller.marshall(notebookInstanceSummary.getCreationTime(), CREATIONTIME_BINDING);
protocolMarshaller.marshall(notebookInstanceSummary.getLastModifiedTime(), LASTMODIFIEDTIME_BINDING);
protocolMarshaller.marshall(notebookInstanceSummary.getNotebookInstanceLifecycleConfigName(), NOTEBOOKINSTANCELIFECYCLECONFIGNAME_BINDING);
protocolMarshaller.marshall(notebookInstanceSummary.getDefaultCodeRepository(), DEFAULTCODEREPOSITORY_BINDING);
protocolMarshaller.marshall(notebookInstanceSummary.getAdditionalCodeRepositories(), ADDITIONALCODEREPOSITORIES_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} | class class_name[name] begin[{]
method[marshall, return_type[void], modifier[public], parameter[notebookInstanceSummary, protocolMarshaller]] begin[{]
if[binary_operation[member[.notebookInstanceSummary], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid argument passed to marshall(...)")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getNotebookInstanceName, postfix_operators=[], prefix_operators=[], qualifier=notebookInstanceSummary, selectors=[], type_arguments=None), MemberReference(member=NOTEBOOKINSTANCENAME_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getNotebookInstanceArn, postfix_operators=[], prefix_operators=[], qualifier=notebookInstanceSummary, selectors=[], type_arguments=None), MemberReference(member=NOTEBOOKINSTANCEARN_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getNotebookInstanceStatus, postfix_operators=[], prefix_operators=[], qualifier=notebookInstanceSummary, selectors=[], type_arguments=None), MemberReference(member=NOTEBOOKINSTANCESTATUS_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getUrl, postfix_operators=[], prefix_operators=[], qualifier=notebookInstanceSummary, selectors=[], type_arguments=None), MemberReference(member=URL_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getInstanceType, postfix_operators=[], prefix_operators=[], qualifier=notebookInstanceSummary, selectors=[], type_arguments=None), MemberReference(member=INSTANCETYPE_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getCreationTime, postfix_operators=[], prefix_operators=[], qualifier=notebookInstanceSummary, selectors=[], type_arguments=None), MemberReference(member=CREATIONTIME_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getLastModifiedTime, postfix_operators=[], prefix_operators=[], qualifier=notebookInstanceSummary, selectors=[], type_arguments=None), MemberReference(member=LASTMODIFIEDTIME_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getNotebookInstanceLifecycleConfigName, postfix_operators=[], prefix_operators=[], qualifier=notebookInstanceSummary, selectors=[], type_arguments=None), MemberReference(member=NOTEBOOKINSTANCELIFECYCLECONFIGNAME_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getDefaultCodeRepository, postfix_operators=[], prefix_operators=[], qualifier=notebookInstanceSummary, selectors=[], type_arguments=None), MemberReference(member=DEFAULTCODEREPOSITORY_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getAdditionalCodeRepositories, postfix_operators=[], prefix_operators=[], qualifier=notebookInstanceSummary, selectors=[], type_arguments=None), MemberReference(member=ADDITIONALCODEREPOSITORIES_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to marshall request to JSON: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), 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=SdkClientException, sub_type=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[public] Keyword[void] identifier[marshall] operator[SEP] identifier[NotebookInstanceSummary] identifier[notebookInstanceSummary] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[notebookInstanceSummary] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[notebookInstanceSummary] operator[SEP] identifier[getNotebookInstanceName] operator[SEP] operator[SEP] , identifier[NOTEBOOKINSTANCENAME_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[notebookInstanceSummary] operator[SEP] identifier[getNotebookInstanceArn] operator[SEP] operator[SEP] , identifier[NOTEBOOKINSTANCEARN_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[notebookInstanceSummary] operator[SEP] identifier[getNotebookInstanceStatus] operator[SEP] operator[SEP] , identifier[NOTEBOOKINSTANCESTATUS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[notebookInstanceSummary] operator[SEP] identifier[getUrl] operator[SEP] operator[SEP] , identifier[URL_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[notebookInstanceSummary] operator[SEP] identifier[getInstanceType] operator[SEP] operator[SEP] , identifier[INSTANCETYPE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[notebookInstanceSummary] operator[SEP] identifier[getCreationTime] operator[SEP] operator[SEP] , identifier[CREATIONTIME_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[notebookInstanceSummary] operator[SEP] identifier[getLastModifiedTime] operator[SEP] operator[SEP] , identifier[LASTMODIFIEDTIME_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[notebookInstanceSummary] operator[SEP] identifier[getNotebookInstanceLifecycleConfigName] operator[SEP] operator[SEP] , identifier[NOTEBOOKINSTANCELIFECYCLECONFIGNAME_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[notebookInstanceSummary] operator[SEP] identifier[getDefaultCodeRepository] operator[SEP] operator[SEP] , identifier[DEFAULTCODEREPOSITORY_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[notebookInstanceSummary] operator[SEP] identifier[getAdditionalCodeRepositories] operator[SEP] operator[SEP] , identifier[ADDITIONALCODEREPOSITORIES_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public EClass getIfcVirtualGridIntersection() {
if (ifcVirtualGridIntersectionEClass == null) {
ifcVirtualGridIntersectionEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(639);
}
return ifcVirtualGridIntersectionEClass;
} | class class_name[name] begin[{]
method[getIfcVirtualGridIntersection, return_type[type[EClass]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.ifcVirtualGridIntersectionEClass], ==, literal[null]]] begin[{]
assign[member[.ifcVirtualGridIntersectionEClass], 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=639)], 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[.ifcVirtualGridIntersectionEClass]]
end[}]
END[}] | Keyword[public] identifier[EClass] identifier[getIfcVirtualGridIntersection] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[ifcVirtualGridIntersectionEClass] operator[==] Other[null] operator[SEP] {
identifier[ifcVirtualGridIntersectionEClass] 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[639] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ifcVirtualGridIntersectionEClass] operator[SEP]
}
|
protected MaterialHelpBlock findHelpBlock(Widget widget) {
if (widget != null) {
if (widget instanceof MaterialHelpBlock) {
return (MaterialHelpBlock) widget;
}
// Try and find the MaterialHelpBlock in the children of the given widget.
if (widget instanceof HasWidgets) {
for (Widget w : (HasWidgets) widget) {
if (w instanceof MaterialHelpBlock) {
return (MaterialHelpBlock) w;
}
}
}
// Try and find the MaterialHelpBlock in the parent of widget.
return findHelpBlock(widget.getParent());
}
return null;
} | class class_name[name] begin[{]
method[findHelpBlock, return_type[type[MaterialHelpBlock]], modifier[protected], parameter[widget]] begin[{]
if[binary_operation[member[.widget], !=, literal[null]]] begin[{]
if[binary_operation[member[.widget], instanceof, type[MaterialHelpBlock]]] begin[{]
return[Cast(expression=MemberReference(member=widget, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=MaterialHelpBlock, sub_type=None))]
else begin[{]
None
end[}]
if[binary_operation[member[.widget], instanceof, type[HasWidgets]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=w, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=MaterialHelpBlock, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Cast(expression=MemberReference(member=w, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=MaterialHelpBlock, sub_type=None)), label=None)]))]), control=EnhancedForControl(iterable=Cast(expression=MemberReference(member=widget, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=HasWidgets, sub_type=None)), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=w)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Widget, sub_type=None))), label=None)
else begin[{]
None
end[}]
return[call[.findHelpBlock, parameter[call[widget.getParent, parameter[]]]]]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[protected] identifier[MaterialHelpBlock] identifier[findHelpBlock] operator[SEP] identifier[Widget] identifier[widget] operator[SEP] {
Keyword[if] operator[SEP] identifier[widget] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[widget] Keyword[instanceof] identifier[MaterialHelpBlock] operator[SEP] {
Keyword[return] operator[SEP] identifier[MaterialHelpBlock] operator[SEP] identifier[widget] operator[SEP]
}
Keyword[if] operator[SEP] identifier[widget] Keyword[instanceof] identifier[HasWidgets] operator[SEP] {
Keyword[for] operator[SEP] identifier[Widget] identifier[w] operator[:] operator[SEP] identifier[HasWidgets] operator[SEP] identifier[widget] operator[SEP] {
Keyword[if] operator[SEP] identifier[w] Keyword[instanceof] identifier[MaterialHelpBlock] operator[SEP] {
Keyword[return] operator[SEP] identifier[MaterialHelpBlock] operator[SEP] identifier[w] operator[SEP]
}
}
}
Keyword[return] identifier[findHelpBlock] operator[SEP] identifier[widget] operator[SEP] identifier[getParent] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
public void marshall(IdentityDescription identityDescription, ProtocolMarshaller protocolMarshaller) {
if (identityDescription == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(identityDescription.getIdentityId(), IDENTITYID_BINDING);
protocolMarshaller.marshall(identityDescription.getLogins(), LOGINS_BINDING);
protocolMarshaller.marshall(identityDescription.getCreationDate(), CREATIONDATE_BINDING);
protocolMarshaller.marshall(identityDescription.getLastModifiedDate(), LASTMODIFIEDDATE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} | class class_name[name] begin[{]
method[marshall, return_type[void], modifier[public], parameter[identityDescription, protocolMarshaller]] begin[{]
if[binary_operation[member[.identityDescription], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid argument passed to marshall(...)")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getIdentityId, postfix_operators=[], prefix_operators=[], qualifier=identityDescription, selectors=[], type_arguments=None), MemberReference(member=IDENTITYID_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getLogins, postfix_operators=[], prefix_operators=[], qualifier=identityDescription, selectors=[], type_arguments=None), MemberReference(member=LOGINS_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getCreationDate, postfix_operators=[], prefix_operators=[], qualifier=identityDescription, selectors=[], type_arguments=None), MemberReference(member=CREATIONDATE_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getLastModifiedDate, postfix_operators=[], prefix_operators=[], qualifier=identityDescription, selectors=[], type_arguments=None), MemberReference(member=LASTMODIFIEDDATE_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to marshall request to JSON: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), 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=SdkClientException, sub_type=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[public] Keyword[void] identifier[marshall] operator[SEP] identifier[IdentityDescription] identifier[identityDescription] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[identityDescription] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[identityDescription] operator[SEP] identifier[getIdentityId] operator[SEP] operator[SEP] , identifier[IDENTITYID_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[identityDescription] operator[SEP] identifier[getLogins] operator[SEP] operator[SEP] , identifier[LOGINS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[identityDescription] operator[SEP] identifier[getCreationDate] operator[SEP] operator[SEP] , identifier[CREATIONDATE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[identityDescription] operator[SEP] identifier[getLastModifiedDate] operator[SEP] operator[SEP] , identifier[LASTMODIFIEDDATE_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public static <T extends File> T createFile(final SecurityContext securityContext, final InputStream fileStream, final Class<T> fileType, final PropertyMap props)
throws FrameworkException, IOException {
T newFile = (T) StructrApp.getInstance(securityContext).create(fileType, props);
setFileData(newFile, fileStream, props.get(StructrApp.key(File.class, "contentType")));
// schedule indexing
newFile.notifyUploadCompletion();
return newFile;
} | class class_name[name] begin[{]
method[createFile, return_type[type[T]], modifier[public static], parameter[securityContext, fileStream, fileType, props]] begin[{]
local_variable[type[T], newFile]
call[.setFileData, parameter[member[.newFile], member[.fileStream], call[props.get, parameter[call[StructrApp.key, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=File, sub_type=None)), literal["contentType"]]]]]]]
call[newFile.notifyUploadCompletion, parameter[]]
return[member[.newFile]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] Keyword[extends] identifier[File] operator[>] identifier[T] identifier[createFile] operator[SEP] Keyword[final] identifier[SecurityContext] identifier[securityContext] , Keyword[final] identifier[InputStream] identifier[fileStream] , Keyword[final] identifier[Class] operator[<] identifier[T] operator[>] identifier[fileType] , Keyword[final] identifier[PropertyMap] identifier[props] operator[SEP] Keyword[throws] identifier[FrameworkException] , identifier[IOException] {
identifier[T] identifier[newFile] operator[=] operator[SEP] identifier[T] operator[SEP] identifier[StructrApp] operator[SEP] identifier[getInstance] operator[SEP] identifier[securityContext] operator[SEP] operator[SEP] identifier[create] operator[SEP] identifier[fileType] , identifier[props] operator[SEP] operator[SEP] identifier[setFileData] operator[SEP] identifier[newFile] , identifier[fileStream] , identifier[props] operator[SEP] identifier[get] operator[SEP] identifier[StructrApp] operator[SEP] identifier[key] operator[SEP] identifier[File] operator[SEP] Keyword[class] , literal[String] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[newFile] operator[SEP] identifier[notifyUploadCompletion] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[newFile] operator[SEP]
}
|
public TypeName unbox() {
if (keyword != null) return this; // Already unboxed.
if (this.equals(BOXED_VOID)) return VOID;
if (this.equals(BOXED_BOOLEAN)) return BOOLEAN;
if (this.equals(BOXED_BYTE)) return BYTE;
if (this.equals(BOXED_SHORT)) return SHORT;
if (this.equals(BOXED_INT)) return INT;
if (this.equals(BOXED_LONG)) return LONG;
if (this.equals(BOXED_CHAR)) return CHAR;
if (this.equals(BOXED_FLOAT)) return FLOAT;
if (this.equals(BOXED_DOUBLE)) return DOUBLE;
throw new UnsupportedOperationException("cannot unbox " + this);
} | class class_name[name] begin[{]
method[unbox, return_type[type[TypeName]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.keyword], !=, literal[null]]] begin[{]
return[THIS[]]
else begin[{]
None
end[}]
if[THIS[call[None.equals, parameter[member[.BOXED_VOID]]]]] begin[{]
return[member[.VOID]]
else begin[{]
None
end[}]
if[THIS[call[None.equals, parameter[member[.BOXED_BOOLEAN]]]]] begin[{]
return[member[.BOOLEAN]]
else begin[{]
None
end[}]
if[THIS[call[None.equals, parameter[member[.BOXED_BYTE]]]]] begin[{]
return[member[.BYTE]]
else begin[{]
None
end[}]
if[THIS[call[None.equals, parameter[member[.BOXED_SHORT]]]]] begin[{]
return[member[.SHORT]]
else begin[{]
None
end[}]
if[THIS[call[None.equals, parameter[member[.BOXED_INT]]]]] begin[{]
return[member[.INT]]
else begin[{]
None
end[}]
if[THIS[call[None.equals, parameter[member[.BOXED_LONG]]]]] begin[{]
return[member[.LONG]]
else begin[{]
None
end[}]
if[THIS[call[None.equals, parameter[member[.BOXED_CHAR]]]]] begin[{]
return[member[.CHAR]]
else begin[{]
None
end[}]
if[THIS[call[None.equals, parameter[member[.BOXED_FLOAT]]]]] begin[{]
return[member[.FLOAT]]
else begin[{]
None
end[}]
if[THIS[call[None.equals, parameter[member[.BOXED_DOUBLE]]]]] begin[{]
return[member[.DOUBLE]]
else begin[{]
None
end[}]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="cannot unbox "), operandr=This(postfix_operators=[], prefix_operators=[], qualifier=None, 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)
end[}]
END[}] | Keyword[public] identifier[TypeName] identifier[unbox] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[keyword] operator[!=] Other[null] operator[SEP] Keyword[return] Keyword[this] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[equals] operator[SEP] identifier[BOXED_VOID] operator[SEP] operator[SEP] Keyword[return] identifier[VOID] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[equals] operator[SEP] identifier[BOXED_BOOLEAN] operator[SEP] operator[SEP] Keyword[return] identifier[BOOLEAN] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[equals] operator[SEP] identifier[BOXED_BYTE] operator[SEP] operator[SEP] Keyword[return] identifier[BYTE] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[equals] operator[SEP] identifier[BOXED_SHORT] operator[SEP] operator[SEP] Keyword[return] identifier[SHORT] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[equals] operator[SEP] identifier[BOXED_INT] operator[SEP] operator[SEP] Keyword[return] identifier[INT] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[equals] operator[SEP] identifier[BOXED_LONG] operator[SEP] operator[SEP] Keyword[return] identifier[LONG] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[equals] operator[SEP] identifier[BOXED_CHAR] operator[SEP] operator[SEP] Keyword[return] identifier[CHAR] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[equals] operator[SEP] identifier[BOXED_FLOAT] operator[SEP] operator[SEP] Keyword[return] identifier[FLOAT] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[equals] operator[SEP] identifier[BOXED_DOUBLE] operator[SEP] operator[SEP] Keyword[return] identifier[DOUBLE] operator[SEP] Keyword[throw] Keyword[new] identifier[UnsupportedOperationException] operator[SEP] literal[String] operator[+] Keyword[this] operator[SEP] operator[SEP]
}
|
private Raster asByteRaster(final Raster raster, ColorModel colorModel) {
switch (raster.getTransferType()) {
case DataBuffer.TYPE_BYTE:
return raster;
case DataBuffer.TYPE_USHORT:
return raster; // TODO: we handle ushort especially for now..
case DataBuffer.TYPE_INT:
final int bands = colorModel.getNumComponents();
final DataBufferInt buffer = (DataBufferInt) raster.getDataBuffer();
int w = raster.getWidth();
int h = raster.getHeight();
int size = buffer.getSize();
return new Raster(
new PixelInterleavedSampleModel(DataBuffer.TYPE_BYTE, w, h, bands, w * bands, createBandOffsets(colorModel)),
new DataBuffer(DataBuffer.TYPE_BYTE, size * bands) {
@Override
public int getElem(int bank, int i) {
int index = i / bands;
int shift = (i % bands) * 8;
return (buffer.getElem(index) >>> shift) & 0xFF;
}
@Override
public void setElem(int bank, int i, int val) {
throw new UnsupportedOperationException("Wrapped buffer is read-only");
}
}, new Point()) {};
default:
throw new IllegalArgumentException(String.format("Raster type %d not supported", raster.getTransferType()));
}
} | class class_name[name] begin[{]
method[asByteRaster, return_type[type[Raster]], modifier[private], parameter[raster, colorModel]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=TYPE_BYTE, postfix_operators=[], prefix_operators=[], qualifier=DataBuffer, selectors=[])], statements=[ReturnStatement(expression=MemberReference(member=raster, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), SwitchStatementCase(case=[MemberReference(member=TYPE_USHORT, postfix_operators=[], prefix_operators=[], qualifier=DataBuffer, selectors=[])], statements=[ReturnStatement(expression=MemberReference(member=raster, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), SwitchStatementCase(case=[MemberReference(member=TYPE_INT, postfix_operators=[], prefix_operators=[], qualifier=DataBuffer, selectors=[])], statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getNumComponents, postfix_operators=[], prefix_operators=[], qualifier=colorModel, selectors=[], type_arguments=None), name=bands)], modifiers={'final'}, type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[], member=getDataBuffer, postfix_operators=[], prefix_operators=[], qualifier=raster, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=DataBufferInt, sub_type=None)), name=buffer)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=DataBufferInt, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getWidth, postfix_operators=[], prefix_operators=[], qualifier=raster, selectors=[], type_arguments=None), name=w)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getHeight, postfix_operators=[], prefix_operators=[], qualifier=raster, selectors=[], type_arguments=None), name=h)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getSize, postfix_operators=[], prefix_operators=[], qualifier=buffer, selectors=[], type_arguments=None), name=size)], modifiers=set(), type=BasicType(dimensions=[], name=int)), ReturnStatement(expression=ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=TYPE_BYTE, postfix_operators=[], prefix_operators=[], qualifier=DataBuffer, selectors=[]), MemberReference(member=w, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=h, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=bands, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=w, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=bands, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), MethodInvocation(arguments=[MemberReference(member=colorModel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createBandOffsets, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PixelInterleavedSampleModel, sub_type=None)), ClassCreator(arguments=[MemberReference(member=TYPE_BYTE, postfix_operators=[], prefix_operators=[], qualifier=DataBuffer, selectors=[]), BinaryOperation(operandl=MemberReference(member=size, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=bands, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*)], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=bands, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=/), name=index)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=bands, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=%), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8), operator=*), name=shift)], modifiers=set(), type=BasicType(dimensions=[], name=int)), ReturnStatement(expression=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getElem, postfix_operators=[], prefix_operators=[], qualifier=buffer, selectors=[], type_arguments=None), operandr=MemberReference(member=shift, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>>>), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xFF), operator=&), label=None)], documentation=None, modifiers={'public'}, name=getElem, parameters=[FormalParameter(annotations=[], modifiers=set(), name=bank, type=BasicType(dimensions=[], name=int), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=i, type=BasicType(dimensions=[], name=int), varargs=False)], return_type=BasicType(dimensions=[], name=int), throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Wrapped buffer is read-only")], 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)], documentation=None, modifiers={'public'}, name=setElem, parameters=[FormalParameter(annotations=[], modifiers=set(), name=bank, type=BasicType(dimensions=[], name=int), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=i, type=BasicType(dimensions=[], name=int), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=val, type=BasicType(dimensions=[], name=int), 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=DataBuffer, sub_type=None)), ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Point, sub_type=None))], body=[], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Raster, sub_type=None)), label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Raster type %d not supported"), MethodInvocation(arguments=[], member=getTransferType, postfix_operators=[], prefix_operators=[], qualifier=raster, selectors=[], type_arguments=None)], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], 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)])], expression=MethodInvocation(arguments=[], member=getTransferType, postfix_operators=[], prefix_operators=[], qualifier=raster, selectors=[], type_arguments=None), label=None)
end[}]
END[}] | Keyword[private] identifier[Raster] identifier[asByteRaster] operator[SEP] Keyword[final] identifier[Raster] identifier[raster] , identifier[ColorModel] identifier[colorModel] operator[SEP] {
Keyword[switch] operator[SEP] identifier[raster] operator[SEP] identifier[getTransferType] operator[SEP] operator[SEP] operator[SEP] {
Keyword[case] identifier[DataBuffer] operator[SEP] identifier[TYPE_BYTE] operator[:] Keyword[return] identifier[raster] operator[SEP] Keyword[case] identifier[DataBuffer] operator[SEP] identifier[TYPE_USHORT] operator[:] Keyword[return] identifier[raster] operator[SEP] Keyword[case] identifier[DataBuffer] operator[SEP] identifier[TYPE_INT] operator[:] Keyword[final] Keyword[int] identifier[bands] operator[=] identifier[colorModel] operator[SEP] identifier[getNumComponents] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[DataBufferInt] identifier[buffer] operator[=] operator[SEP] identifier[DataBufferInt] operator[SEP] identifier[raster] operator[SEP] identifier[getDataBuffer] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[w] operator[=] identifier[raster] operator[SEP] identifier[getWidth] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[h] operator[=] identifier[raster] operator[SEP] identifier[getHeight] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[size] operator[=] identifier[buffer] operator[SEP] identifier[getSize] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[Raster] operator[SEP] Keyword[new] identifier[PixelInterleavedSampleModel] operator[SEP] identifier[DataBuffer] operator[SEP] identifier[TYPE_BYTE] , identifier[w] , identifier[h] , identifier[bands] , identifier[w] operator[*] identifier[bands] , identifier[createBandOffsets] operator[SEP] identifier[colorModel] operator[SEP] operator[SEP] , Keyword[new] identifier[DataBuffer] operator[SEP] identifier[DataBuffer] operator[SEP] identifier[TYPE_BYTE] , identifier[size] operator[*] identifier[bands] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[int] identifier[getElem] operator[SEP] Keyword[int] identifier[bank] , Keyword[int] identifier[i] operator[SEP] {
Keyword[int] identifier[index] operator[=] identifier[i] operator[/] identifier[bands] operator[SEP] Keyword[int] identifier[shift] operator[=] operator[SEP] identifier[i] operator[%] identifier[bands] operator[SEP] operator[*] Other[8] operator[SEP] Keyword[return] operator[SEP] identifier[buffer] operator[SEP] identifier[getElem] operator[SEP] identifier[index] operator[SEP] operator[>] operator[>] operator[>] identifier[shift] operator[SEP] operator[&] literal[Integer] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[setElem] operator[SEP] Keyword[int] identifier[bank] , Keyword[int] identifier[i] , Keyword[int] identifier[val] operator[SEP] {
Keyword[throw] Keyword[new] identifier[UnsupportedOperationException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
} , Keyword[new] identifier[Point] operator[SEP] operator[SEP] operator[SEP] {
} operator[SEP] Keyword[default] operator[:] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[raster] operator[SEP] identifier[getTransferType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@Override
public final void setValue(JsonValue jsonValue) {
try {
this.setValue(convert(jsonValue));
} catch (Exception e) {
logger.error("Error while setting JSON value", e);
}
} | class class_name[name] begin[{]
method[setValue, return_type[void], modifier[final public], parameter[jsonValue]] begin[{]
TryStatement(block=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=jsonValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=convert, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=setValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error while setting JSON value"), 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=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[final] Keyword[void] identifier[setValue] operator[SEP] identifier[JsonValue] identifier[jsonValue] operator[SEP] {
Keyword[try] {
Keyword[this] operator[SEP] identifier[setValue] operator[SEP] identifier[convert] operator[SEP] identifier[jsonValue] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
|
private void appendEntity(OutputStream outputStream,
ByteArrayInputStream byteArrayInputStream) {
try {
byte[] buffer = new byte[BUFFER_SIZE];
while (true) {
int bytesRead = byteArrayInputStream.read(buffer);
if (bytesRead <= 0) {
break;
}
outputStream.write(buffer, 0, bytesRead);
}
} catch (IOException e) {
throw new RuntimeException(e);
}
} | class class_name[name] begin[{]
method[appendEntity, return_type[void], modifier[private], parameter[outputStream, byteArrayInputStream]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ArrayCreator(dimensions=[MemberReference(member=BUFFER_SIZE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=byte)), name=buffer)], modifiers=set(), type=BasicType(dimensions=[None], name=byte)), WhileStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=buffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=read, postfix_operators=[], prefix_operators=[], qualifier=byteArrayInputStream, selectors=[], type_arguments=None), name=bytesRead)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=bytesRead, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=<=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[BreakStatement(goto=None, label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=buffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=bytesRead, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=write, postfix_operators=[], prefix_operators=[], qualifier=outputStream, selectors=[], type_arguments=None), label=None)]), condition=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[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=['IOException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[appendEntity] operator[SEP] identifier[OutputStream] identifier[outputStream] , identifier[ByteArrayInputStream] identifier[byteArrayInputStream] operator[SEP] {
Keyword[try] {
Keyword[byte] operator[SEP] operator[SEP] identifier[buffer] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[BUFFER_SIZE] operator[SEP] operator[SEP] Keyword[while] operator[SEP] literal[boolean] operator[SEP] {
Keyword[int] identifier[bytesRead] operator[=] identifier[byteArrayInputStream] operator[SEP] identifier[read] operator[SEP] identifier[buffer] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bytesRead] operator[<=] Other[0] operator[SEP] {
Keyword[break] operator[SEP]
}
identifier[outputStream] operator[SEP] identifier[write] operator[SEP] identifier[buffer] , Other[0] , identifier[bytesRead] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
public static void main(String[] args) throws Exception {
CommandLineParser parser = new DefaultParser();
Options slaManagerCliOptions = constructCliOptions();
// parse the help options first.
Options helpOptions = constructHelpOptions();
CommandLine cmd = parser.parse(helpOptions, args, true);
if (cmd.hasOption("h")) {
usage(slaManagerCliOptions);
return;
}
try {
cmd = parser.parse(slaManagerCliOptions, args);
} catch (ParseException e) {
usage(slaManagerCliOptions);
throw new RuntimeException("Error parsing command line options: ", e);
}
DownloaderMode mode = DownloaderMode.cluster;
if (cmd.hasOption(CliArgs.MODE.text)) {
mode = DownloaderMode.valueOf(cmd.getOptionValue(CliArgs.MODE.text, null));
}
Config config;
switch (mode) {
case cluster:
config = Config.toClusterMode(Config.newBuilder()
.putAll(ConfigLoader.loadClusterConfig())
.build());
break;
case local:
if (!cmd.hasOption(CliArgs.HERON_HOME.text) || !cmd.hasOption(CliArgs.CONFIG_PATH.text)) {
throw new IllegalArgumentException("Missing heron_home or config_path argument");
}
String heronHome = cmd.getOptionValue(CliArgs.HERON_HOME.text, null);
String configPath = cmd.getOptionValue(CliArgs.CONFIG_PATH.text, null);
config = Config.toLocalMode(Config.newBuilder()
.putAll(ConfigLoader.loadConfig(heronHome, configPath, null, null))
.build());
break;
default:
throw new IllegalArgumentException(
"Invalid mode: " + cmd.getOptionValue(CliArgs.MODE.text));
}
String uri = cmd.getOptionValue(CliArgs.TOPOLOGY_PACKAGE_URI.text, null);
String destination = cmd.getOptionValue(CliArgs.EXTRACT_DESTINATION.text, null);
// make it compatible with old param format
if (uri == null && destination == null) {
String[] leftOverArgs = cmd.getArgs();
if (leftOverArgs.length != 2) {
System.err.println("Usage: downloader <topology-package-uri> <extract-destination>");
return;
}
uri = leftOverArgs[0];
destination = leftOverArgs[1];
}
final URI topologyLocation = new URI(uri);
final Path topologyDestination = Paths.get(destination);
final File file = topologyDestination.toFile();
if (!file.exists()) {
file.mkdirs();
}
Class clazz = Registry.UriToClass(config, topologyLocation);
final Downloader downloader = Registry.getDownloader(clazz, topologyLocation);
downloader.download(topologyLocation, topologyDestination);
} | class class_name[name] begin[{]
method[main, return_type[void], modifier[public static], parameter[args]] begin[{]
local_variable[type[CommandLineParser], parser]
local_variable[type[Options], slaManagerCliOptions]
local_variable[type[Options], helpOptions]
local_variable[type[CommandLine], cmd]
if[call[cmd.hasOption, parameter[literal["h"]]]] begin[{]
call[.usage, parameter[member[.slaManagerCliOptions]]]
return[None]
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=cmd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=slaManagerCliOptions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parse, postfix_operators=[], prefix_operators=[], qualifier=parser, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=slaManagerCliOptions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=usage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error parsing command line options: "), 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=['ParseException']))], finally_block=None, label=None, resources=None)
local_variable[type[DownloaderMode], mode]
if[call[cmd.hasOption, parameter[member[CliArgs.MODE.text]]]] begin[{]
assign[member[.mode], call[DownloaderMode.valueOf, parameter[call[cmd.getOptionValue, parameter[member[CliArgs.MODE.text], literal[null]]]]]]
else begin[{]
None
end[}]
local_variable[type[Config], config]
SwitchStatement(cases=[SwitchStatementCase(case=['cluster'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=config, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=newBuilder, postfix_operators=[], prefix_operators=[], qualifier=Config, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=loadClusterConfig, postfix_operators=[], prefix_operators=[], qualifier=ConfigLoader, selectors=[], type_arguments=None)], member=putAll, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=build, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=toClusterMode, postfix_operators=[], prefix_operators=[], qualifier=Config, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['local'], statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=text, postfix_operators=[], prefix_operators=[], qualifier=CliArgs.HERON_HOME, selectors=[])], member=hasOption, postfix_operators=[], prefix_operators=['!'], qualifier=cmd, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=text, postfix_operators=[], prefix_operators=[], qualifier=CliArgs.CONFIG_PATH, selectors=[])], member=hasOption, postfix_operators=[], prefix_operators=['!'], qualifier=cmd, selectors=[], type_arguments=None), 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="Missing heron_home or config_path argument")], 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)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=text, postfix_operators=[], prefix_operators=[], qualifier=CliArgs.HERON_HOME, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=getOptionValue, postfix_operators=[], prefix_operators=[], qualifier=cmd, selectors=[], type_arguments=None), name=heronHome)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=text, postfix_operators=[], prefix_operators=[], qualifier=CliArgs.CONFIG_PATH, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=getOptionValue, postfix_operators=[], prefix_operators=[], qualifier=cmd, selectors=[], type_arguments=None), name=configPath)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=config, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=newBuilder, postfix_operators=[], prefix_operators=[], qualifier=Config, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=heronHome, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=configPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=loadConfig, postfix_operators=[], prefix_operators=[], qualifier=ConfigLoader, selectors=[], type_arguments=None)], member=putAll, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=build, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=toLocalMode, postfix_operators=[], prefix_operators=[], qualifier=Config, selectors=[], type_arguments=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="Invalid mode: "), operandr=MethodInvocation(arguments=[MemberReference(member=text, postfix_operators=[], prefix_operators=[], qualifier=CliArgs.MODE, selectors=[])], member=getOptionValue, postfix_operators=[], prefix_operators=[], qualifier=cmd, 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=IllegalArgumentException, sub_type=None)), label=None)])], expression=MemberReference(member=mode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
local_variable[type[String], uri]
local_variable[type[String], destination]
if[binary_operation[binary_operation[member[.uri], ==, literal[null]], &&, binary_operation[member[.destination], ==, literal[null]]]] begin[{]
local_variable[type[String], leftOverArgs]
if[binary_operation[member[leftOverArgs.length], !=, literal[2]]] begin[{]
call[System.err.println, parameter[literal["Usage: downloader <topology-package-uri> <extract-destination>"]]]
return[None]
else begin[{]
None
end[}]
assign[member[.uri], member[.leftOverArgs]]
assign[member[.destination], member[.leftOverArgs]]
else begin[{]
None
end[}]
local_variable[type[URI], topologyLocation]
local_variable[type[Path], topologyDestination]
local_variable[type[File], file]
if[call[file.exists, parameter[]]] begin[{]
call[file.mkdirs, parameter[]]
else begin[{]
None
end[}]
local_variable[type[Class], clazz]
local_variable[type[Downloader], downloader]
call[downloader.download, parameter[member[.topologyLocation], member[.topologyDestination]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[main] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[args] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[CommandLineParser] identifier[parser] operator[=] Keyword[new] identifier[DefaultParser] operator[SEP] operator[SEP] operator[SEP] identifier[Options] identifier[slaManagerCliOptions] operator[=] identifier[constructCliOptions] operator[SEP] operator[SEP] operator[SEP] identifier[Options] identifier[helpOptions] operator[=] identifier[constructHelpOptions] operator[SEP] operator[SEP] operator[SEP] identifier[CommandLine] identifier[cmd] operator[=] identifier[parser] operator[SEP] identifier[parse] operator[SEP] identifier[helpOptions] , identifier[args] , literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cmd] operator[SEP] identifier[hasOption] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[usage] operator[SEP] identifier[slaManagerCliOptions] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[try] {
identifier[cmd] operator[=] identifier[parser] operator[SEP] identifier[parse] operator[SEP] identifier[slaManagerCliOptions] , identifier[args] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ParseException] identifier[e] operator[SEP] {
identifier[usage] operator[SEP] identifier[slaManagerCliOptions] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
identifier[DownloaderMode] identifier[mode] operator[=] identifier[DownloaderMode] operator[SEP] identifier[cluster] operator[SEP] Keyword[if] operator[SEP] identifier[cmd] operator[SEP] identifier[hasOption] operator[SEP] identifier[CliArgs] operator[SEP] identifier[MODE] operator[SEP] identifier[text] operator[SEP] operator[SEP] {
identifier[mode] operator[=] identifier[DownloaderMode] operator[SEP] identifier[valueOf] operator[SEP] identifier[cmd] operator[SEP] identifier[getOptionValue] operator[SEP] identifier[CliArgs] operator[SEP] identifier[MODE] operator[SEP] identifier[text] , Other[null] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Config] identifier[config] operator[SEP] Keyword[switch] operator[SEP] identifier[mode] operator[SEP] {
Keyword[case] identifier[cluster] operator[:] identifier[config] operator[=] identifier[Config] operator[SEP] identifier[toClusterMode] operator[SEP] identifier[Config] operator[SEP] identifier[newBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[putAll] operator[SEP] identifier[ConfigLoader] operator[SEP] identifier[loadClusterConfig] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[local] operator[:] Keyword[if] operator[SEP] operator[!] identifier[cmd] operator[SEP] identifier[hasOption] operator[SEP] identifier[CliArgs] operator[SEP] identifier[HERON_HOME] operator[SEP] identifier[text] operator[SEP] operator[||] operator[!] identifier[cmd] operator[SEP] identifier[hasOption] operator[SEP] identifier[CliArgs] operator[SEP] identifier[CONFIG_PATH] operator[SEP] identifier[text] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[String] identifier[heronHome] operator[=] identifier[cmd] operator[SEP] identifier[getOptionValue] operator[SEP] identifier[CliArgs] operator[SEP] identifier[HERON_HOME] operator[SEP] identifier[text] , Other[null] operator[SEP] operator[SEP] identifier[String] identifier[configPath] operator[=] identifier[cmd] operator[SEP] identifier[getOptionValue] operator[SEP] identifier[CliArgs] operator[SEP] identifier[CONFIG_PATH] operator[SEP] identifier[text] , Other[null] operator[SEP] operator[SEP] identifier[config] operator[=] identifier[Config] operator[SEP] identifier[toLocalMode] operator[SEP] identifier[Config] operator[SEP] identifier[newBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[putAll] operator[SEP] identifier[ConfigLoader] operator[SEP] identifier[loadConfig] operator[SEP] identifier[heronHome] , identifier[configPath] , Other[null] , Other[null] operator[SEP] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[cmd] operator[SEP] identifier[getOptionValue] operator[SEP] identifier[CliArgs] operator[SEP] identifier[MODE] operator[SEP] identifier[text] operator[SEP] operator[SEP] operator[SEP]
}
identifier[String] identifier[uri] operator[=] identifier[cmd] operator[SEP] identifier[getOptionValue] operator[SEP] identifier[CliArgs] operator[SEP] identifier[TOPOLOGY_PACKAGE_URI] operator[SEP] identifier[text] , Other[null] operator[SEP] operator[SEP] identifier[String] identifier[destination] operator[=] identifier[cmd] operator[SEP] identifier[getOptionValue] operator[SEP] identifier[CliArgs] operator[SEP] identifier[EXTRACT_DESTINATION] operator[SEP] identifier[text] , Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[uri] operator[==] Other[null] operator[&&] identifier[destination] operator[==] Other[null] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] identifier[leftOverArgs] operator[=] identifier[cmd] operator[SEP] identifier[getArgs] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[leftOverArgs] operator[SEP] identifier[length] operator[!=] Other[2] operator[SEP] {
identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
identifier[uri] operator[=] identifier[leftOverArgs] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[destination] operator[=] identifier[leftOverArgs] operator[SEP] Other[1] operator[SEP] operator[SEP]
}
Keyword[final] identifier[URI] identifier[topologyLocation] operator[=] Keyword[new] identifier[URI] operator[SEP] identifier[uri] operator[SEP] operator[SEP] Keyword[final] identifier[Path] identifier[topologyDestination] operator[=] identifier[Paths] operator[SEP] identifier[get] operator[SEP] identifier[destination] operator[SEP] operator[SEP] Keyword[final] identifier[File] identifier[file] operator[=] identifier[topologyDestination] operator[SEP] identifier[toFile] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[file] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[SEP] {
identifier[file] operator[SEP] identifier[mkdirs] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Class] identifier[clazz] operator[=] identifier[Registry] operator[SEP] identifier[UriToClass] operator[SEP] identifier[config] , identifier[topologyLocation] operator[SEP] operator[SEP] Keyword[final] identifier[Downloader] identifier[downloader] operator[=] identifier[Registry] operator[SEP] identifier[getDownloader] operator[SEP] identifier[clazz] , identifier[topologyLocation] operator[SEP] operator[SEP] identifier[downloader] operator[SEP] identifier[download] operator[SEP] identifier[topologyLocation] , identifier[topologyDestination] operator[SEP] operator[SEP]
}
|
public Retryer<R> withBlockStrategy(BlockStrategy blockStrategy) {
checkState(this.blockStrategy == null, "a block strategy has already been set %s", this.blockStrategy);
this.blockStrategy = checkNotNull(blockStrategy, "BlockStrategy cannot be null");
return this;
} | class class_name[name] begin[{]
method[withBlockStrategy, return_type[type[Retryer]], modifier[public], parameter[blockStrategy]] begin[{]
call[.checkState, parameter[binary_operation[THIS[member[None.blockStrategy]], ==, literal[null]], literal["a block strategy has already been set %s"], THIS[member[None.blockStrategy]]]]
assign[THIS[member[None.blockStrategy]], call[.checkNotNull, parameter[member[.blockStrategy], literal["BlockStrategy cannot be null"]]]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[Retryer] operator[<] identifier[R] operator[>] identifier[withBlockStrategy] operator[SEP] identifier[BlockStrategy] identifier[blockStrategy] operator[SEP] {
identifier[checkState] operator[SEP] Keyword[this] operator[SEP] identifier[blockStrategy] operator[==] Other[null] , literal[String] , Keyword[this] operator[SEP] identifier[blockStrategy] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[blockStrategy] operator[=] identifier[checkNotNull] operator[SEP] identifier[blockStrategy] , literal[String] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
@NotNull
public DbPreparedStatement<T> set(@NotNull String name, @Nullable DbLong value) throws SQLException {
return value == null ? setNull(name, JDBCType.BIGINT) : set(name, value.getDbValue());
} | class class_name[name] begin[{]
method[set, return_type[type[DbPreparedStatement]], modifier[public], parameter[name, value]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getDbValue, postfix_operators=[], prefix_operators=[], qualifier=value, selectors=[], type_arguments=None)], member=set, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), if_true=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=BIGINT, postfix_operators=[], prefix_operators=[], qualifier=JDBCType, selectors=[])], member=setNull, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None))]
end[}]
END[}] | annotation[@] identifier[NotNull] Keyword[public] identifier[DbPreparedStatement] operator[<] identifier[T] operator[>] identifier[set] operator[SEP] annotation[@] identifier[NotNull] identifier[String] identifier[name] , annotation[@] identifier[Nullable] identifier[DbLong] identifier[value] operator[SEP] Keyword[throws] identifier[SQLException] {
Keyword[return] identifier[value] operator[==] Other[null] operator[?] identifier[setNull] operator[SEP] identifier[name] , identifier[JDBCType] operator[SEP] identifier[BIGINT] operator[SEP] operator[:] identifier[set] operator[SEP] identifier[name] , identifier[value] operator[SEP] identifier[getDbValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static SimpleModule getModule() {
SimpleModule module = new SimpleModule();
module.addSerializer(Headers.class, new HeadersSerializer());
return module;
} | class class_name[name] begin[{]
method[getModule, return_type[type[SimpleModule]], modifier[public static], parameter[]] begin[{]
local_variable[type[SimpleModule], module]
call[module.addSerializer, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Headers, sub_type=None)), ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=HeadersSerializer, sub_type=None))]]
return[member[.module]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[SimpleModule] identifier[getModule] operator[SEP] operator[SEP] {
identifier[SimpleModule] identifier[module] operator[=] Keyword[new] identifier[SimpleModule] operator[SEP] operator[SEP] operator[SEP] identifier[module] operator[SEP] identifier[addSerializer] operator[SEP] identifier[Headers] operator[SEP] Keyword[class] , Keyword[new] identifier[HeadersSerializer] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[module] operator[SEP]
}
|
private static int handleError(Throwable t) {
LOG.error("Error while running the command.", t);
System.err.println();
System.err.println("------------------------------------------------------------");
System.err.println(" The program finished with the following exception:");
System.err.println();
if (t.getCause() instanceof InvalidProgramException) {
System.err.println(t.getCause().getMessage());
StackTraceElement[] trace = t.getCause().getStackTrace();
for (StackTraceElement ele: trace) {
System.err.println("\t" + ele);
if (ele.getMethodName().equals("main")) {
break;
}
}
} else {
t.printStackTrace();
}
return 1;
} | class class_name[name] begin[{]
method[handleError, return_type[type[int]], modifier[private static], parameter[t]] begin[{]
call[LOG.error, parameter[literal["Error while running the command."], member[.t]]]
call[System.err.println, parameter[]]
call[System.err.println, parameter[literal["------------------------------------------------------------"]]]
call[System.err.println, parameter[literal[" The program finished with the following exception:"]]]
call[System.err.println, parameter[]]
if[binary_operation[call[t.getCause, parameter[]], instanceof, type[InvalidProgramException]]] begin[{]
call[System.err.println, parameter[call[t.getCause, parameter[]]]]
local_variable[type[StackTraceElement], trace]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\t"), operandr=MemberReference(member=ele, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.err, selectors=[], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=getMethodName, postfix_operators=[], prefix_operators=[], qualifier=ele, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="main")], member=equals, 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=[BreakStatement(goto=None, label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=trace, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=ele)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=StackTraceElement, sub_type=None))), label=None)
else begin[{]
call[t.printStackTrace, parameter[]]
end[}]
return[literal[1]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[int] identifier[handleError] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
identifier[LOG] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[t] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[t] operator[SEP] identifier[getCause] operator[SEP] operator[SEP] Keyword[instanceof] identifier[InvalidProgramException] operator[SEP] {
identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] identifier[t] operator[SEP] identifier[getCause] operator[SEP] operator[SEP] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[StackTraceElement] operator[SEP] operator[SEP] identifier[trace] operator[=] identifier[t] operator[SEP] identifier[getCause] operator[SEP] operator[SEP] operator[SEP] identifier[getStackTrace] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[StackTraceElement] identifier[ele] operator[:] identifier[trace] operator[SEP] {
identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[ele] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ele] operator[SEP] identifier[getMethodName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[break] operator[SEP]
}
}
}
Keyword[else] {
identifier[t] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Other[1] operator[SEP]
}
|
public void marshall(UploadMetadata uploadMetadata, ProtocolMarshaller protocolMarshaller) {
if (uploadMetadata == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(uploadMetadata.getUploadUrl(), UPLOADURL_BINDING);
protocolMarshaller.marshall(uploadMetadata.getSignedHeaders(), SIGNEDHEADERS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} | class class_name[name] begin[{]
method[marshall, return_type[void], modifier[public], parameter[uploadMetadata, protocolMarshaller]] begin[{]
if[binary_operation[member[.uploadMetadata], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid argument passed to marshall(...)")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getUploadUrl, postfix_operators=[], prefix_operators=[], qualifier=uploadMetadata, selectors=[], type_arguments=None), MemberReference(member=UPLOADURL_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getSignedHeaders, postfix_operators=[], prefix_operators=[], qualifier=uploadMetadata, selectors=[], type_arguments=None), MemberReference(member=SIGNEDHEADERS_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to marshall request to JSON: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), 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=SdkClientException, sub_type=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[public] Keyword[void] identifier[marshall] operator[SEP] identifier[UploadMetadata] identifier[uploadMetadata] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[uploadMetadata] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[uploadMetadata] operator[SEP] identifier[getUploadUrl] operator[SEP] operator[SEP] , identifier[UPLOADURL_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[uploadMetadata] operator[SEP] identifier[getSignedHeaders] operator[SEP] operator[SEP] , identifier[SIGNEDHEADERS_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public FormMappingOption filterSimpleTextParameter(FormSimpleTextParameterFilter filter) {
if (filter == null) {
throw new IllegalArgumentException("The argument 'filter' should not be null.");
}
this.simpleTextParameterFilter = OptionalThing.of(filter);
return this;
} | class class_name[name] begin[{]
method[filterSimpleTextParameter, return_type[type[FormMappingOption]], modifier[public], parameter[filter]] begin[{]
if[binary_operation[member[.filter], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The argument 'filter' should not 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[}]
assign[THIS[member[None.simpleTextParameterFilter]], call[OptionalThing.of, parameter[member[.filter]]]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[FormMappingOption] identifier[filterSimpleTextParameter] operator[SEP] identifier[FormSimpleTextParameterFilter] identifier[filter] operator[SEP] {
Keyword[if] operator[SEP] identifier[filter] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[simpleTextParameterFilter] operator[=] identifier[OptionalThing] operator[SEP] identifier[of] operator[SEP] identifier[filter] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
protected CmsLock getRelatedLock() {
if (m_relatedLock == null) {
CmsLockType type;
if (isSystemLock()) {
type = CmsLockType.UNLOCKED;
} else {
type = CmsLockType.SYSTEM_UNLOCKED;
}
CmsLock lock = new CmsLock(getResourceName(), getUserId(), getProject(), type);
lock.setRelatedLock(this);
if (isUnlocked()) {
// prevent the null lock gets modified
return lock;
}
m_relatedLock = lock;
}
return m_relatedLock;
} | class class_name[name] begin[{]
method[getRelatedLock, return_type[type[CmsLock]], modifier[protected], parameter[]] begin[{]
if[binary_operation[member[.m_relatedLock], ==, literal[null]]] begin[{]
local_variable[type[CmsLockType], type]
if[call[.isSystemLock, parameter[]]] begin[{]
assign[member[.type], member[CmsLockType.UNLOCKED]]
else begin[{]
assign[member[.type], member[CmsLockType.SYSTEM_UNLOCKED]]
end[}]
local_variable[type[CmsLock], lock]
call[lock.setRelatedLock, parameter[THIS[]]]
if[call[.isUnlocked, parameter[]]] begin[{]
return[member[.lock]]
else begin[{]
None
end[}]
assign[member[.m_relatedLock], member[.lock]]
else begin[{]
None
end[}]
return[member[.m_relatedLock]]
end[}]
END[}] | Keyword[protected] identifier[CmsLock] identifier[getRelatedLock] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[m_relatedLock] operator[==] Other[null] operator[SEP] {
identifier[CmsLockType] identifier[type] operator[SEP] Keyword[if] operator[SEP] identifier[isSystemLock] operator[SEP] operator[SEP] operator[SEP] {
identifier[type] operator[=] identifier[CmsLockType] operator[SEP] identifier[UNLOCKED] operator[SEP]
}
Keyword[else] {
identifier[type] operator[=] identifier[CmsLockType] operator[SEP] identifier[SYSTEM_UNLOCKED] operator[SEP]
}
identifier[CmsLock] identifier[lock] operator[=] Keyword[new] identifier[CmsLock] operator[SEP] identifier[getResourceName] operator[SEP] operator[SEP] , identifier[getUserId] operator[SEP] operator[SEP] , identifier[getProject] operator[SEP] operator[SEP] , identifier[type] operator[SEP] operator[SEP] identifier[lock] operator[SEP] identifier[setRelatedLock] operator[SEP] Keyword[this] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isUnlocked] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[lock] operator[SEP]
}
identifier[m_relatedLock] operator[=] identifier[lock] operator[SEP]
}
Keyword[return] identifier[m_relatedLock] operator[SEP]
}
|
public void removeDependency(T from, T to) {
lock.writeLock().lock();
try {
Set<T> dependencies = outgoingEdges.get(from);
if (dependencies == null || !dependencies.contains(to)) {
throw new IllegalArgumentException("Inexistent dependency");
}
dependencies.remove(to);
incomingEdges.get(to).remove(from);
} finally {
lock.writeLock().unlock();
}
} | class class_name[name] begin[{]
method[removeDependency, return_type[void], modifier[public], parameter[from, to]] begin[{]
call[lock.writeLock, parameter[]]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=from, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=outgoingEdges, selectors=[], type_arguments=None), name=dependencies)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=Set, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=dependencies, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operandr=MethodInvocation(arguments=[MemberReference(member=to, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=[], prefix_operators=['!'], qualifier=dependencies, selectors=[], type_arguments=None), 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="Inexistent dependency")], 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)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=to, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=dependencies, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=to, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=incomingEdges, selectors=[MethodInvocation(arguments=[MemberReference(member=from, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=writeLock, postfix_operators=[], prefix_operators=[], qualifier=lock, selectors=[MethodInvocation(arguments=[], member=unlock, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[removeDependency] operator[SEP] identifier[T] identifier[from] , identifier[T] identifier[to] operator[SEP] {
identifier[lock] operator[SEP] identifier[writeLock] operator[SEP] operator[SEP] operator[SEP] identifier[lock] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[Set] operator[<] identifier[T] operator[>] identifier[dependencies] operator[=] identifier[outgoingEdges] operator[SEP] identifier[get] operator[SEP] identifier[from] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dependencies] operator[==] Other[null] operator[||] operator[!] identifier[dependencies] operator[SEP] identifier[contains] operator[SEP] identifier[to] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[dependencies] operator[SEP] identifier[remove] operator[SEP] identifier[to] operator[SEP] operator[SEP] identifier[incomingEdges] operator[SEP] identifier[get] operator[SEP] identifier[to] operator[SEP] operator[SEP] identifier[remove] operator[SEP] identifier[from] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[lock] operator[SEP] identifier[writeLock] operator[SEP] operator[SEP] operator[SEP] identifier[unlock] operator[SEP] operator[SEP] operator[SEP]
}
}
|
protected void carriageReturn() {
// the arraylist with lines may not be null
if (lines == null) {
lines = new ArrayList();
}
// If the current line is not null
if (line != null) {
// we check if the end of the page is reached (bugfix by Francois Gravel)
if (currentHeight + line.height() + leading < indentTop() - indentBottom()) {
// if so nonempty lines are added and the height is augmented
if (line.size() > 0) {
currentHeight += line.height();
lines.add(line);
pageEmpty = false;
}
}
// if the end of the line is reached, we start a new page
else {
newPage();
}
}
if (imageEnd > -1 && currentHeight > imageEnd) {
imageEnd = -1;
indentation.imageIndentRight = 0;
indentation.imageIndentLeft = 0;
}
// a new current line is constructed
line = new PdfLine(indentLeft(), indentRight(), alignment, leading);
} | class class_name[name] begin[{]
method[carriageReturn, return_type[void], modifier[protected], parameter[]] begin[{]
if[binary_operation[member[.lines], ==, literal[null]]] begin[{]
assign[member[.lines], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ArrayList, sub_type=None))]
else begin[{]
None
end[}]
if[binary_operation[member[.line], !=, literal[null]]] begin[{]
if[binary_operation[binary_operation[binary_operation[member[.currentHeight], +, call[line.height, parameter[]]], +, member[.leading]], <, binary_operation[call[.indentTop, parameter[]], -, call[.indentBottom, parameter[]]]]] begin[{]
if[binary_operation[call[line.size, parameter[]], >, literal[0]]] begin[{]
assign[member[.currentHeight], call[line.height, parameter[]]]
call[lines.add, parameter[member[.line]]]
assign[member[.pageEmpty], literal[false]]
else begin[{]
None
end[}]
else begin[{]
call[.newPage, parameter[]]
end[}]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.imageEnd], >, literal[1]], &&, binary_operation[member[.currentHeight], >, member[.imageEnd]]]] begin[{]
assign[member[.imageEnd], literal[1]]
assign[member[indentation.imageIndentRight], literal[0]]
assign[member[indentation.imageIndentLeft], literal[0]]
else begin[{]
None
end[}]
assign[member[.line], ClassCreator(arguments=[MethodInvocation(arguments=[], member=indentLeft, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=indentRight, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=alignment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=leading, 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=PdfLine, sub_type=None))]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[carriageReturn] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[lines] operator[==] Other[null] operator[SEP] {
identifier[lines] operator[=] Keyword[new] identifier[ArrayList] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[line] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[currentHeight] operator[+] identifier[line] operator[SEP] identifier[height] operator[SEP] operator[SEP] operator[+] identifier[leading] operator[<] identifier[indentTop] operator[SEP] operator[SEP] operator[-] identifier[indentBottom] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[line] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[currentHeight] operator[+=] identifier[line] operator[SEP] identifier[height] operator[SEP] operator[SEP] operator[SEP] identifier[lines] operator[SEP] identifier[add] operator[SEP] identifier[line] operator[SEP] operator[SEP] identifier[pageEmpty] operator[=] literal[boolean] operator[SEP]
}
}
Keyword[else] {
identifier[newPage] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[imageEnd] operator[>] operator[-] Other[1] operator[&&] identifier[currentHeight] operator[>] identifier[imageEnd] operator[SEP] {
identifier[imageEnd] operator[=] operator[-] Other[1] operator[SEP] identifier[indentation] operator[SEP] identifier[imageIndentRight] operator[=] Other[0] operator[SEP] identifier[indentation] operator[SEP] identifier[imageIndentLeft] operator[=] Other[0] operator[SEP]
}
identifier[line] operator[=] Keyword[new] identifier[PdfLine] operator[SEP] identifier[indentLeft] operator[SEP] operator[SEP] , identifier[indentRight] operator[SEP] operator[SEP] , identifier[alignment] , identifier[leading] operator[SEP] operator[SEP]
}
|
@Override
public long getLongCardinality() {
if (doCacheCardinalities) {
if (highToBitmap.isEmpty()) {
return 0L;
}
int indexOk = ensureCumulatives(highestHigh());
// ensureCumulatives may have removed empty bitmaps
if (highToBitmap.isEmpty()) {
return 0L;
}
return sortedCumulatedCardinality[indexOk - 1];
} else {
long cardinality = 0L;
for (BitmapDataProvider bitmap : highToBitmap.values()) {
cardinality += bitmap.getLongCardinality();
}
return cardinality;
}
} | class class_name[name] begin[{]
method[getLongCardinality, return_type[type[long]], modifier[public], parameter[]] begin[{]
if[member[.doCacheCardinalities]] begin[{]
if[call[highToBitmap.isEmpty, parameter[]]] begin[{]
return[literal[0L]]
else begin[{]
None
end[}]
local_variable[type[int], indexOk]
if[call[highToBitmap.isEmpty, parameter[]]] begin[{]
return[literal[0L]]
else begin[{]
None
end[}]
return[member[.sortedCumulatedCardinality]]
else begin[{]
local_variable[type[long], cardinality]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=cardinality, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[], member=getLongCardinality, postfix_operators=[], prefix_operators=[], qualifier=bitmap, selectors=[], type_arguments=None)), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=values, postfix_operators=[], prefix_operators=[], qualifier=highToBitmap, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=bitmap)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BitmapDataProvider, sub_type=None))), label=None)
return[member[.cardinality]]
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[long] identifier[getLongCardinality] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[doCacheCardinalities] operator[SEP] {
Keyword[if] operator[SEP] identifier[highToBitmap] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] Other[0L] operator[SEP]
}
Keyword[int] identifier[indexOk] operator[=] identifier[ensureCumulatives] operator[SEP] identifier[highestHigh] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[highToBitmap] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] Other[0L] operator[SEP]
}
Keyword[return] identifier[sortedCumulatedCardinality] operator[SEP] identifier[indexOk] operator[-] Other[1] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[long] identifier[cardinality] operator[=] Other[0L] operator[SEP] Keyword[for] operator[SEP] identifier[BitmapDataProvider] identifier[bitmap] operator[:] identifier[highToBitmap] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] {
identifier[cardinality] operator[+=] identifier[bitmap] operator[SEP] identifier[getLongCardinality] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[cardinality] operator[SEP]
}
}
|
@Override
protected boolean beforeHandleRequest(final Request request) {
// Clear file upload ID (if set)
setFileUploadRequestId(null);
// Check if is targeted request (thumbnail request or file content request)
String targetParam = request.getParameter(Environment.TARGET_ID);
boolean targetted = (targetParam != null && targetParam.equals(getTargetId()));
if (targetted) {
doHandleTargetedRequest(request);
return false;
}
// Check if AJAX trigger
if (isCurrentAjaxTrigger()) {
// Upload file request (check for multi part and file id)
if (request.getParameter(FILE_UPLOAD_MULTI_PART_ID_KEY) != null && request.getFileItems(getId()) != null) {
doHandleUploadRequest(request);
return false;
}
// File in list selected by the user
if (request.getParameter(FILE_UPLOAD_ID_KEY) != null) {
doHandleFileAjaxActionRequest(request);
return false;
}
}
return true;
} | class class_name[name] begin[{]
method[beforeHandleRequest, return_type[type[boolean]], modifier[protected], parameter[request]] begin[{]
call[.setFileUploadRequestId, parameter[literal[null]]]
local_variable[type[String], targetParam]
local_variable[type[boolean], targetted]
if[member[.targetted]] begin[{]
call[.doHandleTargetedRequest, parameter[member[.request]]]
return[literal[false]]
else begin[{]
None
end[}]
if[call[.isCurrentAjaxTrigger, parameter[]]] begin[{]
if[binary_operation[binary_operation[call[request.getParameter, parameter[member[.FILE_UPLOAD_MULTI_PART_ID_KEY]]], !=, literal[null]], &&, binary_operation[call[request.getFileItems, parameter[call[.getId, parameter[]]]], !=, literal[null]]]] begin[{]
call[.doHandleUploadRequest, parameter[member[.request]]]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[call[request.getParameter, parameter[member[.FILE_UPLOAD_ID_KEY]]], !=, literal[null]]] begin[{]
call[.doHandleFileAjaxActionRequest, parameter[member[.request]]]
return[literal[false]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[literal[true]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] Keyword[boolean] identifier[beforeHandleRequest] operator[SEP] Keyword[final] identifier[Request] identifier[request] operator[SEP] {
identifier[setFileUploadRequestId] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[String] identifier[targetParam] operator[=] identifier[request] operator[SEP] identifier[getParameter] operator[SEP] identifier[Environment] operator[SEP] identifier[TARGET_ID] operator[SEP] operator[SEP] Keyword[boolean] identifier[targetted] operator[=] operator[SEP] identifier[targetParam] operator[!=] Other[null] operator[&&] identifier[targetParam] operator[SEP] identifier[equals] operator[SEP] identifier[getTargetId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[targetted] operator[SEP] {
identifier[doHandleTargetedRequest] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[isCurrentAjaxTrigger] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[request] operator[SEP] identifier[getParameter] operator[SEP] identifier[FILE_UPLOAD_MULTI_PART_ID_KEY] operator[SEP] operator[!=] Other[null] operator[&&] identifier[request] operator[SEP] identifier[getFileItems] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[doHandleUploadRequest] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[request] operator[SEP] identifier[getParameter] operator[SEP] identifier[FILE_UPLOAD_ID_KEY] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[doHandleFileAjaxActionRequest] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public AnnotatedTypeBuilder<X> removeFromMethod(AnnotatedMethod<? super X> method, Class<? extends Annotation> annotationType) {
return removeFromMethod(method.getJavaMember(), annotationType);
} | class class_name[name] begin[{]
method[removeFromMethod, return_type[type[AnnotatedTypeBuilder]], modifier[public], parameter[method, annotationType]] begin[{]
return[call[.removeFromMethod, parameter[call[method.getJavaMember, parameter[]], member[.annotationType]]]]
end[}]
END[}] | Keyword[public] identifier[AnnotatedTypeBuilder] operator[<] identifier[X] operator[>] identifier[removeFromMethod] operator[SEP] identifier[AnnotatedMethod] operator[<] operator[?] Keyword[super] identifier[X] operator[>] identifier[method] , identifier[Class] operator[<] operator[?] Keyword[extends] identifier[Annotation] operator[>] identifier[annotationType] operator[SEP] {
Keyword[return] identifier[removeFromMethod] operator[SEP] identifier[method] operator[SEP] identifier[getJavaMember] operator[SEP] operator[SEP] , identifier[annotationType] operator[SEP] operator[SEP]
}
|
protected static VideoProject createVideo() {
VideoProject video = FACTORY.createVideoProject();
video.setType(VideoType.LOCAL);
video.setValue("video-" + RandomUtils.nextInt(0, 999) + ".mp4");
return video;
} | class class_name[name] begin[{]
method[createVideo, return_type[type[VideoProject]], modifier[static protected], parameter[]] begin[{]
local_variable[type[VideoProject], video]
call[video.setType, parameter[member[VideoType.LOCAL]]]
call[video.setValue, parameter[binary_operation[binary_operation[literal["video-"], +, call[RandomUtils.nextInt, parameter[literal[0], literal[999]]]], +, literal[".mp4"]]]]
return[member[.video]]
end[}]
END[}] | Keyword[protected] Keyword[static] identifier[VideoProject] identifier[createVideo] operator[SEP] operator[SEP] {
identifier[VideoProject] identifier[video] operator[=] identifier[FACTORY] operator[SEP] identifier[createVideoProject] operator[SEP] operator[SEP] operator[SEP] identifier[video] operator[SEP] identifier[setType] operator[SEP] identifier[VideoType] operator[SEP] identifier[LOCAL] operator[SEP] operator[SEP] identifier[video] operator[SEP] identifier[setValue] operator[SEP] literal[String] operator[+] identifier[RandomUtils] operator[SEP] identifier[nextInt] operator[SEP] Other[0] , Other[999] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[video] operator[SEP]
}
|
@Override
public void from(Map<KEY, VALUE> map) {
getMap().putAll(nullSafeMap(map));
} | class class_name[name] begin[{]
method[from, return_type[void], modifier[public], parameter[map]] begin[{]
call[.getMap, parameter[]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[from] operator[SEP] identifier[Map] operator[<] identifier[KEY] , identifier[VALUE] operator[>] identifier[map] operator[SEP] {
identifier[getMap] operator[SEP] operator[SEP] operator[SEP] identifier[putAll] operator[SEP] identifier[nullSafeMap] operator[SEP] identifier[map] operator[SEP] operator[SEP] operator[SEP]
}
|
public static String replaceStringInString(final String text, final String searchString, final String replacement) {
if (stringIsBlank(text) || stringIsBlank(searchString) || replacement == null) {
return text;
}
int start = 0;
int end = text.indexOf(searchString, start);
if (end == INDEX_NOT_FOUND) {
return text;
}
final int replacedLength = searchString.length();
final StringBuilder builder = new StringBuilder();
while (end != INDEX_NOT_FOUND) {
builder.append(text.substring(start, end)).append(replacement);
start = end + replacedLength;
end = text.indexOf(searchString, start);
}
builder.append(text.substring(start));
return builder.toString();
} | class class_name[name] begin[{]
method[replaceStringInString, return_type[type[String]], modifier[public static], parameter[text, searchString, replacement]] begin[{]
if[binary_operation[binary_operation[call[.stringIsBlank, parameter[member[.text]]], ||, call[.stringIsBlank, parameter[member[.searchString]]]], ||, binary_operation[member[.replacement], ==, literal[null]]]] begin[{]
return[member[.text]]
else begin[{]
None
end[}]
local_variable[type[int], start]
local_variable[type[int], end]
if[binary_operation[member[.end], ==, member[.INDEX_NOT_FOUND]]] begin[{]
return[member[.text]]
else begin[{]
None
end[}]
local_variable[type[int], replacedLength]
local_variable[type[StringBuilder], builder]
while[binary_operation[member[.end], !=, member[.INDEX_NOT_FOUND]]] begin[{]
call[builder.append, parameter[call[text.substring, parameter[member[.start], member[.end]]]]]
assign[member[.start], binary_operation[member[.end], +, member[.replacedLength]]]
assign[member[.end], call[text.indexOf, parameter[member[.searchString], member[.start]]]]
end[}]
call[builder.append, parameter[call[text.substring, parameter[member[.start]]]]]
return[call[builder.toString, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[replaceStringInString] operator[SEP] Keyword[final] identifier[String] identifier[text] , Keyword[final] identifier[String] identifier[searchString] , Keyword[final] identifier[String] identifier[replacement] operator[SEP] {
Keyword[if] operator[SEP] identifier[stringIsBlank] operator[SEP] identifier[text] operator[SEP] operator[||] identifier[stringIsBlank] operator[SEP] identifier[searchString] operator[SEP] operator[||] identifier[replacement] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[text] operator[SEP]
}
Keyword[int] identifier[start] operator[=] Other[0] operator[SEP] Keyword[int] identifier[end] operator[=] identifier[text] operator[SEP] identifier[indexOf] operator[SEP] identifier[searchString] , identifier[start] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[end] operator[==] identifier[INDEX_NOT_FOUND] operator[SEP] {
Keyword[return] identifier[text] operator[SEP]
}
Keyword[final] Keyword[int] identifier[replacedLength] operator[=] identifier[searchString] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[StringBuilder] identifier[builder] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[end] operator[!=] identifier[INDEX_NOT_FOUND] operator[SEP] {
identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[text] operator[SEP] identifier[substring] operator[SEP] identifier[start] , identifier[end] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[replacement] operator[SEP] operator[SEP] identifier[start] operator[=] identifier[end] operator[+] identifier[replacedLength] operator[SEP] identifier[end] operator[=] identifier[text] operator[SEP] identifier[indexOf] operator[SEP] identifier[searchString] , identifier[start] operator[SEP] operator[SEP]
}
identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[text] operator[SEP] identifier[substring] operator[SEP] identifier[start] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[builder] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public Void call() {
if (shouldAnalyze()) {
LOGGER.debug("Begin Analysis of '{}' ({})", dependency.getActualFilePath(), analyzer.getName());
try {
analyzer.analyze(dependency, engine);
} catch (AnalysisException ex) {
LOGGER.warn("An error occurred while analyzing '{}' ({}).", dependency.getActualFilePath(), analyzer.getName());
LOGGER.debug("", ex);
exceptions.add(ex);
} catch (Throwable ex) {
LOGGER.warn("An unexpected error occurred during analysis of '{}' ({}): {}",
dependency.getActualFilePath(), analyzer.getName(), ex.getMessage());
LOGGER.error("", ex);
exceptions.add(ex);
}
}
return null;
} | class class_name[name] begin[{]
method[call, return_type[type[Void]], modifier[public], parameter[]] begin[{]
if[call[.shouldAnalyze, parameter[]]] begin[{]
call[LOGGER.debug, parameter[literal["Begin Analysis of '{}' ({})"], call[dependency.getActualFilePath, parameter[]], call[analyzer.getName, parameter[]]]]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=dependency, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=engine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=analyze, postfix_operators=[], prefix_operators=[], qualifier=analyzer, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="An error occurred while analyzing '{}' ({})."), MethodInvocation(arguments=[], member=getActualFilePath, postfix_operators=[], prefix_operators=[], qualifier=dependency, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=analyzer, selectors=[], type_arguments=None)], member=warn, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debug, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=exceptions, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['AnalysisException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="An unexpected error occurred during analysis of '{}' ({}): {}"), MethodInvocation(arguments=[], member=getActualFilePath, postfix_operators=[], prefix_operators=[], qualifier=dependency, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=analyzer, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=ex, selectors=[], type_arguments=None)], member=warn, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=exceptions, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Throwable']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Void] identifier[call] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[shouldAnalyze] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[dependency] operator[SEP] identifier[getActualFilePath] operator[SEP] operator[SEP] , identifier[analyzer] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[analyzer] operator[SEP] identifier[analyze] operator[SEP] identifier[dependency] , identifier[engine] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[AnalysisException] identifier[ex] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[warn] operator[SEP] literal[String] , identifier[dependency] operator[SEP] identifier[getActualFilePath] operator[SEP] operator[SEP] , identifier[analyzer] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[ex] operator[SEP] operator[SEP] identifier[exceptions] operator[SEP] identifier[add] operator[SEP] identifier[ex] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[ex] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[warn] operator[SEP] literal[String] , identifier[dependency] operator[SEP] identifier[getActualFilePath] operator[SEP] operator[SEP] , identifier[analyzer] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[ex] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[LOGGER] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[ex] operator[SEP] operator[SEP] identifier[exceptions] operator[SEP] identifier[add] operator[SEP] identifier[ex] operator[SEP] operator[SEP]
}
}
Keyword[return] Other[null] operator[SEP]
}
|
public AppHelper add(String name, String displayValue, String description, String defaultValue)
{
Arguments.add(new Argument(name, displayValue, description, defaultValue));
return this;
} | class class_name[name] begin[{]
method[add, return_type[type[AppHelper]], modifier[public], parameter[name, displayValue, description, defaultValue]] begin[{]
call[Arguments.add, parameter[ClassCreator(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=displayValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=description, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=defaultValue, 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=Argument, sub_type=None))]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[AppHelper] identifier[add] operator[SEP] identifier[String] identifier[name] , identifier[String] identifier[displayValue] , identifier[String] identifier[description] , identifier[String] identifier[defaultValue] operator[SEP] {
identifier[Arguments] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[Argument] operator[SEP] identifier[name] , identifier[displayValue] , identifier[description] , identifier[defaultValue] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
@Action(name = "Merge Arrays",
outputs = {
@Output(OutputNames.RETURN_RESULT),
@Output(OutputNames.RETURN_CODE),
@Output(OutputNames.EXCEPTION)
},
responses = {
@Response(text = ResponseNames.SUCCESS, field = OutputNames.RETURN_CODE, value = ReturnCodes.SUCCESS, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED),
@Response(text = ResponseNames.FAILURE, field = OutputNames.RETURN_CODE, value = ReturnCodes.FAILURE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true)
})
public Map<String, String> execute(@Param(value = Constants.InputNames.ARRAY, required = true) String array1,
@Param(value = Constants.InputNames.ARRAY, required = true) String array2) {
Map<String, String> returnResult = new HashMap<>();
if (StringUtilities.isBlank(array1)) {
final String exceptionValue = NOT_A_VALID_JSON_ARRAY_MESSAGE + ARRAY1_MESSAGE.replaceFirst("=", EMPTY_STRING);
return populateResult(returnResult, exceptionValue, new Exception(exceptionValue));
}
if (StringUtilities.isBlank(array2)) {
final String exceptionValue = NOT_A_VALID_JSON_ARRAY_MESSAGE + ARRAY2_MESSAGE.replaceFirst("=", EMPTY_STRING);
return populateResult(returnResult, new Exception(exceptionValue));
}
JsonNode jsonNode1;
JsonNode jsonNode2;
ObjectMapper mapper = new ObjectMapper();
try {
jsonNode1 = mapper.readTree(array1);
} catch (IOException exception) {
final String value = INVALID_JSON_OBJECT_PROVIDED_EXCEPTION_MESSAGE + ARRAY1_MESSAGE + array1;
return populateResult(returnResult, value, exception);
}
try {
jsonNode2 = mapper.readTree(array2);
} catch (IOException exception) {
final String value = INVALID_JSON_OBJECT_PROVIDED_EXCEPTION_MESSAGE + ARRAY2_MESSAGE + array2;
return populateResult(returnResult, value, exception);
}
final String result;
if (jsonNode1 instanceof ArrayNode && jsonNode2 instanceof ArrayNode) {
final ArrayNode asJsonArray1 = (ArrayNode) jsonNode1;
final ArrayNode asJsonArray2 = (ArrayNode) jsonNode2;
final ArrayNode asJsonArrayResult = new ArrayNode(mapper.getNodeFactory());
asJsonArrayResult.addAll(asJsonArray1);
asJsonArrayResult.addAll(asJsonArray2);
result = asJsonArrayResult.toString();
} else {
result = NOT_A_VALID_JSON_ARRAY_MESSAGE + ARRAY1_MESSAGE + array1 + ARRAY2_MESSAGE + array2;
return populateResult(returnResult, new Exception(result));
}
return populateResult(returnResult, result, null);
} | class class_name[name] begin[{]
method[execute, return_type[type[Map]], modifier[public], parameter[array1, array2]] begin[{]
local_variable[type[Map], returnResult]
if[call[StringUtilities.isBlank, parameter[member[.array1]]]] begin[{]
local_variable[type[String], exceptionValue]
return[call[.populateResult, parameter[member[.returnResult], member[.exceptionValue], ClassCreator(arguments=[MemberReference(member=exceptionValue, 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=Exception, sub_type=None))]]]
else begin[{]
None
end[}]
if[call[StringUtilities.isBlank, parameter[member[.array2]]]] begin[{]
local_variable[type[String], exceptionValue]
return[call[.populateResult, parameter[member[.returnResult], ClassCreator(arguments=[MemberReference(member=exceptionValue, 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=Exception, sub_type=None))]]]
else begin[{]
None
end[}]
local_variable[type[JsonNode], jsonNode1]
local_variable[type[JsonNode], jsonNode2]
local_variable[type[ObjectMapper], mapper]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=jsonNode1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=array1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readTree, postfix_operators=[], prefix_operators=[], qualifier=mapper, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=INVALID_JSON_OBJECT_PROVIDED_EXCEPTION_MESSAGE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=ARRAY1_MESSAGE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=MemberReference(member=array1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), name=value)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=returnResult, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=exception, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=populateResult, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=exception, types=['IOException']))], finally_block=None, label=None, resources=None)
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=jsonNode2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=array2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readTree, postfix_operators=[], prefix_operators=[], qualifier=mapper, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=INVALID_JSON_OBJECT_PROVIDED_EXCEPTION_MESSAGE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=ARRAY2_MESSAGE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=MemberReference(member=array2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), name=value)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=returnResult, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=exception, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=populateResult, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=exception, types=['IOException']))], finally_block=None, label=None, resources=None)
local_variable[type[String], result]
if[binary_operation[binary_operation[member[.jsonNode1], instanceof, type[ArrayNode]], &&, binary_operation[member[.jsonNode2], instanceof, type[ArrayNode]]]] begin[{]
local_variable[type[ArrayNode], asJsonArray1]
local_variable[type[ArrayNode], asJsonArray2]
local_variable[type[ArrayNode], asJsonArrayResult]
call[asJsonArrayResult.addAll, parameter[member[.asJsonArray1]]]
call[asJsonArrayResult.addAll, parameter[member[.asJsonArray2]]]
assign[member[.result], call[asJsonArrayResult.toString, parameter[]]]
else begin[{]
assign[member[.result], binary_operation[binary_operation[binary_operation[binary_operation[member[.NOT_A_VALID_JSON_ARRAY_MESSAGE], +, member[.ARRAY1_MESSAGE]], +, member[.array1]], +, member[.ARRAY2_MESSAGE]], +, member[.array2]]]
return[call[.populateResult, parameter[member[.returnResult], ClassCreator(arguments=[MemberReference(member=result, 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=Exception, sub_type=None))]]]
end[}]
return[call[.populateResult, parameter[member[.returnResult], member[.result], literal[null]]]]
end[}]
END[}] | annotation[@] identifier[Action] operator[SEP] identifier[name] operator[=] literal[String] , identifier[outputs] operator[=] {
annotation[@] identifier[Output] operator[SEP] identifier[OutputNames] operator[SEP] identifier[RETURN_RESULT] operator[SEP] , annotation[@] identifier[Output] operator[SEP] identifier[OutputNames] operator[SEP] identifier[RETURN_CODE] operator[SEP] , annotation[@] identifier[Output] operator[SEP] identifier[OutputNames] operator[SEP] identifier[EXCEPTION] operator[SEP]
} , identifier[responses] operator[=] {
annotation[@] identifier[Response] operator[SEP] identifier[text] operator[=] identifier[ResponseNames] operator[SEP] identifier[SUCCESS] , identifier[field] operator[=] identifier[OutputNames] operator[SEP] identifier[RETURN_CODE] , identifier[value] operator[=] identifier[ReturnCodes] operator[SEP] identifier[SUCCESS] , identifier[matchType] operator[=] identifier[MatchType] operator[SEP] identifier[COMPARE_EQUAL] , identifier[responseType] operator[=] identifier[ResponseType] operator[SEP] identifier[RESOLVED] operator[SEP] , annotation[@] identifier[Response] operator[SEP] identifier[text] operator[=] identifier[ResponseNames] operator[SEP] identifier[FAILURE] , identifier[field] operator[=] identifier[OutputNames] operator[SEP] identifier[RETURN_CODE] , identifier[value] operator[=] identifier[ReturnCodes] operator[SEP] identifier[FAILURE] , identifier[matchType] operator[=] identifier[MatchType] operator[SEP] identifier[COMPARE_EQUAL] , identifier[responseType] operator[=] identifier[ResponseType] operator[SEP] identifier[ERROR] , identifier[isOnFail] operator[=] literal[boolean] operator[SEP]
} operator[SEP] Keyword[public] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[execute] operator[SEP] annotation[@] identifier[Param] operator[SEP] identifier[value] operator[=] identifier[Constants] operator[SEP] identifier[InputNames] operator[SEP] identifier[ARRAY] , identifier[required] operator[=] literal[boolean] operator[SEP] identifier[String] identifier[array1] , annotation[@] identifier[Param] operator[SEP] identifier[value] operator[=] identifier[Constants] operator[SEP] identifier[InputNames] operator[SEP] identifier[ARRAY] , identifier[required] operator[=] literal[boolean] operator[SEP] identifier[String] identifier[array2] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[returnResult] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[StringUtilities] operator[SEP] identifier[isBlank] operator[SEP] identifier[array1] operator[SEP] operator[SEP] {
Keyword[final] identifier[String] identifier[exceptionValue] operator[=] identifier[NOT_A_VALID_JSON_ARRAY_MESSAGE] operator[+] identifier[ARRAY1_MESSAGE] operator[SEP] identifier[replaceFirst] operator[SEP] literal[String] , identifier[EMPTY_STRING] operator[SEP] operator[SEP] Keyword[return] identifier[populateResult] operator[SEP] identifier[returnResult] , identifier[exceptionValue] , Keyword[new] identifier[Exception] operator[SEP] identifier[exceptionValue] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[StringUtilities] operator[SEP] identifier[isBlank] operator[SEP] identifier[array2] operator[SEP] operator[SEP] {
Keyword[final] identifier[String] identifier[exceptionValue] operator[=] identifier[NOT_A_VALID_JSON_ARRAY_MESSAGE] operator[+] identifier[ARRAY2_MESSAGE] operator[SEP] identifier[replaceFirst] operator[SEP] literal[String] , identifier[EMPTY_STRING] operator[SEP] operator[SEP] Keyword[return] identifier[populateResult] operator[SEP] identifier[returnResult] , Keyword[new] identifier[Exception] operator[SEP] identifier[exceptionValue] operator[SEP] operator[SEP] operator[SEP]
}
identifier[JsonNode] identifier[jsonNode1] operator[SEP] identifier[JsonNode] identifier[jsonNode2] operator[SEP] identifier[ObjectMapper] identifier[mapper] operator[=] Keyword[new] identifier[ObjectMapper] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[jsonNode1] operator[=] identifier[mapper] operator[SEP] identifier[readTree] operator[SEP] identifier[array1] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[exception] operator[SEP] {
Keyword[final] identifier[String] identifier[value] operator[=] identifier[INVALID_JSON_OBJECT_PROVIDED_EXCEPTION_MESSAGE] operator[+] identifier[ARRAY1_MESSAGE] operator[+] identifier[array1] operator[SEP] Keyword[return] identifier[populateResult] operator[SEP] identifier[returnResult] , identifier[value] , identifier[exception] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[jsonNode2] operator[=] identifier[mapper] operator[SEP] identifier[readTree] operator[SEP] identifier[array2] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[exception] operator[SEP] {
Keyword[final] identifier[String] identifier[value] operator[=] identifier[INVALID_JSON_OBJECT_PROVIDED_EXCEPTION_MESSAGE] operator[+] identifier[ARRAY2_MESSAGE] operator[+] identifier[array2] operator[SEP] Keyword[return] identifier[populateResult] operator[SEP] identifier[returnResult] , identifier[value] , identifier[exception] operator[SEP] operator[SEP]
}
Keyword[final] identifier[String] identifier[result] operator[SEP] Keyword[if] operator[SEP] identifier[jsonNode1] Keyword[instanceof] identifier[ArrayNode] operator[&&] identifier[jsonNode2] Keyword[instanceof] identifier[ArrayNode] operator[SEP] {
Keyword[final] identifier[ArrayNode] identifier[asJsonArray1] operator[=] operator[SEP] identifier[ArrayNode] operator[SEP] identifier[jsonNode1] operator[SEP] Keyword[final] identifier[ArrayNode] identifier[asJsonArray2] operator[=] operator[SEP] identifier[ArrayNode] operator[SEP] identifier[jsonNode2] operator[SEP] Keyword[final] identifier[ArrayNode] identifier[asJsonArrayResult] operator[=] Keyword[new] identifier[ArrayNode] operator[SEP] identifier[mapper] operator[SEP] identifier[getNodeFactory] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[asJsonArrayResult] operator[SEP] identifier[addAll] operator[SEP] identifier[asJsonArray1] operator[SEP] operator[SEP] identifier[asJsonArrayResult] operator[SEP] identifier[addAll] operator[SEP] identifier[asJsonArray2] operator[SEP] operator[SEP] identifier[result] operator[=] identifier[asJsonArrayResult] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[result] operator[=] identifier[NOT_A_VALID_JSON_ARRAY_MESSAGE] operator[+] identifier[ARRAY1_MESSAGE] operator[+] identifier[array1] operator[+] identifier[ARRAY2_MESSAGE] operator[+] identifier[array2] operator[SEP] Keyword[return] identifier[populateResult] operator[SEP] identifier[returnResult] , Keyword[new] identifier[Exception] operator[SEP] identifier[result] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[populateResult] operator[SEP] identifier[returnResult] , identifier[result] , Other[null] operator[SEP] operator[SEP]
}
|
@Override
public com.liferay.commerce.account.service.persistence.CommerceAccountOrganizationRelPK getPrimaryKey() {
return _commerceAccountOrganizationRel.getPrimaryKey();
} | class class_name[name] begin[{]
method[getPrimaryKey, return_type[type[com]], modifier[public], parameter[]] begin[{]
return[call[_commerceAccountOrganizationRel.getPrimaryKey, parameter[]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[com] operator[SEP] identifier[liferay] operator[SEP] identifier[commerce] operator[SEP] identifier[account] operator[SEP] identifier[service] operator[SEP] identifier[persistence] operator[SEP] identifier[CommerceAccountOrganizationRelPK] identifier[getPrimaryKey] operator[SEP] operator[SEP] {
Keyword[return] identifier[_commerceAccountOrganizationRel] operator[SEP] identifier[getPrimaryKey] operator[SEP] operator[SEP] operator[SEP]
}
|
public boolean hasProperty(String category, String key) {
return this.categories.containsKey(category) && this.categories.get(category).containsKey(key);
} | class class_name[name] begin[{]
method[hasProperty, return_type[type[boolean]], modifier[public], parameter[category, key]] begin[{]
return[binary_operation[THIS[member[None.categories]call[None.containsKey, parameter[member[.category]]]], &&, THIS[member[None.categories]call[None.get, parameter[member[.category]]]call[None.containsKey, parameter[member[.key]]]]]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[hasProperty] operator[SEP] identifier[String] identifier[category] , identifier[String] identifier[key] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP] identifier[categories] operator[SEP] identifier[containsKey] operator[SEP] identifier[category] operator[SEP] operator[&&] Keyword[this] operator[SEP] identifier[categories] operator[SEP] identifier[get] operator[SEP] identifier[category] operator[SEP] operator[SEP] identifier[containsKey] operator[SEP] identifier[key] operator[SEP] operator[SEP]
}
|
public List<?> getNotSelected() {
List options = getOptions();
if (options == null || options.isEmpty()) {
return Collections.EMPTY_LIST;
}
List notSelected = new ArrayList(options);
notSelected.removeAll(getSelected());
return Collections.unmodifiableList(notSelected);
} | class class_name[name] begin[{]
method[getNotSelected, return_type[type[List]], modifier[public], parameter[]] begin[{]
local_variable[type[List], options]
if[binary_operation[binary_operation[member[.options], ==, literal[null]], ||, call[options.isEmpty, parameter[]]]] begin[{]
return[member[Collections.EMPTY_LIST]]
else begin[{]
None
end[}]
local_variable[type[List], notSelected]
call[notSelected.removeAll, parameter[call[.getSelected, parameter[]]]]
return[call[Collections.unmodifiableList, parameter[member[.notSelected]]]]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] operator[?] operator[>] identifier[getNotSelected] operator[SEP] operator[SEP] {
identifier[List] identifier[options] operator[=] identifier[getOptions] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[options] operator[==] Other[null] operator[||] identifier[options] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[Collections] operator[SEP] identifier[EMPTY_LIST] operator[SEP]
}
identifier[List] identifier[notSelected] operator[=] Keyword[new] identifier[ArrayList] operator[SEP] identifier[options] operator[SEP] operator[SEP] identifier[notSelected] operator[SEP] identifier[removeAll] operator[SEP] identifier[getSelected] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[Collections] operator[SEP] identifier[unmodifiableList] operator[SEP] identifier[notSelected] operator[SEP] operator[SEP]
}
|
private static void createSuperForwarder(ClassNode targetNode, MethodNode forwarder, final Map<String,ClassNode> genericsSpec) {
List<ClassNode> interfaces = new ArrayList<ClassNode>(Traits.collectAllInterfacesReverseOrder(targetNode, new LinkedHashSet<ClassNode>()));
String name = forwarder.getName();
Parameter[] forwarderParameters = forwarder.getParameters();
LinkedHashSet<ClassNode> traits = new LinkedHashSet<ClassNode>();
List<MethodNode> superForwarders = new LinkedList<MethodNode>();
for (ClassNode node : interfaces) {
if (Traits.isTrait(node)) {
MethodNode method = node.getDeclaredMethod(name, forwarderParameters);
if (method!=null) {
// a similar method exists, we need a super bridge
// trait$super$foo(Class currentTrait, ...)
traits.add(node);
superForwarders.add(method);
}
}
}
for (MethodNode superForwarder : superForwarders) {
doCreateSuperForwarder(targetNode, superForwarder, traits.toArray(ClassNode.EMPTY_ARRAY), genericsSpec);
}
} | class class_name[name] begin[{]
method[createSuperForwarder, return_type[void], modifier[private static], parameter[targetNode, forwarder, genericsSpec]] begin[{]
local_variable[type[List], interfaces]
local_variable[type[String], name]
local_variable[type[Parameter], forwarderParameters]
local_variable[type[LinkedHashSet], traits]
local_variable[type[List], superForwarders]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isTrait, postfix_operators=[], prefix_operators=[], qualifier=Traits, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=forwarderParameters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getDeclaredMethod, postfix_operators=[], prefix_operators=[], qualifier=node, selectors=[], type_arguments=None), name=method)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MethodNode, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=method, 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=[MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=traits, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=method, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=superForwarders, selectors=[], type_arguments=None), label=None)]))]))]), control=EnhancedForControl(iterable=MemberReference(member=interfaces, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=node)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ClassNode, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=targetNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=superForwarder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=EMPTY_ARRAY, postfix_operators=[], prefix_operators=[], qualifier=ClassNode, selectors=[])], member=toArray, postfix_operators=[], prefix_operators=[], qualifier=traits, selectors=[], type_arguments=None), MemberReference(member=genericsSpec, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=doCreateSuperForwarder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=superForwarders, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=superForwarder)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MethodNode, sub_type=None))), label=None)
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[void] identifier[createSuperForwarder] operator[SEP] identifier[ClassNode] identifier[targetNode] , identifier[MethodNode] identifier[forwarder] , Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[ClassNode] operator[>] identifier[genericsSpec] operator[SEP] {
identifier[List] operator[<] identifier[ClassNode] operator[>] identifier[interfaces] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[ClassNode] operator[>] operator[SEP] identifier[Traits] operator[SEP] identifier[collectAllInterfacesReverseOrder] operator[SEP] identifier[targetNode] , Keyword[new] identifier[LinkedHashSet] operator[<] identifier[ClassNode] operator[>] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[name] operator[=] identifier[forwarder] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[Parameter] operator[SEP] operator[SEP] identifier[forwarderParameters] operator[=] identifier[forwarder] operator[SEP] identifier[getParameters] operator[SEP] operator[SEP] operator[SEP] identifier[LinkedHashSet] operator[<] identifier[ClassNode] operator[>] identifier[traits] operator[=] Keyword[new] identifier[LinkedHashSet] operator[<] identifier[ClassNode] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[MethodNode] operator[>] identifier[superForwarders] operator[=] Keyword[new] identifier[LinkedList] operator[<] identifier[MethodNode] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[ClassNode] identifier[node] operator[:] identifier[interfaces] operator[SEP] {
Keyword[if] operator[SEP] identifier[Traits] operator[SEP] identifier[isTrait] operator[SEP] identifier[node] operator[SEP] operator[SEP] {
identifier[MethodNode] identifier[method] operator[=] identifier[node] operator[SEP] identifier[getDeclaredMethod] operator[SEP] identifier[name] , identifier[forwarderParameters] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[method] operator[!=] Other[null] operator[SEP] {
identifier[traits] operator[SEP] identifier[add] operator[SEP] identifier[node] operator[SEP] operator[SEP] identifier[superForwarders] operator[SEP] identifier[add] operator[SEP] identifier[method] operator[SEP] operator[SEP]
}
}
}
Keyword[for] operator[SEP] identifier[MethodNode] identifier[superForwarder] operator[:] identifier[superForwarders] operator[SEP] {
identifier[doCreateSuperForwarder] operator[SEP] identifier[targetNode] , identifier[superForwarder] , identifier[traits] operator[SEP] identifier[toArray] operator[SEP] identifier[ClassNode] operator[SEP] identifier[EMPTY_ARRAY] operator[SEP] , identifier[genericsSpec] operator[SEP] operator[SEP]
}
}
|
public AddBrownNtoN_F32 setDistortion( /**/double[] radial, /**/double t1, /**/double t2) {
params = new RadialTangential_F32(radial,t1,t2);
return this;
} | class class_name[name] begin[{]
method[setDistortion, return_type[type[AddBrownNtoN_F32]], modifier[public], parameter[radial, t1, t2]] begin[{]
assign[member[.params], ClassCreator(arguments=[MemberReference(member=radial, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=t1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=t2, 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=RadialTangential_F32, sub_type=None))]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[AddBrownNtoN_F32] identifier[setDistortion] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[radial] , Keyword[double] identifier[t1] , Keyword[double] identifier[t2] operator[SEP] {
identifier[params] operator[=] Keyword[new] identifier[RadialTangential_F32] operator[SEP] identifier[radial] , identifier[t1] , identifier[t2] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public static boolean status(HttpResponse response, int code, int... codes) {
int status = assertNotNull(response).getStatusLine().getStatusCode();
if(status == code) {
return true;
}
if(codes != null && codes.length > 0) {
for (int statusCode : codes) {
if(status == statusCode) {
return true;
}
}
}
return false;
} | class class_name[name] begin[{]
method[status, return_type[type[boolean]], modifier[public static], parameter[response, code, codes]] begin[{]
local_variable[type[int], status]
if[binary_operation[member[.status], ==, member[.code]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.codes], !=, literal[null]], &&, binary_operation[member[codes.length], >, literal[0]]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=status, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=statusCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=codes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=statusCode)], modifiers=set(), type=BasicType(dimensions=[], name=int))), label=None)
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[status] operator[SEP] identifier[HttpResponse] identifier[response] , Keyword[int] identifier[code] , Keyword[int] operator[...] identifier[codes] operator[SEP] {
Keyword[int] identifier[status] operator[=] identifier[assertNotNull] operator[SEP] identifier[response] operator[SEP] operator[SEP] identifier[getStatusLine] operator[SEP] operator[SEP] operator[SEP] identifier[getStatusCode] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[status] operator[==] identifier[code] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[codes] operator[!=] Other[null] operator[&&] identifier[codes] operator[SEP] identifier[length] operator[>] Other[0] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[statusCode] operator[:] identifier[codes] operator[SEP] {
Keyword[if] operator[SEP] identifier[status] operator[==] identifier[statusCode] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
private int reduceTableSize() {
int returnCode = HTODDynacache.NO_EXCEPTION;
int count = this.entryRemove;
if (count > 0) {
int removeSize = 5;
while (count > 0) {
int minSize = Integer.MAX_VALUE;
Iterator<Map.Entry<Object,Set<Object>>> e = dependencyToEntryTable.entrySet().iterator();
while (e.hasNext()) {
Map.Entry entry = (Map.Entry) e.next();
Object id = entry.getKey();
ValueSet vs = (ValueSet) entry.getValue();
int vsSize = vs.size();
if (vsSize < removeSize) {
if (this.type == DEP_ID_TABLE) {
returnCode = this.htod.writeValueSet(HTODDynacache.DEP_ID_DATA, id, vs, HTODDynacache.ALL); // valueSet may be empty after writeValueSet
this.htod.cache.getCacheStatisticsListener().depIdsOffloadedToDisk(id);
Tr.debug(tc, " reduceTableSize dependency id=" + id + " vs=" + vs.size() + " returnCode="+returnCode);
} else {
returnCode = this.htod.writeValueSet(HTODDynacache.TEMPLATE_ID_DATA, id, vs, HTODDynacache.ALL); // valueSet may be empty after writeValueSet
this.htod.cache.getCacheStatisticsListener().templatesOffloadedToDisk(id);
Tr.debug(tc,"reduceTableSize template id=" + id + " vs=" + vs.size() + " returnCode="+returnCode);
}
dependencyToEntryTable.remove(id);
dependencyNotUpdatedTable.remove(id);
count--;
if (returnCode == HTODDynacache.DISK_EXCEPTION) {
return returnCode;
} else if (returnCode == HTODDynacache.DISK_SIZE_OVER_LIMIT_EXCEPTION) {
this.htod.delCacheEntry(vs, CachePerf.DISK_OVERFLOW, CachePerf.LOCAL,
!Cache.FROM_DEPID_TEMPLATE_INVALIDATION,
HTODInvalidationBuffer.FIRE_EVENT);
returnCode = HTODDynacache.NO_EXCEPTION;
return returnCode;
}
} else {
minSize = vsSize < minSize ? vsSize : minSize;
}
if (count == 0) {
break;
}
}
removeSize = minSize;
removeSize += 3;
}
}
return returnCode;
} | class class_name[name] begin[{]
method[reduceTableSize, return_type[type[int]], modifier[private], parameter[]] begin[{]
local_variable[type[int], returnCode]
local_variable[type[int], count]
if[binary_operation[member[.count], >, literal[0]]] begin[{]
local_variable[type[int], removeSize]
while[binary_operation[member[.count], >, literal[0]]] begin[{]
local_variable[type[int], minSize]
local_variable[type[Iterator], e]
while[call[e.hasNext, parameter[]]] begin[{]
local_variable[type[Map], entry]
local_variable[type[Object], id]
local_variable[type[ValueSet], vs]
local_variable[type[int], vsSize]
if[binary_operation[member[.vsSize], <, member[.removeSize]]] begin[{]
if[binary_operation[THIS[member[None.type]], ==, member[.DEP_ID_TABLE]]] begin[{]
assign[member[.returnCode], THIS[member[None.htod]call[None.writeValueSet, parameter[member[HTODDynacache.DEP_ID_DATA], member[.id], member[.vs], member[HTODDynacache.ALL]]]]]
THIS[member[None.htod]member[None.cache]call[None.getCacheStatisticsListener, parameter[]]call[None.depIdsOffloadedToDisk, parameter[member[.id]]]]
call[Tr.debug, parameter[member[.tc], binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[literal[" reduceTableSize dependency id="], +, member[.id]], +, literal[" vs="]], +, call[vs.size, parameter[]]], +, literal[" returnCode="]], +, member[.returnCode]]]]
else begin[{]
assign[member[.returnCode], THIS[member[None.htod]call[None.writeValueSet, parameter[member[HTODDynacache.TEMPLATE_ID_DATA], member[.id], member[.vs], member[HTODDynacache.ALL]]]]]
THIS[member[None.htod]member[None.cache]call[None.getCacheStatisticsListener, parameter[]]call[None.templatesOffloadedToDisk, parameter[member[.id]]]]
call[Tr.debug, parameter[member[.tc], binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[literal["reduceTableSize template id="], +, member[.id]], +, literal[" vs="]], +, call[vs.size, parameter[]]], +, literal[" returnCode="]], +, member[.returnCode]]]]
end[}]
call[dependencyToEntryTable.remove, parameter[member[.id]]]
call[dependencyNotUpdatedTable.remove, parameter[member[.id]]]
member[.count]
if[binary_operation[member[.returnCode], ==, member[HTODDynacache.DISK_EXCEPTION]]] begin[{]
return[member[.returnCode]]
else begin[{]
if[binary_operation[member[.returnCode], ==, member[HTODDynacache.DISK_SIZE_OVER_LIMIT_EXCEPTION]]] begin[{]
THIS[member[None.htod]call[None.delCacheEntry, parameter[member[.vs], member[CachePerf.DISK_OVERFLOW], member[CachePerf.LOCAL], member[Cache.FROM_DEPID_TEMPLATE_INVALIDATION], member[HTODInvalidationBuffer.FIRE_EVENT]]]]
assign[member[.returnCode], member[HTODDynacache.NO_EXCEPTION]]
return[member[.returnCode]]
else begin[{]
None
end[}]
end[}]
else begin[{]
assign[member[.minSize], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=vsSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=minSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), if_false=MemberReference(member=minSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=vsSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]
end[}]
if[binary_operation[member[.count], ==, literal[0]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
end[}]
assign[member[.removeSize], member[.minSize]]
assign[member[.removeSize], literal[3]]
end[}]
else begin[{]
None
end[}]
return[member[.returnCode]]
end[}]
END[}] | Keyword[private] Keyword[int] identifier[reduceTableSize] operator[SEP] operator[SEP] {
Keyword[int] identifier[returnCode] operator[=] identifier[HTODDynacache] operator[SEP] identifier[NO_EXCEPTION] operator[SEP] Keyword[int] identifier[count] operator[=] Keyword[this] operator[SEP] identifier[entryRemove] operator[SEP] Keyword[if] operator[SEP] identifier[count] operator[>] Other[0] operator[SEP] {
Keyword[int] identifier[removeSize] operator[=] Other[5] operator[SEP] Keyword[while] operator[SEP] identifier[count] operator[>] Other[0] operator[SEP] {
Keyword[int] identifier[minSize] operator[=] identifier[Integer] operator[SEP] identifier[MAX_VALUE] operator[SEP] identifier[Iterator] operator[<] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[Object] , identifier[Set] operator[<] identifier[Object] operator[>] operator[>] operator[>] identifier[e] operator[=] identifier[dependencyToEntryTable] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[e] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[Map] operator[SEP] identifier[Entry] identifier[entry] operator[=] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[SEP] identifier[e] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[Object] identifier[id] operator[=] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[ValueSet] identifier[vs] operator[=] operator[SEP] identifier[ValueSet] operator[SEP] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[vsSize] operator[=] identifier[vs] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[vsSize] operator[<] identifier[removeSize] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[type] operator[==] identifier[DEP_ID_TABLE] operator[SEP] {
identifier[returnCode] operator[=] Keyword[this] operator[SEP] identifier[htod] operator[SEP] identifier[writeValueSet] operator[SEP] identifier[HTODDynacache] operator[SEP] identifier[DEP_ID_DATA] , identifier[id] , identifier[vs] , identifier[HTODDynacache] operator[SEP] identifier[ALL] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[htod] operator[SEP] identifier[cache] operator[SEP] identifier[getCacheStatisticsListener] operator[SEP] operator[SEP] operator[SEP] identifier[depIdsOffloadedToDisk] operator[SEP] identifier[id] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[+] identifier[id] operator[+] literal[String] operator[+] identifier[vs] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[returnCode] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[returnCode] operator[=] Keyword[this] operator[SEP] identifier[htod] operator[SEP] identifier[writeValueSet] operator[SEP] identifier[HTODDynacache] operator[SEP] identifier[TEMPLATE_ID_DATA] , identifier[id] , identifier[vs] , identifier[HTODDynacache] operator[SEP] identifier[ALL] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[htod] operator[SEP] identifier[cache] operator[SEP] identifier[getCacheStatisticsListener] operator[SEP] operator[SEP] operator[SEP] identifier[templatesOffloadedToDisk] operator[SEP] identifier[id] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[+] identifier[id] operator[+] literal[String] operator[+] identifier[vs] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[returnCode] operator[SEP] operator[SEP]
}
identifier[dependencyToEntryTable] operator[SEP] identifier[remove] operator[SEP] identifier[id] operator[SEP] operator[SEP] identifier[dependencyNotUpdatedTable] operator[SEP] identifier[remove] operator[SEP] identifier[id] operator[SEP] operator[SEP] identifier[count] operator[--] operator[SEP] Keyword[if] operator[SEP] identifier[returnCode] operator[==] identifier[HTODDynacache] operator[SEP] identifier[DISK_EXCEPTION] operator[SEP] {
Keyword[return] identifier[returnCode] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[returnCode] operator[==] identifier[HTODDynacache] operator[SEP] identifier[DISK_SIZE_OVER_LIMIT_EXCEPTION] operator[SEP] {
Keyword[this] operator[SEP] identifier[htod] operator[SEP] identifier[delCacheEntry] operator[SEP] identifier[vs] , identifier[CachePerf] operator[SEP] identifier[DISK_OVERFLOW] , identifier[CachePerf] operator[SEP] identifier[LOCAL] , operator[!] identifier[Cache] operator[SEP] identifier[FROM_DEPID_TEMPLATE_INVALIDATION] , identifier[HTODInvalidationBuffer] operator[SEP] identifier[FIRE_EVENT] operator[SEP] operator[SEP] identifier[returnCode] operator[=] identifier[HTODDynacache] operator[SEP] identifier[NO_EXCEPTION] operator[SEP] Keyword[return] identifier[returnCode] operator[SEP]
}
}
Keyword[else] {
identifier[minSize] operator[=] identifier[vsSize] operator[<] identifier[minSize] operator[?] identifier[vsSize] operator[:] identifier[minSize] operator[SEP]
}
Keyword[if] operator[SEP] identifier[count] operator[==] Other[0] operator[SEP] {
Keyword[break] operator[SEP]
}
}
identifier[removeSize] operator[=] identifier[minSize] operator[SEP] identifier[removeSize] operator[+=] Other[3] operator[SEP]
}
}
Keyword[return] identifier[returnCode] operator[SEP]
}
|
@XmlElementDecl(namespace = "http://docs.oasis-open.org/ns/cmis/messaging/200908/", name = "typeId", scope = GetObjectRelationships.class)
public JAXBElement<String> createGetObjectRelationshipsTypeId(String value) {
return new JAXBElement<String>(_GetTypeChildrenTypeId_QNAME,
String.class, GetObjectRelationships.class, value);
} | class class_name[name] begin[{]
method[createGetObjectRelationshipsTypeId, return_type[type[JAXBElement]], modifier[public], parameter[value]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=_GetTypeChildrenTypeId_QNAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None)), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=GetObjectRelationships, sub_type=None)), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], 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=String, sub_type=None))], dimensions=None, name=JAXBElement, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[XmlElementDecl] operator[SEP] identifier[namespace] operator[=] literal[String] , identifier[name] operator[=] literal[String] , identifier[scope] operator[=] identifier[GetObjectRelationships] operator[SEP] Keyword[class] operator[SEP] Keyword[public] identifier[JAXBElement] operator[<] identifier[String] operator[>] identifier[createGetObjectRelationshipsTypeId] operator[SEP] identifier[String] identifier[value] operator[SEP] {
Keyword[return] Keyword[new] identifier[JAXBElement] operator[<] identifier[String] operator[>] operator[SEP] identifier[_GetTypeChildrenTypeId_QNAME] , identifier[String] operator[SEP] Keyword[class] , identifier[GetObjectRelationships] operator[SEP] Keyword[class] , identifier[value] operator[SEP] operator[SEP]
}
|
private ResourceHandler createZipResourceHandler(final URL zipFile) throws IOException {
final FileSystem fileSystem = newFileSystem(URI.create("jar:" + zipFile), Collections.<String, Object>emptyMap());
final ResourceManager resMgr = new FileSystemResourceManager(fileSystem);
return new ResourceHandler(resMgr);
} | class class_name[name] begin[{]
method[createZipResourceHandler, return_type[type[ResourceHandler]], modifier[private], parameter[zipFile]] begin[{]
local_variable[type[FileSystem], fileSystem]
local_variable[type[ResourceManager], resMgr]
return[ClassCreator(arguments=[MemberReference(member=resMgr, 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=ResourceHandler, sub_type=None))]
end[}]
END[}] | Keyword[private] identifier[ResourceHandler] identifier[createZipResourceHandler] operator[SEP] Keyword[final] identifier[URL] identifier[zipFile] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[final] identifier[FileSystem] identifier[fileSystem] operator[=] identifier[newFileSystem] operator[SEP] identifier[URI] operator[SEP] identifier[create] operator[SEP] literal[String] operator[+] identifier[zipFile] operator[SEP] , identifier[Collections] operator[SEP] operator[<] identifier[String] , identifier[Object] operator[>] identifier[emptyMap] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[ResourceManager] identifier[resMgr] operator[=] Keyword[new] identifier[FileSystemResourceManager] operator[SEP] identifier[fileSystem] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[ResourceHandler] operator[SEP] identifier[resMgr] operator[SEP] operator[SEP]
}
|
@Override
public Date computeFirstFireTime (final ICalendar calendar)
{
m_aNextFireTime = getFireTimeAfter (new Date (getStartTime ().getTime () - 1000L));
// Check calendar for date-time exclusion
while (m_aNextFireTime != null && calendar != null && !calendar.isTimeIncluded (m_aNextFireTime.getTime ()))
{
m_aNextFireTime = getFireTimeAfter (m_aNextFireTime);
if (m_aNextFireTime == null)
break;
// avoid infinite loop
final Calendar c = PDTFactory.createCalendar ();
c.setTime (m_aNextFireTime);
if (c.get (Calendar.YEAR) > CQuartz.MAX_YEAR)
{
return null;
}
}
return m_aNextFireTime;
} | class class_name[name] begin[{]
method[computeFirstFireTime, return_type[type[Date]], modifier[public], parameter[calendar]] begin[{]
assign[member[.m_aNextFireTime], call[.getFireTimeAfter, parameter[ClassCreator(arguments=[BinaryOperation(operandl=MethodInvocation(arguments=[], member=getStartTime, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getTime, 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=1000L), operator=-)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Date, sub_type=None))]]]
while[binary_operation[binary_operation[binary_operation[member[.m_aNextFireTime], !=, literal[null]], &&, binary_operation[member[.calendar], !=, literal[null]]], &&, call[calendar.isTimeIncluded, parameter[call[m_aNextFireTime.getTime, parameter[]]]]]] begin[{]
assign[member[.m_aNextFireTime], call[.getFireTimeAfter, parameter[member[.m_aNextFireTime]]]]
if[binary_operation[member[.m_aNextFireTime], ==, literal[null]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
local_variable[type[Calendar], c]
call[c.setTime, parameter[member[.m_aNextFireTime]]]
if[binary_operation[call[c.get, parameter[member[Calendar.YEAR]]], >, member[CQuartz.MAX_YEAR]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
end[}]
return[member[.m_aNextFireTime]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Date] identifier[computeFirstFireTime] operator[SEP] Keyword[final] identifier[ICalendar] identifier[calendar] operator[SEP] {
identifier[m_aNextFireTime] operator[=] identifier[getFireTimeAfter] operator[SEP] Keyword[new] identifier[Date] operator[SEP] identifier[getStartTime] operator[SEP] operator[SEP] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] operator[-] Other[1000L] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[m_aNextFireTime] operator[!=] Other[null] operator[&&] identifier[calendar] operator[!=] Other[null] operator[&&] operator[!] identifier[calendar] operator[SEP] identifier[isTimeIncluded] operator[SEP] identifier[m_aNextFireTime] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[m_aNextFireTime] operator[=] identifier[getFireTimeAfter] operator[SEP] identifier[m_aNextFireTime] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[m_aNextFireTime] operator[==] Other[null] operator[SEP] Keyword[break] operator[SEP] Keyword[final] identifier[Calendar] identifier[c] operator[=] identifier[PDTFactory] operator[SEP] identifier[createCalendar] operator[SEP] operator[SEP] operator[SEP] identifier[c] operator[SEP] identifier[setTime] operator[SEP] identifier[m_aNextFireTime] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[c] operator[SEP] identifier[get] operator[SEP] identifier[Calendar] operator[SEP] identifier[YEAR] operator[SEP] operator[>] identifier[CQuartz] operator[SEP] identifier[MAX_YEAR] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
}
Keyword[return] identifier[m_aNextFireTime] operator[SEP]
}
|
public Response<Double> incrByFloat(final String key, final double increment) {
return new PipelineOperation<Double>() {
@Override
Response<Double> execute(Pipeline jedisPipeline) throws DynoException {
return jedisPipeline.incrByFloat(key, increment);
}
}.execute(key, OpName.INCRBYFLOAT);
} | class class_name[name] begin[{]
method[incrByFloat, return_type[type[Response]], modifier[public], parameter[key, increment]] begin[{]
return[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=increment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=incrByFloat, postfix_operators=[], prefix_operators=[], qualifier=jedisPipeline, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers=set(), name=execute, parameters=[FormalParameter(annotations=[], modifiers=set(), name=jedisPipeline, type=ReferenceType(arguments=None, dimensions=[], name=Pipeline, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Double, sub_type=None))], dimensions=[], name=Response, sub_type=None), throws=['DynoException'], type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=INCRBYFLOAT, postfix_operators=[], prefix_operators=[], qualifier=OpName, selectors=[])], member=execute, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Double, sub_type=None))], dimensions=None, name=PipelineOperation, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[Response] operator[<] identifier[Double] operator[>] identifier[incrByFloat] operator[SEP] Keyword[final] identifier[String] identifier[key] , Keyword[final] Keyword[double] identifier[increment] operator[SEP] {
Keyword[return] Keyword[new] identifier[PipelineOperation] operator[<] identifier[Double] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] identifier[Response] operator[<] identifier[Double] operator[>] identifier[execute] operator[SEP] identifier[Pipeline] identifier[jedisPipeline] operator[SEP] Keyword[throws] identifier[DynoException] {
Keyword[return] identifier[jedisPipeline] operator[SEP] identifier[incrByFloat] operator[SEP] identifier[key] , identifier[increment] operator[SEP] operator[SEP]
}
} operator[SEP] identifier[execute] operator[SEP] identifier[key] , identifier[OpName] operator[SEP] identifier[INCRBYFLOAT] operator[SEP] operator[SEP]
}
|
@Override
public CommerceAvailabilityEstimate findByUuid_C_First(String uuid,
long companyId,
OrderByComparator<CommerceAvailabilityEstimate> orderByComparator)
throws NoSuchAvailabilityEstimateException {
CommerceAvailabilityEstimate commerceAvailabilityEstimate = fetchByUuid_C_First(uuid,
companyId, orderByComparator);
if (commerceAvailabilityEstimate != null) {
return commerceAvailabilityEstimate;
}
StringBundler msg = new StringBundler(6);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("uuid=");
msg.append(uuid);
msg.append(", companyId=");
msg.append(companyId);
msg.append("}");
throw new NoSuchAvailabilityEstimateException(msg.toString());
} | class class_name[name] begin[{]
method[findByUuid_C_First, return_type[type[CommerceAvailabilityEstimate]], modifier[public], parameter[uuid, companyId, orderByComparator]] begin[{]
local_variable[type[CommerceAvailabilityEstimate], commerceAvailabilityEstimate]
if[binary_operation[member[.commerceAvailabilityEstimate], !=, literal[null]]] begin[{]
return[member[.commerceAvailabilityEstimate]]
else begin[{]
None
end[}]
local_variable[type[StringBundler], msg]
call[msg.append, parameter[member[._NO_SUCH_ENTITY_WITH_KEY]]]
call[msg.append, parameter[literal["uuid="]]]
call[msg.append, parameter[member[.uuid]]]
call[msg.append, parameter[literal[", companyId="]]]
call[msg.append, parameter[member[.companyId]]]
call[msg.append, parameter[literal["}"]]]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=msg, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NoSuchAvailabilityEstimateException, sub_type=None)), label=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[CommerceAvailabilityEstimate] identifier[findByUuid_C_First] operator[SEP] identifier[String] identifier[uuid] , Keyword[long] identifier[companyId] , identifier[OrderByComparator] operator[<] identifier[CommerceAvailabilityEstimate] operator[>] identifier[orderByComparator] operator[SEP] Keyword[throws] identifier[NoSuchAvailabilityEstimateException] {
identifier[CommerceAvailabilityEstimate] identifier[commerceAvailabilityEstimate] operator[=] identifier[fetchByUuid_C_First] operator[SEP] identifier[uuid] , identifier[companyId] , identifier[orderByComparator] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[commerceAvailabilityEstimate] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[commerceAvailabilityEstimate] operator[SEP]
}
identifier[StringBundler] identifier[msg] operator[=] Keyword[new] identifier[StringBundler] operator[SEP] Other[6] operator[SEP] operator[SEP] identifier[msg] operator[SEP] identifier[append] operator[SEP] identifier[_NO_SUCH_ENTITY_WITH_KEY] operator[SEP] operator[SEP] identifier[msg] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[msg] operator[SEP] identifier[append] operator[SEP] identifier[uuid] operator[SEP] operator[SEP] identifier[msg] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[msg] operator[SEP] identifier[append] operator[SEP] identifier[companyId] operator[SEP] operator[SEP] identifier[msg] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[NoSuchAvailabilityEstimateException] operator[SEP] identifier[msg] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@com.fasterxml.jackson.annotation.JsonProperty("DetectedLanguageCode")
public void setDetectedLanguageCode(String detectedLanguageCode) {
this.detectedLanguageCode = detectedLanguageCode;
} | class class_name[name] begin[{]
method[setDetectedLanguageCode, return_type[void], modifier[public], parameter[detectedLanguageCode]] begin[{]
assign[THIS[member[None.detectedLanguageCode]], member[.detectedLanguageCode]]
end[}]
END[}] | annotation[@] identifier[com] operator[SEP] identifier[fasterxml] operator[SEP] identifier[jackson] operator[SEP] identifier[annotation] operator[SEP] identifier[JsonProperty] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[void] identifier[setDetectedLanguageCode] operator[SEP] identifier[String] identifier[detectedLanguageCode] operator[SEP] {
Keyword[this] operator[SEP] identifier[detectedLanguageCode] operator[=] identifier[detectedLanguageCode] operator[SEP]
}
|
public AxisAngle4d set(Quaterniondc q) {
double acos = safeAcos(q.w());
double invSqrt = 1.0 / Math.sqrt(1.0 - q.w() * q.w());
this.x = q.x() * invSqrt;
this.y = q.y() * invSqrt;
this.z = q.z() * invSqrt;
this.angle = acos + acos;
return this;
} | class class_name[name] begin[{]
method[set, return_type[type[AxisAngle4d]], modifier[public], parameter[q]] begin[{]
local_variable[type[double], acos]
local_variable[type[double], invSqrt]
assign[THIS[member[None.x]], binary_operation[call[q.x, parameter[]], *, member[.invSqrt]]]
assign[THIS[member[None.y]], binary_operation[call[q.y, parameter[]], *, member[.invSqrt]]]
assign[THIS[member[None.z]], binary_operation[call[q.z, parameter[]], *, member[.invSqrt]]]
assign[THIS[member[None.angle]], binary_operation[member[.acos], +, member[.acos]]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[AxisAngle4d] identifier[set] operator[SEP] identifier[Quaterniondc] identifier[q] operator[SEP] {
Keyword[double] identifier[acos] operator[=] identifier[safeAcos] operator[SEP] identifier[q] operator[SEP] identifier[w] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[invSqrt] operator[=] literal[Float] operator[/] identifier[Math] operator[SEP] identifier[sqrt] operator[SEP] literal[Float] operator[-] identifier[q] operator[SEP] identifier[w] operator[SEP] operator[SEP] operator[*] identifier[q] operator[SEP] identifier[w] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[x] operator[=] identifier[q] operator[SEP] identifier[x] operator[SEP] operator[SEP] operator[*] identifier[invSqrt] operator[SEP] Keyword[this] operator[SEP] identifier[y] operator[=] identifier[q] operator[SEP] identifier[y] operator[SEP] operator[SEP] operator[*] identifier[invSqrt] operator[SEP] Keyword[this] operator[SEP] identifier[z] operator[=] identifier[q] operator[SEP] identifier[z] operator[SEP] operator[SEP] operator[*] identifier[invSqrt] operator[SEP] Keyword[this] operator[SEP] identifier[angle] operator[=] identifier[acos] operator[+] identifier[acos] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public void addImage(Image image, boolean inlineImage) throws DocumentException {
if (!image.hasAbsoluteY())
throw new DocumentException("The image must have absolute positioning.");
float matrix[] = image.matrix();
matrix[Image.CX] = image.getAbsoluteX() - matrix[Image.CX];
matrix[Image.CY] = image.getAbsoluteY() - matrix[Image.CY];
addImage(image, matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5], inlineImage);
} | class class_name[name] begin[{]
method[addImage, return_type[void], modifier[public], parameter[image, inlineImage]] begin[{]
if[call[image.hasAbsoluteY, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The image must have absolute positioning.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DocumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[float], matrix]
assign[member[.matrix], binary_operation[call[image.getAbsoluteX, parameter[]], -, member[.matrix]]]
assign[member[.matrix], binary_operation[call[image.getAbsoluteY, parameter[]], -, member[.matrix]]]
call[.addImage, parameter[member[.image], member[.matrix], member[.matrix], member[.matrix], member[.matrix], member[.matrix], member[.matrix], member[.inlineImage]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addImage] operator[SEP] identifier[Image] identifier[image] , Keyword[boolean] identifier[inlineImage] operator[SEP] Keyword[throws] identifier[DocumentException] {
Keyword[if] operator[SEP] operator[!] identifier[image] operator[SEP] identifier[hasAbsoluteY] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[DocumentException] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[float] identifier[matrix] operator[SEP] operator[SEP] operator[=] identifier[image] operator[SEP] identifier[matrix] operator[SEP] operator[SEP] operator[SEP] identifier[matrix] operator[SEP] identifier[Image] operator[SEP] identifier[CX] operator[SEP] operator[=] identifier[image] operator[SEP] identifier[getAbsoluteX] operator[SEP] operator[SEP] operator[-] identifier[matrix] operator[SEP] identifier[Image] operator[SEP] identifier[CX] operator[SEP] operator[SEP] identifier[matrix] operator[SEP] identifier[Image] operator[SEP] identifier[CY] operator[SEP] operator[=] identifier[image] operator[SEP] identifier[getAbsoluteY] operator[SEP] operator[SEP] operator[-] identifier[matrix] operator[SEP] identifier[Image] operator[SEP] identifier[CY] operator[SEP] operator[SEP] identifier[addImage] operator[SEP] identifier[image] , identifier[matrix] operator[SEP] Other[0] operator[SEP] , identifier[matrix] operator[SEP] Other[1] operator[SEP] , identifier[matrix] operator[SEP] Other[2] operator[SEP] , identifier[matrix] operator[SEP] Other[3] operator[SEP] , identifier[matrix] operator[SEP] Other[4] operator[SEP] , identifier[matrix] operator[SEP] Other[5] operator[SEP] , identifier[inlineImage] operator[SEP] operator[SEP]
}
|
private void addCalculateCrispValue(Program program, Java.CLASS clazz) {
Java.METHOD calc = clazz.addMETHOD("private", "Number", "calculateCrispValue");
calc.setComment("Calculate the crisp value");
calc.setReturnComment("the crisp value");
calc.addArg("Number", "from", "Start interval");
calc.addArg("Number", "to", "End interval");
calc.addArg("Number", "step", "Interval step");
calc.addArg("double[]", "fuzzy", "Fuzzy value");
calc.addS("double area = 0.0");
calc.addS("double moment = 0.0");
Java.FOR fout = calc.addFOR("int i = 0", "i < fuzzy.length", "i++");
fout.addS("double normalized = from.doubleValue() + (step.doubleValue() * i)");
fout.addS("area += fuzzy[i]");
fout.addS("moment += fuzzy[i] * normalized");
calc.addS("double crisp = Math.abs(area) < " + program.getEpsilon() + " ? "
+ "to.doubleValue() + step.doubleValue() : moment / area");
calc.addRETURN("Math.abs(crisp) > " + program.getEpsilon() + " ? crisp : 0.0");
} | class class_name[name] begin[{]
method[addCalculateCrispValue, return_type[void], modifier[private], parameter[program, clazz]] begin[{]
local_variable[type[Java], calc]
call[calc.setComment, parameter[literal["Calculate the crisp value"]]]
call[calc.setReturnComment, parameter[literal["the crisp value"]]]
call[calc.addArg, parameter[literal["Number"], literal["from"], literal["Start interval"]]]
call[calc.addArg, parameter[literal["Number"], literal["to"], literal["End interval"]]]
call[calc.addArg, parameter[literal["Number"], literal["step"], literal["Interval step"]]]
call[calc.addArg, parameter[literal["double[]"], literal["fuzzy"], literal["Fuzzy value"]]]
call[calc.addS, parameter[literal["double area = 0.0"]]]
call[calc.addS, parameter[literal["double moment = 0.0"]]]
local_variable[type[Java], fout]
call[fout.addS, parameter[literal["double normalized = from.doubleValue() + (step.doubleValue() * i)"]]]
call[fout.addS, parameter[literal["area += fuzzy[i]"]]]
call[fout.addS, parameter[literal["moment += fuzzy[i] * normalized"]]]
call[calc.addS, parameter[binary_operation[binary_operation[binary_operation[literal["double crisp = Math.abs(area) < "], +, call[program.getEpsilon, parameter[]]], +, literal[" ? "]], +, literal["to.doubleValue() + step.doubleValue() : moment / area"]]]]
call[calc.addRETURN, parameter[binary_operation[binary_operation[literal["Math.abs(crisp) > "], +, call[program.getEpsilon, parameter[]]], +, literal[" ? crisp : 0.0"]]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[addCalculateCrispValue] operator[SEP] identifier[Program] identifier[program] , identifier[Java] operator[SEP] identifier[CLASS] identifier[clazz] operator[SEP] {
identifier[Java] operator[SEP] identifier[METHOD] identifier[calc] operator[=] identifier[clazz] operator[SEP] identifier[addMETHOD] operator[SEP] literal[String] , literal[String] , literal[String] operator[SEP] operator[SEP] identifier[calc] operator[SEP] identifier[setComment] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[calc] operator[SEP] identifier[setReturnComment] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[calc] operator[SEP] identifier[addArg] operator[SEP] literal[String] , literal[String] , literal[String] operator[SEP] operator[SEP] identifier[calc] operator[SEP] identifier[addArg] operator[SEP] literal[String] , literal[String] , literal[String] operator[SEP] operator[SEP] identifier[calc] operator[SEP] identifier[addArg] operator[SEP] literal[String] , literal[String] , literal[String] operator[SEP] operator[SEP] identifier[calc] operator[SEP] identifier[addArg] operator[SEP] literal[String] , literal[String] , literal[String] operator[SEP] operator[SEP] identifier[calc] operator[SEP] identifier[addS] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[calc] operator[SEP] identifier[addS] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Java] operator[SEP] identifier[FOR] identifier[fout] operator[=] identifier[calc] operator[SEP] identifier[addFOR] operator[SEP] literal[String] , literal[String] , literal[String] operator[SEP] operator[SEP] identifier[fout] operator[SEP] identifier[addS] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[fout] operator[SEP] identifier[addS] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[fout] operator[SEP] identifier[addS] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[calc] operator[SEP] identifier[addS] operator[SEP] literal[String] operator[+] identifier[program] operator[SEP] identifier[getEpsilon] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] literal[String] operator[SEP] operator[SEP] identifier[calc] operator[SEP] identifier[addRETURN] operator[SEP] literal[String] operator[+] identifier[program] operator[SEP] identifier[getEpsilon] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
|
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
// Get the NetworkService.
NetworkServiceInterface networkService =
adManagerServices.get(session, NetworkServiceInterface.class);
// Get all networks that you have access to with the current authentication
// credentials.
Network[] networks = networkService.getAllNetworks();
if (networks == null || networks.length == 0) {
System.out.printf("No accessible networks found.%n");
return;
}
int i = 0;
for (Network network : networks) {
System.out.printf(
"%d) Network with network code '%s' and display name '%s' was found.%n",
i++, network.getNetworkCode(), network.getDisplayName());
}
System.out.printf("Number of networks found: %d%n", networks.length);
} | class class_name[name] begin[{]
method[runExample, return_type[void], modifier[public static], parameter[adManagerServices, session]] begin[{]
local_variable[type[NetworkServiceInterface], networkService]
local_variable[type[Network], networks]
if[binary_operation[binary_operation[member[.networks], ==, literal[null]], ||, binary_operation[member[networks.length], ==, literal[0]]]] begin[{]
call[System.out.printf, parameter[literal["No accessible networks found.%n"]]]
return[None]
else begin[{]
None
end[}]
local_variable[type[int], i]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="%d) Network with network code '%s' and display name '%s' was found.%n"), MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getNetworkCode, postfix_operators=[], prefix_operators=[], qualifier=network, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getDisplayName, postfix_operators=[], prefix_operators=[], qualifier=network, selectors=[], type_arguments=None)], member=printf, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=networks, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=network)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Network, sub_type=None))), label=None)
call[System.out.printf, parameter[literal["Number of networks found: %d%n"], member[networks.length]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[runExample] operator[SEP] identifier[AdManagerServices] identifier[adManagerServices] , identifier[AdManagerSession] identifier[session] operator[SEP] Keyword[throws] identifier[RemoteException] {
identifier[NetworkServiceInterface] identifier[networkService] operator[=] identifier[adManagerServices] operator[SEP] identifier[get] operator[SEP] identifier[session] , identifier[NetworkServiceInterface] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[Network] operator[SEP] operator[SEP] identifier[networks] operator[=] identifier[networkService] operator[SEP] identifier[getAllNetworks] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[networks] operator[==] Other[null] operator[||] identifier[networks] operator[SEP] identifier[length] operator[==] Other[0] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[printf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[Network] identifier[network] operator[:] identifier[networks] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[printf] operator[SEP] literal[String] , identifier[i] operator[++] , identifier[network] operator[SEP] identifier[getNetworkCode] operator[SEP] operator[SEP] , identifier[network] operator[SEP] identifier[getDisplayName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[printf] operator[SEP] literal[String] , identifier[networks] operator[SEP] identifier[length] operator[SEP] operator[SEP]
}
|
public static void accept(SARLQuickfixProvider provider, Issue issue, IssueResolutionAcceptor acceptor) {
final String[] data = issue.getData();
if (data != null && data.length > 1) {
final String actionName = data[1];
final ActionAddModification modification = new ActionAddModification(actionName);
modification.setIssue(issue);
modification.setTools(provider);
acceptor.accept(issue,
MessageFormat.format(Messages.SARLQuickfixProvider_2, actionName),
MessageFormat.format(Messages.SARLQuickfixProvider_3, actionName),
JavaPluginImages.IMG_CORRECTION_ADD,
modification,
IProposalRelevance.ADD_UNIMPLEMENTED_METHODS);
}
} | class class_name[name] begin[{]
method[accept, return_type[void], modifier[public static], parameter[provider, issue, acceptor]] begin[{]
local_variable[type[String], data]
if[binary_operation[binary_operation[member[.data], !=, literal[null]], &&, binary_operation[member[data.length], >, literal[1]]]] begin[{]
local_variable[type[String], actionName]
local_variable[type[ActionAddModification], modification]
call[modification.setIssue, parameter[member[.issue]]]
call[modification.setTools, parameter[member[.provider]]]
call[acceptor.accept, parameter[member[.issue], call[MessageFormat.format, parameter[member[Messages.SARLQuickfixProvider_2], member[.actionName]]], call[MessageFormat.format, parameter[member[Messages.SARLQuickfixProvider_3], member[.actionName]]], member[JavaPluginImages.IMG_CORRECTION_ADD], member[.modification], member[IProposalRelevance.ADD_UNIMPLEMENTED_METHODS]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[accept] operator[SEP] identifier[SARLQuickfixProvider] identifier[provider] , identifier[Issue] identifier[issue] , identifier[IssueResolutionAcceptor] identifier[acceptor] operator[SEP] {
Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[data] operator[=] identifier[issue] operator[SEP] identifier[getData] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[data] operator[!=] Other[null] operator[&&] identifier[data] operator[SEP] identifier[length] operator[>] Other[1] operator[SEP] {
Keyword[final] identifier[String] identifier[actionName] operator[=] identifier[data] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[final] identifier[ActionAddModification] identifier[modification] operator[=] Keyword[new] identifier[ActionAddModification] operator[SEP] identifier[actionName] operator[SEP] operator[SEP] identifier[modification] operator[SEP] identifier[setIssue] operator[SEP] identifier[issue] operator[SEP] operator[SEP] identifier[modification] operator[SEP] identifier[setTools] operator[SEP] identifier[provider] operator[SEP] operator[SEP] identifier[acceptor] operator[SEP] identifier[accept] operator[SEP] identifier[issue] , identifier[MessageFormat] operator[SEP] identifier[format] operator[SEP] identifier[Messages] operator[SEP] identifier[SARLQuickfixProvider_2] , identifier[actionName] operator[SEP] , identifier[MessageFormat] operator[SEP] identifier[format] operator[SEP] identifier[Messages] operator[SEP] identifier[SARLQuickfixProvider_3] , identifier[actionName] operator[SEP] , identifier[JavaPluginImages] operator[SEP] identifier[IMG_CORRECTION_ADD] , identifier[modification] , identifier[IProposalRelevance] operator[SEP] identifier[ADD_UNIMPLEMENTED_METHODS] operator[SEP] operator[SEP]
}
}
|
private Exception buildAndLogException(Exception e) throws Exception {
PartitionRecord pr = new PartitionRecord(false);
pr.setExecutor(_pe.name);
List<PartitionRecord> records = _pe.taskStore.find(pr);
PartitionRecord record = records.get(0);
String id = "PersistentExecutorMBean-".concat(String.valueOf(exceptionCounter.getAndIncrement()));
String logDir = record.getUserDir().concat("servers/").concat(record.getLibertyServer()).concat("/logs/");
Exception ex = new Exception(MBeanMessageHelper.getUnableToPerformOperationMessage(record.getLibertyServer(), record.getHostName(),
logDir.replace('/', File.separatorChar), id));
Object[] serverStrings = { id, Utils.stackTraceToString(e) };
Tr.error(tc, "CWWKC1559.mbean.operation.failure", serverStrings);
return ex;
} | class class_name[name] begin[{]
method[buildAndLogException, return_type[type[Exception]], modifier[private], parameter[e]] begin[{]
local_variable[type[PartitionRecord], pr]
call[pr.setExecutor, parameter[member[_pe.name]]]
local_variable[type[List], records]
local_variable[type[PartitionRecord], record]
local_variable[type[String], id]
local_variable[type[String], logDir]
local_variable[type[Exception], ex]
local_variable[type[Object], serverStrings]
call[Tr.error, parameter[member[.tc], literal["CWWKC1559.mbean.operation.failure"], member[.serverStrings]]]
return[member[.ex]]
end[}]
END[}] | Keyword[private] identifier[Exception] identifier[buildAndLogException] operator[SEP] identifier[Exception] identifier[e] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[PartitionRecord] identifier[pr] operator[=] Keyword[new] identifier[PartitionRecord] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[pr] operator[SEP] identifier[setExecutor] operator[SEP] identifier[_pe] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[PartitionRecord] operator[>] identifier[records] operator[=] identifier[_pe] operator[SEP] identifier[taskStore] operator[SEP] identifier[find] operator[SEP] identifier[pr] operator[SEP] operator[SEP] identifier[PartitionRecord] identifier[record] operator[=] identifier[records] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[String] identifier[id] operator[=] literal[String] operator[SEP] identifier[concat] operator[SEP] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[exceptionCounter] operator[SEP] identifier[getAndIncrement] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[logDir] operator[=] identifier[record] operator[SEP] identifier[getUserDir] operator[SEP] operator[SEP] operator[SEP] identifier[concat] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[concat] operator[SEP] identifier[record] operator[SEP] identifier[getLibertyServer] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[concat] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Exception] identifier[ex] operator[=] Keyword[new] identifier[Exception] operator[SEP] identifier[MBeanMessageHelper] operator[SEP] identifier[getUnableToPerformOperationMessage] operator[SEP] identifier[record] operator[SEP] identifier[getLibertyServer] operator[SEP] operator[SEP] , identifier[record] operator[SEP] identifier[getHostName] operator[SEP] operator[SEP] , identifier[logDir] operator[SEP] identifier[replace] operator[SEP] literal[String] , identifier[File] operator[SEP] identifier[separatorChar] operator[SEP] , identifier[id] operator[SEP] operator[SEP] operator[SEP] identifier[Object] operator[SEP] operator[SEP] identifier[serverStrings] operator[=] {
identifier[id] , identifier[Utils] operator[SEP] identifier[stackTraceToString] operator[SEP] identifier[e] operator[SEP]
} operator[SEP] identifier[Tr] operator[SEP] identifier[error] operator[SEP] identifier[tc] , literal[String] , identifier[serverStrings] operator[SEP] operator[SEP] Keyword[return] identifier[ex] operator[SEP]
}
|
@Override
public ImageSource apply(ImageSource source) {
if (radius != 0) {
if (source.isGrayscale()) {
return applyGrayscale(source, radius);
} else {
return applyRGB(source, radius);
}
} else {
if (source.isGrayscale()) {
return applyGrayscale(source, kernel);
} else {
return applyRGB(source, kernel);
}
}
} | class class_name[name] begin[{]
method[apply, return_type[type[ImageSource]], modifier[public], parameter[source]] begin[{]
if[binary_operation[member[.radius], !=, literal[0]]] begin[{]
if[call[source.isGrayscale, parameter[]]] begin[{]
return[call[.applyGrayscale, parameter[member[.source], member[.radius]]]]
else begin[{]
return[call[.applyRGB, parameter[member[.source], member[.radius]]]]
end[}]
else begin[{]
if[call[source.isGrayscale, parameter[]]] begin[{]
return[call[.applyGrayscale, parameter[member[.source], member[.kernel]]]]
else begin[{]
return[call[.applyRGB, parameter[member[.source], member[.kernel]]]]
end[}]
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[ImageSource] identifier[apply] operator[SEP] identifier[ImageSource] identifier[source] operator[SEP] {
Keyword[if] operator[SEP] identifier[radius] operator[!=] Other[0] operator[SEP] {
Keyword[if] operator[SEP] identifier[source] operator[SEP] identifier[isGrayscale] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[applyGrayscale] operator[SEP] identifier[source] , identifier[radius] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[applyRGB] operator[SEP] identifier[source] , identifier[radius] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[source] operator[SEP] identifier[isGrayscale] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[applyGrayscale] operator[SEP] identifier[source] , identifier[kernel] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[applyRGB] operator[SEP] identifier[source] , identifier[kernel] operator[SEP] operator[SEP]
}
}
}
|
public static void setupTracingConfig() {
TracingUtilities.setupTracingConfig();
List<String> descriptors = Arrays.asList(
"BigtableTable.getTableDescriptor",
"BigtableTable.exists",
"BigtableTable.existsAll",
"BigtableTable.batch",
"BigtableTable.batchCallback",
"BigtableTable.get",
"BigtableTable.put",
"BigtableTable.checkAndPut",
"BigtableTable.delete",
"BigtableTable.checkAndDelete",
"BigtableTable.checkAndMutate",
"BigtableTable.mutateRow",
"BigtableTable.append",
"BigtableTable.increment",
"BigtableTable.incrementColumnValue"
);
Tracing.getExportComponent().getSampledSpanStore().registerSpanNamesForCollection(descriptors);
} | class class_name[name] begin[{]
method[setupTracingConfig, return_type[void], modifier[public static], parameter[]] begin[{]
call[TracingUtilities.setupTracingConfig, parameter[]]
local_variable[type[List], descriptors]
call[Tracing.getExportComponent, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[setupTracingConfig] operator[SEP] operator[SEP] {
identifier[TracingUtilities] operator[SEP] identifier[setupTracingConfig] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[descriptors] operator[=] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] literal[String] , literal[String] , literal[String] , literal[String] , literal[String] , literal[String] , literal[String] , literal[String] , literal[String] , literal[String] , literal[String] , literal[String] , literal[String] , literal[String] , literal[String] operator[SEP] operator[SEP] identifier[Tracing] operator[SEP] identifier[getExportComponent] operator[SEP] operator[SEP] operator[SEP] identifier[getSampledSpanStore] operator[SEP] operator[SEP] operator[SEP] identifier[registerSpanNamesForCollection] operator[SEP] identifier[descriptors] operator[SEP] operator[SEP]
}
|
public int add(int label,float score) {
int i = 0;
int max;
if(n==-1)
max = scores.size();
else
max = n>scores.size()?scores.size():n;
for (i = 0; i < max; i++) {
if (score > scores.get(i))
break;
}
//TODO: 没有删除多余的信息
if(n!=-1&&i>=n)
return -1;
if(i<scores.size()){
scores.insert(i,score);
labels.insert(i,label);
}else{
scores.add(score);
labels.add(label);
}
return i;
} | class class_name[name] begin[{]
method[add, return_type[type[int]], modifier[public], parameter[label, score]] begin[{]
local_variable[type[int], i]
local_variable[type[int], max]
if[binary_operation[member[.n], ==, literal[1]]] begin[{]
assign[member[.max], call[scores.size, parameter[]]]
else begin[{]
assign[member[.max], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=scores, selectors=[], type_arguments=None), operator=>), if_false=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=scores, selectors=[], type_arguments=None))]
end[}]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=score, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=scores, selectors=[], type_arguments=None), operator=>), else_statement=None, label=None, then_statement=BreakStatement(goto=None, label=None))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=max, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=[Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))], update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
if[binary_operation[binary_operation[member[.n], !=, literal[1]], &&, binary_operation[member[.i], >=, member[.n]]]] begin[{]
return[literal[1]]
else begin[{]
None
end[}]
if[binary_operation[member[.i], <, call[scores.size, parameter[]]]] begin[{]
call[scores.insert, parameter[member[.i], member[.score]]]
call[labels.insert, parameter[member[.i], member[.label]]]
else begin[{]
call[scores.add, parameter[member[.score]]]
call[labels.add, parameter[member[.label]]]
end[}]
return[member[.i]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[add] operator[SEP] Keyword[int] identifier[label] , Keyword[float] identifier[score] operator[SEP] {
Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] Keyword[int] identifier[max] operator[SEP] Keyword[if] operator[SEP] identifier[n] operator[==] operator[-] Other[1] operator[SEP] identifier[max] operator[=] identifier[scores] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[else] identifier[max] operator[=] identifier[n] operator[>] identifier[scores] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[?] identifier[scores] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[:] identifier[n] operator[SEP] Keyword[for] operator[SEP] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[max] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[score] operator[>] identifier[scores] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
Keyword[if] operator[SEP] identifier[n] operator[!=] operator[-] Other[1] operator[&&] identifier[i] operator[>=] identifier[n] operator[SEP] Keyword[return] operator[-] Other[1] operator[SEP] Keyword[if] operator[SEP] identifier[i] operator[<] identifier[scores] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] {
identifier[scores] operator[SEP] identifier[insert] operator[SEP] identifier[i] , identifier[score] operator[SEP] operator[SEP] identifier[labels] operator[SEP] identifier[insert] operator[SEP] identifier[i] , identifier[label] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[scores] operator[SEP] identifier[add] operator[SEP] identifier[score] operator[SEP] operator[SEP] identifier[labels] operator[SEP] identifier[add] operator[SEP] identifier[label] operator[SEP] operator[SEP]
}
Keyword[return] identifier[i] operator[SEP]
}
|
@SuppressWarnings("unchecked")
public <T extends XPathBuilder> T addSearchTextType(SearchType... searchTextTypes) {
if (searchTextTypes != null) {
this.searchTextType.addAll(0, Arrays.asList(searchTextTypes));
}
this.searchTextType = cleanUpSearchType(this.searchTextType);
return (T) this;
} | class class_name[name] begin[{]
method[addSearchTextType, return_type[type[T]], modifier[public], parameter[searchTextTypes]] begin[{]
if[binary_operation[member[.searchTextTypes], !=, literal[null]]] begin[{]
THIS[member[None.searchTextType]call[None.addAll, parameter[literal[0], call[Arrays.asList, parameter[member[.searchTextTypes]]]]]]
else begin[{]
None
end[}]
assign[THIS[member[None.searchTextType]], call[.cleanUpSearchType, parameter[THIS[member[None.searchTextType]]]]]
return[Cast(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] operator[<] identifier[T] Keyword[extends] identifier[XPathBuilder] operator[>] identifier[T] identifier[addSearchTextType] operator[SEP] identifier[SearchType] operator[...] identifier[searchTextTypes] operator[SEP] {
Keyword[if] operator[SEP] identifier[searchTextTypes] operator[!=] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[searchTextType] operator[SEP] identifier[addAll] operator[SEP] Other[0] , identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[searchTextTypes] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[searchTextType] operator[=] identifier[cleanUpSearchType] operator[SEP] Keyword[this] operator[SEP] identifier[searchTextType] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[T] operator[SEP] Keyword[this] operator[SEP]
}
|
protected void reconnect() {
disconnect().then(ok -> {
logger.info("Trying to reconnect...");
scheduler.schedule(this::connect, 5, TimeUnit.SECONDS);
}).catchError(cause -> {
logger.warn("Unable to disconnect from Redis server!", cause);
scheduler.schedule(this::connect, 5, TimeUnit.SECONDS);
});
} | class class_name[name] begin[{]
method[reconnect, return_type[void], modifier[protected], parameter[]] begin[{]
call[.disconnect, parameter[]]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[reconnect] operator[SEP] operator[SEP] {
identifier[disconnect] operator[SEP] operator[SEP] operator[SEP] identifier[then] operator[SEP] identifier[ok] operator[->] {
identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[scheduler] operator[SEP] identifier[schedule] operator[SEP] Keyword[this] operator[::] identifier[connect] , Other[5] , identifier[TimeUnit] operator[SEP] identifier[SECONDS] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP] identifier[catchError] operator[SEP] identifier[cause] operator[->] {
identifier[logger] operator[SEP] identifier[warn] operator[SEP] literal[String] , identifier[cause] operator[SEP] operator[SEP] identifier[scheduler] operator[SEP] identifier[schedule] operator[SEP] Keyword[this] operator[::] identifier[connect] , Other[5] , identifier[TimeUnit] operator[SEP] identifier[SECONDS] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP]
}
|
public Project getProject(String namespace, String project, Boolean includeStatistics) throws GitLabApiException {
if (namespace == null) {
throw new RuntimeException("namespace cannot be null");
}
if (project == null) {
throw new RuntimeException("project cannot be null");
}
String projectPath = null;
try {
projectPath = URLEncoder.encode(namespace + "/" + project, "UTF-8");
} catch (UnsupportedEncodingException uee) {
throw (new GitLabApiException(uee));
}
Form formData = new GitLabApiForm().withParam("statistics", includeStatistics);
Response response = get(Response.Status.OK, formData.asMap(), "projects", projectPath);
return (response.readEntity(Project.class));
} | class class_name[name] begin[{]
method[getProject, return_type[type[Project]], modifier[public], parameter[namespace, project, includeStatistics]] begin[{]
if[binary_operation[member[.namespace], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="namespace cannot be null")], 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[}]
if[binary_operation[member[.project], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="project cannot be null")], 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[}]
local_variable[type[String], projectPath]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=projectPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=namespace, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/"), operator=+), operandr=MemberReference(member=project, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="UTF-8")], member=encode, postfix_operators=[], prefix_operators=[], qualifier=URLEncoder, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=uee, 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=GitLabApiException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=uee, types=['UnsupportedEncodingException']))], finally_block=None, label=None, resources=None)
local_variable[type[Form], formData]
local_variable[type[Response], response]
return[call[response.readEntity, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Project, sub_type=None))]]]
end[}]
END[}] | Keyword[public] identifier[Project] identifier[getProject] operator[SEP] identifier[String] identifier[namespace] , identifier[String] identifier[project] , identifier[Boolean] identifier[includeStatistics] operator[SEP] Keyword[throws] identifier[GitLabApiException] {
Keyword[if] operator[SEP] identifier[namespace] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[project] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[String] identifier[projectPath] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[projectPath] operator[=] identifier[URLEncoder] operator[SEP] identifier[encode] operator[SEP] identifier[namespace] operator[+] literal[String] operator[+] identifier[project] , literal[String] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[UnsupportedEncodingException] identifier[uee] operator[SEP] {
Keyword[throw] operator[SEP] Keyword[new] identifier[GitLabApiException] operator[SEP] identifier[uee] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Form] identifier[formData] operator[=] Keyword[new] identifier[GitLabApiForm] operator[SEP] operator[SEP] operator[SEP] identifier[withParam] operator[SEP] literal[String] , identifier[includeStatistics] operator[SEP] operator[SEP] identifier[Response] identifier[response] operator[=] identifier[get] operator[SEP] identifier[Response] operator[SEP] identifier[Status] operator[SEP] identifier[OK] , identifier[formData] operator[SEP] identifier[asMap] operator[SEP] operator[SEP] , literal[String] , identifier[projectPath] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[response] operator[SEP] identifier[readEntity] operator[SEP] identifier[Project] operator[SEP] Keyword[class] operator[SEP] operator[SEP] operator[SEP]
}
|
private void writeJobStates(JsonWriter jsonWriter, List<? extends JobState> jobStates) throws IOException {
jsonWriter.beginArray();
for (JobState jobState : jobStates) {
writeJobState(jsonWriter, jobState);
}
jsonWriter.endArray();
} | class class_name[name] begin[{]
method[writeJobStates, return_type[void], modifier[private], parameter[jsonWriter, jobStates]] begin[{]
call[jsonWriter.beginArray, parameter[]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=jsonWriter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=jobState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeJobState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=jobStates, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=jobState)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JobState, sub_type=None))), label=None)
call[jsonWriter.endArray, parameter[]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[writeJobStates] operator[SEP] identifier[JsonWriter] identifier[jsonWriter] , identifier[List] operator[<] operator[?] Keyword[extends] identifier[JobState] operator[>] identifier[jobStates] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[jsonWriter] operator[SEP] identifier[beginArray] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[JobState] identifier[jobState] operator[:] identifier[jobStates] operator[SEP] {
identifier[writeJobState] operator[SEP] identifier[jsonWriter] , identifier[jobState] operator[SEP] operator[SEP]
}
identifier[jsonWriter] operator[SEP] identifier[endArray] operator[SEP] operator[SEP] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.