code stringlengths 63 466k | code_sememe stringlengths 141 3.79M | token_type stringlengths 274 1.23M |
|---|---|---|
public void forEach(final Function<T, Void> function)
{
for ( final ListenerEntry<T> entry : listeners.values() )
{
entry.executor.execute
(
new Runnable()
{
@Override
public void run()
{
try
{
function.apply(entry.listener);
}
catch ( Throwable e )
{
log.error(String.format("Listener (%s) threw an exception", entry.listener), e);
}
}
}
);
}
} | class class_name[name] begin[{]
method[forEach, return_type[void], modifier[public], parameter[function]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=listener, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[])], member=apply, postfix_operators=[], prefix_operators=[], qualifier=function, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Listener (%s) threw an exception"), MemberReference(member=listener, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Throwable']))], finally_block=None, label=None, resources=None)], documentation=None, modifiers={'public'}, name=run, 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=Runnable, sub_type=None))], member=execute, postfix_operators=[], prefix_operators=[], qualifier=entry.executor, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=values, postfix_operators=[], prefix_operators=[], qualifier=listeners, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=ListenerEntry, sub_type=None))), label=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[forEach] operator[SEP] Keyword[final] identifier[Function] operator[<] identifier[T] , identifier[Void] operator[>] identifier[function] operator[SEP] {
Keyword[for] operator[SEP] Keyword[final] identifier[ListenerEntry] operator[<] identifier[T] operator[>] identifier[entry] operator[:] identifier[listeners] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] {
identifier[entry] operator[SEP] identifier[executor] operator[SEP] identifier[execute] operator[SEP] Keyword[new] identifier[Runnable] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[run] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[function] operator[SEP] identifier[apply] operator[SEP] identifier[entry] operator[SEP] identifier[listener] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[e] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[entry] operator[SEP] identifier[listener] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
} operator[SEP] operator[SEP]
}
}
|
public EClass getIfcDistributionElementType() {
if (ifcDistributionElementTypeEClass == null) {
ifcDistributionElementTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(162);
}
return ifcDistributionElementTypeEClass;
} | class class_name[name] begin[{]
method[getIfcDistributionElementType, return_type[type[EClass]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.ifcDistributionElementTypeEClass], ==, literal[null]]] begin[{]
assign[member[.ifcDistributionElementTypeEClass], 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=162)], 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[.ifcDistributionElementTypeEClass]]
end[}]
END[}] | Keyword[public] identifier[EClass] identifier[getIfcDistributionElementType] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[ifcDistributionElementTypeEClass] operator[==] Other[null] operator[SEP] {
identifier[ifcDistributionElementTypeEClass] 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[162] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ifcDistributionElementTypeEClass] operator[SEP]
}
|
@NotNull
public final String marshal(@NotNull final SerializerRegistry registry,
@NotNull final CommonEvent commonEvent) {
Contract.requireArgNotNull("registry", registry);
Contract.requireArgNotNull("commonEvent", commonEvent);
final Serializer serializer = registry.getSerializer(EscEvent.SER_TYPE);
final EscEvent event = createEscEvent(registry, serializer.getMimeType(), commonEvent);
final byte[] data = serializer.marshal(event, EscEvent.SER_TYPE);
return new String(data, serializer.getMimeType().getEncoding());
} | class class_name[name] begin[{]
method[marshal, return_type[type[String]], modifier[final public], parameter[registry, commonEvent]] begin[{]
call[Contract.requireArgNotNull, parameter[literal["registry"], member[.registry]]]
call[Contract.requireArgNotNull, parameter[literal["commonEvent"], member[.commonEvent]]]
local_variable[type[Serializer], serializer]
local_variable[type[EscEvent], event]
local_variable[type[byte], data]
return[ClassCreator(arguments=[MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getMimeType, postfix_operators=[], prefix_operators=[], qualifier=serializer, selectors=[MethodInvocation(arguments=[], member=getEncoding, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[NotNull] Keyword[public] Keyword[final] identifier[String] identifier[marshal] operator[SEP] annotation[@] identifier[NotNull] Keyword[final] identifier[SerializerRegistry] identifier[registry] , annotation[@] identifier[NotNull] Keyword[final] identifier[CommonEvent] identifier[commonEvent] operator[SEP] {
identifier[Contract] operator[SEP] identifier[requireArgNotNull] operator[SEP] literal[String] , identifier[registry] operator[SEP] operator[SEP] identifier[Contract] operator[SEP] identifier[requireArgNotNull] operator[SEP] literal[String] , identifier[commonEvent] operator[SEP] operator[SEP] Keyword[final] identifier[Serializer] identifier[serializer] operator[=] identifier[registry] operator[SEP] identifier[getSerializer] operator[SEP] identifier[EscEvent] operator[SEP] identifier[SER_TYPE] operator[SEP] operator[SEP] Keyword[final] identifier[EscEvent] identifier[event] operator[=] identifier[createEscEvent] operator[SEP] identifier[registry] , identifier[serializer] operator[SEP] identifier[getMimeType] operator[SEP] operator[SEP] , identifier[commonEvent] operator[SEP] operator[SEP] Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[data] operator[=] identifier[serializer] operator[SEP] identifier[marshal] operator[SEP] identifier[event] , identifier[EscEvent] operator[SEP] identifier[SER_TYPE] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[String] operator[SEP] identifier[data] , identifier[serializer] operator[SEP] identifier[getMimeType] operator[SEP] operator[SEP] operator[SEP] identifier[getEncoding] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public Observable<Page<QuotaInner>> listAsync(final String location) {
return listWithServiceResponseAsync(location)
.map(new Func1<ServiceResponse<Page<QuotaInner>>, Page<QuotaInner>>() {
@Override
public Page<QuotaInner> call(ServiceResponse<Page<QuotaInner>> response) {
return response.body();
}
});
} | class class_name[name] begin[{]
method[listAsync, return_type[type[Observable]], modifier[public], parameter[location]] begin[{]
return[call[.listWithServiceResponseAsync, parameter[member[.location]]]]
end[}]
END[}] | Keyword[public] identifier[Observable] operator[<] identifier[Page] operator[<] identifier[QuotaInner] operator[>] operator[>] identifier[listAsync] operator[SEP] Keyword[final] identifier[String] identifier[location] operator[SEP] {
Keyword[return] identifier[listWithServiceResponseAsync] operator[SEP] identifier[location] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[QuotaInner] operator[>] operator[>] , identifier[Page] operator[<] identifier[QuotaInner] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Page] operator[<] identifier[QuotaInner] operator[>] identifier[call] operator[SEP] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[QuotaInner] operator[>] operator[>] identifier[response] operator[SEP] {
Keyword[return] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
public void img(Object base, String localName) throws SAXException {
output.write(
"<IMG src='"+res(base,localName)+"'>");
} | class class_name[name] begin[{]
method[img, return_type[void], modifier[public], parameter[base, localName]] begin[{]
call[output.write, parameter[binary_operation[binary_operation[literal["<IMG src='"], +, call[.res, parameter[member[.base], member[.localName]]]], +, literal["'>"]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[img] operator[SEP] identifier[Object] identifier[base] , identifier[String] identifier[localName] operator[SEP] Keyword[throws] identifier[SAXException] {
identifier[output] operator[SEP] identifier[write] operator[SEP] literal[String] operator[+] identifier[res] operator[SEP] identifier[base] , identifier[localName] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
|
public DistributedVirtualSwitchProductSpec[] queryAvailableDvsSpec(Boolean recommended) throws RuntimeFault, RemoteException {
return getVimService().queryAvailableDvsSpec(getMOR(), recommended);
} | class class_name[name] begin[{]
method[queryAvailableDvsSpec, return_type[type[DistributedVirtualSwitchProductSpec]], modifier[public], parameter[recommended]] begin[{]
return[call[.getVimService, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[DistributedVirtualSwitchProductSpec] operator[SEP] operator[SEP] identifier[queryAvailableDvsSpec] operator[SEP] identifier[Boolean] identifier[recommended] operator[SEP] Keyword[throws] identifier[RuntimeFault] , identifier[RemoteException] {
Keyword[return] identifier[getVimService] operator[SEP] operator[SEP] operator[SEP] identifier[queryAvailableDvsSpec] operator[SEP] identifier[getMOR] operator[SEP] operator[SEP] , identifier[recommended] operator[SEP] operator[SEP]
}
|
public static void multAddOuter( double alpha , DMatrix6x6 A , double beta , DMatrix6 u , DMatrix6 v , DMatrix6x6 C ) {
C.a11 = alpha*A.a11 + beta*u.a1*v.a1;
C.a12 = alpha*A.a12 + beta*u.a1*v.a2;
C.a13 = alpha*A.a13 + beta*u.a1*v.a3;
C.a14 = alpha*A.a14 + beta*u.a1*v.a4;
C.a15 = alpha*A.a15 + beta*u.a1*v.a5;
C.a16 = alpha*A.a16 + beta*u.a1*v.a6;
C.a21 = alpha*A.a21 + beta*u.a2*v.a1;
C.a22 = alpha*A.a22 + beta*u.a2*v.a2;
C.a23 = alpha*A.a23 + beta*u.a2*v.a3;
C.a24 = alpha*A.a24 + beta*u.a2*v.a4;
C.a25 = alpha*A.a25 + beta*u.a2*v.a5;
C.a26 = alpha*A.a26 + beta*u.a2*v.a6;
C.a31 = alpha*A.a31 + beta*u.a3*v.a1;
C.a32 = alpha*A.a32 + beta*u.a3*v.a2;
C.a33 = alpha*A.a33 + beta*u.a3*v.a3;
C.a34 = alpha*A.a34 + beta*u.a3*v.a4;
C.a35 = alpha*A.a35 + beta*u.a3*v.a5;
C.a36 = alpha*A.a36 + beta*u.a3*v.a6;
C.a41 = alpha*A.a41 + beta*u.a4*v.a1;
C.a42 = alpha*A.a42 + beta*u.a4*v.a2;
C.a43 = alpha*A.a43 + beta*u.a4*v.a3;
C.a44 = alpha*A.a44 + beta*u.a4*v.a4;
C.a45 = alpha*A.a45 + beta*u.a4*v.a5;
C.a46 = alpha*A.a46 + beta*u.a4*v.a6;
C.a51 = alpha*A.a51 + beta*u.a5*v.a1;
C.a52 = alpha*A.a52 + beta*u.a5*v.a2;
C.a53 = alpha*A.a53 + beta*u.a5*v.a3;
C.a54 = alpha*A.a54 + beta*u.a5*v.a4;
C.a55 = alpha*A.a55 + beta*u.a5*v.a5;
C.a56 = alpha*A.a56 + beta*u.a5*v.a6;
C.a61 = alpha*A.a61 + beta*u.a6*v.a1;
C.a62 = alpha*A.a62 + beta*u.a6*v.a2;
C.a63 = alpha*A.a63 + beta*u.a6*v.a3;
C.a64 = alpha*A.a64 + beta*u.a6*v.a4;
C.a65 = alpha*A.a65 + beta*u.a6*v.a5;
C.a66 = alpha*A.a66 + beta*u.a6*v.a6;
} | class class_name[name] begin[{]
method[multAddOuter, return_type[void], modifier[public static], parameter[alpha, A, beta, u, v, C]] begin[{]
assign[member[C.a11], binary_operation[binary_operation[member[.alpha], *, member[A.a11]], +, binary_operation[binary_operation[member[.beta], *, member[u.a1]], *, member[v.a1]]]]
assign[member[C.a12], binary_operation[binary_operation[member[.alpha], *, member[A.a12]], +, binary_operation[binary_operation[member[.beta], *, member[u.a1]], *, member[v.a2]]]]
assign[member[C.a13], binary_operation[binary_operation[member[.alpha], *, member[A.a13]], +, binary_operation[binary_operation[member[.beta], *, member[u.a1]], *, member[v.a3]]]]
assign[member[C.a14], binary_operation[binary_operation[member[.alpha], *, member[A.a14]], +, binary_operation[binary_operation[member[.beta], *, member[u.a1]], *, member[v.a4]]]]
assign[member[C.a15], binary_operation[binary_operation[member[.alpha], *, member[A.a15]], +, binary_operation[binary_operation[member[.beta], *, member[u.a1]], *, member[v.a5]]]]
assign[member[C.a16], binary_operation[binary_operation[member[.alpha], *, member[A.a16]], +, binary_operation[binary_operation[member[.beta], *, member[u.a1]], *, member[v.a6]]]]
assign[member[C.a21], binary_operation[binary_operation[member[.alpha], *, member[A.a21]], +, binary_operation[binary_operation[member[.beta], *, member[u.a2]], *, member[v.a1]]]]
assign[member[C.a22], binary_operation[binary_operation[member[.alpha], *, member[A.a22]], +, binary_operation[binary_operation[member[.beta], *, member[u.a2]], *, member[v.a2]]]]
assign[member[C.a23], binary_operation[binary_operation[member[.alpha], *, member[A.a23]], +, binary_operation[binary_operation[member[.beta], *, member[u.a2]], *, member[v.a3]]]]
assign[member[C.a24], binary_operation[binary_operation[member[.alpha], *, member[A.a24]], +, binary_operation[binary_operation[member[.beta], *, member[u.a2]], *, member[v.a4]]]]
assign[member[C.a25], binary_operation[binary_operation[member[.alpha], *, member[A.a25]], +, binary_operation[binary_operation[member[.beta], *, member[u.a2]], *, member[v.a5]]]]
assign[member[C.a26], binary_operation[binary_operation[member[.alpha], *, member[A.a26]], +, binary_operation[binary_operation[member[.beta], *, member[u.a2]], *, member[v.a6]]]]
assign[member[C.a31], binary_operation[binary_operation[member[.alpha], *, member[A.a31]], +, binary_operation[binary_operation[member[.beta], *, member[u.a3]], *, member[v.a1]]]]
assign[member[C.a32], binary_operation[binary_operation[member[.alpha], *, member[A.a32]], +, binary_operation[binary_operation[member[.beta], *, member[u.a3]], *, member[v.a2]]]]
assign[member[C.a33], binary_operation[binary_operation[member[.alpha], *, member[A.a33]], +, binary_operation[binary_operation[member[.beta], *, member[u.a3]], *, member[v.a3]]]]
assign[member[C.a34], binary_operation[binary_operation[member[.alpha], *, member[A.a34]], +, binary_operation[binary_operation[member[.beta], *, member[u.a3]], *, member[v.a4]]]]
assign[member[C.a35], binary_operation[binary_operation[member[.alpha], *, member[A.a35]], +, binary_operation[binary_operation[member[.beta], *, member[u.a3]], *, member[v.a5]]]]
assign[member[C.a36], binary_operation[binary_operation[member[.alpha], *, member[A.a36]], +, binary_operation[binary_operation[member[.beta], *, member[u.a3]], *, member[v.a6]]]]
assign[member[C.a41], binary_operation[binary_operation[member[.alpha], *, member[A.a41]], +, binary_operation[binary_operation[member[.beta], *, member[u.a4]], *, member[v.a1]]]]
assign[member[C.a42], binary_operation[binary_operation[member[.alpha], *, member[A.a42]], +, binary_operation[binary_operation[member[.beta], *, member[u.a4]], *, member[v.a2]]]]
assign[member[C.a43], binary_operation[binary_operation[member[.alpha], *, member[A.a43]], +, binary_operation[binary_operation[member[.beta], *, member[u.a4]], *, member[v.a3]]]]
assign[member[C.a44], binary_operation[binary_operation[member[.alpha], *, member[A.a44]], +, binary_operation[binary_operation[member[.beta], *, member[u.a4]], *, member[v.a4]]]]
assign[member[C.a45], binary_operation[binary_operation[member[.alpha], *, member[A.a45]], +, binary_operation[binary_operation[member[.beta], *, member[u.a4]], *, member[v.a5]]]]
assign[member[C.a46], binary_operation[binary_operation[member[.alpha], *, member[A.a46]], +, binary_operation[binary_operation[member[.beta], *, member[u.a4]], *, member[v.a6]]]]
assign[member[C.a51], binary_operation[binary_operation[member[.alpha], *, member[A.a51]], +, binary_operation[binary_operation[member[.beta], *, member[u.a5]], *, member[v.a1]]]]
assign[member[C.a52], binary_operation[binary_operation[member[.alpha], *, member[A.a52]], +, binary_operation[binary_operation[member[.beta], *, member[u.a5]], *, member[v.a2]]]]
assign[member[C.a53], binary_operation[binary_operation[member[.alpha], *, member[A.a53]], +, binary_operation[binary_operation[member[.beta], *, member[u.a5]], *, member[v.a3]]]]
assign[member[C.a54], binary_operation[binary_operation[member[.alpha], *, member[A.a54]], +, binary_operation[binary_operation[member[.beta], *, member[u.a5]], *, member[v.a4]]]]
assign[member[C.a55], binary_operation[binary_operation[member[.alpha], *, member[A.a55]], +, binary_operation[binary_operation[member[.beta], *, member[u.a5]], *, member[v.a5]]]]
assign[member[C.a56], binary_operation[binary_operation[member[.alpha], *, member[A.a56]], +, binary_operation[binary_operation[member[.beta], *, member[u.a5]], *, member[v.a6]]]]
assign[member[C.a61], binary_operation[binary_operation[member[.alpha], *, member[A.a61]], +, binary_operation[binary_operation[member[.beta], *, member[u.a6]], *, member[v.a1]]]]
assign[member[C.a62], binary_operation[binary_operation[member[.alpha], *, member[A.a62]], +, binary_operation[binary_operation[member[.beta], *, member[u.a6]], *, member[v.a2]]]]
assign[member[C.a63], binary_operation[binary_operation[member[.alpha], *, member[A.a63]], +, binary_operation[binary_operation[member[.beta], *, member[u.a6]], *, member[v.a3]]]]
assign[member[C.a64], binary_operation[binary_operation[member[.alpha], *, member[A.a64]], +, binary_operation[binary_operation[member[.beta], *, member[u.a6]], *, member[v.a4]]]]
assign[member[C.a65], binary_operation[binary_operation[member[.alpha], *, member[A.a65]], +, binary_operation[binary_operation[member[.beta], *, member[u.a6]], *, member[v.a5]]]]
assign[member[C.a66], binary_operation[binary_operation[member[.alpha], *, member[A.a66]], +, binary_operation[binary_operation[member[.beta], *, member[u.a6]], *, member[v.a6]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[multAddOuter] operator[SEP] Keyword[double] identifier[alpha] , identifier[DMatrix6x6] identifier[A] , Keyword[double] identifier[beta] , identifier[DMatrix6] identifier[u] , identifier[DMatrix6] identifier[v] , identifier[DMatrix6x6] identifier[C] operator[SEP] {
identifier[C] operator[SEP] identifier[a11] operator[=] identifier[alpha] operator[*] identifier[A] operator[SEP] identifier[a11] operator[+] identifier[beta] operator[*] identifier[u] operator[SEP] identifier[a1] operator[*] identifier[v] operator[SEP] identifier[a1] operator[SEP] identifier[C] operator[SEP] identifier[a12] operator[=] identifier[alpha] operator[*] identifier[A] operator[SEP] identifier[a12] operator[+] identifier[beta] operator[*] identifier[u] operator[SEP] identifier[a1] operator[*] identifier[v] operator[SEP] identifier[a2] operator[SEP] identifier[C] operator[SEP] identifier[a13] operator[=] identifier[alpha] operator[*] identifier[A] operator[SEP] identifier[a13] operator[+] identifier[beta] operator[*] identifier[u] operator[SEP] identifier[a1] operator[*] identifier[v] operator[SEP] identifier[a3] operator[SEP] identifier[C] operator[SEP] identifier[a14] operator[=] identifier[alpha] operator[*] identifier[A] operator[SEP] identifier[a14] operator[+] identifier[beta] operator[*] identifier[u] operator[SEP] identifier[a1] operator[*] identifier[v] operator[SEP] identifier[a4] operator[SEP] identifier[C] operator[SEP] identifier[a15] operator[=] identifier[alpha] operator[*] identifier[A] operator[SEP] identifier[a15] operator[+] identifier[beta] operator[*] identifier[u] operator[SEP] identifier[a1] operator[*] identifier[v] operator[SEP] identifier[a5] operator[SEP] identifier[C] operator[SEP] identifier[a16] operator[=] identifier[alpha] operator[*] identifier[A] operator[SEP] identifier[a16] operator[+] identifier[beta] operator[*] identifier[u] operator[SEP] identifier[a1] operator[*] identifier[v] operator[SEP] identifier[a6] operator[SEP] identifier[C] operator[SEP] identifier[a21] operator[=] identifier[alpha] operator[*] identifier[A] operator[SEP] identifier[a21] operator[+] identifier[beta] operator[*] identifier[u] operator[SEP] identifier[a2] operator[*] identifier[v] operator[SEP] identifier[a1] operator[SEP] identifier[C] operator[SEP] identifier[a22] operator[=] identifier[alpha] operator[*] identifier[A] operator[SEP] identifier[a22] operator[+] identifier[beta] operator[*] identifier[u] operator[SEP] identifier[a2] operator[*] identifier[v] operator[SEP] identifier[a2] operator[SEP] identifier[C] operator[SEP] identifier[a23] operator[=] identifier[alpha] operator[*] identifier[A] operator[SEP] identifier[a23] operator[+] identifier[beta] operator[*] identifier[u] operator[SEP] identifier[a2] operator[*] identifier[v] operator[SEP] identifier[a3] operator[SEP] identifier[C] operator[SEP] identifier[a24] operator[=] identifier[alpha] operator[*] identifier[A] operator[SEP] identifier[a24] operator[+] identifier[beta] operator[*] identifier[u] operator[SEP] identifier[a2] operator[*] identifier[v] operator[SEP] identifier[a4] operator[SEP] identifier[C] operator[SEP] identifier[a25] operator[=] identifier[alpha] operator[*] identifier[A] operator[SEP] identifier[a25] operator[+] identifier[beta] operator[*] identifier[u] operator[SEP] identifier[a2] operator[*] identifier[v] operator[SEP] identifier[a5] operator[SEP] identifier[C] operator[SEP] identifier[a26] operator[=] identifier[alpha] operator[*] identifier[A] operator[SEP] identifier[a26] operator[+] identifier[beta] operator[*] identifier[u] operator[SEP] identifier[a2] operator[*] identifier[v] operator[SEP] identifier[a6] operator[SEP] identifier[C] operator[SEP] identifier[a31] operator[=] identifier[alpha] operator[*] identifier[A] operator[SEP] identifier[a31] operator[+] identifier[beta] operator[*] identifier[u] operator[SEP] identifier[a3] operator[*] identifier[v] operator[SEP] identifier[a1] operator[SEP] identifier[C] operator[SEP] identifier[a32] operator[=] identifier[alpha] operator[*] identifier[A] operator[SEP] identifier[a32] operator[+] identifier[beta] operator[*] identifier[u] operator[SEP] identifier[a3] operator[*] identifier[v] operator[SEP] identifier[a2] operator[SEP] identifier[C] operator[SEP] identifier[a33] operator[=] identifier[alpha] operator[*] identifier[A] operator[SEP] identifier[a33] operator[+] identifier[beta] operator[*] identifier[u] operator[SEP] identifier[a3] operator[*] identifier[v] operator[SEP] identifier[a3] operator[SEP] identifier[C] operator[SEP] identifier[a34] operator[=] identifier[alpha] operator[*] identifier[A] operator[SEP] identifier[a34] operator[+] identifier[beta] operator[*] identifier[u] operator[SEP] identifier[a3] operator[*] identifier[v] operator[SEP] identifier[a4] operator[SEP] identifier[C] operator[SEP] identifier[a35] operator[=] identifier[alpha] operator[*] identifier[A] operator[SEP] identifier[a35] operator[+] identifier[beta] operator[*] identifier[u] operator[SEP] identifier[a3] operator[*] identifier[v] operator[SEP] identifier[a5] operator[SEP] identifier[C] operator[SEP] identifier[a36] operator[=] identifier[alpha] operator[*] identifier[A] operator[SEP] identifier[a36] operator[+] identifier[beta] operator[*] identifier[u] operator[SEP] identifier[a3] operator[*] identifier[v] operator[SEP] identifier[a6] operator[SEP] identifier[C] operator[SEP] identifier[a41] operator[=] identifier[alpha] operator[*] identifier[A] operator[SEP] identifier[a41] operator[+] identifier[beta] operator[*] identifier[u] operator[SEP] identifier[a4] operator[*] identifier[v] operator[SEP] identifier[a1] operator[SEP] identifier[C] operator[SEP] identifier[a42] operator[=] identifier[alpha] operator[*] identifier[A] operator[SEP] identifier[a42] operator[+] identifier[beta] operator[*] identifier[u] operator[SEP] identifier[a4] operator[*] identifier[v] operator[SEP] identifier[a2] operator[SEP] identifier[C] operator[SEP] identifier[a43] operator[=] identifier[alpha] operator[*] identifier[A] operator[SEP] identifier[a43] operator[+] identifier[beta] operator[*] identifier[u] operator[SEP] identifier[a4] operator[*] identifier[v] operator[SEP] identifier[a3] operator[SEP] identifier[C] operator[SEP] identifier[a44] operator[=] identifier[alpha] operator[*] identifier[A] operator[SEP] identifier[a44] operator[+] identifier[beta] operator[*] identifier[u] operator[SEP] identifier[a4] operator[*] identifier[v] operator[SEP] identifier[a4] operator[SEP] identifier[C] operator[SEP] identifier[a45] operator[=] identifier[alpha] operator[*] identifier[A] operator[SEP] identifier[a45] operator[+] identifier[beta] operator[*] identifier[u] operator[SEP] identifier[a4] operator[*] identifier[v] operator[SEP] identifier[a5] operator[SEP] identifier[C] operator[SEP] identifier[a46] operator[=] identifier[alpha] operator[*] identifier[A] operator[SEP] identifier[a46] operator[+] identifier[beta] operator[*] identifier[u] operator[SEP] identifier[a4] operator[*] identifier[v] operator[SEP] identifier[a6] operator[SEP] identifier[C] operator[SEP] identifier[a51] operator[=] identifier[alpha] operator[*] identifier[A] operator[SEP] identifier[a51] operator[+] identifier[beta] operator[*] identifier[u] operator[SEP] identifier[a5] operator[*] identifier[v] operator[SEP] identifier[a1] operator[SEP] identifier[C] operator[SEP] identifier[a52] operator[=] identifier[alpha] operator[*] identifier[A] operator[SEP] identifier[a52] operator[+] identifier[beta] operator[*] identifier[u] operator[SEP] identifier[a5] operator[*] identifier[v] operator[SEP] identifier[a2] operator[SEP] identifier[C] operator[SEP] identifier[a53] operator[=] identifier[alpha] operator[*] identifier[A] operator[SEP] identifier[a53] operator[+] identifier[beta] operator[*] identifier[u] operator[SEP] identifier[a5] operator[*] identifier[v] operator[SEP] identifier[a3] operator[SEP] identifier[C] operator[SEP] identifier[a54] operator[=] identifier[alpha] operator[*] identifier[A] operator[SEP] identifier[a54] operator[+] identifier[beta] operator[*] identifier[u] operator[SEP] identifier[a5] operator[*] identifier[v] operator[SEP] identifier[a4] operator[SEP] identifier[C] operator[SEP] identifier[a55] operator[=] identifier[alpha] operator[*] identifier[A] operator[SEP] identifier[a55] operator[+] identifier[beta] operator[*] identifier[u] operator[SEP] identifier[a5] operator[*] identifier[v] operator[SEP] identifier[a5] operator[SEP] identifier[C] operator[SEP] identifier[a56] operator[=] identifier[alpha] operator[*] identifier[A] operator[SEP] identifier[a56] operator[+] identifier[beta] operator[*] identifier[u] operator[SEP] identifier[a5] operator[*] identifier[v] operator[SEP] identifier[a6] operator[SEP] identifier[C] operator[SEP] identifier[a61] operator[=] identifier[alpha] operator[*] identifier[A] operator[SEP] identifier[a61] operator[+] identifier[beta] operator[*] identifier[u] operator[SEP] identifier[a6] operator[*] identifier[v] operator[SEP] identifier[a1] operator[SEP] identifier[C] operator[SEP] identifier[a62] operator[=] identifier[alpha] operator[*] identifier[A] operator[SEP] identifier[a62] operator[+] identifier[beta] operator[*] identifier[u] operator[SEP] identifier[a6] operator[*] identifier[v] operator[SEP] identifier[a2] operator[SEP] identifier[C] operator[SEP] identifier[a63] operator[=] identifier[alpha] operator[*] identifier[A] operator[SEP] identifier[a63] operator[+] identifier[beta] operator[*] identifier[u] operator[SEP] identifier[a6] operator[*] identifier[v] operator[SEP] identifier[a3] operator[SEP] identifier[C] operator[SEP] identifier[a64] operator[=] identifier[alpha] operator[*] identifier[A] operator[SEP] identifier[a64] operator[+] identifier[beta] operator[*] identifier[u] operator[SEP] identifier[a6] operator[*] identifier[v] operator[SEP] identifier[a4] operator[SEP] identifier[C] operator[SEP] identifier[a65] operator[=] identifier[alpha] operator[*] identifier[A] operator[SEP] identifier[a65] operator[+] identifier[beta] operator[*] identifier[u] operator[SEP] identifier[a6] operator[*] identifier[v] operator[SEP] identifier[a5] operator[SEP] identifier[C] operator[SEP] identifier[a66] operator[=] identifier[alpha] operator[*] identifier[A] operator[SEP] identifier[a66] operator[+] identifier[beta] operator[*] identifier[u] operator[SEP] identifier[a6] operator[*] identifier[v] operator[SEP] identifier[a6] operator[SEP]
}
|
public static CharArraySequence from(final char[] value, final int offset, final int len) {
final char[] buffer = new char[value.length];
System.arraycopy(value, offset, buffer, 0, len);
return new CharArraySequence(buffer);
} | class class_name[name] begin[{]
method[from, return_type[type[CharArraySequence]], modifier[public static], parameter[value, offset, len]] begin[{]
local_variable[type[char], buffer]
call[System.arraycopy, parameter[member[.value], member[.offset], member[.buffer], literal[0], member[.len]]]
return[ClassCreator(arguments=[MemberReference(member=buffer, 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=CharArraySequence, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[CharArraySequence] identifier[from] operator[SEP] Keyword[final] Keyword[char] operator[SEP] operator[SEP] identifier[value] , Keyword[final] Keyword[int] identifier[offset] , Keyword[final] Keyword[int] identifier[len] operator[SEP] {
Keyword[final] Keyword[char] operator[SEP] operator[SEP] identifier[buffer] operator[=] Keyword[new] Keyword[char] operator[SEP] identifier[value] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[value] , identifier[offset] , identifier[buffer] , Other[0] , identifier[len] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[CharArraySequence] operator[SEP] identifier[buffer] operator[SEP] operator[SEP]
}
|
private static final Function<ParameterPair, Double> buildDefaultDistanceFunction() {
return new Function<ParameterPair, Double>() {
@Override
public Double apply(ParameterPair pair) {
if (pair.formal().isNullLiteral() || pair.actual().isNullLiteral()) {
return 0.0;
}
if (!pair.formal().isUnknownName() && !pair.actual().isUnknownName()) {
String normalizedSource =
NamingConventions.convertToLowerUnderscore(pair.formal().name());
String normalizedTarget =
NamingConventions.convertToLowerUnderscore(pair.actual().name());
return NeedlemanWunschEditDistance.getNormalizedEditDistance(
/*source=*/ normalizedSource,
/*target=*/ normalizedTarget,
/*caseSensitive=*/ false,
/*changeCost=*/ 8,
/*openGapCost=*/ 8,
/*continueGapCost=*/ 1);
}
return pair.formal().index() == pair.actual().index() ? 0.0 : Double.POSITIVE_INFINITY;
}
};
} | class class_name[name] begin[{]
method[buildDefaultDistanceFunction, return_type[type[Function]], modifier[final private static], parameter[]] begin[{]
return[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=formal, postfix_operators=[], prefix_operators=[], qualifier=pair, selectors=[MethodInvocation(arguments=[], member=isNullLiteral, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=MethodInvocation(arguments=[], member=actual, postfix_operators=[], prefix_operators=[], qualifier=pair, selectors=[MethodInvocation(arguments=[], member=isNullLiteral, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0.0), label=None)])), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=formal, postfix_operators=[], prefix_operators=['!'], qualifier=pair, selectors=[MethodInvocation(arguments=[], member=isUnknownName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=MethodInvocation(arguments=[], member=actual, postfix_operators=[], prefix_operators=['!'], qualifier=pair, selectors=[MethodInvocation(arguments=[], member=isUnknownName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=formal, postfix_operators=[], prefix_operators=[], qualifier=pair, selectors=[MethodInvocation(arguments=[], member=name, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=convertToLowerUnderscore, postfix_operators=[], prefix_operators=[], qualifier=NamingConventions, selectors=[], type_arguments=None), name=normalizedSource)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=actual, postfix_operators=[], prefix_operators=[], qualifier=pair, selectors=[MethodInvocation(arguments=[], member=name, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=convertToLowerUnderscore, postfix_operators=[], prefix_operators=[], qualifier=NamingConventions, selectors=[], type_arguments=None), name=normalizedTarget)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=normalizedSource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=normalizedTarget, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=getNormalizedEditDistance, postfix_operators=[], prefix_operators=[], qualifier=NeedlemanWunschEditDistance, selectors=[], type_arguments=None), label=None)])), ReturnStatement(expression=TernaryExpression(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=formal, postfix_operators=[], prefix_operators=[], qualifier=pair, selectors=[MethodInvocation(arguments=[], member=index, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=MethodInvocation(arguments=[], member=actual, postfix_operators=[], prefix_operators=[], qualifier=pair, selectors=[MethodInvocation(arguments=[], member=index, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator===), if_false=MemberReference(member=POSITIVE_INFINITY, postfix_operators=[], prefix_operators=[], qualifier=Double, selectors=[]), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0.0)), label=None)], documentation=None, modifiers={'public'}, name=apply, parameters=[FormalParameter(annotations=[], modifiers=set(), name=pair, type=ReferenceType(arguments=None, dimensions=[], name=ParameterPair, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=None, dimensions=[], name=Double, sub_type=None), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=ParameterPair, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Double, sub_type=None))], dimensions=None, name=Function, sub_type=None))]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[final] identifier[Function] operator[<] identifier[ParameterPair] , identifier[Double] operator[>] identifier[buildDefaultDistanceFunction] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[Function] operator[<] identifier[ParameterPair] , identifier[Double] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Double] identifier[apply] operator[SEP] identifier[ParameterPair] identifier[pair] operator[SEP] {
Keyword[if] operator[SEP] identifier[pair] operator[SEP] identifier[formal] operator[SEP] operator[SEP] operator[SEP] identifier[isNullLiteral] operator[SEP] operator[SEP] operator[||] identifier[pair] operator[SEP] identifier[actual] operator[SEP] operator[SEP] operator[SEP] identifier[isNullLiteral] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[Float] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[pair] operator[SEP] identifier[formal] operator[SEP] operator[SEP] operator[SEP] identifier[isUnknownName] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[pair] operator[SEP] identifier[actual] operator[SEP] operator[SEP] operator[SEP] identifier[isUnknownName] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[normalizedSource] operator[=] identifier[NamingConventions] operator[SEP] identifier[convertToLowerUnderscore] operator[SEP] identifier[pair] operator[SEP] identifier[formal] operator[SEP] operator[SEP] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[normalizedTarget] operator[=] identifier[NamingConventions] operator[SEP] identifier[convertToLowerUnderscore] operator[SEP] identifier[pair] operator[SEP] identifier[actual] operator[SEP] operator[SEP] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[NeedlemanWunschEditDistance] operator[SEP] identifier[getNormalizedEditDistance] operator[SEP] identifier[normalizedSource] , identifier[normalizedTarget] , literal[boolean] , Other[8] , Other[8] , Other[1] operator[SEP] operator[SEP]
}
Keyword[return] identifier[pair] operator[SEP] identifier[formal] operator[SEP] operator[SEP] operator[SEP] identifier[index] operator[SEP] operator[SEP] operator[==] identifier[pair] operator[SEP] identifier[actual] operator[SEP] operator[SEP] operator[SEP] identifier[index] operator[SEP] operator[SEP] operator[?] literal[Float] operator[:] identifier[Double] operator[SEP] identifier[POSITIVE_INFINITY] operator[SEP]
}
} operator[SEP]
}
|
public static void escapeUriPathSegment(final char[] text, final int offset, final int len, final Writer writer,
final String encoding)
throws IOException {
if (writer == null) {
throw new IllegalArgumentException("Argument 'writer' cannot be null");
}
if (encoding == null) {
throw new IllegalArgumentException("Argument 'encoding' cannot be null");
}
final int textLen = (text == null? 0 : text.length);
if (offset < 0 || offset > textLen) {
throw new IllegalArgumentException(
"Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen);
}
if (len < 0 || (offset + len) > textLen) {
throw new IllegalArgumentException(
"Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen);
}
UriEscapeUtil.escape(text, offset, len, writer, UriEscapeUtil.UriEscapeType.PATH_SEGMENT, encoding);
} | class class_name[name] begin[{]
method[escapeUriPathSegment, return_type[void], modifier[public static], parameter[text, offset, len, writer, encoding]] begin[{]
if[binary_operation[member[.writer], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Argument 'writer' cannot be null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.encoding], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Argument 'encoding' cannot be null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[int], textLen]
if[binary_operation[binary_operation[member[.offset], <, literal[0]], ||, binary_operation[member[.offset], >, member[.textLen]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid (offset, len). offset="), operandr=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", len="), operator=+), operandr=MemberReference(member=len, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", text.length="), operator=+), operandr=MemberReference(member=textLen, 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=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.len], <, literal[0]], ||, binary_operation[binary_operation[member[.offset], +, member[.len]], >, member[.textLen]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid (offset, len). offset="), operandr=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", len="), operator=+), operandr=MemberReference(member=len, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", text.length="), operator=+), operandr=MemberReference(member=textLen, 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=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[UriEscapeUtil.escape, parameter[member[.text], member[.offset], member[.len], member[.writer], member[UriEscapeUtil.UriEscapeType.PATH_SEGMENT], member[.encoding]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[escapeUriPathSegment] operator[SEP] Keyword[final] Keyword[char] operator[SEP] operator[SEP] identifier[text] , Keyword[final] Keyword[int] identifier[offset] , Keyword[final] Keyword[int] identifier[len] , Keyword[final] identifier[Writer] identifier[writer] , Keyword[final] identifier[String] identifier[encoding] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[writer] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[encoding] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[final] Keyword[int] identifier[textLen] operator[=] operator[SEP] identifier[text] operator[==] Other[null] operator[?] Other[0] operator[:] identifier[text] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[offset] operator[<] Other[0] operator[||] identifier[offset] operator[>] identifier[textLen] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[offset] operator[+] literal[String] operator[+] identifier[len] operator[+] literal[String] operator[+] identifier[textLen] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[len] operator[<] Other[0] operator[||] operator[SEP] identifier[offset] operator[+] identifier[len] operator[SEP] operator[>] identifier[textLen] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[offset] operator[+] literal[String] operator[+] identifier[len] operator[+] literal[String] operator[+] identifier[textLen] operator[SEP] operator[SEP]
}
identifier[UriEscapeUtil] operator[SEP] identifier[escape] operator[SEP] identifier[text] , identifier[offset] , identifier[len] , identifier[writer] , identifier[UriEscapeUtil] operator[SEP] identifier[UriEscapeType] operator[SEP] identifier[PATH_SEGMENT] , identifier[encoding] operator[SEP] operator[SEP]
}
|
public Datatype.Builder removeStandardMethodUnderrides(StandardMethod key) {
Objects.requireNonNull(key);
standardMethodUnderrides.remove(key);
return (Datatype.Builder) this;
} | class class_name[name] begin[{]
method[removeStandardMethodUnderrides, return_type[type[Datatype]], modifier[public], parameter[key]] begin[{]
call[Objects.requireNonNull, parameter[member[.key]]]
call[standardMethodUnderrides.remove, parameter[member[.key]]]
return[Cast(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Datatype, sub_type=ReferenceType(arguments=None, dimensions=None, name=Builder, sub_type=None)))]
end[}]
END[}] | Keyword[public] identifier[Datatype] operator[SEP] identifier[Builder] identifier[removeStandardMethodUnderrides] operator[SEP] identifier[StandardMethod] identifier[key] operator[SEP] {
identifier[Objects] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[key] operator[SEP] operator[SEP] identifier[standardMethodUnderrides] operator[SEP] identifier[remove] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[Datatype] operator[SEP] identifier[Builder] operator[SEP] Keyword[this] operator[SEP]
}
|
public static GraphicalModel readFromStream(InputStream stream) throws IOException {
return readFromProto(GraphicalModelProto.GraphicalModel.parseDelimitedFrom(stream));
} | class class_name[name] begin[{]
method[readFromStream, return_type[type[GraphicalModel]], modifier[public static], parameter[stream]] begin[{]
return[call[.readFromProto, parameter[call[GraphicalModelProto.GraphicalModel.parseDelimitedFrom, parameter[member[.stream]]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[GraphicalModel] identifier[readFromStream] operator[SEP] identifier[InputStream] identifier[stream] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[return] identifier[readFromProto] operator[SEP] identifier[GraphicalModelProto] operator[SEP] identifier[GraphicalModel] operator[SEP] identifier[parseDelimitedFrom] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP]
}
|
public void checkForValue(final double VALUE) {
boolean wasSmaller = Double.compare(checkedValue, VALUE) < 0;
boolean wasBigger = Double.compare(checkedValue, VALUE) > 0;
boolean isBigger = Double.compare(VALUE, checkedValue) > 0;
boolean isSmaller = Double.compare(VALUE, checkedValue) < 0;
if (wasSmaller && isBigger) {
fireMarkerEvent(EXCEEDED_EVENT);
} else if (wasBigger && isSmaller) {
fireMarkerEvent(UNDERRUN_EVENT);
}
checkedValue = VALUE;
} | class class_name[name] begin[{]
method[checkForValue, return_type[void], modifier[public], parameter[VALUE]] begin[{]
local_variable[type[boolean], wasSmaller]
local_variable[type[boolean], wasBigger]
local_variable[type[boolean], isBigger]
local_variable[type[boolean], isSmaller]
if[binary_operation[member[.wasSmaller], &&, member[.isBigger]]] begin[{]
call[.fireMarkerEvent, parameter[member[.EXCEEDED_EVENT]]]
else begin[{]
if[binary_operation[member[.wasBigger], &&, member[.isSmaller]]] begin[{]
call[.fireMarkerEvent, parameter[member[.UNDERRUN_EVENT]]]
else begin[{]
None
end[}]
end[}]
assign[member[.checkedValue], member[.VALUE]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[checkForValue] operator[SEP] Keyword[final] Keyword[double] identifier[VALUE] operator[SEP] {
Keyword[boolean] identifier[wasSmaller] operator[=] identifier[Double] operator[SEP] identifier[compare] operator[SEP] identifier[checkedValue] , identifier[VALUE] operator[SEP] operator[<] Other[0] operator[SEP] Keyword[boolean] identifier[wasBigger] operator[=] identifier[Double] operator[SEP] identifier[compare] operator[SEP] identifier[checkedValue] , identifier[VALUE] operator[SEP] operator[>] Other[0] operator[SEP] Keyword[boolean] identifier[isBigger] operator[=] identifier[Double] operator[SEP] identifier[compare] operator[SEP] identifier[VALUE] , identifier[checkedValue] operator[SEP] operator[>] Other[0] operator[SEP] Keyword[boolean] identifier[isSmaller] operator[=] identifier[Double] operator[SEP] identifier[compare] operator[SEP] identifier[VALUE] , identifier[checkedValue] operator[SEP] operator[<] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[wasSmaller] operator[&&] identifier[isBigger] operator[SEP] {
identifier[fireMarkerEvent] operator[SEP] identifier[EXCEEDED_EVENT] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[wasBigger] operator[&&] identifier[isSmaller] operator[SEP] {
identifier[fireMarkerEvent] operator[SEP] identifier[UNDERRUN_EVENT] operator[SEP] operator[SEP]
}
identifier[checkedValue] operator[=] identifier[VALUE] operator[SEP]
}
|
public void texture(Shape shape, Image image, float scaleX, float scaleY) {
texture(shape, image, scaleX, scaleY, false);
} | class class_name[name] begin[{]
method[texture, return_type[void], modifier[public], parameter[shape, image, scaleX, scaleY]] begin[{]
call[.texture, parameter[member[.shape], member[.image], member[.scaleX], member[.scaleY], literal[false]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[texture] operator[SEP] identifier[Shape] identifier[shape] , identifier[Image] identifier[image] , Keyword[float] identifier[scaleX] , Keyword[float] identifier[scaleY] operator[SEP] {
identifier[texture] operator[SEP] identifier[shape] , identifier[image] , identifier[scaleX] , identifier[scaleY] , literal[boolean] operator[SEP] operator[SEP]
}
|
public void remove(Cookie cookie) {
cookie.getHttpCookie().setExpiryDate(new Date(0));
cookieRepresentationCache.remove(cookie.getHttpCookie());
getStore().clearExpired(new Date(1));
} | class class_name[name] begin[{]
method[remove, return_type[void], modifier[public], parameter[cookie]] begin[{]
call[cookie.getHttpCookie, parameter[]]
call[cookieRepresentationCache.remove, parameter[call[cookie.getHttpCookie, parameter[]]]]
call[.getStore, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[remove] operator[SEP] identifier[Cookie] identifier[cookie] operator[SEP] {
identifier[cookie] operator[SEP] identifier[getHttpCookie] operator[SEP] operator[SEP] operator[SEP] identifier[setExpiryDate] operator[SEP] Keyword[new] identifier[Date] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] identifier[cookieRepresentationCache] operator[SEP] identifier[remove] operator[SEP] identifier[cookie] operator[SEP] identifier[getHttpCookie] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getStore] operator[SEP] operator[SEP] operator[SEP] identifier[clearExpired] operator[SEP] Keyword[new] identifier[Date] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP]
}
|
private void makeAnswerArraysAndTagIndex(Collection<List<IN>> docs) {
if (answerArrays == null) {
answerArrays = new HashSet<List<String>>();
}
if (classIndex == null) {
classIndex = new HashIndex<String>();
}
for (List<IN> doc : docs) {
if (flags.useReverse) {
Collections.reverse(doc);
}
int leng = doc.size();
for (int start = 0; start < leng; start++) {
for (int diff = 1; diff <= flags.maxLeft && start + diff <= leng; diff++) {
String[] seq = new String[diff];
for (int i = start; i < start + diff; i++) {
seq[i - start] = doc.get(i).get(AnswerAnnotation.class);
}
answerArrays.add(Arrays.asList(seq));
}
}
for (int i = 0; i < leng; i++) {
CoreLabel wordInfo = doc.get(i);
classIndex.add(wordInfo.get(AnswerAnnotation.class));
}
if (flags.useReverse) {
Collections.reverse(doc);
}
}
} | class class_name[name] begin[{]
method[makeAnswerArraysAndTagIndex, return_type[void], modifier[private], parameter[docs]] begin[{]
if[binary_operation[member[.answerArrays], ==, literal[null]]] begin[{]
assign[member[.answerArrays], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=List, sub_type=None))], dimensions=None, name=HashSet, sub_type=None))]
else begin[{]
None
end[}]
if[binary_operation[member[.classIndex], ==, literal[null]]] begin[{]
assign[member[.classIndex], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=HashIndex, sub_type=None))]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MemberReference(member=useReverse, postfix_operators=[], prefix_operators=[], qualifier=flags, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=doc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=reverse, postfix_operators=[], prefix_operators=[], qualifier=Collections, selectors=[], type_arguments=None), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=doc, selectors=[], type_arguments=None), name=leng)], modifiers=set(), type=BasicType(dimensions=[], name=int)), ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ArrayCreator(dimensions=[MemberReference(member=diff, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None)), name=seq)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=String, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=seq, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-))]), type==, value=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=doc, selectors=[MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AnswerAnnotation, sub_type=None))], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=diff, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=seq, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=asList, postfix_operators=[], prefix_operators=[], qualifier=Arrays, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=answerArrays, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=diff, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=maxLeft, postfix_operators=[], prefix_operators=[], qualifier=flags, selectors=[]), operator=<=), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=diff, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=MemberReference(member=leng, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), operator=&&), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), name=diff)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=diff, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=leng, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=start)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=start, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=doc, selectors=[], type_arguments=None), name=wordInfo)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CoreLabel, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AnswerAnnotation, sub_type=None))], member=get, postfix_operators=[], prefix_operators=[], qualifier=wordInfo, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=classIndex, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=leng, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None), IfStatement(condition=MemberReference(member=useReverse, postfix_operators=[], prefix_operators=[], qualifier=flags, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=doc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=reverse, postfix_operators=[], prefix_operators=[], qualifier=Collections, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=docs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=doc)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=IN, sub_type=None))], dimensions=[], name=List, sub_type=None))), label=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[makeAnswerArraysAndTagIndex] operator[SEP] identifier[Collection] operator[<] identifier[List] operator[<] identifier[IN] operator[>] operator[>] identifier[docs] operator[SEP] {
Keyword[if] operator[SEP] identifier[answerArrays] operator[==] Other[null] operator[SEP] {
identifier[answerArrays] operator[=] Keyword[new] identifier[HashSet] operator[<] identifier[List] operator[<] identifier[String] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[classIndex] operator[==] Other[null] operator[SEP] {
identifier[classIndex] operator[=] Keyword[new] identifier[HashIndex] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[List] operator[<] identifier[IN] operator[>] identifier[doc] operator[:] identifier[docs] operator[SEP] {
Keyword[if] operator[SEP] identifier[flags] operator[SEP] identifier[useReverse] operator[SEP] {
identifier[Collections] operator[SEP] identifier[reverse] operator[SEP] identifier[doc] operator[SEP] operator[SEP]
}
Keyword[int] identifier[leng] operator[=] identifier[doc] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[start] operator[=] Other[0] operator[SEP] identifier[start] operator[<] identifier[leng] operator[SEP] identifier[start] operator[++] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[diff] operator[=] Other[1] operator[SEP] identifier[diff] operator[<=] identifier[flags] operator[SEP] identifier[maxLeft] operator[&&] identifier[start] operator[+] identifier[diff] operator[<=] identifier[leng] operator[SEP] identifier[diff] operator[++] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] identifier[seq] operator[=] Keyword[new] identifier[String] operator[SEP] identifier[diff] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[start] operator[SEP] identifier[i] operator[<] identifier[start] operator[+] identifier[diff] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[seq] operator[SEP] identifier[i] operator[-] identifier[start] operator[SEP] operator[=] identifier[doc] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[AnswerAnnotation] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
identifier[answerArrays] operator[SEP] identifier[add] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[seq] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[leng] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[CoreLabel] identifier[wordInfo] operator[=] identifier[doc] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[classIndex] operator[SEP] identifier[add] operator[SEP] identifier[wordInfo] operator[SEP] identifier[get] operator[SEP] identifier[AnswerAnnotation] operator[SEP] Keyword[class] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[flags] operator[SEP] identifier[useReverse] operator[SEP] {
identifier[Collections] operator[SEP] identifier[reverse] operator[SEP] identifier[doc] operator[SEP] operator[SEP]
}
}
}
|
public static <K, V> CounterMap<K, V> parallelCounterMap() {
CounterMap<K, V> totalWords = new CounterMap<>();
return totalWords;
} | class class_name[name] begin[{]
method[parallelCounterMap, return_type[type[CounterMap]], modifier[public static], parameter[]] begin[{]
local_variable[type[CounterMap], totalWords]
return[member[.totalWords]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[K] , identifier[V] operator[>] identifier[CounterMap] operator[<] identifier[K] , identifier[V] operator[>] identifier[parallelCounterMap] operator[SEP] operator[SEP] {
identifier[CounterMap] operator[<] identifier[K] , identifier[V] operator[>] identifier[totalWords] operator[=] Keyword[new] identifier[CounterMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[totalWords] operator[SEP]
}
|
protected void runCommand(String commandName, CommandSession session, String[] params) {
try {
Method method = service.getClass().getMethod(commandName, PrintWriter.class, String[].class);
PrintWriter printWriter = new PrintWriter(session.getConsole());
method.invoke(service, printWriter, params);
printWriter.flush();
} catch (NoSuchMethodException e) {
session.getConsole().println("No such command: " + commandName);
} catch (Exception e) {
LOG.log(Level.WARNING, "Unable to execute command: " + commandName + " with args: " + Arrays.toString(params), e);
e.printStackTrace(session.getConsole());
}
} | class class_name[name] begin[{]
method[runCommand, return_type[void], modifier[protected], parameter[commandName, session, params]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=service, selectors=[MethodInvocation(arguments=[MemberReference(member=commandName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PrintWriter, sub_type=None)), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))], member=getMethod, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=method)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Method, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getConsole, postfix_operators=[], prefix_operators=[], qualifier=session, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PrintWriter, sub_type=None)), name=printWriter)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=PrintWriter, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=service, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=printWriter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=params, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=invoke, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=flush, postfix_operators=[], prefix_operators=[], qualifier=printWriter, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=getConsole, postfix_operators=[], prefix_operators=[], qualifier=session, selectors=[MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="No such command: "), operandr=MemberReference(member=commandName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=println, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NoSuchMethodException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=WARNING, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to execute command: "), operandr=MemberReference(member=commandName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" with args: "), operator=+), operandr=MethodInvocation(arguments=[MemberReference(member=params, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toString, postfix_operators=[], prefix_operators=[], qualifier=Arrays, selectors=[], type_arguments=None), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=log, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getConsole, postfix_operators=[], prefix_operators=[], qualifier=session, selectors=[], type_arguments=None)], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[runCommand] operator[SEP] identifier[String] identifier[commandName] , identifier[CommandSession] identifier[session] , identifier[String] operator[SEP] operator[SEP] identifier[params] operator[SEP] {
Keyword[try] {
identifier[Method] identifier[method] operator[=] identifier[service] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getMethod] operator[SEP] identifier[commandName] , identifier[PrintWriter] operator[SEP] Keyword[class] , identifier[String] operator[SEP] operator[SEP] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[PrintWriter] identifier[printWriter] operator[=] Keyword[new] identifier[PrintWriter] operator[SEP] identifier[session] operator[SEP] identifier[getConsole] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[method] operator[SEP] identifier[invoke] operator[SEP] identifier[service] , identifier[printWriter] , identifier[params] operator[SEP] operator[SEP] identifier[printWriter] operator[SEP] identifier[flush] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NoSuchMethodException] identifier[e] operator[SEP] {
identifier[session] operator[SEP] identifier[getConsole] operator[SEP] operator[SEP] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[commandName] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[LOG] operator[SEP] identifier[log] operator[SEP] identifier[Level] operator[SEP] identifier[WARNING] , literal[String] operator[+] identifier[commandName] operator[+] literal[String] operator[+] identifier[Arrays] operator[SEP] identifier[toString] operator[SEP] identifier[params] operator[SEP] , identifier[e] operator[SEP] operator[SEP] identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] identifier[session] operator[SEP] identifier[getConsole] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public void setThings(java.util.Collection<String> things) {
if (things == null) {
this.things = null;
return;
}
this.things = new java.util.ArrayList<String>(things);
} | class class_name[name] begin[{]
method[setThings, return_type[void], modifier[public], parameter[things]] begin[{]
if[binary_operation[member[.things], ==, literal[null]]] begin[{]
assign[THIS[member[None.things]], literal[null]]
return[None]
else begin[{]
None
end[}]
assign[THIS[member[None.things]], ClassCreator(arguments=[MemberReference(member=things, 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=String, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))))]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setThings] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Collection] operator[<] identifier[String] operator[>] identifier[things] operator[SEP] {
Keyword[if] operator[SEP] identifier[things] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[things] operator[=] Other[null] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[this] operator[SEP] identifier[things] operator[=] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] identifier[things] operator[SEP] operator[SEP]
}
|
public PGPConstant createPGPConstantFromString(EDataType eDataType, String initialValue) {
PGPConstant result = PGPConstant.get(initialValue);
if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
return result;
} | class class_name[name] begin[{]
method[createPGPConstantFromString, return_type[type[PGPConstant]], modifier[public], parameter[eDataType, initialValue]] begin[{]
local_variable[type[PGPConstant], result]
if[binary_operation[member[.result], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The value '"), operandr=MemberReference(member=initialValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' is not a valid enumerator of '"), operator=+), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=eDataType, selectors=[], type_arguments=None), 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=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}] | Keyword[public] identifier[PGPConstant] identifier[createPGPConstantFromString] operator[SEP] identifier[EDataType] identifier[eDataType] , identifier[String] identifier[initialValue] operator[SEP] {
identifier[PGPConstant] identifier[result] operator[=] identifier[PGPConstant] operator[SEP] identifier[get] operator[SEP] identifier[initialValue] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[initialValue] operator[+] literal[String] operator[+] identifier[eDataType] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
Call<Map<String, Long>> newBucketedTraceIdCall(
QueryRequest request, TimestampRange timestampRange, int traceIndexFetchSize) {
// trace_by_service_span adds special empty-string span name in order to search by all
String spanName = null != request.spanName() ? request.spanName() : "";
Long minDuration = request.minDuration(), maxDuration = request.maxDuration();
int startBucket = CassandraUtil.durationIndexBucket(timestampRange.startMillis * 1000);
int endBucket = CassandraUtil.durationIndexBucket(timestampRange.endMillis * 1000);
if (startBucket > endBucket) {
throw new IllegalArgumentException(
"Start bucket (" + startBucket + ") > end bucket (" + endBucket + ")");
}
// "" isn't a real value. it is used to template bucketed calls and replaced later
String serviceName = null != request.serviceName() ? request.serviceName() : "";
// TODO: ideally, the buckets are traversed backwards, only spawning queries for older buckets
// if younger buckets are empty. This will be an async continuation, punted for now.
List<SelectTraceIdsFromServiceSpan.Input> serviceSpans = new ArrayList<>();
List<SelectTraceIdsFromServiceRemoteService.Input> serviceRemoteServices = new ArrayList<>();
String remoteService = request.remoteServiceName();
for (int bucket = endBucket; bucket >= startBucket; bucket--) {
boolean addSpanQuery = true;
if (remoteService != null) {
if (traceIdsFromServiceRemoteService == null) {
throw new IllegalArgumentException("remoteService=" + remoteService
+ " unsupported due to missing table " + TABLE_SERVICE_REMOTE_SERVICES);
}
serviceRemoteServices.add(
traceIdsFromServiceRemoteService.newInput(
serviceName,
remoteService,
bucket,
timestampRange,
traceIndexFetchSize));
// If the remote service query can satisfy the request, don't make a redundant span query
addSpanQuery = !spanName.isEmpty() || minDuration != null;
}
if (!addSpanQuery) continue;
serviceSpans.add(
traceIdsFromServiceSpan.newInput(
serviceName,
spanName,
bucket,
minDuration,
maxDuration,
timestampRange,
traceIndexFetchSize));
}
if ("".equals(serviceName)) {
// If we have no service name, we have to lookup service names before running trace ID queries
Call<List<String>> serviceNames = getServiceNames();
if (serviceRemoteServices.isEmpty()) {
return serviceNames.flatMap(traceIdsFromServiceSpan.newFlatMapper(serviceSpans));
} else if (serviceSpans.isEmpty()) {
return serviceNames.flatMap(
traceIdsFromServiceRemoteService.newFlatMapper(serviceRemoteServices));
}
return serviceNames.flatMap(new AggregateFlatMapper<>(
traceIdsFromServiceSpan.newFlatMapper(serviceSpans),
traceIdsFromServiceRemoteService.newFlatMapper(serviceRemoteServices)
));
}
if (serviceRemoteServices.isEmpty()) {
return traceIdsFromServiceSpan.newCall(serviceSpans);
} else if (serviceSpans.isEmpty()) {
return traceIdsFromServiceRemoteService.newCall(serviceRemoteServices);
} else {
return new IntersectMaps<>(asList(
traceIdsFromServiceSpan.newCall(serviceSpans),
traceIdsFromServiceRemoteService.newCall(serviceRemoteServices)
));
}
} | class class_name[name] begin[{]
method[newBucketedTraceIdCall, return_type[type[Call]], modifier[default], parameter[request, timestampRange, traceIndexFetchSize]] begin[{]
local_variable[type[String], spanName]
local_variable[type[Long], minDuration]
local_variable[type[int], startBucket]
local_variable[type[int], endBucket]
if[binary_operation[member[.startBucket], >, member[.endBucket]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Start bucket ("), operandr=MemberReference(member=startBucket, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=") > end bucket ("), operator=+), operandr=MemberReference(member=endBucket, 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=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[String], serviceName]
local_variable[type[List], serviceSpans]
local_variable[type[List], serviceRemoteServices]
local_variable[type[String], remoteService]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), name=addSpanQuery)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=remoteService, 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=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=traceIdsFromServiceRemoteService, 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=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="remoteService="), operandr=MemberReference(member=remoteService, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" unsupported due to missing table "), operator=+), operandr=MemberReference(member=TABLE_SERVICE_REMOTE_SERVICES, 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=IllegalArgumentException, sub_type=None)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=serviceName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=remoteService, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=bucket, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=timestampRange, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=traceIndexFetchSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=newInput, postfix_operators=[], prefix_operators=[], qualifier=traceIdsFromServiceRemoteService, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=serviceRemoteServices, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=addSpanQuery, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=['!'], qualifier=spanName, selectors=[], type_arguments=None), operandr=BinaryOperation(operandl=MemberReference(member=minDuration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operator=||)), label=None)])), IfStatement(condition=MemberReference(member=addSpanQuery, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=ContinueStatement(goto=None, label=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=serviceName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=spanName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=bucket, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=minDuration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=maxDuration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=timestampRange, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=traceIndexFetchSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=newInput, postfix_operators=[], prefix_operators=[], qualifier=traceIdsFromServiceSpan, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=serviceSpans, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=bucket, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=startBucket, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=endBucket, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=bucket)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=bucket, postfix_operators=['--'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
if[literal[""]] begin[{]
local_variable[type[Call], serviceNames]
if[call[serviceRemoteServices.isEmpty, parameter[]]] begin[{]
return[call[serviceNames.flatMap, parameter[call[traceIdsFromServiceSpan.newFlatMapper, parameter[member[.serviceSpans]]]]]]
else begin[{]
if[call[serviceSpans.isEmpty, parameter[]]] begin[{]
return[call[serviceNames.flatMap, parameter[call[traceIdsFromServiceRemoteService.newFlatMapper, parameter[member[.serviceRemoteServices]]]]]]
else begin[{]
None
end[}]
end[}]
return[call[serviceNames.flatMap, parameter[ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=serviceSpans, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=newFlatMapper, postfix_operators=[], prefix_operators=[], qualifier=traceIdsFromServiceSpan, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=serviceRemoteServices, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=newFlatMapper, postfix_operators=[], prefix_operators=[], qualifier=traceIdsFromServiceRemoteService, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=AggregateFlatMapper, sub_type=None))]]]
else begin[{]
None
end[}]
if[call[serviceRemoteServices.isEmpty, parameter[]]] begin[{]
return[call[traceIdsFromServiceSpan.newCall, parameter[member[.serviceSpans]]]]
else begin[{]
if[call[serviceSpans.isEmpty, parameter[]]] begin[{]
return[call[traceIdsFromServiceRemoteService.newCall, parameter[member[.serviceRemoteServices]]]]
else begin[{]
return[ClassCreator(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=serviceSpans, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=newCall, postfix_operators=[], prefix_operators=[], qualifier=traceIdsFromServiceSpan, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=serviceRemoteServices, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=newCall, postfix_operators=[], prefix_operators=[], qualifier=traceIdsFromServiceRemoteService, selectors=[], type_arguments=None)], member=asList, 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=[], dimensions=None, name=IntersectMaps, sub_type=None))]
end[}]
end[}]
end[}]
END[}] | identifier[Call] operator[<] identifier[Map] operator[<] identifier[String] , identifier[Long] operator[>] operator[>] identifier[newBucketedTraceIdCall] operator[SEP] identifier[QueryRequest] identifier[request] , identifier[TimestampRange] identifier[timestampRange] , Keyword[int] identifier[traceIndexFetchSize] operator[SEP] {
identifier[String] identifier[spanName] operator[=] Other[null] operator[!=] identifier[request] operator[SEP] identifier[spanName] operator[SEP] operator[SEP] operator[?] identifier[request] operator[SEP] identifier[spanName] operator[SEP] operator[SEP] operator[:] literal[String] operator[SEP] identifier[Long] identifier[minDuration] operator[=] identifier[request] operator[SEP] identifier[minDuration] operator[SEP] operator[SEP] , identifier[maxDuration] operator[=] identifier[request] operator[SEP] identifier[maxDuration] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[startBucket] operator[=] identifier[CassandraUtil] operator[SEP] identifier[durationIndexBucket] operator[SEP] identifier[timestampRange] operator[SEP] identifier[startMillis] operator[*] Other[1000] operator[SEP] operator[SEP] Keyword[int] identifier[endBucket] operator[=] identifier[CassandraUtil] operator[SEP] identifier[durationIndexBucket] operator[SEP] identifier[timestampRange] operator[SEP] identifier[endMillis] operator[*] Other[1000] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[startBucket] operator[>] identifier[endBucket] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[startBucket] operator[+] literal[String] operator[+] identifier[endBucket] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[String] identifier[serviceName] operator[=] Other[null] operator[!=] identifier[request] operator[SEP] identifier[serviceName] operator[SEP] operator[SEP] operator[?] identifier[request] operator[SEP] identifier[serviceName] operator[SEP] operator[SEP] operator[:] literal[String] operator[SEP] identifier[List] operator[<] identifier[SelectTraceIdsFromServiceSpan] operator[SEP] identifier[Input] operator[>] identifier[serviceSpans] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[SelectTraceIdsFromServiceRemoteService] operator[SEP] identifier[Input] operator[>] identifier[serviceRemoteServices] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[remoteService] operator[=] identifier[request] operator[SEP] identifier[remoteServiceName] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[bucket] operator[=] identifier[endBucket] operator[SEP] identifier[bucket] operator[>=] identifier[startBucket] operator[SEP] identifier[bucket] operator[--] operator[SEP] {
Keyword[boolean] identifier[addSpanQuery] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[remoteService] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[traceIdsFromServiceRemoteService] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[remoteService] operator[+] literal[String] operator[+] identifier[TABLE_SERVICE_REMOTE_SERVICES] operator[SEP] operator[SEP]
}
identifier[serviceRemoteServices] operator[SEP] identifier[add] operator[SEP] identifier[traceIdsFromServiceRemoteService] operator[SEP] identifier[newInput] operator[SEP] identifier[serviceName] , identifier[remoteService] , identifier[bucket] , identifier[timestampRange] , identifier[traceIndexFetchSize] operator[SEP] operator[SEP] operator[SEP] identifier[addSpanQuery] operator[=] operator[!] identifier[spanName] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[||] identifier[minDuration] operator[!=] Other[null] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[addSpanQuery] operator[SEP] Keyword[continue] operator[SEP] identifier[serviceSpans] operator[SEP] identifier[add] operator[SEP] identifier[traceIdsFromServiceSpan] operator[SEP] identifier[newInput] operator[SEP] identifier[serviceName] , identifier[spanName] , identifier[bucket] , identifier[minDuration] , identifier[maxDuration] , identifier[timestampRange] , identifier[traceIndexFetchSize] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[serviceName] operator[SEP] operator[SEP] {
identifier[Call] operator[<] identifier[List] operator[<] identifier[String] operator[>] operator[>] identifier[serviceNames] operator[=] identifier[getServiceNames] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[serviceRemoteServices] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[serviceNames] operator[SEP] identifier[flatMap] operator[SEP] identifier[traceIdsFromServiceSpan] operator[SEP] identifier[newFlatMapper] operator[SEP] identifier[serviceSpans] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[serviceSpans] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[serviceNames] operator[SEP] identifier[flatMap] operator[SEP] identifier[traceIdsFromServiceRemoteService] operator[SEP] identifier[newFlatMapper] operator[SEP] identifier[serviceRemoteServices] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[serviceNames] operator[SEP] identifier[flatMap] operator[SEP] Keyword[new] identifier[AggregateFlatMapper] operator[<] operator[>] operator[SEP] identifier[traceIdsFromServiceSpan] operator[SEP] identifier[newFlatMapper] operator[SEP] identifier[serviceSpans] operator[SEP] , identifier[traceIdsFromServiceRemoteService] operator[SEP] identifier[newFlatMapper] operator[SEP] identifier[serviceRemoteServices] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[serviceRemoteServices] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[traceIdsFromServiceSpan] operator[SEP] identifier[newCall] operator[SEP] identifier[serviceSpans] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[serviceSpans] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[traceIdsFromServiceRemoteService] operator[SEP] identifier[newCall] operator[SEP] identifier[serviceRemoteServices] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] Keyword[new] identifier[IntersectMaps] operator[<] operator[>] operator[SEP] identifier[asList] operator[SEP] identifier[traceIdsFromServiceSpan] operator[SEP] identifier[newCall] operator[SEP] identifier[serviceSpans] operator[SEP] , identifier[traceIdsFromServiceRemoteService] operator[SEP] identifier[newCall] operator[SEP] identifier[serviceRemoteServices] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public synchronized SSLConfig getSSLConfig(String alias) throws IllegalArgumentException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "getSSLConfig: " + alias);
SSLConfig rc = null;
if (alias == null || alias.equals("")) {
rc = getDefaultSSLConfig();
} else {
// sslConfigMap is not yet populated!!!
rc = sslConfigMap.get(alias);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "getSSLConfig", rc);
return rc;
} | class class_name[name] begin[{]
method[getSSLConfig, return_type[type[SSLConfig]], modifier[synchronized public], parameter[alias]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[Tr.entry, parameter[member[.tc], binary_operation[literal["getSSLConfig: "], +, member[.alias]]]]
else begin[{]
None
end[}]
local_variable[type[SSLConfig], rc]
if[binary_operation[binary_operation[member[.alias], ==, literal[null]], ||, call[alias.equals, parameter[literal[""]]]]] begin[{]
assign[member[.rc], call[.getDefaultSSLConfig, parameter[]]]
else begin[{]
assign[member[.rc], call[sslConfigMap.get, parameter[member[.alias]]]]
end[}]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[Tr.exit, parameter[member[.tc], literal["getSSLConfig"], member[.rc]]]
else begin[{]
None
end[}]
return[member[.rc]]
end[}]
END[}] | Keyword[public] Keyword[synchronized] identifier[SSLConfig] identifier[getSSLConfig] operator[SEP] identifier[String] identifier[alias] operator[SEP] Keyword[throws] identifier[IllegalArgumentException] {
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[Tr] operator[SEP] identifier[entry] operator[SEP] identifier[tc] , literal[String] operator[+] identifier[alias] operator[SEP] operator[SEP] identifier[SSLConfig] identifier[rc] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[alias] operator[==] Other[null] operator[||] identifier[alias] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[rc] operator[=] identifier[getDefaultSSLConfig] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[rc] operator[=] identifier[sslConfigMap] operator[SEP] identifier[get] operator[SEP] identifier[alias] 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[Tr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] , identifier[rc] operator[SEP] operator[SEP] Keyword[return] identifier[rc] operator[SEP]
}
|
@Override
public String[] getHeader(boolean firstLineCheck) throws IOException {
final String[] header = super.getHeader(firstLineCheck);
if(beanMappingCache.getOriginal().isValidateHeader()) {
try {
validateHeader(header, beanMappingCache.getHeader());
} catch(SuperCsvNoMatchColumnSizeException | SuperCsvNoMatchHeaderException e) {
// convert exception and format to message.
errorMessages.addAll(exceptionConverter.convertAndFormat(e, beanMappingCache.getOriginal()));
throw e;
}
}
return header;
} | class class_name[name] begin[{]
method[getHeader, return_type[type[String]], modifier[public], parameter[firstLineCheck]] begin[{]
local_variable[type[String], header]
if[call[beanMappingCache.getOriginal, parameter[]]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=header, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getHeader, postfix_operators=[], prefix_operators=[], qualifier=beanMappingCache, selectors=[], type_arguments=None)], member=validateHeader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getOriginal, postfix_operators=[], prefix_operators=[], qualifier=beanMappingCache, selectors=[], type_arguments=None)], member=convertAndFormat, postfix_operators=[], prefix_operators=[], qualifier=exceptionConverter, selectors=[], type_arguments=None)], member=addAll, postfix_operators=[], prefix_operators=[], qualifier=errorMessages, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SuperCsvNoMatchColumnSizeException', 'SuperCsvNoMatchHeaderException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
return[member[.header]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[String] operator[SEP] operator[SEP] identifier[getHeader] operator[SEP] Keyword[boolean] identifier[firstLineCheck] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[header] operator[=] Keyword[super] operator[SEP] identifier[getHeader] operator[SEP] identifier[firstLineCheck] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[beanMappingCache] operator[SEP] identifier[getOriginal] operator[SEP] operator[SEP] operator[SEP] identifier[isValidateHeader] operator[SEP] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[validateHeader] operator[SEP] identifier[header] , identifier[beanMappingCache] operator[SEP] identifier[getHeader] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[SuperCsvNoMatchColumnSizeException] operator[|] identifier[SuperCsvNoMatchHeaderException] identifier[e] operator[SEP] {
identifier[errorMessages] operator[SEP] identifier[addAll] operator[SEP] identifier[exceptionConverter] operator[SEP] identifier[convertAndFormat] operator[SEP] identifier[e] , identifier[beanMappingCache] operator[SEP] identifier[getOriginal] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] identifier[e] operator[SEP]
}
}
Keyword[return] identifier[header] operator[SEP]
}
|
public double getValueAtAsDouble(final int row, final int col) {
final Object valueAt = getValueAt(row, col);
double number = 0;
if (valueAt != null && !valueAt.toString().equals("")) {
number = Double.parseDouble(valueAt.toString().trim());
}
return number;
} | class class_name[name] begin[{]
method[getValueAtAsDouble, return_type[type[double]], modifier[public], parameter[row, col]] begin[{]
local_variable[type[Object], valueAt]
local_variable[type[double], number]
if[binary_operation[binary_operation[member[.valueAt], !=, literal[null]], &&, call[valueAt.toString, parameter[]]]] begin[{]
assign[member[.number], call[Double.parseDouble, parameter[call[valueAt.toString, parameter[]]]]]
else begin[{]
None
end[}]
return[member[.number]]
end[}]
END[}] | Keyword[public] Keyword[double] identifier[getValueAtAsDouble] operator[SEP] Keyword[final] Keyword[int] identifier[row] , Keyword[final] Keyword[int] identifier[col] operator[SEP] {
Keyword[final] identifier[Object] identifier[valueAt] operator[=] identifier[getValueAt] operator[SEP] identifier[row] , identifier[col] operator[SEP] operator[SEP] Keyword[double] identifier[number] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[valueAt] operator[!=] Other[null] operator[&&] operator[!] identifier[valueAt] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[number] operator[=] identifier[Double] operator[SEP] identifier[parseDouble] operator[SEP] identifier[valueAt] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[number] operator[SEP]
}
|
public BigInteger unpackBigInteger()
throws IOException
{
byte b = readByte();
if (Code.isFixInt(b)) {
return BigInteger.valueOf((long) b);
}
switch (b) {
case Code.UINT8: // unsigned int 8
byte u8 = readByte();
return BigInteger.valueOf((long) (u8 & 0xff));
case Code.UINT16: // unsigned int 16
short u16 = readShort();
return BigInteger.valueOf((long) (u16 & 0xffff));
case Code.UINT32: // unsigned int 32
int u32 = readInt();
if (u32 < 0) {
return BigInteger.valueOf((long) (u32 & 0x7fffffff) + 0x80000000L);
}
else {
return BigInteger.valueOf((long) u32);
}
case Code.UINT64: // unsigned int 64
long u64 = readLong();
if (u64 < 0L) {
BigInteger bi = BigInteger.valueOf(u64 + Long.MAX_VALUE + 1L).setBit(63);
return bi;
}
else {
return BigInteger.valueOf(u64);
}
case Code.INT8: // signed int 8
byte i8 = readByte();
return BigInteger.valueOf((long) i8);
case Code.INT16: // signed int 16
short i16 = readShort();
return BigInteger.valueOf((long) i16);
case Code.INT32: // signed int 32
int i32 = readInt();
return BigInteger.valueOf((long) i32);
case Code.INT64: // signed int 64
long i64 = readLong();
return BigInteger.valueOf(i64);
}
throw unexpected("Integer", b);
} | class class_name[name] begin[{]
method[unpackBigInteger, return_type[type[BigInteger]], modifier[public], parameter[]] begin[{]
local_variable[type[byte], b]
if[call[Code.isFixInt, parameter[member[.b]]]] begin[{]
return[call[BigInteger.valueOf, parameter[Cast(expression=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=long))]]]
else begin[{]
None
end[}]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=UINT8, postfix_operators=[], prefix_operators=[], qualifier=Code, selectors=[])], statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=readByte, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=u8)], modifiers=set(), type=BasicType(dimensions=[], name=byte)), ReturnStatement(expression=MethodInvocation(arguments=[Cast(expression=BinaryOperation(operandl=MemberReference(member=u8, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xff), operator=&), type=BasicType(dimensions=[], name=long))], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=BigInteger, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[MemberReference(member=UINT16, postfix_operators=[], prefix_operators=[], qualifier=Code, selectors=[])], statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=readShort, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=u16)], modifiers=set(), type=BasicType(dimensions=[], name=short)), ReturnStatement(expression=MethodInvocation(arguments=[Cast(expression=BinaryOperation(operandl=MemberReference(member=u16, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xffff), operator=&), type=BasicType(dimensions=[], name=long))], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=BigInteger, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[MemberReference(member=UINT32, postfix_operators=[], prefix_operators=[], qualifier=Code, selectors=[])], statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=readInt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=u32)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=u32, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=<), else_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=u32, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=long))], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=BigInteger, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Cast(expression=BinaryOperation(operandl=MemberReference(member=u32, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x7fffffff), operator=&), type=BasicType(dimensions=[], name=long)), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x80000000L), operator=+)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=BigInteger, selectors=[], type_arguments=None), label=None)]))]), SwitchStatementCase(case=[MemberReference(member=UINT64, postfix_operators=[], prefix_operators=[], qualifier=Code, selectors=[])], statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=readLong, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=u64)], modifiers=set(), type=BasicType(dimensions=[], name=long)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=u64, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0L), operator=<), else_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=u64, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=BigInteger, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=u64, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=MAX_VALUE, postfix_operators=[], prefix_operators=[], qualifier=Long, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1L), operator=+)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=BigInteger, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=63)], member=setBit, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=bi)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BigInteger, sub_type=None)), ReturnStatement(expression=MemberReference(member=bi, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), SwitchStatementCase(case=[MemberReference(member=INT8, postfix_operators=[], prefix_operators=[], qualifier=Code, selectors=[])], statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=readByte, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=i8)], modifiers=set(), type=BasicType(dimensions=[], name=byte)), ReturnStatement(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=i8, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=long))], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=BigInteger, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[MemberReference(member=INT16, postfix_operators=[], prefix_operators=[], qualifier=Code, selectors=[])], statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=readShort, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=i16)], modifiers=set(), type=BasicType(dimensions=[], name=short)), ReturnStatement(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=i16, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=long))], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=BigInteger, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[MemberReference(member=INT32, postfix_operators=[], prefix_operators=[], qualifier=Code, selectors=[])], statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=readInt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=i32)], modifiers=set(), type=BasicType(dimensions=[], name=int)), ReturnStatement(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=i32, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=long))], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=BigInteger, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[MemberReference(member=INT64, postfix_operators=[], prefix_operators=[], qualifier=Code, selectors=[])], statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=readLong, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=i64)], modifiers=set(), type=BasicType(dimensions=[], name=long)), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=i64, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=BigInteger, selectors=[], type_arguments=None), label=None)])], expression=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
ThrowStatement(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Integer"), MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=unexpected, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)
end[}]
END[}] | Keyword[public] identifier[BigInteger] identifier[unpackBigInteger] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[byte] identifier[b] operator[=] identifier[readByte] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Code] operator[SEP] identifier[isFixInt] operator[SEP] identifier[b] operator[SEP] operator[SEP] {
Keyword[return] identifier[BigInteger] operator[SEP] identifier[valueOf] operator[SEP] operator[SEP] Keyword[long] operator[SEP] identifier[b] operator[SEP] operator[SEP]
}
Keyword[switch] operator[SEP] identifier[b] operator[SEP] {
Keyword[case] identifier[Code] operator[SEP] identifier[UINT8] operator[:] Keyword[byte] identifier[u8] operator[=] identifier[readByte] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[BigInteger] operator[SEP] identifier[valueOf] operator[SEP] operator[SEP] Keyword[long] operator[SEP] operator[SEP] identifier[u8] operator[&] literal[Integer] operator[SEP] operator[SEP] operator[SEP] Keyword[case] identifier[Code] operator[SEP] identifier[UINT16] operator[:] Keyword[short] identifier[u16] operator[=] identifier[readShort] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[BigInteger] operator[SEP] identifier[valueOf] operator[SEP] operator[SEP] Keyword[long] operator[SEP] operator[SEP] identifier[u16] operator[&] literal[Integer] operator[SEP] operator[SEP] operator[SEP] Keyword[case] identifier[Code] operator[SEP] identifier[UINT32] operator[:] Keyword[int] identifier[u32] operator[=] identifier[readInt] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[u32] operator[<] Other[0] operator[SEP] {
Keyword[return] identifier[BigInteger] operator[SEP] identifier[valueOf] operator[SEP] operator[SEP] Keyword[long] operator[SEP] operator[SEP] identifier[u32] operator[&] literal[Integer] operator[SEP] operator[+] literal[Integer] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[BigInteger] operator[SEP] identifier[valueOf] operator[SEP] operator[SEP] Keyword[long] operator[SEP] identifier[u32] operator[SEP] operator[SEP]
}
Keyword[case] identifier[Code] operator[SEP] identifier[UINT64] operator[:] Keyword[long] identifier[u64] operator[=] identifier[readLong] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[u64] operator[<] Other[0L] operator[SEP] {
identifier[BigInteger] identifier[bi] operator[=] identifier[BigInteger] operator[SEP] identifier[valueOf] operator[SEP] identifier[u64] operator[+] identifier[Long] operator[SEP] identifier[MAX_VALUE] operator[+] Other[1L] operator[SEP] operator[SEP] identifier[setBit] operator[SEP] Other[63] operator[SEP] operator[SEP] Keyword[return] identifier[bi] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[BigInteger] operator[SEP] identifier[valueOf] operator[SEP] identifier[u64] operator[SEP] operator[SEP]
}
Keyword[case] identifier[Code] operator[SEP] identifier[INT8] operator[:] Keyword[byte] identifier[i8] operator[=] identifier[readByte] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[BigInteger] operator[SEP] identifier[valueOf] operator[SEP] operator[SEP] Keyword[long] operator[SEP] identifier[i8] operator[SEP] operator[SEP] Keyword[case] identifier[Code] operator[SEP] identifier[INT16] operator[:] Keyword[short] identifier[i16] operator[=] identifier[readShort] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[BigInteger] operator[SEP] identifier[valueOf] operator[SEP] operator[SEP] Keyword[long] operator[SEP] identifier[i16] operator[SEP] operator[SEP] Keyword[case] identifier[Code] operator[SEP] identifier[INT32] operator[:] Keyword[int] identifier[i32] operator[=] identifier[readInt] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[BigInteger] operator[SEP] identifier[valueOf] operator[SEP] operator[SEP] Keyword[long] operator[SEP] identifier[i32] operator[SEP] operator[SEP] Keyword[case] identifier[Code] operator[SEP] identifier[INT64] operator[:] Keyword[long] identifier[i64] operator[=] identifier[readLong] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[BigInteger] operator[SEP] identifier[valueOf] operator[SEP] identifier[i64] operator[SEP] operator[SEP]
}
Keyword[throw] identifier[unexpected] operator[SEP] literal[String] , identifier[b] operator[SEP] operator[SEP]
}
|
protected void connectAndLogin() throws IOException {
if (!ftpClient.isConnected()) {
ftpClient.connect(getEndpointConfiguration().getHost(), getEndpointConfiguration().getPort());
if (log.isDebugEnabled()) {
log.debug("Connected to FTP server: " + ftpClient.getReplyString());
}
int reply = ftpClient.getReplyCode();
if (!FTPReply.isPositiveCompletion(reply)) {
throw new CitrusRuntimeException("FTP server refused connection.");
}
log.info("Opened connection to FTP server");
if (getEndpointConfiguration().getUser() != null) {
if (log.isDebugEnabled()) {
log.debug(String.format("Login as user: '%s'", getEndpointConfiguration().getUser()));
}
boolean login = ftpClient.login(getEndpointConfiguration().getUser(), getEndpointConfiguration().getPassword());
if (!login) {
throw new CitrusRuntimeException(String.format("Failed to login to FTP server using credentials: %s:%s", getEndpointConfiguration().getUser(), getEndpointConfiguration().getPassword()));
}
}
if (getEndpointConfiguration().isLocalPassiveMode()) {
ftpClient.enterLocalPassiveMode();
}
}
} | class class_name[name] begin[{]
method[connectAndLogin, return_type[void], modifier[protected], parameter[]] begin[{]
if[call[ftpClient.isConnected, parameter[]]] begin[{]
call[ftpClient.connect, parameter[call[.getEndpointConfiguration, parameter[]], call[.getEndpointConfiguration, parameter[]]]]
if[call[log.isDebugEnabled, parameter[]]] begin[{]
call[log.debug, parameter[binary_operation[literal["Connected to FTP server: "], +, call[ftpClient.getReplyString, parameter[]]]]]
else begin[{]
None
end[}]
local_variable[type[int], reply]
if[call[FTPReply.isPositiveCompletion, parameter[member[.reply]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="FTP server refused connection.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CitrusRuntimeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[log.info, parameter[literal["Opened connection to FTP server"]]]
if[binary_operation[call[.getEndpointConfiguration, parameter[]], !=, literal[null]]] begin[{]
if[call[log.isDebugEnabled, parameter[]]] begin[{]
call[log.debug, parameter[call[String.format, parameter[literal["Login as user: '%s'"], call[.getEndpointConfiguration, parameter[]]]]]]
else begin[{]
None
end[}]
local_variable[type[boolean], login]
if[member[.login]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to login to FTP server using credentials: %s:%s"), MethodInvocation(arguments=[], member=getEndpointConfiguration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getUser, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MethodInvocation(arguments=[], member=getEndpointConfiguration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getPassword, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], 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=CitrusRuntimeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[call[.getEndpointConfiguration, parameter[]]] begin[{]
call[ftpClient.enterLocalPassiveMode, parameter[]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[connectAndLogin] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] operator[!] identifier[ftpClient] operator[SEP] identifier[isConnected] operator[SEP] operator[SEP] operator[SEP] {
identifier[ftpClient] operator[SEP] identifier[connect] operator[SEP] identifier[getEndpointConfiguration] operator[SEP] operator[SEP] operator[SEP] identifier[getHost] operator[SEP] operator[SEP] , identifier[getEndpointConfiguration] operator[SEP] operator[SEP] operator[SEP] identifier[getPort] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[log] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[ftpClient] operator[SEP] identifier[getReplyString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[int] identifier[reply] operator[=] identifier[ftpClient] operator[SEP] identifier[getReplyCode] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[FTPReply] operator[SEP] identifier[isPositiveCompletion] operator[SEP] identifier[reply] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[CitrusRuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[log] operator[SEP] identifier[info] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[getEndpointConfiguration] operator[SEP] operator[SEP] operator[SEP] identifier[getUser] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[log] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[log] operator[SEP] identifier[debug] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[getEndpointConfiguration] operator[SEP] operator[SEP] operator[SEP] identifier[getUser] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[boolean] identifier[login] operator[=] identifier[ftpClient] operator[SEP] identifier[login] operator[SEP] identifier[getEndpointConfiguration] operator[SEP] operator[SEP] operator[SEP] identifier[getUser] operator[SEP] operator[SEP] , identifier[getEndpointConfiguration] operator[SEP] operator[SEP] operator[SEP] identifier[getPassword] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[login] operator[SEP] {
Keyword[throw] Keyword[new] identifier[CitrusRuntimeException] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[getEndpointConfiguration] operator[SEP] operator[SEP] operator[SEP] identifier[getUser] operator[SEP] operator[SEP] , identifier[getEndpointConfiguration] operator[SEP] operator[SEP] operator[SEP] identifier[getPassword] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[getEndpointConfiguration] operator[SEP] operator[SEP] operator[SEP] identifier[isLocalPassiveMode] operator[SEP] operator[SEP] operator[SEP] {
identifier[ftpClient] operator[SEP] identifier[enterLocalPassiveMode] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
@NullSafe
@SuppressWarnings("unchecked")
public ProxyFactory<T> adviseWith(MethodInterceptor<T>... methodInterceptors) {
Collections.addAll(this.methodInterceptors, nullSafeArray(methodInterceptors));
return this;
} | class class_name[name] begin[{]
method[adviseWith, return_type[type[ProxyFactory]], modifier[public], parameter[methodInterceptors]] begin[{]
call[Collections.addAll, parameter[THIS[member[None.methodInterceptors]], call[.nullSafeArray, parameter[member[.methodInterceptors]]]]]
return[THIS[]]
end[}]
END[}] | annotation[@] identifier[NullSafe] annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] identifier[ProxyFactory] operator[<] identifier[T] operator[>] identifier[adviseWith] operator[SEP] identifier[MethodInterceptor] operator[<] identifier[T] operator[>] operator[...] identifier[methodInterceptors] operator[SEP] {
identifier[Collections] operator[SEP] identifier[addAll] operator[SEP] Keyword[this] operator[SEP] identifier[methodInterceptors] , identifier[nullSafeArray] operator[SEP] identifier[methodInterceptors] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
@Urlencoded
private void openURL2(String urlString, Command cmd) {
HTTPMethod m;
try (HTTPSession httpclient = HTTPFactory.newSession(urlString)) {
/* you might think this works, but it doesnt:
URI raw = new URI(urlString.trim());
appendLine("raw scheme= " + raw.getScheme() + "\n auth= " + raw.getRawAuthority() + "\n path= " + raw.getRawPath() +
"\n query= " + raw.getRawQuery() + "\n fragment= " + raw.getRawFragment()+"\n");
URI url = new URI(raw.getScheme(), raw.getRawAuthority(),
URIUtil.encodePath(raw.getRawPath()),
URIUtil.encodeQuery(raw.getRawQuery()),
raw.getRawFragment());
appendLine("encoded scheme= " + url.getScheme() + "\n auth= " + url.getAuthority() + "\n path= " + url.getPath() +
"\n query= " + url.getQuery() + "\n fragment= " + url.getFragment()+"\n");
urlString = url.toString();
*/
//urlString = URLnaming.escapeQuery(urlString);
if (cmd == Command.GET)
m = HTTPFactory.Get(httpclient,urlString);
else if (cmd == Command.HEAD)
m = HTTPFactory.Head(httpclient,urlString);
else if (cmd == Command.OPTIONS)
m = HTTPFactory.Options(httpclient,urlString);
else if (cmd == Command.PUT) {
m = HTTPFactory.Put(httpclient,urlString);
m.setRequestContent(new StringEntity(ta.getText())); // was setRequestContentAsString(ta.getText());
} else {
throw new IOException("Unsupported command: " + cmd);
}
m.setCompression("gzip,deflate");
/* FIX
appendLine("HttpClient " + m.getName() + " " + urlString);
appendLine(" do Authentication= " + m.getDoAuthentication());
appendLine(" follow Redirects= " + m.getFollowRedirects());
appendLine(" cookie policy= " + p.getCookiePolicy());
appendLine(" http version= " + p.getVersion().toString());
appendLine(" timeout (msecs)= " + p.getSoTimeout());
appendLine(" virtual host= " + p.getVirtualHost());
*/
printHeaders("Request Headers = ", m.getRequestHeaders());
appendLine(" ");
m.execute();
printHeaders("Request Headers2 = ", m.getRequestHeaders());
appendLine(" ");
appendLine("Status = " + m.getStatusCode() + " " + m.getStatusText());
appendLine("Status Line = " + m.getStatusLine());
printHeaders("Response Headers = ", m.getResponseHeaders());
if (cmd == Command.GET) {
appendLine("\nResponseBody---------------");
String charset = m.getResponseCharSet();
if (charset == null) charset = CDM.UTF8;
String contents = null;
// check for deflate and gzip compression
Header h = m.getResponseHeader("content-encoding");
String encoding = (h == null) ? null : h.getValue();
if (encoding != null && encoding.equals("deflate")) {
byte[] body = m.getResponseAsBytes();
if (body != null) {
InputStream is = new BufferedInputStream(new InflaterInputStream(new ByteArrayInputStream(body)), 10000);
contents = IO.readContents(is, charset);
double ratio = (double) contents.length() / body.length;
appendLine(" deflate encoded=" + body.length + " decoded=" + contents.length() + " ratio= " + ratio);
}
} else if (encoding != null && encoding.equals("gzip")) {
byte[] body = m.getResponseAsBytes();
if (body != null) {
InputStream is = new BufferedInputStream(new GZIPInputStream(new ByteArrayInputStream(body)), 10000);
contents = IO.readContents(is, charset);
double ratio = (double) contents.length() / body.length;
appendLine(" gzip encoded=" + body.length + " decoded=" + contents.length() + " ratio= " + ratio);
}
} else {
byte[] body = m.getResponseAsBytes(50 * 1000); // max 50 Kbytes
contents = (body == null) ? "" : new String(body, charset);
}
if (contents != null) {
if (contents.length() > 50 * 1000) // limit contents
contents = contents.substring(0, 50 * 1000);
appendLine(contents);
}
} else if (cmd == Command.OPTIONS)
printSet("AllowedMethods = ", HTTPFactory.getAllowedMethods());
} catch (IOException e) {
StringWriter sw = new StringWriter(5000);
e.printStackTrace(new PrintWriter(sw));
appendLine(sw.toString());
}
} | class class_name[name] begin[{]
method[openURL2, return_type[void], modifier[private], parameter[urlString, cmd]] begin[{]
local_variable[type[HTTPMethod], m]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=cmd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=GET, postfix_operators=[], prefix_operators=[], qualifier=Command, selectors=[]), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=cmd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=HEAD, postfix_operators=[], prefix_operators=[], qualifier=Command, selectors=[]), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=cmd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=OPTIONS, postfix_operators=[], prefix_operators=[], qualifier=Command, selectors=[]), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=cmd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=PUT, postfix_operators=[], prefix_operators=[], qualifier=Command, selectors=[]), operator===), else_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unsupported command: "), operandr=MemberReference(member=cmd, 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=IOException, sub_type=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=m, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=httpclient, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=urlString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=Put, postfix_operators=[], prefix_operators=[], qualifier=HTTPFactory, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getText, postfix_operators=[], prefix_operators=[], qualifier=ta, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StringEntity, sub_type=None))], member=setRequestContent, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=m, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=httpclient, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=urlString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=Options, postfix_operators=[], prefix_operators=[], qualifier=HTTPFactory, selectors=[], type_arguments=None)), label=None)), label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=m, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=httpclient, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=urlString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=Head, postfix_operators=[], prefix_operators=[], qualifier=HTTPFactory, selectors=[], type_arguments=None)), label=None)), label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=m, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=httpclient, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=urlString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=Get, postfix_operators=[], prefix_operators=[], qualifier=HTTPFactory, selectors=[], type_arguments=None)), label=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="gzip,deflate")], member=setCompression, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Request Headers = "), MethodInvocation(arguments=[], member=getRequestHeaders, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None)], member=printHeaders, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" ")], member=appendLine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=execute, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Request Headers2 = "), MethodInvocation(arguments=[], member=getRequestHeaders, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None)], member=printHeaders, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" ")], member=appendLine, postfix_operators=[], prefix_operators=[], qualifier=, 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="Status = "), operandr=MethodInvocation(arguments=[], member=getStatusCode, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" "), operator=+), operandr=MethodInvocation(arguments=[], member=getStatusText, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None), operator=+)], member=appendLine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Status Line = "), operandr=MethodInvocation(arguments=[], member=getStatusLine, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None), operator=+)], member=appendLine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Response Headers = "), MethodInvocation(arguments=[], member=getResponseHeaders, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None)], member=printHeaders, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=cmd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=GET, postfix_operators=[], prefix_operators=[], qualifier=Command, selectors=[]), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=cmd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=OPTIONS, postfix_operators=[], prefix_operators=[], qualifier=Command, selectors=[]), operator===), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="AllowedMethods = "), MethodInvocation(arguments=[], member=getAllowedMethods, postfix_operators=[], prefix_operators=[], qualifier=HTTPFactory, selectors=[], type_arguments=None)], member=printSet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\nResponseBody---------------")], member=appendLine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getResponseCharSet, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None), name=charset)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=charset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=charset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=UTF8, postfix_operators=[], prefix_operators=[], qualifier=CDM, selectors=[])), label=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=contents)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="content-encoding")], member=getResponseHeader, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None), name=h)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Header, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=h, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=h, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), name=encoding)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=encoding, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="deflate")], member=equals, postfix_operators=[], prefix_operators=[], qualifier=encoding, selectors=[], type_arguments=None), operator=&&), else_statement=IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=encoding, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="gzip")], member=equals, postfix_operators=[], prefix_operators=[], qualifier=encoding, selectors=[], type_arguments=None), operator=&&), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=50), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1000), operator=*)], member=getResponseAsBytes, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None), name=body)], modifiers=set(), type=BasicType(dimensions=[None], name=byte)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=contents, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=body, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=ClassCreator(arguments=[MemberReference(member=body, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=charset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None)), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""))), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getResponseAsBytes, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None), name=body)], modifiers=set(), type=BasicType(dimensions=[None], name=byte)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=body, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[ClassCreator(arguments=[ClassCreator(arguments=[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=ByteArrayInputStream, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=GZIPInputStream, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=10000)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BufferedInputStream, sub_type=None)), name=is)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=InputStream, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=contents, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=is, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=charset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readContents, postfix_operators=[], prefix_operators=[], qualifier=IO, selectors=[], type_arguments=None)), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=Cast(expression=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=contents, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=double)), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=body, selectors=[]), operator=/), name=ratio)], modifiers=set(), type=BasicType(dimensions=[], name=double)), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" gzip encoded="), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=body, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" decoded="), operator=+), operandr=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=contents, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" ratio= "), operator=+), operandr=MemberReference(member=ratio, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=appendLine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))])), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getResponseAsBytes, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None), name=body)], modifiers=set(), type=BasicType(dimensions=[None], name=byte)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=body, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[ClassCreator(arguments=[ClassCreator(arguments=[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=ByteArrayInputStream, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InflaterInputStream, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=10000)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BufferedInputStream, sub_type=None)), name=is)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=InputStream, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=contents, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=is, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=charset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readContents, postfix_operators=[], prefix_operators=[], qualifier=IO, selectors=[], type_arguments=None)), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=Cast(expression=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=contents, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=double)), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=body, selectors=[]), operator=/), name=ratio)], modifiers=set(), type=BasicType(dimensions=[], name=double)), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" deflate encoded="), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=body, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" decoded="), operator=+), operandr=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=contents, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" ratio= "), operator=+), operandr=MemberReference(member=ratio, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=appendLine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=contents, 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=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=contents, selectors=[], type_arguments=None), operandr=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=50), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1000), operator=*), operator=>), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=contents, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=50), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1000), operator=*)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=contents, selectors=[], type_arguments=None)), label=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=contents, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=appendLine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]))], catches=[CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=5000)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StringWriter, sub_type=None)), name=sw)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=StringWriter, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=sw, 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=PrintWriter, sub_type=None))], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=sw, selectors=[], type_arguments=None)], member=appendLine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=httpclient, type=ReferenceType(arguments=None, dimensions=[], name=HTTPSession, sub_type=None), value=MethodInvocation(arguments=[MemberReference(member=urlString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=newSession, postfix_operators=[], prefix_operators=[], qualifier=HTTPFactory, selectors=[], type_arguments=None))])
end[}]
END[}] | annotation[@] identifier[Urlencoded] Keyword[private] Keyword[void] identifier[openURL2] operator[SEP] identifier[String] identifier[urlString] , identifier[Command] identifier[cmd] operator[SEP] {
identifier[HTTPMethod] identifier[m] operator[SEP] Keyword[try] operator[SEP] identifier[HTTPSession] identifier[httpclient] operator[=] identifier[HTTPFactory] operator[SEP] identifier[newSession] operator[SEP] identifier[urlString] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[cmd] operator[==] identifier[Command] operator[SEP] identifier[GET] operator[SEP] identifier[m] operator[=] identifier[HTTPFactory] operator[SEP] identifier[Get] operator[SEP] identifier[httpclient] , identifier[urlString] operator[SEP] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[cmd] operator[==] identifier[Command] operator[SEP] identifier[HEAD] operator[SEP] identifier[m] operator[=] identifier[HTTPFactory] operator[SEP] identifier[Head] operator[SEP] identifier[httpclient] , identifier[urlString] operator[SEP] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[cmd] operator[==] identifier[Command] operator[SEP] identifier[OPTIONS] operator[SEP] identifier[m] operator[=] identifier[HTTPFactory] operator[SEP] identifier[Options] operator[SEP] identifier[httpclient] , identifier[urlString] operator[SEP] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[cmd] operator[==] identifier[Command] operator[SEP] identifier[PUT] operator[SEP] {
identifier[m] operator[=] identifier[HTTPFactory] operator[SEP] identifier[Put] operator[SEP] identifier[httpclient] , identifier[urlString] operator[SEP] operator[SEP] identifier[m] operator[SEP] identifier[setRequestContent] operator[SEP] Keyword[new] identifier[StringEntity] operator[SEP] identifier[ta] operator[SEP] identifier[getText] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[+] identifier[cmd] operator[SEP] operator[SEP]
}
identifier[m] operator[SEP] identifier[setCompression] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[printHeaders] operator[SEP] literal[String] , identifier[m] operator[SEP] identifier[getRequestHeaders] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[appendLine] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[m] operator[SEP] identifier[execute] operator[SEP] operator[SEP] operator[SEP] identifier[printHeaders] operator[SEP] literal[String] , identifier[m] operator[SEP] identifier[getRequestHeaders] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[appendLine] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[appendLine] operator[SEP] literal[String] operator[+] identifier[m] operator[SEP] identifier[getStatusCode] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[m] operator[SEP] identifier[getStatusText] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[appendLine] operator[SEP] literal[String] operator[+] identifier[m] operator[SEP] identifier[getStatusLine] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[printHeaders] operator[SEP] literal[String] , identifier[m] operator[SEP] identifier[getResponseHeaders] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cmd] operator[==] identifier[Command] operator[SEP] identifier[GET] operator[SEP] {
identifier[appendLine] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] identifier[charset] operator[=] identifier[m] operator[SEP] identifier[getResponseCharSet] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[charset] operator[==] Other[null] operator[SEP] identifier[charset] operator[=] identifier[CDM] operator[SEP] identifier[UTF8] operator[SEP] identifier[String] identifier[contents] operator[=] Other[null] operator[SEP] identifier[Header] identifier[h] operator[=] identifier[m] operator[SEP] identifier[getResponseHeader] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] identifier[encoding] operator[=] operator[SEP] identifier[h] operator[==] Other[null] operator[SEP] operator[?] Other[null] operator[:] identifier[h] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[encoding] operator[!=] Other[null] operator[&&] identifier[encoding] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[byte] operator[SEP] operator[SEP] identifier[body] operator[=] identifier[m] operator[SEP] identifier[getResponseAsBytes] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[body] operator[!=] Other[null] operator[SEP] {
identifier[InputStream] identifier[is] operator[=] Keyword[new] identifier[BufferedInputStream] operator[SEP] Keyword[new] identifier[InflaterInputStream] operator[SEP] Keyword[new] identifier[ByteArrayInputStream] operator[SEP] identifier[body] operator[SEP] operator[SEP] , Other[10000] operator[SEP] operator[SEP] identifier[contents] operator[=] identifier[IO] operator[SEP] identifier[readContents] operator[SEP] identifier[is] , identifier[charset] operator[SEP] operator[SEP] Keyword[double] identifier[ratio] operator[=] operator[SEP] Keyword[double] operator[SEP] identifier[contents] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[/] identifier[body] operator[SEP] identifier[length] operator[SEP] identifier[appendLine] operator[SEP] literal[String] operator[+] identifier[body] operator[SEP] identifier[length] operator[+] literal[String] operator[+] identifier[contents] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[ratio] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[encoding] operator[!=] Other[null] operator[&&] identifier[encoding] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[byte] operator[SEP] operator[SEP] identifier[body] operator[=] identifier[m] operator[SEP] identifier[getResponseAsBytes] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[body] operator[!=] Other[null] operator[SEP] {
identifier[InputStream] identifier[is] operator[=] Keyword[new] identifier[BufferedInputStream] operator[SEP] Keyword[new] identifier[GZIPInputStream] operator[SEP] Keyword[new] identifier[ByteArrayInputStream] operator[SEP] identifier[body] operator[SEP] operator[SEP] , Other[10000] operator[SEP] operator[SEP] identifier[contents] operator[=] identifier[IO] operator[SEP] identifier[readContents] operator[SEP] identifier[is] , identifier[charset] operator[SEP] operator[SEP] Keyword[double] identifier[ratio] operator[=] operator[SEP] Keyword[double] operator[SEP] identifier[contents] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[/] identifier[body] operator[SEP] identifier[length] operator[SEP] identifier[appendLine] operator[SEP] literal[String] operator[+] identifier[body] operator[SEP] identifier[length] operator[+] literal[String] operator[+] identifier[contents] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[ratio] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[byte] operator[SEP] operator[SEP] identifier[body] operator[=] identifier[m] operator[SEP] identifier[getResponseAsBytes] operator[SEP] Other[50] operator[*] Other[1000] operator[SEP] operator[SEP] identifier[contents] operator[=] operator[SEP] identifier[body] operator[==] Other[null] operator[SEP] operator[?] literal[String] operator[:] Keyword[new] identifier[String] operator[SEP] identifier[body] , identifier[charset] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[contents] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[contents] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[50] operator[*] Other[1000] operator[SEP] identifier[contents] operator[=] identifier[contents] operator[SEP] identifier[substring] operator[SEP] Other[0] , Other[50] operator[*] Other[1000] operator[SEP] operator[SEP] identifier[appendLine] operator[SEP] identifier[contents] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[cmd] operator[==] identifier[Command] operator[SEP] identifier[OPTIONS] operator[SEP] identifier[printSet] operator[SEP] literal[String] , identifier[HTTPFactory] operator[SEP] identifier[getAllowedMethods] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[StringWriter] identifier[sw] operator[=] Keyword[new] identifier[StringWriter] operator[SEP] Other[5000] operator[SEP] operator[SEP] identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] Keyword[new] identifier[PrintWriter] operator[SEP] identifier[sw] operator[SEP] operator[SEP] operator[SEP] identifier[appendLine] operator[SEP] identifier[sw] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static void addRequestDebug(SessionContext ctx, String line) {
List<String> rd = getRequestDebug(ctx);
rd.add(line);
} | class class_name[name] begin[{]
method[addRequestDebug, return_type[void], modifier[public static], parameter[ctx, line]] begin[{]
local_variable[type[List], rd]
call[rd.add, parameter[member[.line]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[addRequestDebug] operator[SEP] identifier[SessionContext] identifier[ctx] , identifier[String] identifier[line] operator[SEP] {
identifier[List] operator[<] identifier[String] operator[>] identifier[rd] operator[=] identifier[getRequestDebug] operator[SEP] identifier[ctx] operator[SEP] operator[SEP] identifier[rd] operator[SEP] identifier[add] operator[SEP] identifier[line] operator[SEP] operator[SEP]
}
|
public static StreamEx<String> split(CharSequence str, String regex) {
if (str.length() == 0)
return of("");
if (regex.isEmpty()) {
return IntStreamEx.ofChars(str).mapToObj(ch -> new String(new char[] { (char) ch }));
}
char ch = regex.charAt(0);
if (regex.length() == 1 && ".$|()[{^?*+\\".indexOf(ch) == -1) {
return split(str, ch);
} else if (regex.length() == 2 && ch == '\\') {
ch = regex.charAt(1);
if ((ch < '0' || ch > '9') && (ch < 'A' || ch > 'Z') && (ch < 'a' || ch > 'z')
&& (ch < Character.MIN_HIGH_SURROGATE || ch > Character.MAX_LOW_SURROGATE)) {
return split(str, ch);
}
}
return new StreamEx<>(Pattern.compile(regex).splitAsStream(str), StreamContext.SEQUENTIAL);
} | class class_name[name] begin[{]
method[split, return_type[type[StreamEx]], modifier[public static], parameter[str, regex]] begin[{]
if[binary_operation[call[str.length, parameter[]], ==, literal[0]]] begin[{]
return[call[.of, parameter[literal[""]]]]
else begin[{]
None
end[}]
if[call[regex.isEmpty, parameter[]]] begin[{]
return[call[IntStreamEx.ofChars, parameter[member[.str]]]]
else begin[{]
None
end[}]
local_variable[type[char], ch]
if[binary_operation[binary_operation[call[regex.length, parameter[]], ==, literal[1]], &&, binary_operation[literal[".$|()[{^?*+\\"], ==, literal[1]]]] begin[{]
return[call[.split, parameter[member[.str], member[.ch]]]]
else begin[{]
if[binary_operation[binary_operation[call[regex.length, parameter[]], ==, literal[2]], &&, binary_operation[member[.ch], ==, literal['\\']]]] begin[{]
assign[member[.ch], call[regex.charAt, parameter[literal[1]]]]
if[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[member[.ch], <, literal['0']], ||, binary_operation[member[.ch], >, literal['9']]], &&, binary_operation[binary_operation[member[.ch], <, literal['A']], ||, binary_operation[member[.ch], >, literal['Z']]]], &&, binary_operation[binary_operation[member[.ch], <, literal['a']], ||, binary_operation[member[.ch], >, literal['z']]]], &&, binary_operation[binary_operation[member[.ch], <, member[Character.MIN_HIGH_SURROGATE]], ||, binary_operation[member[.ch], >, member[Character.MAX_LOW_SURROGATE]]]]] begin[{]
return[call[.split, parameter[member[.str], member[.ch]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
return[ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=regex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=compile, postfix_operators=[], prefix_operators=[], qualifier=Pattern, selectors=[MethodInvocation(arguments=[MemberReference(member=str, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=splitAsStream, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MemberReference(member=SEQUENTIAL, postfix_operators=[], prefix_operators=[], qualifier=StreamContext, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=StreamEx, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[StreamEx] operator[<] identifier[String] operator[>] identifier[split] operator[SEP] identifier[CharSequence] identifier[str] , identifier[String] identifier[regex] operator[SEP] {
Keyword[if] operator[SEP] identifier[str] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] Keyword[return] identifier[of] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[regex] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[IntStreamEx] operator[SEP] identifier[ofChars] operator[SEP] identifier[str] operator[SEP] operator[SEP] identifier[mapToObj] operator[SEP] identifier[ch] operator[->] Keyword[new] identifier[String] operator[SEP] Keyword[new] Keyword[char] operator[SEP] operator[SEP] {
operator[SEP] Keyword[char] operator[SEP] identifier[ch]
} operator[SEP] operator[SEP] operator[SEP]
}
Keyword[char] identifier[ch] operator[=] identifier[regex] operator[SEP] identifier[charAt] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[regex] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[1] operator[&&] literal[String] operator[SEP] identifier[indexOf] operator[SEP] identifier[ch] operator[SEP] operator[==] operator[-] Other[1] operator[SEP] {
Keyword[return] identifier[split] operator[SEP] identifier[str] , identifier[ch] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[regex] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[2] operator[&&] identifier[ch] operator[==] literal[String] operator[SEP] {
identifier[ch] operator[=] identifier[regex] operator[SEP] identifier[charAt] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[ch] operator[<] literal[String] operator[||] identifier[ch] operator[>] literal[String] operator[SEP] operator[&&] operator[SEP] identifier[ch] operator[<] literal[String] operator[||] identifier[ch] operator[>] literal[String] operator[SEP] operator[&&] operator[SEP] identifier[ch] operator[<] literal[String] operator[||] identifier[ch] operator[>] literal[String] operator[SEP] operator[&&] operator[SEP] identifier[ch] operator[<] identifier[Character] operator[SEP] identifier[MIN_HIGH_SURROGATE] operator[||] identifier[ch] operator[>] identifier[Character] operator[SEP] identifier[MAX_LOW_SURROGATE] operator[SEP] operator[SEP] {
Keyword[return] identifier[split] operator[SEP] identifier[str] , identifier[ch] operator[SEP] operator[SEP]
}
}
Keyword[return] Keyword[new] identifier[StreamEx] operator[<] operator[>] operator[SEP] identifier[Pattern] operator[SEP] identifier[compile] operator[SEP] identifier[regex] operator[SEP] operator[SEP] identifier[splitAsStream] operator[SEP] identifier[str] operator[SEP] , identifier[StreamContext] operator[SEP] identifier[SEQUENTIAL] operator[SEP] operator[SEP]
}
|
private List iterateAndReturnNative(final ResultSet rSet) {
final Iterator<Row> rowIter = rSet.iterator();
final List results = new ArrayList();
final List item = new ArrayList<>();
final boolean isSingle = (rSet.getColumnDefinitions().size() == 1);
while (rowIter.hasNext()) {
final Row row = rowIter.next();
final ColumnDefinitions columnDefs = row.getColumnDefinitions();
final Iterator<Definition> columnDefIter = columnDefs.iterator();
item.clear();
while (columnDefIter.hasNext()) {
final Definition columnDef = columnDefIter.next();
item.add(DSClientUtilities.assign(row, null, null, columnDef.getType().getName(), null,
columnDef.getName(), null, null));
}
if (isSingle) {
if (!item.isEmpty())
results.add(item.get(0));
else
results.add(null);
} else
results.add(item.toArray(new Object[item.size()]));
}
return results;
} | class class_name[name] begin[{]
method[iterateAndReturnNative, return_type[type[List]], modifier[private], parameter[rSet]] begin[{]
local_variable[type[Iterator], rowIter]
local_variable[type[List], results]
local_variable[type[List], item]
local_variable[type[boolean], isSingle]
while[call[rowIter.hasNext, parameter[]]] begin[{]
local_variable[type[Row], row]
local_variable[type[ColumnDefinitions], columnDefs]
local_variable[type[Iterator], columnDefIter]
call[item.clear, parameter[]]
while[call[columnDefIter.hasNext, parameter[]]] begin[{]
local_variable[type[Definition], columnDef]
call[item.add, parameter[call[DSClientUtilities.assign, parameter[member[.row], literal[null], literal[null], call[columnDef.getType, parameter[]], literal[null], call[columnDef.getName, parameter[]], literal[null], literal[null]]]]]
end[}]
if[member[.isSingle]] begin[{]
if[call[item.isEmpty, parameter[]]] begin[{]
call[results.add, parameter[call[item.get, parameter[literal[0]]]]]
else begin[{]
call[results.add, parameter[literal[null]]]
end[}]
else begin[{]
call[results.add, parameter[call[item.toArray, parameter[ArrayCreator(dimensions=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[], type_arguments=None)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]]]
end[}]
end[}]
return[member[.results]]
end[}]
END[}] | Keyword[private] identifier[List] identifier[iterateAndReturnNative] operator[SEP] Keyword[final] identifier[ResultSet] identifier[rSet] operator[SEP] {
Keyword[final] identifier[Iterator] operator[<] identifier[Row] operator[>] identifier[rowIter] operator[=] identifier[rSet] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[List] identifier[results] operator[=] Keyword[new] identifier[ArrayList] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[List] identifier[item] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[boolean] identifier[isSingle] operator[=] operator[SEP] identifier[rSet] operator[SEP] identifier[getColumnDefinitions] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[1] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[rowIter] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[Row] identifier[row] operator[=] identifier[rowIter] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[ColumnDefinitions] identifier[columnDefs] operator[=] identifier[row] operator[SEP] identifier[getColumnDefinitions] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Iterator] operator[<] identifier[Definition] operator[>] identifier[columnDefIter] operator[=] identifier[columnDefs] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[item] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[columnDefIter] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[Definition] identifier[columnDef] operator[=] identifier[columnDefIter] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[item] operator[SEP] identifier[add] operator[SEP] identifier[DSClientUtilities] operator[SEP] identifier[assign] operator[SEP] identifier[row] , Other[null] , Other[null] , identifier[columnDef] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , Other[null] , identifier[columnDef] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , Other[null] , Other[null] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[isSingle] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[item] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] identifier[results] operator[SEP] identifier[add] operator[SEP] identifier[item] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] Keyword[else] identifier[results] operator[SEP] identifier[add] operator[SEP] Other[null] operator[SEP] operator[SEP]
}
Keyword[else] identifier[results] operator[SEP] identifier[add] operator[SEP] identifier[item] operator[SEP] identifier[toArray] operator[SEP] Keyword[new] identifier[Object] operator[SEP] identifier[item] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[results] operator[SEP]
}
|
public static FormatOptions of(int flags, int width, int precision) {
if (!checkFlagConsistency(flags, width != UNSET)) {
throw new IllegalArgumentException("invalid flags: 0x" + Integer.toHexString(flags));
}
if ((width < 1 || width > MAX_ALLOWED_WIDTH) && width != UNSET) {
throw new IllegalArgumentException("invalid width: " + width);
}
if ((precision < 0 || precision > MAX_ALLOWED_PRECISION) && precision != UNSET) {
throw new IllegalArgumentException("invalid precision: " + precision);
}
return new FormatOptions(flags, width, precision);
} | class class_name[name] begin[{]
method[of, return_type[type[FormatOptions]], modifier[public static], parameter[flags, width, precision]] begin[{]
if[call[.checkFlagConsistency, parameter[member[.flags], binary_operation[member[.width], !=, member[.UNSET]]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="invalid flags: 0x"), operandr=MethodInvocation(arguments=[MemberReference(member=flags, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toHexString, postfix_operators=[], prefix_operators=[], qualifier=Integer, 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)
else begin[{]
None
end[}]
if[binary_operation[binary_operation[binary_operation[member[.width], <, literal[1]], ||, binary_operation[member[.width], >, member[.MAX_ALLOWED_WIDTH]]], &&, binary_operation[member[.width], !=, member[.UNSET]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="invalid width: "), operandr=MemberReference(member=width, 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=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[binary_operation[binary_operation[member[.precision], <, literal[0]], ||, binary_operation[member[.precision], >, member[.MAX_ALLOWED_PRECISION]]], &&, binary_operation[member[.precision], !=, member[.UNSET]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="invalid precision: "), operandr=MemberReference(member=precision, 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=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MemberReference(member=flags, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=width, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=precision, 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=FormatOptions, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[FormatOptions] identifier[of] operator[SEP] Keyword[int] identifier[flags] , Keyword[int] identifier[width] , Keyword[int] identifier[precision] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[checkFlagConsistency] operator[SEP] identifier[flags] , identifier[width] operator[!=] identifier[UNSET] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[Integer] operator[SEP] identifier[toHexString] operator[SEP] identifier[flags] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[SEP] identifier[width] operator[<] Other[1] operator[||] identifier[width] operator[>] identifier[MAX_ALLOWED_WIDTH] operator[SEP] operator[&&] identifier[width] operator[!=] identifier[UNSET] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[width] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[SEP] identifier[precision] operator[<] Other[0] operator[||] identifier[precision] operator[>] identifier[MAX_ALLOWED_PRECISION] operator[SEP] operator[&&] identifier[precision] operator[!=] identifier[UNSET] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[precision] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[FormatOptions] operator[SEP] identifier[flags] , identifier[width] , identifier[precision] operator[SEP] operator[SEP]
}
|
public synchronized void updateDocumentContent(Long docid, String content) throws SQLException {
if (cache_document==CACHE_OFF) {
edadb.updateDocumentContent(docid, content);
} else if (cache_document==CACHE_ONLY) {
Document docvo = documentCache.get(docid);
if (docvo!=null) docvo.setContent(content);
} else {
edadb.updateDocumentContent(docid, content);
Document docvo = documentCache.get(docid);
if (docvo!=null) docvo.setContent(content);
}
} | class class_name[name] begin[{]
method[updateDocumentContent, return_type[void], modifier[synchronized public], parameter[docid, content]] begin[{]
if[binary_operation[member[.cache_document], ==, member[.CACHE_OFF]]] begin[{]
call[edadb.updateDocumentContent, parameter[member[.docid], member[.content]]]
else begin[{]
if[binary_operation[member[.cache_document], ==, member[.CACHE_ONLY]]] begin[{]
local_variable[type[Document], docvo]
if[binary_operation[member[.docvo], !=, literal[null]]] begin[{]
call[docvo.setContent, parameter[member[.content]]]
else begin[{]
None
end[}]
else begin[{]
call[edadb.updateDocumentContent, parameter[member[.docid], member[.content]]]
local_variable[type[Document], docvo]
if[binary_operation[member[.docvo], !=, literal[null]]] begin[{]
call[docvo.setContent, parameter[member[.content]]]
else begin[{]
None
end[}]
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[synchronized] Keyword[void] identifier[updateDocumentContent] operator[SEP] identifier[Long] identifier[docid] , identifier[String] identifier[content] operator[SEP] Keyword[throws] identifier[SQLException] {
Keyword[if] operator[SEP] identifier[cache_document] operator[==] identifier[CACHE_OFF] operator[SEP] {
identifier[edadb] operator[SEP] identifier[updateDocumentContent] operator[SEP] identifier[docid] , identifier[content] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[cache_document] operator[==] identifier[CACHE_ONLY] operator[SEP] {
identifier[Document] identifier[docvo] operator[=] identifier[documentCache] operator[SEP] identifier[get] operator[SEP] identifier[docid] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[docvo] operator[!=] Other[null] operator[SEP] identifier[docvo] operator[SEP] identifier[setContent] operator[SEP] identifier[content] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[edadb] operator[SEP] identifier[updateDocumentContent] operator[SEP] identifier[docid] , identifier[content] operator[SEP] operator[SEP] identifier[Document] identifier[docvo] operator[=] identifier[documentCache] operator[SEP] identifier[get] operator[SEP] identifier[docid] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[docvo] operator[!=] Other[null] operator[SEP] identifier[docvo] operator[SEP] identifier[setContent] operator[SEP] identifier[content] operator[SEP] operator[SEP]
}
}
|
public ListGroupsResult withGroupIdentifiers(GroupIdentifier... groupIdentifiers) {
if (this.groupIdentifiers == null) {
setGroupIdentifiers(new java.util.ArrayList<GroupIdentifier>(groupIdentifiers.length));
}
for (GroupIdentifier ele : groupIdentifiers) {
this.groupIdentifiers.add(ele);
}
return this;
} | class class_name[name] begin[{]
method[withGroupIdentifiers, return_type[type[ListGroupsResult]], modifier[public], parameter[groupIdentifiers]] begin[{]
if[binary_operation[THIS[member[None.groupIdentifiers]], ==, literal[null]]] begin[{]
call[.setGroupIdentifiers, parameter[ClassCreator(arguments=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=groupIdentifiers, 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=GroupIdentifier, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))))]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=groupIdentifiers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=ele, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=groupIdentifiers, 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=GroupIdentifier, sub_type=None))), label=None)
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[ListGroupsResult] identifier[withGroupIdentifiers] operator[SEP] identifier[GroupIdentifier] operator[...] identifier[groupIdentifiers] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[groupIdentifiers] operator[==] Other[null] operator[SEP] {
identifier[setGroupIdentifiers] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[GroupIdentifier] operator[>] operator[SEP] identifier[groupIdentifiers] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[GroupIdentifier] identifier[ele] operator[:] identifier[groupIdentifiers] operator[SEP] {
Keyword[this] operator[SEP] identifier[groupIdentifiers] operator[SEP] identifier[add] operator[SEP] identifier[ele] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public RedisClusterNode getPartitionByNodeId(String nodeId) {
for (RedisClusterNode partition : nodeReadView) {
if (partition.getNodeId().equals(nodeId)) {
return partition;
}
}
return null;
} | class class_name[name] begin[{]
method[getPartitionByNodeId, return_type[type[RedisClusterNode]], modifier[public], parameter[nodeId]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=getNodeId, postfix_operators=[], prefix_operators=[], qualifier=partition, selectors=[MethodInvocation(arguments=[MemberReference(member=nodeId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], 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=[ReturnStatement(expression=MemberReference(member=partition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=nodeReadView, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=partition)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=RedisClusterNode, sub_type=None))), label=None)
return[literal[null]]
end[}]
END[}] | Keyword[public] identifier[RedisClusterNode] identifier[getPartitionByNodeId] operator[SEP] identifier[String] identifier[nodeId] operator[SEP] {
Keyword[for] operator[SEP] identifier[RedisClusterNode] identifier[partition] operator[:] identifier[nodeReadView] operator[SEP] {
Keyword[if] operator[SEP] identifier[partition] operator[SEP] identifier[getNodeId] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[nodeId] operator[SEP] operator[SEP] {
Keyword[return] identifier[partition] operator[SEP]
}
}
Keyword[return] Other[null] operator[SEP]
}
|
private static Optional<AnnotationSpec> getLazyInitAnnotation(Elements elements) {
if (elements.getTypeElement(LAZY_INIT.toString()) == null) {
return Optional.empty();
}
return Optional.of(AnnotationSpec.builder(LAZY_INIT).build());
} | class class_name[name] begin[{]
method[getLazyInitAnnotation, return_type[type[Optional]], modifier[private static], parameter[elements]] begin[{]
if[binary_operation[call[elements.getTypeElement, parameter[call[LAZY_INIT.toString, parameter[]]]], ==, literal[null]]] begin[{]
return[call[Optional.empty, parameter[]]]
else begin[{]
None
end[}]
return[call[Optional.of, parameter[call[AnnotationSpec.builder, parameter[member[.LAZY_INIT]]]]]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[Optional] operator[<] identifier[AnnotationSpec] operator[>] identifier[getLazyInitAnnotation] operator[SEP] identifier[Elements] identifier[elements] operator[SEP] {
Keyword[if] operator[SEP] identifier[elements] operator[SEP] identifier[getTypeElement] operator[SEP] identifier[LAZY_INIT] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[Optional] operator[SEP] identifier[empty] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[Optional] operator[SEP] identifier[of] operator[SEP] identifier[AnnotationSpec] operator[SEP] identifier[builder] operator[SEP] identifier[LAZY_INIT] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private MessageBuffer getNextBuffer()
throws IOException
{
MessageBuffer next = in.next();
if (next == null) {
throw new MessageInsufficientBufferException();
}
assert (buffer != null);
totalReadBytes += buffer.size();
return next;
} | class class_name[name] begin[{]
method[getNextBuffer, return_type[type[MessageBuffer]], modifier[private], parameter[]] begin[{]
local_variable[type[MessageBuffer], next]
if[binary_operation[member[.next], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MessageInsufficientBufferException, sub_type=None)), label=None)
else begin[{]
None
end[}]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=buffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None, value=None)
assign[member[.totalReadBytes], call[buffer.size, parameter[]]]
return[member[.next]]
end[}]
END[}] | Keyword[private] identifier[MessageBuffer] identifier[getNextBuffer] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[MessageBuffer] identifier[next] operator[=] identifier[in] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[next] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[MessageInsufficientBufferException] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[assert] operator[SEP] identifier[buffer] operator[!=] Other[null] operator[SEP] operator[SEP] identifier[totalReadBytes] operator[+=] identifier[buffer] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[next] operator[SEP]
}
|
private static boolean isBinary(InputStream in) {
try {
int size = in.available();
if (size > 1024) size = 1024;
byte[] data = new byte[size];
in.read(data);
in.close();
int ascii = 0;
int other = 0;
for (int i = 0; i < data.length; i++) {
byte b = data[i];
if (b < 0x09) return true;
if (b == 0x09 || b == 0x0A || b == 0x0C || b == 0x0D) ascii++;
else if (b >= 0x20 && b <= 0x7E) ascii++;
else other++;
}
return other != 0 && 100 * other / (ascii + other) > 95;
} catch (IOException e) {
throw E.ioException(e);
}
} | class class_name[name] begin[{]
method[isBinary, return_type[type[boolean]], modifier[private static], parameter[in]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=available, postfix_operators=[], prefix_operators=[], qualifier=in, selectors=[], type_arguments=None), name=size)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=size, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1024), operator=>), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=size, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1024)), label=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ArrayCreator(dimensions=[MemberReference(member=size, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=byte)), name=data)], modifiers=set(), type=BasicType(dimensions=[None], name=byte)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=read, postfix_operators=[], prefix_operators=[], qualifier=in, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=in, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=ascii)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=other)], modifiers=set(), type=BasicType(dimensions=[], name=int)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=b)], modifiers=set(), type=BasicType(dimensions=[], name=byte)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x09), operator=<), else_statement=None, label=None, then_statement=ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x09), operator===), operandr=BinaryOperation(operandl=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x0A), operator===), operator=||), operandr=BinaryOperation(operandl=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x0C), operator===), operator=||), operandr=BinaryOperation(operandl=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x0D), operator===), operator=||), else_statement=IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x20), operator=>=), operandr=BinaryOperation(operandl=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x7E), operator=<=), operator=&&), else_statement=StatementExpression(expression=MemberReference(member=other, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None), label=None, then_statement=StatementExpression(expression=MemberReference(member=ascii, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)), label=None, then_statement=StatementExpression(expression=MemberReference(member=ascii, 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=data, 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), ReturnStatement(expression=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=other, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=!=), operandr=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=100), operandr=MemberReference(member=other, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operandr=BinaryOperation(operandl=MemberReference(member=ascii, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=other, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operator=/), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=95), operator=>), operator=&&), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=ioException, postfix_operators=[], prefix_operators=[], qualifier=E, selectors=[], type_arguments=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[static] Keyword[boolean] identifier[isBinary] operator[SEP] identifier[InputStream] identifier[in] operator[SEP] {
Keyword[try] {
Keyword[int] identifier[size] operator[=] identifier[in] operator[SEP] identifier[available] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[size] operator[>] Other[1024] operator[SEP] identifier[size] operator[=] Other[1024] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[data] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[size] operator[SEP] operator[SEP] identifier[in] operator[SEP] identifier[read] operator[SEP] identifier[data] operator[SEP] operator[SEP] identifier[in] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[ascii] operator[=] Other[0] operator[SEP] Keyword[int] identifier[other] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[data] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[byte] identifier[b] operator[=] identifier[data] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[b] operator[<] literal[Integer] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[b] operator[==] literal[Integer] operator[||] identifier[b] operator[==] literal[Integer] operator[||] identifier[b] operator[==] literal[Integer] operator[||] identifier[b] operator[==] literal[Integer] operator[SEP] identifier[ascii] operator[++] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[b] operator[>=] literal[Integer] operator[&&] identifier[b] operator[<=] literal[Integer] operator[SEP] identifier[ascii] operator[++] operator[SEP] Keyword[else] identifier[other] operator[++] operator[SEP]
}
Keyword[return] identifier[other] operator[!=] Other[0] operator[&&] Other[100] operator[*] identifier[other] operator[/] operator[SEP] identifier[ascii] operator[+] identifier[other] operator[SEP] operator[>] Other[95] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] identifier[E] operator[SEP] identifier[ioException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
protected Properties difference(final Map map) {
final Properties difference = new Properties();
for (final Object o : map.entrySet()) {
final Map.Entry entry = (Map.Entry) o;
final String key = (String) entry.getKey();
final String val = (String) entry.getValue();
if (!properties.containsKey(key)) {
difference.setProperty(key, val);
}
}
return difference;
} | class class_name[name] begin[{]
method[difference, return_type[type[Properties]], modifier[protected], parameter[map]] begin[{]
local_variable[type[Properties], difference]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=None, dimensions=None, name=Entry, sub_type=None))), name=entry)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=None, dimensions=None, name=Entry, sub_type=None))), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), name=key)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), name=val)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=containsKey, postfix_operators=[], prefix_operators=['!'], qualifier=properties, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=val, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setProperty, postfix_operators=[], prefix_operators=[], qualifier=difference, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=map, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=o)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))), label=None)
return[member[.difference]]
end[}]
END[}] | Keyword[protected] identifier[Properties] identifier[difference] operator[SEP] Keyword[final] identifier[Map] identifier[map] operator[SEP] {
Keyword[final] identifier[Properties] identifier[difference] operator[=] Keyword[new] identifier[Properties] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[Object] identifier[o] operator[:] identifier[map] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[Map] operator[SEP] identifier[Entry] identifier[entry] operator[=] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[SEP] identifier[o] operator[SEP] Keyword[final] identifier[String] identifier[key] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[val] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[properties] operator[SEP] identifier[containsKey] operator[SEP] identifier[key] operator[SEP] operator[SEP] {
identifier[difference] operator[SEP] identifier[setProperty] operator[SEP] identifier[key] , identifier[val] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[difference] operator[SEP]
}
|
@BetaApi(
"The surface for long-running operations is not stable yet and may change in the future.")
public final OperationFuture<Empty, OperationMetadata> importDataAsync(
String name, InputConfig inputConfig) {
ImportDataRequest request =
ImportDataRequest.newBuilder().setName(name).setInputConfig(inputConfig).build();
return importDataAsync(request);
} | class class_name[name] begin[{]
method[importDataAsync, return_type[type[OperationFuture]], modifier[final public], parameter[name, inputConfig]] begin[{]
local_variable[type[ImportDataRequest], request]
return[call[.importDataAsync, parameter[member[.request]]]]
end[}]
END[}] | annotation[@] identifier[BetaApi] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[final] identifier[OperationFuture] operator[<] identifier[Empty] , identifier[OperationMetadata] operator[>] identifier[importDataAsync] operator[SEP] identifier[String] identifier[name] , identifier[InputConfig] identifier[inputConfig] operator[SEP] {
identifier[ImportDataRequest] identifier[request] operator[=] identifier[ImportDataRequest] operator[SEP] identifier[newBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[setName] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[setInputConfig] operator[SEP] identifier[inputConfig] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[importDataAsync] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
private int writeBytesMultiple(ChannelOutboundBuffer in, IovArray array) throws IOException {
final long expectedWrittenBytes = array.size();
assert expectedWrittenBytes != 0;
final int cnt = array.count();
assert cnt != 0;
final long localWrittenBytes = socket.writevAddresses(array.memoryAddress(0), cnt);
if (localWrittenBytes > 0) {
adjustMaxBytesPerGatheringWrite(expectedWrittenBytes, localWrittenBytes, array.maxBytes());
in.removeBytes(localWrittenBytes);
return 1;
}
return WRITE_STATUS_SNDBUF_FULL;
} | class class_name[name] begin[{]
method[writeBytesMultiple, return_type[type[int]], modifier[private], parameter[in, array]] begin[{]
local_variable[type[long], expectedWrittenBytes]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=expectedWrittenBytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=!=), label=None, value=None)
local_variable[type[int], cnt]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=cnt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=!=), label=None, value=None)
local_variable[type[long], localWrittenBytes]
if[binary_operation[member[.localWrittenBytes], >, literal[0]]] begin[{]
call[.adjustMaxBytesPerGatheringWrite, parameter[member[.expectedWrittenBytes], member[.localWrittenBytes], call[array.maxBytes, parameter[]]]]
call[in.removeBytes, parameter[member[.localWrittenBytes]]]
return[literal[1]]
else begin[{]
None
end[}]
return[member[.WRITE_STATUS_SNDBUF_FULL]]
end[}]
END[}] | Keyword[private] Keyword[int] identifier[writeBytesMultiple] operator[SEP] identifier[ChannelOutboundBuffer] identifier[in] , identifier[IovArray] identifier[array] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[final] Keyword[long] identifier[expectedWrittenBytes] operator[=] identifier[array] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[assert] identifier[expectedWrittenBytes] operator[!=] Other[0] operator[SEP] Keyword[final] Keyword[int] identifier[cnt] operator[=] identifier[array] operator[SEP] identifier[count] operator[SEP] operator[SEP] operator[SEP] Keyword[assert] identifier[cnt] operator[!=] Other[0] operator[SEP] Keyword[final] Keyword[long] identifier[localWrittenBytes] operator[=] identifier[socket] operator[SEP] identifier[writevAddresses] operator[SEP] identifier[array] operator[SEP] identifier[memoryAddress] operator[SEP] Other[0] operator[SEP] , identifier[cnt] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[localWrittenBytes] operator[>] Other[0] operator[SEP] {
identifier[adjustMaxBytesPerGatheringWrite] operator[SEP] identifier[expectedWrittenBytes] , identifier[localWrittenBytes] , identifier[array] operator[SEP] identifier[maxBytes] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[in] operator[SEP] identifier[removeBytes] operator[SEP] identifier[localWrittenBytes] operator[SEP] operator[SEP] Keyword[return] Other[1] operator[SEP]
}
Keyword[return] identifier[WRITE_STATUS_SNDBUF_FULL] operator[SEP]
}
|
@Override
public boolean canAuthenticate(String resource) {
if (resource == null) {
return false;
}
ClientCredential credential = getCredentialForResource(resource);
return credential != null;
} | class class_name[name] begin[{]
method[canAuthenticate, return_type[type[boolean]], modifier[public], parameter[resource]] begin[{]
if[binary_operation[member[.resource], ==, literal[null]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[ClientCredential], credential]
return[binary_operation[member[.credential], !=, literal[null]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[canAuthenticate] operator[SEP] identifier[String] identifier[resource] operator[SEP] {
Keyword[if] operator[SEP] identifier[resource] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[ClientCredential] identifier[credential] operator[=] identifier[getCredentialForResource] operator[SEP] identifier[resource] operator[SEP] operator[SEP] Keyword[return] identifier[credential] operator[!=] Other[null] operator[SEP]
}
|
public void registerSingleton(String name, Class<?> clazz) throws BeansException {
GenericBeanDefinition bd = new GenericBeanDefinition();
bd.setBeanClass(clazz);
getDefaultListableBeanFactory().registerBeanDefinition(name, bd);
} | class class_name[name] begin[{]
method[registerSingleton, return_type[void], modifier[public], parameter[name, clazz]] begin[{]
local_variable[type[GenericBeanDefinition], bd]
call[bd.setBeanClass, parameter[member[.clazz]]]
call[.getDefaultListableBeanFactory, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[registerSingleton] operator[SEP] identifier[String] identifier[name] , identifier[Class] operator[<] operator[?] operator[>] identifier[clazz] operator[SEP] Keyword[throws] identifier[BeansException] {
identifier[GenericBeanDefinition] identifier[bd] operator[=] Keyword[new] identifier[GenericBeanDefinition] operator[SEP] operator[SEP] operator[SEP] identifier[bd] operator[SEP] identifier[setBeanClass] operator[SEP] identifier[clazz] operator[SEP] operator[SEP] identifier[getDefaultListableBeanFactory] operator[SEP] operator[SEP] operator[SEP] identifier[registerBeanDefinition] operator[SEP] identifier[name] , identifier[bd] operator[SEP] operator[SEP]
}
|
private static Date calculateExpiresAt( JSONObject jsonObj )
{
long expiresAt_s = jsonObj.optLong( OAuth2Credentials.EXPIRES_AT, -1 );
// If nothing specified in json, check if expires_in is present:
// this happens when token is received from oauth server
if ( expiresAt_s < 0 && jsonObj.has( OAuth2Credentials.EXPIRES_IN ) ) {
long expiresIn_s = jsonObj.getLong( OAuth2Credentials.EXPIRES_IN );
// We take a margin to be safe: it appears that some providers do NOT take any margin
// so token will not be early refreshed
if ( expiresIn_s > 6 * 60 ) { // should be always true
expiresIn_s -= 5 * 60; // 5 minutes to be safe
}
expiresAt_s = System.currentTimeMillis() / 1000 + expiresIn_s;
}
if ( expiresAt_s < 0 ) {
return null;
}
return new Date( expiresAt_s * 1000 );
} | class class_name[name] begin[{]
method[calculateExpiresAt, return_type[type[Date]], modifier[private static], parameter[jsonObj]] begin[{]
local_variable[type[long], expiresAt_s]
if[binary_operation[binary_operation[member[.expiresAt_s], <, literal[0]], &&, call[jsonObj.has, parameter[member[OAuth2Credentials.EXPIRES_IN]]]]] begin[{]
local_variable[type[long], expiresIn_s]
if[binary_operation[member[.expiresIn_s], >, binary_operation[literal[6], *, literal[60]]]] begin[{]
assign[member[.expiresIn_s], binary_operation[literal[5], *, literal[60]]]
else begin[{]
None
end[}]
assign[member[.expiresAt_s], binary_operation[binary_operation[call[System.currentTimeMillis, parameter[]], /, literal[1000]], +, member[.expiresIn_s]]]
else begin[{]
None
end[}]
if[binary_operation[member[.expiresAt_s], <, literal[0]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[BinaryOperation(operandl=MemberReference(member=expiresAt_s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1000), 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))]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[Date] identifier[calculateExpiresAt] operator[SEP] identifier[JSONObject] identifier[jsonObj] operator[SEP] {
Keyword[long] identifier[expiresAt_s] operator[=] identifier[jsonObj] operator[SEP] identifier[optLong] operator[SEP] identifier[OAuth2Credentials] operator[SEP] identifier[EXPIRES_AT] , operator[-] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[expiresAt_s] operator[<] Other[0] operator[&&] identifier[jsonObj] operator[SEP] identifier[has] operator[SEP] identifier[OAuth2Credentials] operator[SEP] identifier[EXPIRES_IN] operator[SEP] operator[SEP] {
Keyword[long] identifier[expiresIn_s] operator[=] identifier[jsonObj] operator[SEP] identifier[getLong] operator[SEP] identifier[OAuth2Credentials] operator[SEP] identifier[EXPIRES_IN] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[expiresIn_s] operator[>] Other[6] operator[*] Other[60] operator[SEP] {
identifier[expiresIn_s] operator[-=] Other[5] operator[*] Other[60] operator[SEP]
}
identifier[expiresAt_s] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[/] Other[1000] operator[+] identifier[expiresIn_s] operator[SEP]
}
Keyword[if] operator[SEP] identifier[expiresAt_s] operator[<] Other[0] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[return] Keyword[new] identifier[Date] operator[SEP] identifier[expiresAt_s] operator[*] Other[1000] operator[SEP] operator[SEP]
}
|
@Override
public int insertAt(final int position, @Nullable final CharSequence input, boolean cursorAfterTrailingHardcoded) {
if (slots.isEmpty() || !slots.checkIsIndex(position) || input == null || input.length() == 0) {
return position;
}
showHardcodedTail = true;
int cursorPosition = position;
Slot slotCandidate = slots.getSlot(position);
if (forbidInputWhenFilled && filledFrom(slotCandidate)) {
return position;
}
Deque<Character> inStack = dequeFrom(input);
while (!inStack.isEmpty()) {
char newValue = inStack.pop();
// find index offset to the next slot we can input current character to
final SlotIndexOffset slotForInputIndex = validSlotIndexOffset(slotCandidate, newValue);
// if there were any non-hardcoded slots skipped while looking for next slot offset
// and we don't allow 'spots' in the input - we should stop inserting right now
if (!showingEmptySlots && slotForInputIndex.nonHarcodedSlotSkipped) {
break;
}
cursorPosition += slotForInputIndex.indexOffset;
final Slot slotForInput = slots.getSlot(cursorPosition);
if (slotForInput != null) {
slotCandidate = slotForInput;
final int insertOffset = slotCandidate.setValue(newValue, slotForInputIndex.indexOffset > 0);
cursorPosition += insertOffset;
slotCandidate = slots.getSlot(cursorPosition);
if (!terminated && emptySlotsOnTail() < 1) {
extendTail(1);
}
}
}
if (cursorAfterTrailingHardcoded) {
int hardcodedTailLength = 0;
if (slotCandidate != null) {
hardcodedTailLength = slotCandidate.hardcodedSequenceEndIndex();
}
if (hardcodedTailLength > 0) {
cursorPosition += hardcodedTailLength;
}
}
// allow hardcoded tail be visible only if we've inserted at the end of the input
final Slot nextSlot = slots.getSlot(cursorPosition);
showHardcodedTail = nextSlot == null || !nextSlot.anyInputToTheRight();
return cursorPosition;
} | class class_name[name] begin[{]
method[insertAt, return_type[type[int]], modifier[public], parameter[position, input, cursorAfterTrailingHardcoded]] begin[{]
if[binary_operation[binary_operation[binary_operation[call[slots.isEmpty, parameter[]], ||, call[slots.checkIsIndex, parameter[member[.position]]]], ||, binary_operation[member[.input], ==, literal[null]]], ||, binary_operation[call[input.length, parameter[]], ==, literal[0]]]] begin[{]
return[member[.position]]
else begin[{]
None
end[}]
assign[member[.showHardcodedTail], literal[true]]
local_variable[type[int], cursorPosition]
local_variable[type[Slot], slotCandidate]
if[binary_operation[member[.forbidInputWhenFilled], &&, call[.filledFrom, parameter[member[.slotCandidate]]]]] begin[{]
return[member[.position]]
else begin[{]
None
end[}]
local_variable[type[Deque], inStack]
while[call[inStack.isEmpty, parameter[]]] begin[{]
local_variable[type[char], newValue]
local_variable[type[SlotIndexOffset], slotForInputIndex]
if[binary_operation[member[.showingEmptySlots], &&, member[slotForInputIndex.nonHarcodedSlotSkipped]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
assign[member[.cursorPosition], member[slotForInputIndex.indexOffset]]
local_variable[type[Slot], slotForInput]
if[binary_operation[member[.slotForInput], !=, literal[null]]] begin[{]
assign[member[.slotCandidate], member[.slotForInput]]
local_variable[type[int], insertOffset]
assign[member[.cursorPosition], member[.insertOffset]]
assign[member[.slotCandidate], call[slots.getSlot, parameter[member[.cursorPosition]]]]
if[binary_operation[member[.terminated], &&, binary_operation[call[.emptySlotsOnTail, parameter[]], <, literal[1]]]] begin[{]
call[.extendTail, parameter[literal[1]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
if[member[.cursorAfterTrailingHardcoded]] begin[{]
local_variable[type[int], hardcodedTailLength]
if[binary_operation[member[.slotCandidate], !=, literal[null]]] begin[{]
assign[member[.hardcodedTailLength], call[slotCandidate.hardcodedSequenceEndIndex, parameter[]]]
else begin[{]
None
end[}]
if[binary_operation[member[.hardcodedTailLength], >, literal[0]]] begin[{]
assign[member[.cursorPosition], member[.hardcodedTailLength]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
local_variable[type[Slot], nextSlot]
assign[member[.showHardcodedTail], binary_operation[binary_operation[member[.nextSlot], ==, literal[null]], ||, call[nextSlot.anyInputToTheRight, parameter[]]]]
return[member[.cursorPosition]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[int] identifier[insertAt] operator[SEP] Keyword[final] Keyword[int] identifier[position] , annotation[@] identifier[Nullable] Keyword[final] identifier[CharSequence] identifier[input] , Keyword[boolean] identifier[cursorAfterTrailingHardcoded] operator[SEP] {
Keyword[if] operator[SEP] identifier[slots] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[||] operator[!] identifier[slots] operator[SEP] identifier[checkIsIndex] operator[SEP] identifier[position] operator[SEP] operator[||] identifier[input] operator[==] Other[null] operator[||] identifier[input] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[return] identifier[position] operator[SEP]
}
identifier[showHardcodedTail] operator[=] literal[boolean] operator[SEP] Keyword[int] identifier[cursorPosition] operator[=] identifier[position] operator[SEP] identifier[Slot] identifier[slotCandidate] operator[=] identifier[slots] operator[SEP] identifier[getSlot] operator[SEP] identifier[position] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[forbidInputWhenFilled] operator[&&] identifier[filledFrom] operator[SEP] identifier[slotCandidate] operator[SEP] operator[SEP] {
Keyword[return] identifier[position] operator[SEP]
}
identifier[Deque] operator[<] identifier[Character] operator[>] identifier[inStack] operator[=] identifier[dequeFrom] operator[SEP] identifier[input] operator[SEP] operator[SEP] Keyword[while] operator[SEP] operator[!] identifier[inStack] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[char] identifier[newValue] operator[=] identifier[inStack] operator[SEP] identifier[pop] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[SlotIndexOffset] identifier[slotForInputIndex] operator[=] identifier[validSlotIndexOffset] operator[SEP] identifier[slotCandidate] , identifier[newValue] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[showingEmptySlots] operator[&&] identifier[slotForInputIndex] operator[SEP] identifier[nonHarcodedSlotSkipped] operator[SEP] {
Keyword[break] operator[SEP]
}
identifier[cursorPosition] operator[+=] identifier[slotForInputIndex] operator[SEP] identifier[indexOffset] operator[SEP] Keyword[final] identifier[Slot] identifier[slotForInput] operator[=] identifier[slots] operator[SEP] identifier[getSlot] operator[SEP] identifier[cursorPosition] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[slotForInput] operator[!=] Other[null] operator[SEP] {
identifier[slotCandidate] operator[=] identifier[slotForInput] operator[SEP] Keyword[final] Keyword[int] identifier[insertOffset] operator[=] identifier[slotCandidate] operator[SEP] identifier[setValue] operator[SEP] identifier[newValue] , identifier[slotForInputIndex] operator[SEP] identifier[indexOffset] operator[>] Other[0] operator[SEP] operator[SEP] identifier[cursorPosition] operator[+=] identifier[insertOffset] operator[SEP] identifier[slotCandidate] operator[=] identifier[slots] operator[SEP] identifier[getSlot] operator[SEP] identifier[cursorPosition] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[terminated] operator[&&] identifier[emptySlotsOnTail] operator[SEP] operator[SEP] operator[<] Other[1] operator[SEP] {
identifier[extendTail] operator[SEP] Other[1] operator[SEP] operator[SEP]
}
}
}
Keyword[if] operator[SEP] identifier[cursorAfterTrailingHardcoded] operator[SEP] {
Keyword[int] identifier[hardcodedTailLength] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[slotCandidate] operator[!=] Other[null] operator[SEP] {
identifier[hardcodedTailLength] operator[=] identifier[slotCandidate] operator[SEP] identifier[hardcodedSequenceEndIndex] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[hardcodedTailLength] operator[>] Other[0] operator[SEP] {
identifier[cursorPosition] operator[+=] identifier[hardcodedTailLength] operator[SEP]
}
}
Keyword[final] identifier[Slot] identifier[nextSlot] operator[=] identifier[slots] operator[SEP] identifier[getSlot] operator[SEP] identifier[cursorPosition] operator[SEP] operator[SEP] identifier[showHardcodedTail] operator[=] identifier[nextSlot] operator[==] Other[null] operator[||] operator[!] identifier[nextSlot] operator[SEP] identifier[anyInputToTheRight] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[cursorPosition] operator[SEP]
}
|
public OvhOrder order_orderId_debt_pay_POST(Long orderId) throws IOException {
String qPath = "/me/order/{orderId}/debt/pay";
StringBuilder sb = path(qPath, orderId);
String resp = exec(qPath, "POST", sb.toString(), null);
return convertTo(resp, OvhOrder.class);
} | class class_name[name] begin[{]
method[order_orderId_debt_pay_POST, return_type[type[OvhOrder]], modifier[public], parameter[orderId]] begin[{]
local_variable[type[String], qPath]
local_variable[type[StringBuilder], sb]
local_variable[type[String], resp]
return[call[.convertTo, parameter[member[.resp], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=OvhOrder, sub_type=None))]]]
end[}]
END[}] | Keyword[public] identifier[OvhOrder] identifier[order_orderId_debt_pay_POST] operator[SEP] identifier[Long] identifier[orderId] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[String] identifier[qPath] operator[=] literal[String] operator[SEP] identifier[StringBuilder] identifier[sb] operator[=] identifier[path] operator[SEP] identifier[qPath] , identifier[orderId] operator[SEP] operator[SEP] identifier[String] identifier[resp] operator[=] identifier[exec] operator[SEP] identifier[qPath] , literal[String] , identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP] Keyword[return] identifier[convertTo] operator[SEP] identifier[resp] , identifier[OvhOrder] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
|
private void checkElementReferences(
final CmsContainerPageElementPanel element,
final AsyncCallback<CmsRemovedElementStatus> callback) {
ReferenceCheckVisitor visitor = new ReferenceCheckVisitor(element);
processPageContent(visitor);
if (visitor.hasReferences()) {
// Don't need to ask the server because we already know we have other references in the same page
CmsRpcAction<CmsListInfoBean> infoAction = new CmsRpcAction<CmsListInfoBean>() {
@Override
public void execute() {
start(200, true);
CmsCoreProvider.getVfsService().getPageInfo(new CmsUUID(getServerId(element.getId())), this);
}
@Override
protected void onResponse(CmsListInfoBean result) {
stop(false);
callback.onSuccess(new CmsRemovedElementStatus(null, result, false, null));
}
};
infoAction.execute();
} else {
CmsRpcAction<CmsRemovedElementStatus> getStatusAction = new CmsRpcAction<CmsRemovedElementStatus>() {
@Override
public void execute() {
start(200, true);
getContainerpageService().getRemovedElementStatus(
element.getId(),
CmsCoreProvider.get().getStructureId(),
this);
}
@Override
public void onResponse(final CmsRemovedElementStatus status) {
stop(false);
callback.onSuccess(status);
}
};
getStatusAction.execute();
}
} | class class_name[name] begin[{]
method[checkElementReferences, return_type[void], modifier[private], parameter[element, callback]] begin[{]
local_variable[type[ReferenceCheckVisitor], visitor]
call[.processPageContent, parameter[member[.visitor]]]
if[call[visitor.hasReferences, parameter[]]] begin[{]
local_variable[type[CmsRpcAction], infoAction]
call[infoAction.execute, parameter[]]
else begin[{]
local_variable[type[CmsRpcAction], getStatusAction]
call[getStatusAction.execute, parameter[]]
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[checkElementReferences] operator[SEP] Keyword[final] identifier[CmsContainerPageElementPanel] identifier[element] , Keyword[final] identifier[AsyncCallback] operator[<] identifier[CmsRemovedElementStatus] operator[>] identifier[callback] operator[SEP] {
identifier[ReferenceCheckVisitor] identifier[visitor] operator[=] Keyword[new] identifier[ReferenceCheckVisitor] operator[SEP] identifier[element] operator[SEP] operator[SEP] identifier[processPageContent] operator[SEP] identifier[visitor] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[visitor] operator[SEP] identifier[hasReferences] operator[SEP] operator[SEP] operator[SEP] {
identifier[CmsRpcAction] operator[<] identifier[CmsListInfoBean] operator[>] identifier[infoAction] operator[=] Keyword[new] identifier[CmsRpcAction] operator[<] identifier[CmsListInfoBean] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[execute] operator[SEP] operator[SEP] {
identifier[start] operator[SEP] Other[200] , literal[boolean] operator[SEP] operator[SEP] identifier[CmsCoreProvider] operator[SEP] identifier[getVfsService] operator[SEP] operator[SEP] operator[SEP] identifier[getPageInfo] operator[SEP] Keyword[new] identifier[CmsUUID] operator[SEP] identifier[getServerId] operator[SEP] identifier[element] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] , Keyword[this] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[onResponse] operator[SEP] identifier[CmsListInfoBean] identifier[result] operator[SEP] {
identifier[stop] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[callback] operator[SEP] identifier[onSuccess] operator[SEP] Keyword[new] identifier[CmsRemovedElementStatus] operator[SEP] Other[null] , identifier[result] , literal[boolean] , Other[null] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] identifier[infoAction] operator[SEP] identifier[execute] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[CmsRpcAction] operator[<] identifier[CmsRemovedElementStatus] operator[>] identifier[getStatusAction] operator[=] Keyword[new] identifier[CmsRpcAction] operator[<] identifier[CmsRemovedElementStatus] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[execute] operator[SEP] operator[SEP] {
identifier[start] operator[SEP] Other[200] , literal[boolean] operator[SEP] operator[SEP] identifier[getContainerpageService] operator[SEP] operator[SEP] operator[SEP] identifier[getRemovedElementStatus] operator[SEP] identifier[element] operator[SEP] identifier[getId] operator[SEP] operator[SEP] , identifier[CmsCoreProvider] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[getStructureId] operator[SEP] operator[SEP] , Keyword[this] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onResponse] operator[SEP] Keyword[final] identifier[CmsRemovedElementStatus] identifier[status] operator[SEP] {
identifier[stop] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[callback] operator[SEP] identifier[onSuccess] operator[SEP] identifier[status] operator[SEP] operator[SEP]
}
} operator[SEP] identifier[getStatusAction] operator[SEP] identifier[execute] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public void marshall(AttachStaticIpRequest attachStaticIpRequest, ProtocolMarshaller protocolMarshaller) {
if (attachStaticIpRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(attachStaticIpRequest.getStaticIpName(), STATICIPNAME_BINDING);
protocolMarshaller.marshall(attachStaticIpRequest.getInstanceName(), INSTANCENAME_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[attachStaticIpRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.attachStaticIpRequest], ==, 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=getStaticIpName, postfix_operators=[], prefix_operators=[], qualifier=attachStaticIpRequest, selectors=[], type_arguments=None), MemberReference(member=STATICIPNAME_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=getInstanceName, postfix_operators=[], prefix_operators=[], qualifier=attachStaticIpRequest, selectors=[], type_arguments=None), MemberReference(member=INSTANCENAME_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[AttachStaticIpRequest] identifier[attachStaticIpRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[attachStaticIpRequest] 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[attachStaticIpRequest] operator[SEP] identifier[getStaticIpName] operator[SEP] operator[SEP] , identifier[STATICIPNAME_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[attachStaticIpRequest] operator[SEP] identifier[getInstanceName] operator[SEP] operator[SEP] , identifier[INSTANCENAME_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 byte[] getMD5(byte[] src) {
assert src != null;
try {
return MessageDigest.getInstance("MD5").digest(src);
} catch (NoSuchAlgorithmException ex) {
throw new IllegalArgumentException("Missing 'MD5' algorithm", ex);
}
} | class class_name[name] begin[{]
method[getMD5, return_type[type[byte]], modifier[public static], parameter[src]] begin[{]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=src, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None, value=None)
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="MD5")], member=getInstance, postfix_operators=[], prefix_operators=[], qualifier=MessageDigest, selectors=[MethodInvocation(arguments=[MemberReference(member=src, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=digest, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Missing 'MD5' algorithm"), MemberReference(member=ex, 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=IllegalArgumentException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['NoSuchAlgorithmException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[byte] operator[SEP] operator[SEP] identifier[getMD5] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[src] operator[SEP] {
Keyword[assert] identifier[src] operator[!=] Other[null] operator[SEP] Keyword[try] {
Keyword[return] identifier[MessageDigest] operator[SEP] identifier[getInstance] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[digest] operator[SEP] identifier[src] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NoSuchAlgorithmException] identifier[ex] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] , identifier[ex] operator[SEP] operator[SEP]
}
}
|
static <T> List<T> freeze(List<T> list) {
return list == null ? null : Collections.unmodifiableList(list);
} | class class_name[name] begin[{]
method[freeze, return_type[type[List]], modifier[static], parameter[list]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=list, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[MemberReference(member=list, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=unmodifiableList, postfix_operators=[], prefix_operators=[], qualifier=Collections, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
end[}]
END[}] | Keyword[static] operator[<] identifier[T] operator[>] identifier[List] operator[<] identifier[T] operator[>] identifier[freeze] operator[SEP] identifier[List] operator[<] identifier[T] operator[>] identifier[list] operator[SEP] {
Keyword[return] identifier[list] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[Collections] operator[SEP] identifier[unmodifiableList] operator[SEP] identifier[list] operator[SEP] operator[SEP]
}
|
@Override
public void createUser(User user, String password) throws ServiceException {
if(! isStarted){
ServiceDirectoryError error = new ServiceDirectoryError(ErrorCode.SERVICE_DIRECTORY_MANAGER_FACTORY_CLOSED);
throw new ServiceException(error);
}
if(user == null){
throw new IllegalArgumentException("The User can not be null.");
}
getRegistrationService().createUser(user, password);
} | class class_name[name] begin[{]
method[createUser, return_type[void], modifier[public], parameter[user, password]] begin[{]
if[member[.isStarted]] begin[{]
local_variable[type[ServiceDirectoryError], error]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=error, 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=ServiceException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.user], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The User can 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[}]
call[.getRegistrationService, parameter[]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[createUser] operator[SEP] identifier[User] identifier[user] , identifier[String] identifier[password] operator[SEP] Keyword[throws] identifier[ServiceException] {
Keyword[if] operator[SEP] operator[!] identifier[isStarted] operator[SEP] {
identifier[ServiceDirectoryError] identifier[error] operator[=] Keyword[new] identifier[ServiceDirectoryError] operator[SEP] identifier[ErrorCode] operator[SEP] identifier[SERVICE_DIRECTORY_MANAGER_FACTORY_CLOSED] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[ServiceException] operator[SEP] identifier[error] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[user] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[getRegistrationService] operator[SEP] operator[SEP] operator[SEP] identifier[createUser] operator[SEP] identifier[user] , identifier[password] operator[SEP] operator[SEP]
}
|
private synchronized void enumerateStringProperties(Hashtable<String, String> h) {
if (defaults != null) {
defaults.enumerateStringProperties(h);
}
for (Enumeration e = keys() ; e.hasMoreElements() ;) {
Object k = e.nextElement();
Object v = get(k);
if (k instanceof String && v instanceof String) {
h.put((String) k, (String) v);
}
}
} | class class_name[name] begin[{]
method[enumerateStringProperties, return_type[void], modifier[synchronized private], parameter[h]] begin[{]
if[binary_operation[member[.defaults], !=, literal[null]]] begin[{]
call[defaults.enumerateStringProperties, parameter[member[.h]]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=nextElement, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), name=k)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=v)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None), operator=instanceof), operandr=BinaryOperation(operandl=MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None), operator=instanceof), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), Cast(expression=MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], member=put, postfix_operators=[], prefix_operators=[], qualifier=h, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=MethodInvocation(arguments=[], member=hasMoreElements, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=keys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=e)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Enumeration, sub_type=None)), update=None), label=None)
end[}]
END[}] | Keyword[private] Keyword[synchronized] Keyword[void] identifier[enumerateStringProperties] operator[SEP] identifier[Hashtable] operator[<] identifier[String] , identifier[String] operator[>] identifier[h] operator[SEP] {
Keyword[if] operator[SEP] identifier[defaults] operator[!=] Other[null] operator[SEP] {
identifier[defaults] operator[SEP] identifier[enumerateStringProperties] operator[SEP] identifier[h] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[Enumeration] identifier[e] operator[=] identifier[keys] operator[SEP] operator[SEP] operator[SEP] identifier[e] operator[SEP] identifier[hasMoreElements] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[Object] identifier[k] operator[=] identifier[e] operator[SEP] identifier[nextElement] operator[SEP] operator[SEP] operator[SEP] identifier[Object] identifier[v] operator[=] identifier[get] operator[SEP] identifier[k] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[k] Keyword[instanceof] identifier[String] operator[&&] identifier[v] Keyword[instanceof] identifier[String] operator[SEP] {
identifier[h] operator[SEP] identifier[put] operator[SEP] operator[SEP] identifier[String] operator[SEP] identifier[k] , operator[SEP] identifier[String] operator[SEP] identifier[v] operator[SEP] operator[SEP]
}
}
}
|
private void removePath( Collection<InternalWorkingMemory> wms, RuleRemovalContext context, Map<Integer, BaseNode> stillInUse, Collection<ObjectSource> alphas, PathEndNode endNode ) {
LeftTupleNode[] nodes = endNode.getPathNodes();
for (int i = endNode.getPositionInPath(); i >= 0; i--) {
BaseNode node = (BaseNode) nodes[i];
boolean removed = false;
if ( NodeTypeEnums.isLeftTupleNode( node ) ) {
removed = removeLeftTupleNode(wms, context, stillInUse, node);
}
if ( removed ) {
// reteoo requires to call remove on the OTN for tuples cleanup
if (NodeTypeEnums.isBetaNode(node) && !((BetaNode) node).isRightInputIsRiaNode()) {
alphas.add(((BetaNode) node).getRightInput());
} else if (node.getType() == NodeTypeEnums.LeftInputAdapterNode) {
alphas.add(((LeftInputAdapterNode) node).getObjectSource());
}
}
if (NodeTypeEnums.isBetaNode(node) && ((BetaNode) node).isRightInputIsRiaNode()) {
endNode = (PathEndNode) ((BetaNode) node).getRightInput();
removePath(wms, context, stillInUse, alphas, endNode);
return;
}
}
} | class class_name[name] begin[{]
method[removePath, return_type[void], modifier[private], parameter[wms, context, stillInUse, alphas, endNode]] begin[{]
local_variable[type[LeftTupleNode], nodes]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=nodes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type=ReferenceType(arguments=None, dimensions=[], name=BaseNode, sub_type=None)), name=node)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BaseNode, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), name=removed)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isLeftTupleNode, postfix_operators=[], prefix_operators=[], qualifier=NodeTypeEnums, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=removed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=wms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=stillInUse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=removeLeftTupleNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)])), IfStatement(condition=MemberReference(member=removed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isBetaNode, postfix_operators=[], prefix_operators=[], qualifier=NodeTypeEnums, selectors=[], type_arguments=None), operandr=Cast(expression=MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=BetaNode, sub_type=None)), operator=&&), else_statement=IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=node, selectors=[], type_arguments=None), operandr=MemberReference(member=LeftInputAdapterNode, postfix_operators=[], prefix_operators=[], qualifier=NodeTypeEnums, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=LeftInputAdapterNode, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=alphas, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=BetaNode, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=alphas, selectors=[], type_arguments=None), label=None)]))])), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isBetaNode, postfix_operators=[], prefix_operators=[], qualifier=NodeTypeEnums, selectors=[], type_arguments=None), operandr=Cast(expression=MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=BetaNode, sub_type=None)), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=endNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=Cast(expression=MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=BetaNode, sub_type=None)), type=ReferenceType(arguments=None, dimensions=[], name=PathEndNode, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=wms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=stillInUse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=alphas, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=endNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=removePath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=getPositionInPath, postfix_operators=[], prefix_operators=[], qualifier=endNode, selectors=[], type_arguments=None), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['--'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[removePath] operator[SEP] identifier[Collection] operator[<] identifier[InternalWorkingMemory] operator[>] identifier[wms] , identifier[RuleRemovalContext] identifier[context] , identifier[Map] operator[<] identifier[Integer] , identifier[BaseNode] operator[>] identifier[stillInUse] , identifier[Collection] operator[<] identifier[ObjectSource] operator[>] identifier[alphas] , identifier[PathEndNode] identifier[endNode] operator[SEP] {
identifier[LeftTupleNode] operator[SEP] operator[SEP] identifier[nodes] operator[=] identifier[endNode] operator[SEP] identifier[getPathNodes] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[endNode] operator[SEP] identifier[getPositionInPath] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[>=] Other[0] operator[SEP] identifier[i] operator[--] operator[SEP] {
identifier[BaseNode] identifier[node] operator[=] operator[SEP] identifier[BaseNode] operator[SEP] identifier[nodes] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[boolean] identifier[removed] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[NodeTypeEnums] operator[SEP] identifier[isLeftTupleNode] operator[SEP] identifier[node] operator[SEP] operator[SEP] {
identifier[removed] operator[=] identifier[removeLeftTupleNode] operator[SEP] identifier[wms] , identifier[context] , identifier[stillInUse] , identifier[node] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[removed] operator[SEP] {
Keyword[if] operator[SEP] identifier[NodeTypeEnums] operator[SEP] identifier[isBetaNode] operator[SEP] identifier[node] operator[SEP] operator[&&] operator[!] operator[SEP] operator[SEP] identifier[BetaNode] operator[SEP] identifier[node] operator[SEP] operator[SEP] identifier[isRightInputIsRiaNode] operator[SEP] operator[SEP] operator[SEP] {
identifier[alphas] operator[SEP] identifier[add] operator[SEP] operator[SEP] operator[SEP] identifier[BetaNode] operator[SEP] identifier[node] operator[SEP] operator[SEP] identifier[getRightInput] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[node] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[==] identifier[NodeTypeEnums] operator[SEP] identifier[LeftInputAdapterNode] operator[SEP] {
identifier[alphas] operator[SEP] identifier[add] operator[SEP] operator[SEP] operator[SEP] identifier[LeftInputAdapterNode] operator[SEP] identifier[node] operator[SEP] operator[SEP] identifier[getObjectSource] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[NodeTypeEnums] operator[SEP] identifier[isBetaNode] operator[SEP] identifier[node] operator[SEP] operator[&&] operator[SEP] operator[SEP] identifier[BetaNode] operator[SEP] identifier[node] operator[SEP] operator[SEP] identifier[isRightInputIsRiaNode] operator[SEP] operator[SEP] operator[SEP] {
identifier[endNode] operator[=] operator[SEP] identifier[PathEndNode] operator[SEP] operator[SEP] operator[SEP] identifier[BetaNode] operator[SEP] identifier[node] operator[SEP] operator[SEP] identifier[getRightInput] operator[SEP] operator[SEP] operator[SEP] identifier[removePath] operator[SEP] identifier[wms] , identifier[context] , identifier[stillInUse] , identifier[alphas] , identifier[endNode] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
}
}
|
public int getFrequency(E from, E to)
{
return matrix[from.ordinal()][to.ordinal()];
} | class class_name[name] begin[{]
method[getFrequency, return_type[type[int]], modifier[public], parameter[from, to]] begin[{]
return[member[.matrix]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[getFrequency] operator[SEP] identifier[E] identifier[from] , identifier[E] identifier[to] operator[SEP] {
Keyword[return] identifier[matrix] operator[SEP] identifier[from] operator[SEP] identifier[ordinal] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[to] operator[SEP] identifier[ordinal] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
static void constructTotalThroughputGraph(Map.Entry<String, LrProjectScenarioResults> scenarioResults,
JSONObject scenarioGraphData) {
Map<Integer, WholeRunResult> totalThroughputResults = scenarioResults.getValue().getTotalThroughtputResults();
JSONObject totalThroughputResultsGraphSet =
extractWholeRunSlaResult(totalThroughputResults, "Bytes");
if (!totalThroughputResultsGraphSet.getJSONArray(LABELS).isEmpty()) {
totalThroughputResultsGraphSet.put(TITLE, "Total Throughput");
totalThroughputResultsGraphSet.put(X_AXIS_TITLE, "Build number");
totalThroughputResultsGraphSet.put(Y_AXIS_TITLE, "Bytes");
totalThroughputResultsGraphSet.put(DESCRIPTION,
" Displays the amount of throughput (in bytes) on the Web server during the load test. " +
"Throughput represents the amount of data that the Vusers received from the server at" +
" any given second. This graph helps you to evaluate the amount of load Vusers " +
"generate, in terms of server throughput.\n");
scenarioGraphData.put("totalThroughput", totalThroughputResultsGraphSet);
}
} | class class_name[name] begin[{]
method[constructTotalThroughputGraph, return_type[void], modifier[static], parameter[scenarioResults, scenarioGraphData]] begin[{]
local_variable[type[Map], totalThroughputResults]
local_variable[type[JSONObject], totalThroughputResultsGraphSet]
if[call[totalThroughputResultsGraphSet.getJSONArray, parameter[member[.LABELS]]]] begin[{]
call[totalThroughputResultsGraphSet.put, parameter[member[.TITLE], literal["Total Throughput"]]]
call[totalThroughputResultsGraphSet.put, parameter[member[.X_AXIS_TITLE], literal["Build number"]]]
call[totalThroughputResultsGraphSet.put, parameter[member[.Y_AXIS_TITLE], literal["Bytes"]]]
call[totalThroughputResultsGraphSet.put, parameter[member[.DESCRIPTION], binary_operation[binary_operation[binary_operation[literal[" Displays the amount of throughput (in bytes) on the Web server during the load test. "], +, literal["Throughput represents the amount of data that the Vusers received from the server at"]], +, literal[" any given second. This graph helps you to evaluate the amount of load Vusers "]], +, literal["generate, in terms of server throughput.\n"]]]]
call[scenarioGraphData.put, parameter[literal["totalThroughput"], member[.totalThroughputResultsGraphSet]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[static] Keyword[void] identifier[constructTotalThroughputGraph] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[LrProjectScenarioResults] operator[>] identifier[scenarioResults] , identifier[JSONObject] identifier[scenarioGraphData] operator[SEP] {
identifier[Map] operator[<] identifier[Integer] , identifier[WholeRunResult] operator[>] identifier[totalThroughputResults] operator[=] identifier[scenarioResults] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[getTotalThroughtputResults] operator[SEP] operator[SEP] operator[SEP] identifier[JSONObject] identifier[totalThroughputResultsGraphSet] operator[=] identifier[extractWholeRunSlaResult] operator[SEP] identifier[totalThroughputResults] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[totalThroughputResultsGraphSet] operator[SEP] identifier[getJSONArray] operator[SEP] identifier[LABELS] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[totalThroughputResultsGraphSet] operator[SEP] identifier[put] operator[SEP] identifier[TITLE] , literal[String] operator[SEP] operator[SEP] identifier[totalThroughputResultsGraphSet] operator[SEP] identifier[put] operator[SEP] identifier[X_AXIS_TITLE] , literal[String] operator[SEP] operator[SEP] identifier[totalThroughputResultsGraphSet] operator[SEP] identifier[put] operator[SEP] identifier[Y_AXIS_TITLE] , literal[String] operator[SEP] operator[SEP] identifier[totalThroughputResultsGraphSet] operator[SEP] identifier[put] operator[SEP] identifier[DESCRIPTION] , literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[SEP] operator[SEP] identifier[scenarioGraphData] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[totalThroughputResultsGraphSet] operator[SEP] operator[SEP]
}
}
|
public WebAuthenticator getWebAuthenticator(WebRequest webRequest) {
String authMech = webAppSecurityConfig.getOverrideHttpAuthMethod();
if (authMech != null && authMech.equals("CLIENT_CERT")) {
return createCertificateLoginAuthenticator();
}
SecurityMetadata securityMetadata = webRequest.getSecurityMetadata();
LoginConfiguration loginConfig = securityMetadata.getLoginConfiguration();
if (loginConfig != null) {
String authenticationMethod = loginConfig.getAuthenticationMethod();
if (LoginConfiguration.FORM.equalsIgnoreCase(authenticationMethod)) {
return createFormLoginAuthenticator(webRequest);
} else if (LoginConfiguration.CLIENT_CERT.equalsIgnoreCase(authenticationMethod)) {
return createCertificateLoginAuthenticator();
}
}
return getBasicAuthAuthenticator();
} | class class_name[name] begin[{]
method[getWebAuthenticator, return_type[type[WebAuthenticator]], modifier[public], parameter[webRequest]] begin[{]
local_variable[type[String], authMech]
if[binary_operation[binary_operation[member[.authMech], !=, literal[null]], &&, call[authMech.equals, parameter[literal["CLIENT_CERT"]]]]] begin[{]
return[call[.createCertificateLoginAuthenticator, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[SecurityMetadata], securityMetadata]
local_variable[type[LoginConfiguration], loginConfig]
if[binary_operation[member[.loginConfig], !=, literal[null]]] begin[{]
local_variable[type[String], authenticationMethod]
if[call[LoginConfiguration.FORM.equalsIgnoreCase, parameter[member[.authenticationMethod]]]] begin[{]
return[call[.createFormLoginAuthenticator, parameter[member[.webRequest]]]]
else begin[{]
if[call[LoginConfiguration.CLIENT_CERT.equalsIgnoreCase, parameter[member[.authenticationMethod]]]] begin[{]
return[call[.createCertificateLoginAuthenticator, parameter[]]]
else begin[{]
None
end[}]
end[}]
else begin[{]
None
end[}]
return[call[.getBasicAuthAuthenticator, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[WebAuthenticator] identifier[getWebAuthenticator] operator[SEP] identifier[WebRequest] identifier[webRequest] operator[SEP] {
identifier[String] identifier[authMech] operator[=] identifier[webAppSecurityConfig] operator[SEP] identifier[getOverrideHttpAuthMethod] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[authMech] operator[!=] Other[null] operator[&&] identifier[authMech] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[return] identifier[createCertificateLoginAuthenticator] operator[SEP] operator[SEP] operator[SEP]
}
identifier[SecurityMetadata] identifier[securityMetadata] operator[=] identifier[webRequest] operator[SEP] identifier[getSecurityMetadata] operator[SEP] operator[SEP] operator[SEP] identifier[LoginConfiguration] identifier[loginConfig] operator[=] identifier[securityMetadata] operator[SEP] identifier[getLoginConfiguration] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[loginConfig] operator[!=] Other[null] operator[SEP] {
identifier[String] identifier[authenticationMethod] operator[=] identifier[loginConfig] operator[SEP] identifier[getAuthenticationMethod] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[LoginConfiguration] operator[SEP] identifier[FORM] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[authenticationMethod] operator[SEP] operator[SEP] {
Keyword[return] identifier[createFormLoginAuthenticator] operator[SEP] identifier[webRequest] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[LoginConfiguration] operator[SEP] identifier[CLIENT_CERT] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[authenticationMethod] operator[SEP] operator[SEP] {
Keyword[return] identifier[createCertificateLoginAuthenticator] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[getBasicAuthAuthenticator] operator[SEP] operator[SEP] operator[SEP]
}
|
public static Version fromClasspathProperties(@Nonnull Class<?> clazz, String path, String propertyName, String gitPath, String gitPropertyName, Version defaultVersion) {
try {
final URL resource = getResource(clazz, path);
final Properties versionProperties = new Properties();
versionProperties.load(resource.openStream());
final com.github.zafarkhaja.semver.Version version = com.github.zafarkhaja.semver.Version.valueOf(versionProperties.getProperty(propertyName));
final int major = version.getMajorVersion();
final int minor = version.getMinorVersion();
final int patch = version.getPatchVersion();
final String qualifier = version.getPreReleaseVersion();
String commitSha = null;
try {
final Properties git = new Properties();
final URL gitResource = getResource(clazz, gitPath);
git.load(gitResource.openStream());
commitSha = git.getProperty(gitPropertyName);
// abbreviate if present and looks like a long sha
if (commitSha != null && commitSha.length() > 7) {
commitSha = commitSha.substring(0, 7);
}
} catch (Exception e) {
LOG.debug("Git commit details are not available, skipping.", e);
}
return from(major, minor, patch, qualifier, commitSha);
} catch (Exception e) {
LOG.error("Unable to read " + path + ", this build has no version number.", e);
}
return defaultVersion;
} | class class_name[name] begin[{]
method[fromClasspathProperties, return_type[type[Version]], modifier[public static], parameter[clazz, path, propertyName, gitPath, gitPropertyName, defaultVersion]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=clazz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getResource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=resource)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=URL, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Properties, sub_type=None)), name=versionProperties)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Properties, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=openStream, postfix_operators=[], prefix_operators=[], qualifier=resource, selectors=[], type_arguments=None)], member=load, postfix_operators=[], prefix_operators=[], qualifier=versionProperties, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=propertyName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getProperty, postfix_operators=[], prefix_operators=[], qualifier=versionProperties, selectors=[], type_arguments=None)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=com.github.zafarkhaja.semver.Version, selectors=[], type_arguments=None), name=version)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=com, sub_type=ReferenceType(arguments=None, dimensions=None, name=github, sub_type=ReferenceType(arguments=None, dimensions=None, name=zafarkhaja, sub_type=ReferenceType(arguments=None, dimensions=None, name=semver, sub_type=ReferenceType(arguments=None, dimensions=None, name=Version, sub_type=None)))))), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getMajorVersion, postfix_operators=[], prefix_operators=[], qualifier=version, selectors=[], type_arguments=None), name=major)], modifiers={'final'}, type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getMinorVersion, postfix_operators=[], prefix_operators=[], qualifier=version, selectors=[], type_arguments=None), name=minor)], modifiers={'final'}, type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getPatchVersion, postfix_operators=[], prefix_operators=[], qualifier=version, selectors=[], type_arguments=None), name=patch)], modifiers={'final'}, type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getPreReleaseVersion, postfix_operators=[], prefix_operators=[], qualifier=version, selectors=[], type_arguments=None), name=qualifier)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=commitSha)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Properties, sub_type=None)), name=git)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Properties, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=clazz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=gitPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getResource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=gitResource)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=URL, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=openStream, postfix_operators=[], prefix_operators=[], qualifier=gitResource, selectors=[], type_arguments=None)], member=load, postfix_operators=[], prefix_operators=[], qualifier=git, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=commitSha, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=gitPropertyName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getProperty, postfix_operators=[], prefix_operators=[], qualifier=git, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=commitSha, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=commitSha, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=7), operator=>), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=commitSha, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=7)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=commitSha, selectors=[], type_arguments=None)), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Git commit details are not available, skipping."), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debug, postfix_operators=[], prefix_operators=[], qualifier=LOG, 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), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=major, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=minor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=patch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=qualifier, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=commitSha, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=from, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to read "), operandr=MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", this build has no version number."), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
return[member[.defaultVersion]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Version] identifier[fromClasspathProperties] operator[SEP] annotation[@] identifier[Nonnull] identifier[Class] operator[<] operator[?] operator[>] identifier[clazz] , identifier[String] identifier[path] , identifier[String] identifier[propertyName] , identifier[String] identifier[gitPath] , identifier[String] identifier[gitPropertyName] , identifier[Version] identifier[defaultVersion] operator[SEP] {
Keyword[try] {
Keyword[final] identifier[URL] identifier[resource] operator[=] identifier[getResource] operator[SEP] identifier[clazz] , identifier[path] operator[SEP] operator[SEP] Keyword[final] identifier[Properties] identifier[versionProperties] operator[=] Keyword[new] identifier[Properties] operator[SEP] operator[SEP] operator[SEP] identifier[versionProperties] operator[SEP] identifier[load] operator[SEP] identifier[resource] operator[SEP] identifier[openStream] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[com] operator[SEP] identifier[github] operator[SEP] identifier[zafarkhaja] operator[SEP] identifier[semver] operator[SEP] identifier[Version] identifier[version] operator[=] identifier[com] operator[SEP] identifier[github] operator[SEP] identifier[zafarkhaja] operator[SEP] identifier[semver] operator[SEP] identifier[Version] operator[SEP] identifier[valueOf] operator[SEP] identifier[versionProperties] operator[SEP] identifier[getProperty] operator[SEP] identifier[propertyName] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[major] operator[=] identifier[version] operator[SEP] identifier[getMajorVersion] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[minor] operator[=] identifier[version] operator[SEP] identifier[getMinorVersion] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[patch] operator[=] identifier[version] operator[SEP] identifier[getPatchVersion] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[qualifier] operator[=] identifier[version] operator[SEP] identifier[getPreReleaseVersion] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[commitSha] operator[=] Other[null] operator[SEP] Keyword[try] {
Keyword[final] identifier[Properties] identifier[git] operator[=] Keyword[new] identifier[Properties] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[URL] identifier[gitResource] operator[=] identifier[getResource] operator[SEP] identifier[clazz] , identifier[gitPath] operator[SEP] operator[SEP] identifier[git] operator[SEP] identifier[load] operator[SEP] identifier[gitResource] operator[SEP] identifier[openStream] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[commitSha] operator[=] identifier[git] operator[SEP] identifier[getProperty] operator[SEP] identifier[gitPropertyName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[commitSha] operator[!=] Other[null] operator[&&] identifier[commitSha] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[7] operator[SEP] {
identifier[commitSha] operator[=] identifier[commitSha] operator[SEP] identifier[substring] operator[SEP] Other[0] , Other[7] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[LOG] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[return] identifier[from] operator[SEP] identifier[major] , identifier[minor] , identifier[patch] , identifier[qualifier] , identifier[commitSha] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[LOG] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[path] operator[+] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[return] identifier[defaultVersion] operator[SEP]
}
|
public final void mT__127() throws RecognitionException {
try {
int _type = T__127;
int _channel = DEFAULT_TOKEN_CHANNEL;
// BELScript.g:114:8: ( 'hasMembers' )
// BELScript.g:114:10: 'hasMembers'
{
match("hasMembers");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
} | class class_name[name] begin[{]
method[mT__127, return_type[void], modifier[final public], parameter[]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=T__127, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=_type)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=DEFAULT_TOKEN_CHANNEL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=_channel)], modifiers=set(), type=BasicType(dimensions=[], name=int)), BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="hasMembers")], member=match, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), StatementExpression(expression=Assignment(expressionl=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), type==, value=MemberReference(member=_type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=channel, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), type==, value=MemberReference(member=_channel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)], catches=None, finally_block=[], label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[void] identifier[mT__127] operator[SEP] operator[SEP] Keyword[throws] identifier[RecognitionException] {
Keyword[try] {
Keyword[int] identifier[_type] operator[=] identifier[T__127] operator[SEP] Keyword[int] identifier[_channel] operator[=] identifier[DEFAULT_TOKEN_CHANNEL] operator[SEP] {
identifier[match] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[state] operator[SEP] identifier[type] operator[=] identifier[_type] operator[SEP] identifier[state] operator[SEP] identifier[channel] operator[=] identifier[_channel] operator[SEP]
}
Keyword[finally] {
}
}
|
public boolean containsChild(final AbstractHtml childTag) {
final Lock lock = sharedObject.getLock(ACCESS_OBJECT).readLock();
try {
lock.lock();
return children.contains(childTag);
} finally {
lock.unlock();
}
} | class class_name[name] begin[{]
method[containsChild, return_type[type[boolean]], modifier[public], parameter[childTag]] begin[{]
local_variable[type[Lock], lock]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=lock, postfix_operators=[], prefix_operators=[], qualifier=lock, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=childTag, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=[], prefix_operators=[], qualifier=children, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=unlock, postfix_operators=[], prefix_operators=[], qualifier=lock, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[containsChild] operator[SEP] Keyword[final] identifier[AbstractHtml] identifier[childTag] operator[SEP] {
Keyword[final] identifier[Lock] identifier[lock] operator[=] identifier[sharedObject] operator[SEP] identifier[getLock] operator[SEP] identifier[ACCESS_OBJECT] operator[SEP] operator[SEP] identifier[readLock] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[lock] operator[SEP] identifier[lock] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[children] operator[SEP] identifier[contains] operator[SEP] identifier[childTag] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[lock] operator[SEP] identifier[unlock] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static double quantile(double val, double loc, double scale, double shape1, double shape2) {
if(!(val >= 0.) || !(val <= 1.)) {
return Double.NaN;
}
if(val == 0.) {
if(shape2 <= 0.) {
return shape1 < 0. ? loc + scale / shape1 : Double.NEGATIVE_INFINITY;
}
else {
return loc + (shape1 != 0. //
? scale / shape1 * (1. - FastMath.pow(shape2, -shape1)) //
: scale * FastMath.log(shape2));
}
}
if(val == 1.) {
return shape1 <= 0. ? Double.NEGATIVE_INFINITY : loc + scale / shape1;
}
val = -FastMath.log(val);
if(shape2 != 0.) {
val = (1 - FastMath.exp(-shape2 * val)) / shape2;
}
val = -FastMath.log(val);
if(shape1 != 0.) {
val = (1 - FastMath.exp(-shape1 * val)) / shape1;
}
return loc + scale * val;
} | class class_name[name] begin[{]
method[quantile, return_type[type[double]], modifier[public static], parameter[val, loc, scale, shape1, shape2]] begin[{]
if[binary_operation[binary_operation[member[.val], >=, literal[0.]], ||, binary_operation[member[.val], <=, literal[1.]]]] begin[{]
return[member[Double.NaN]]
else begin[{]
None
end[}]
if[binary_operation[member[.val], ==, literal[0.]]] begin[{]
if[binary_operation[member[.shape2], <=, literal[0.]]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=shape1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0.), operator=<), if_false=MemberReference(member=NEGATIVE_INFINITY, postfix_operators=[], prefix_operators=[], qualifier=Double, selectors=[]), if_true=BinaryOperation(operandl=MemberReference(member=loc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=scale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=shape1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=/), operator=+))]
else begin[{]
return[binary_operation[member[.loc], +, TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=shape1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0.), operator=!=), if_false=BinaryOperation(operandl=MemberReference(member=scale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[MemberReference(member=shape2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=log, postfix_operators=[], prefix_operators=[], qualifier=FastMath, selectors=[], type_arguments=None), operator=*), if_true=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=scale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=shape1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=/), operandr=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1.), operandr=MethodInvocation(arguments=[MemberReference(member=shape2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=shape1, postfix_operators=[], prefix_operators=['-'], qualifier=, selectors=[])], member=pow, postfix_operators=[], prefix_operators=[], qualifier=FastMath, selectors=[], type_arguments=None), operator=-), operator=*))]]
end[}]
else begin[{]
None
end[}]
if[binary_operation[member[.val], ==, literal[1.]]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=shape1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0.), operator=<=), if_false=BinaryOperation(operandl=MemberReference(member=loc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=scale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=shape1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=/), operator=+), if_true=MemberReference(member=NEGATIVE_INFINITY, postfix_operators=[], prefix_operators=[], qualifier=Double, selectors=[]))]
else begin[{]
None
end[}]
assign[member[.val], call[FastMath.log, parameter[member[.val]]]]
if[binary_operation[member[.shape2], !=, literal[0.]]] begin[{]
assign[member[.val], binary_operation[binary_operation[literal[1], -, call[FastMath.exp, parameter[binary_operation[member[.shape2], *, member[.val]]]]], /, member[.shape2]]]
else begin[{]
None
end[}]
assign[member[.val], call[FastMath.log, parameter[member[.val]]]]
if[binary_operation[member[.shape1], !=, literal[0.]]] begin[{]
assign[member[.val], binary_operation[binary_operation[literal[1], -, call[FastMath.exp, parameter[binary_operation[member[.shape1], *, member[.val]]]]], /, member[.shape1]]]
else begin[{]
None
end[}]
return[binary_operation[member[.loc], +, binary_operation[member[.scale], *, member[.val]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[double] identifier[quantile] operator[SEP] Keyword[double] identifier[val] , Keyword[double] identifier[loc] , Keyword[double] identifier[scale] , Keyword[double] identifier[shape1] , Keyword[double] identifier[shape2] operator[SEP] {
Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[val] operator[>=] literal[Float] operator[SEP] operator[||] operator[!] operator[SEP] identifier[val] operator[<=] literal[Float] operator[SEP] operator[SEP] {
Keyword[return] identifier[Double] operator[SEP] identifier[NaN] operator[SEP]
}
Keyword[if] operator[SEP] identifier[val] operator[==] literal[Float] operator[SEP] {
Keyword[if] operator[SEP] identifier[shape2] operator[<=] literal[Float] operator[SEP] {
Keyword[return] identifier[shape1] operator[<] literal[Float] operator[?] identifier[loc] operator[+] identifier[scale] operator[/] identifier[shape1] operator[:] identifier[Double] operator[SEP] identifier[NEGATIVE_INFINITY] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[loc] operator[+] operator[SEP] identifier[shape1] operator[!=] literal[Float] operator[?] identifier[scale] operator[/] identifier[shape1] operator[*] operator[SEP] literal[Float] operator[-] identifier[FastMath] operator[SEP] identifier[pow] operator[SEP] identifier[shape2] , operator[-] identifier[shape1] operator[SEP] operator[SEP] operator[:] identifier[scale] operator[*] identifier[FastMath] operator[SEP] identifier[log] operator[SEP] identifier[shape2] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[val] operator[==] literal[Float] operator[SEP] {
Keyword[return] identifier[shape1] operator[<=] literal[Float] operator[?] identifier[Double] operator[SEP] identifier[NEGATIVE_INFINITY] operator[:] identifier[loc] operator[+] identifier[scale] operator[/] identifier[shape1] operator[SEP]
}
identifier[val] operator[=] operator[-] identifier[FastMath] operator[SEP] identifier[log] operator[SEP] identifier[val] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[shape2] operator[!=] literal[Float] operator[SEP] {
identifier[val] operator[=] operator[SEP] Other[1] operator[-] identifier[FastMath] operator[SEP] identifier[exp] operator[SEP] operator[-] identifier[shape2] operator[*] identifier[val] operator[SEP] operator[SEP] operator[/] identifier[shape2] operator[SEP]
}
identifier[val] operator[=] operator[-] identifier[FastMath] operator[SEP] identifier[log] operator[SEP] identifier[val] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[shape1] operator[!=] literal[Float] operator[SEP] {
identifier[val] operator[=] operator[SEP] Other[1] operator[-] identifier[FastMath] operator[SEP] identifier[exp] operator[SEP] operator[-] identifier[shape1] operator[*] identifier[val] operator[SEP] operator[SEP] operator[/] identifier[shape1] operator[SEP]
}
Keyword[return] identifier[loc] operator[+] identifier[scale] operator[*] identifier[val] operator[SEP]
}
|
static Iterator<MutableLongTuple> wrappingIteratorInternal(
LongTuple bounds, Iterator<? extends MutableLongTuple> delegate)
{
return new Iterator<MutableLongTuple>()
{
@Override
public boolean hasNext()
{
return delegate.hasNext();
}
@Override
public MutableLongTuple next()
{
return LongTupleUtils.wrap(delegate.next(), bounds);
}
@Override
public void remove()
{
delegate.remove();
}
};
} | class class_name[name] begin[{]
method[wrappingIteratorInternal, return_type[type[Iterator]], modifier[static], parameter[bounds, delegate]] begin[{]
return[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=delegate, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=hasNext, parameters=[], return_type=BasicType(dimensions=[], name=boolean), throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=delegate, selectors=[], type_arguments=None), MemberReference(member=bounds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=wrap, postfix_operators=[], prefix_operators=[], qualifier=LongTupleUtils, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=next, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=MutableLongTuple, sub_type=None), throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[], member=remove, postfix_operators=[], prefix_operators=[], qualifier=delegate, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=remove, parameters=[], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=MutableLongTuple, sub_type=None))], dimensions=None, name=Iterator, sub_type=None))]
end[}]
END[}] | Keyword[static] identifier[Iterator] operator[<] identifier[MutableLongTuple] operator[>] identifier[wrappingIteratorInternal] operator[SEP] identifier[LongTuple] identifier[bounds] , identifier[Iterator] operator[<] operator[?] Keyword[extends] identifier[MutableLongTuple] operator[>] identifier[delegate] operator[SEP] {
Keyword[return] Keyword[new] identifier[Iterator] operator[<] identifier[MutableLongTuple] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[hasNext] operator[SEP] operator[SEP] {
Keyword[return] identifier[delegate] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] identifier[MutableLongTuple] identifier[next] operator[SEP] operator[SEP] {
Keyword[return] identifier[LongTupleUtils] operator[SEP] identifier[wrap] operator[SEP] identifier[delegate] operator[SEP] identifier[next] operator[SEP] operator[SEP] , identifier[bounds] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[remove] operator[SEP] operator[SEP] {
identifier[delegate] operator[SEP] identifier[remove] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP]
}
|
private void onParticipantAdded(ParticipantAddedEvent event) {
handler.post(() -> listener.onParticipantAdded(event));
log("Event published " + event.toString());
} | class class_name[name] begin[{]
method[onParticipantAdded, return_type[void], modifier[private], parameter[event]] begin[{]
call[handler.post, parameter[LambdaExpression(body=MethodInvocation(arguments=[MemberReference(member=event, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=onParticipantAdded, postfix_operators=[], prefix_operators=[], qualifier=listener, selectors=[], type_arguments=None), parameters=[])]]
call[.log, parameter[binary_operation[literal["Event published "], +, call[event.toString, parameter[]]]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[onParticipantAdded] operator[SEP] identifier[ParticipantAddedEvent] identifier[event] operator[SEP] {
identifier[handler] operator[SEP] identifier[post] operator[SEP] operator[SEP] operator[SEP] operator[->] identifier[listener] operator[SEP] identifier[onParticipantAdded] operator[SEP] identifier[event] operator[SEP] operator[SEP] operator[SEP] identifier[log] operator[SEP] literal[String] operator[+] identifier[event] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity",
"checkstyle:nestedifdepth", "checkstyle:parameternumber"})
public IStatus populateInheritanceContext(
TypeFinder typeFinder,
Map<ActionPrototype, IMethod> finalOperations,
Map<ActionPrototype, IMethod> overridableOperations,
Map<String, IField> inheritedFields,
Map<ActionPrototype, IMethod> operationsToImplement,
Map<ActionParameterTypes, IMethod> superConstructors,
String superClass,
List<String> superInterfaces) throws JavaModelException {
final Set<ActionPrototype> treatedElements = new TreeSet<>();
final SARLEclipsePlugin plugin = SARLEclipsePlugin.getDefault();
final List<IStatus> statuses = new ArrayList<>();
// Get the operations that must be implemented
if (operationsToImplement != null) {
final SuperTypeIterator typeIterator = new SuperTypeIterator(typeFinder, true, superInterfaces);
while (typeIterator.hasNext()) {
final IType type = typeIterator.next();
for (final IMethod operation : type.getMethods()) {
if (!Flags.isStatic(operation.getFlags())
&& !Flags.isFinal(operation.getFlags())
&& !operation.isLambdaMethod()
&& !operation.isConstructor()) {
final ActionParameterTypes sig = this.actionPrototypeProvider.createParameterTypes(
Flags.isVarargs(operation.getFlags()), getFormalParameterProvider(operation));
final ActionPrototype actionKey = this.actionPrototypeProvider.createActionPrototype(
operation.getElementName(),
sig);
if (treatedElements.add(actionKey)) {
if (Flags.isDefaultMethod(operation.getFlags())) {
if (!overridableOperations.containsKey(actionKey)) {
overridableOperations.put(actionKey, operation);
}
} else {
if (!operationsToImplement.containsKey(actionKey)) {
operationsToImplement.put(actionKey, operation);
}
}
}
}
}
}
statuses.addAll(typeIterator.getStatuses());
}
// Check on the implemented features, inherited from the super type
if (isValidSuperType(superClass)) {
final SuperTypeIterator typeIterator = new SuperTypeIterator(typeFinder, false, superClass);
while (typeIterator.hasNext()) {
final IType type = typeIterator.next();
final boolean checkForConstructors = superConstructors != null
&& type.getFullyQualifiedName().equals(superClass);
for (final IMethod operation : type.getMethods()) {
if (!Flags.isStatic(operation.getFlags())
&& !operation.isLambdaMethod()
&& isVisible(typeFinder, type, operation)) {
if (!operation.isConstructor()
&& !Utils.isHiddenMember(operation.getElementName())) {
final ActionParameterTypes sig = this.actionPrototypeProvider.createParameterTypes(
Flags.isVarargs(operation.getFlags()), getFormalParameterProvider(operation));
final ActionPrototype actionKey = this.actionPrototypeProvider.createActionPrototype(
operation.getElementName(), sig);
if (treatedElements.add(actionKey)) {
final int flags = operation.getFlags();
if (Flags.isAbstract(flags) && !Flags.isDefaultMethod(flags)) {
if (operationsToImplement != null) {
operationsToImplement.put(actionKey, operation);
}
} else if (Flags.isFinal(flags)) {
if (finalOperations != null) {
finalOperations.put(actionKey, operation);
}
if (operationsToImplement != null) {
operationsToImplement.remove(actionKey);
}
} else {
if (overridableOperations != null) {
overridableOperations.put(actionKey, operation);
}
if (operationsToImplement != null) {
operationsToImplement.remove(actionKey);
}
}
}
} else if (checkForConstructors && operation.isConstructor() && superConstructors != null) {
final ActionParameterTypes sig = this.actionPrototypeProvider.createParameterTypes(
Flags.isVarargs(operation.getFlags()), getFormalParameterProvider(operation));
superConstructors.put(sig, operation);
}
}
}
if (inheritedFields != null) {
for (final IField field : type.getFields()) {
if (!Flags.isStatic(field.getFlags())
&& !Utils.isHiddenMember(field.getElementName())
&& isVisible(typeFinder, type, field)) {
inheritedFields.putIfAbsent(field.getElementName(), field);
}
}
}
}
statuses.addAll(typeIterator.getStatuses());
}
if (statuses.isEmpty()) {
return plugin.createOkStatus();
}
if (statuses.size() == 1) {
return statuses.get(0);
}
return plugin.createMultiStatus(statuses);
} | class class_name[name] begin[{]
method[populateInheritanceContext, return_type[type[IStatus]], modifier[public], parameter[typeFinder, finalOperations, overridableOperations, inheritedFields, operationsToImplement, superConstructors, superClass, superInterfaces]] begin[{]
local_variable[type[Set], treatedElements]
local_variable[type[SARLEclipsePlugin], plugin]
local_variable[type[List], statuses]
if[binary_operation[member[.operationsToImplement], !=, literal[null]]] begin[{]
local_variable[type[SuperTypeIterator], typeIterator]
while[call[typeIterator.hasNext, parameter[]]] begin[{]
local_variable[type[IType], type]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getFlags, postfix_operators=[], prefix_operators=[], qualifier=operation, selectors=[], type_arguments=None)], member=isStatic, postfix_operators=[], prefix_operators=['!'], qualifier=Flags, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getFlags, postfix_operators=[], prefix_operators=[], qualifier=operation, selectors=[], type_arguments=None)], member=isFinal, postfix_operators=[], prefix_operators=['!'], qualifier=Flags, selectors=[], type_arguments=None), operator=&&), operandr=MethodInvocation(arguments=[], member=isLambdaMethod, postfix_operators=[], prefix_operators=['!'], qualifier=operation, selectors=[], type_arguments=None), operator=&&), operandr=MethodInvocation(arguments=[], member=isConstructor, postfix_operators=[], prefix_operators=['!'], qualifier=operation, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=actionPrototypeProvider, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getFlags, postfix_operators=[], prefix_operators=[], qualifier=operation, selectors=[], type_arguments=None)], member=isVarargs, postfix_operators=[], prefix_operators=[], qualifier=Flags, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=operation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getFormalParameterProvider, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=createParameterTypes, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), name=sig)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ActionParameterTypes, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=actionPrototypeProvider, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getElementName, postfix_operators=[], prefix_operators=[], qualifier=operation, selectors=[], type_arguments=None), MemberReference(member=sig, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createActionPrototype, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), name=actionKey)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ActionPrototype, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=actionKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=treatedElements, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getFlags, postfix_operators=[], prefix_operators=[], qualifier=operation, selectors=[], type_arguments=None)], member=isDefaultMethod, postfix_operators=[], prefix_operators=[], qualifier=Flags, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=actionKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=containsKey, postfix_operators=[], prefix_operators=['!'], qualifier=operationsToImplement, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=actionKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=operation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=operationsToImplement, selectors=[], type_arguments=None), label=None)]))]), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=actionKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=containsKey, postfix_operators=[], prefix_operators=['!'], qualifier=overridableOperations, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=actionKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=operation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=overridableOperations, selectors=[], type_arguments=None), label=None)]))]))]))]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getMethods, postfix_operators=[], prefix_operators=[], qualifier=type, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=operation)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=IMethod, sub_type=None))), label=None)
end[}]
call[statuses.addAll, parameter[call[typeIterator.getStatuses, parameter[]]]]
else begin[{]
None
end[}]
if[call[.isValidSuperType, parameter[member[.superClass]]]] begin[{]
local_variable[type[SuperTypeIterator], typeIterator]
while[call[typeIterator.hasNext, parameter[]]] begin[{]
local_variable[type[IType], type]
local_variable[type[boolean], checkForConstructors]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getFlags, postfix_operators=[], prefix_operators=[], qualifier=operation, selectors=[], type_arguments=None)], member=isStatic, postfix_operators=[], prefix_operators=['!'], qualifier=Flags, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=isLambdaMethod, postfix_operators=[], prefix_operators=['!'], qualifier=operation, selectors=[], type_arguments=None), operator=&&), operandr=MethodInvocation(arguments=[MemberReference(member=typeFinder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=operation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isVisible, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isConstructor, postfix_operators=[], prefix_operators=['!'], qualifier=operation, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getElementName, postfix_operators=[], prefix_operators=[], qualifier=operation, selectors=[], type_arguments=None)], member=isHiddenMember, postfix_operators=[], prefix_operators=['!'], qualifier=Utils, selectors=[], type_arguments=None), operator=&&), else_statement=IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=checkForConstructors, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=isConstructor, postfix_operators=[], prefix_operators=[], qualifier=operation, selectors=[], type_arguments=None), operator=&&), operandr=BinaryOperation(operandl=MemberReference(member=superConstructors, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=actionPrototypeProvider, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getFlags, postfix_operators=[], prefix_operators=[], qualifier=operation, selectors=[], type_arguments=None)], member=isVarargs, postfix_operators=[], prefix_operators=[], qualifier=Flags, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=operation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getFormalParameterProvider, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=createParameterTypes, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), name=sig)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ActionParameterTypes, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=sig, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=operation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=superConstructors, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=actionPrototypeProvider, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getFlags, postfix_operators=[], prefix_operators=[], qualifier=operation, selectors=[], type_arguments=None)], member=isVarargs, postfix_operators=[], prefix_operators=[], qualifier=Flags, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=operation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getFormalParameterProvider, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=createParameterTypes, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), name=sig)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ActionParameterTypes, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=actionPrototypeProvider, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getElementName, postfix_operators=[], prefix_operators=[], qualifier=operation, selectors=[], type_arguments=None), MemberReference(member=sig, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createActionPrototype, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), name=actionKey)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ActionPrototype, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=actionKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=treatedElements, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getFlags, postfix_operators=[], prefix_operators=[], qualifier=operation, selectors=[], type_arguments=None), name=flags)], modifiers={'final'}, type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=flags, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isAbstract, postfix_operators=[], prefix_operators=[], qualifier=Flags, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=flags, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isDefaultMethod, postfix_operators=[], prefix_operators=['!'], qualifier=Flags, selectors=[], type_arguments=None), operator=&&), else_statement=IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=flags, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isFinal, postfix_operators=[], prefix_operators=[], qualifier=Flags, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=overridableOperations, 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=actionKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=operation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=overridableOperations, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=operationsToImplement, 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=actionKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=operationsToImplement, selectors=[], type_arguments=None), label=None)]))]), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=finalOperations, 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=actionKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=operation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=finalOperations, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=operationsToImplement, 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=actionKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=operationsToImplement, selectors=[], type_arguments=None), label=None)]))])), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=operationsToImplement, 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=actionKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=operation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=operationsToImplement, selectors=[], type_arguments=None), label=None)]))]))]))]))]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getMethods, postfix_operators=[], prefix_operators=[], qualifier=type, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=operation)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=IMethod, sub_type=None))), label=None)
if[binary_operation[member[.inheritedFields], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getFlags, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[], type_arguments=None)], member=isStatic, postfix_operators=[], prefix_operators=['!'], qualifier=Flags, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getElementName, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[], type_arguments=None)], member=isHiddenMember, postfix_operators=[], prefix_operators=['!'], qualifier=Utils, selectors=[], type_arguments=None), operator=&&), operandr=MethodInvocation(arguments=[MemberReference(member=typeFinder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isVisible, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getElementName, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[], type_arguments=None), MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=putIfAbsent, postfix_operators=[], prefix_operators=[], qualifier=inheritedFields, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getFields, postfix_operators=[], prefix_operators=[], qualifier=type, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=field)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=IField, sub_type=None))), label=None)
else begin[{]
None
end[}]
end[}]
call[statuses.addAll, parameter[call[typeIterator.getStatuses, parameter[]]]]
else begin[{]
None
end[}]
if[call[statuses.isEmpty, parameter[]]] begin[{]
return[call[plugin.createOkStatus, parameter[]]]
else begin[{]
None
end[}]
if[binary_operation[call[statuses.size, parameter[]], ==, literal[1]]] begin[{]
return[call[statuses.get, parameter[literal[0]]]]
else begin[{]
None
end[}]
return[call[plugin.createMultiStatus, parameter[member[.statuses]]]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] {
literal[String] , literal[String] , literal[String] , literal[String]
} operator[SEP] Keyword[public] identifier[IStatus] identifier[populateInheritanceContext] operator[SEP] identifier[TypeFinder] identifier[typeFinder] , identifier[Map] operator[<] identifier[ActionPrototype] , identifier[IMethod] operator[>] identifier[finalOperations] , identifier[Map] operator[<] identifier[ActionPrototype] , identifier[IMethod] operator[>] identifier[overridableOperations] , identifier[Map] operator[<] identifier[String] , identifier[IField] operator[>] identifier[inheritedFields] , identifier[Map] operator[<] identifier[ActionPrototype] , identifier[IMethod] operator[>] identifier[operationsToImplement] , identifier[Map] operator[<] identifier[ActionParameterTypes] , identifier[IMethod] operator[>] identifier[superConstructors] , identifier[String] identifier[superClass] , identifier[List] operator[<] identifier[String] operator[>] identifier[superInterfaces] operator[SEP] Keyword[throws] identifier[JavaModelException] {
Keyword[final] identifier[Set] operator[<] identifier[ActionPrototype] operator[>] identifier[treatedElements] operator[=] Keyword[new] identifier[TreeSet] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[SARLEclipsePlugin] identifier[plugin] operator[=] identifier[SARLEclipsePlugin] operator[SEP] identifier[getDefault] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[IStatus] operator[>] identifier[statuses] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[operationsToImplement] operator[!=] Other[null] operator[SEP] {
Keyword[final] identifier[SuperTypeIterator] identifier[typeIterator] operator[=] Keyword[new] identifier[SuperTypeIterator] operator[SEP] identifier[typeFinder] , literal[boolean] , identifier[superInterfaces] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[typeIterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[IType] identifier[type] operator[=] identifier[typeIterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[IMethod] identifier[operation] operator[:] identifier[type] operator[SEP] identifier[getMethods] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[Flags] operator[SEP] identifier[isStatic] operator[SEP] identifier[operation] operator[SEP] identifier[getFlags] operator[SEP] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[Flags] operator[SEP] identifier[isFinal] operator[SEP] identifier[operation] operator[SEP] identifier[getFlags] operator[SEP] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[operation] operator[SEP] identifier[isLambdaMethod] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[operation] operator[SEP] identifier[isConstructor] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[ActionParameterTypes] identifier[sig] operator[=] Keyword[this] operator[SEP] identifier[actionPrototypeProvider] operator[SEP] identifier[createParameterTypes] operator[SEP] identifier[Flags] operator[SEP] identifier[isVarargs] operator[SEP] identifier[operation] operator[SEP] identifier[getFlags] operator[SEP] operator[SEP] operator[SEP] , identifier[getFormalParameterProvider] operator[SEP] identifier[operation] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[ActionPrototype] identifier[actionKey] operator[=] Keyword[this] operator[SEP] identifier[actionPrototypeProvider] operator[SEP] identifier[createActionPrototype] operator[SEP] identifier[operation] operator[SEP] identifier[getElementName] operator[SEP] operator[SEP] , identifier[sig] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[treatedElements] operator[SEP] identifier[add] operator[SEP] identifier[actionKey] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[Flags] operator[SEP] identifier[isDefaultMethod] operator[SEP] identifier[operation] operator[SEP] identifier[getFlags] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[overridableOperations] operator[SEP] identifier[containsKey] operator[SEP] identifier[actionKey] operator[SEP] operator[SEP] {
identifier[overridableOperations] operator[SEP] identifier[put] operator[SEP] identifier[actionKey] , identifier[operation] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[if] operator[SEP] operator[!] identifier[operationsToImplement] operator[SEP] identifier[containsKey] operator[SEP] identifier[actionKey] operator[SEP] operator[SEP] {
identifier[operationsToImplement] operator[SEP] identifier[put] operator[SEP] identifier[actionKey] , identifier[operation] operator[SEP] operator[SEP]
}
}
}
}
}
}
identifier[statuses] operator[SEP] identifier[addAll] operator[SEP] identifier[typeIterator] operator[SEP] identifier[getStatuses] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[isValidSuperType] operator[SEP] identifier[superClass] operator[SEP] operator[SEP] {
Keyword[final] identifier[SuperTypeIterator] identifier[typeIterator] operator[=] Keyword[new] identifier[SuperTypeIterator] operator[SEP] identifier[typeFinder] , literal[boolean] , identifier[superClass] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[typeIterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[IType] identifier[type] operator[=] identifier[typeIterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[boolean] identifier[checkForConstructors] operator[=] identifier[superConstructors] operator[!=] Other[null] operator[&&] identifier[type] operator[SEP] identifier[getFullyQualifiedName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[superClass] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[IMethod] identifier[operation] operator[:] identifier[type] operator[SEP] identifier[getMethods] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[Flags] operator[SEP] identifier[isStatic] operator[SEP] identifier[operation] operator[SEP] identifier[getFlags] operator[SEP] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[operation] operator[SEP] identifier[isLambdaMethod] operator[SEP] operator[SEP] operator[&&] identifier[isVisible] operator[SEP] identifier[typeFinder] , identifier[type] , identifier[operation] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[operation] operator[SEP] identifier[isConstructor] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[Utils] operator[SEP] identifier[isHiddenMember] operator[SEP] identifier[operation] operator[SEP] identifier[getElementName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[ActionParameterTypes] identifier[sig] operator[=] Keyword[this] operator[SEP] identifier[actionPrototypeProvider] operator[SEP] identifier[createParameterTypes] operator[SEP] identifier[Flags] operator[SEP] identifier[isVarargs] operator[SEP] identifier[operation] operator[SEP] identifier[getFlags] operator[SEP] operator[SEP] operator[SEP] , identifier[getFormalParameterProvider] operator[SEP] identifier[operation] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[ActionPrototype] identifier[actionKey] operator[=] Keyword[this] operator[SEP] identifier[actionPrototypeProvider] operator[SEP] identifier[createActionPrototype] operator[SEP] identifier[operation] operator[SEP] identifier[getElementName] operator[SEP] operator[SEP] , identifier[sig] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[treatedElements] operator[SEP] identifier[add] operator[SEP] identifier[actionKey] operator[SEP] operator[SEP] {
Keyword[final] Keyword[int] identifier[flags] operator[=] identifier[operation] operator[SEP] identifier[getFlags] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Flags] operator[SEP] identifier[isAbstract] operator[SEP] identifier[flags] operator[SEP] operator[&&] operator[!] identifier[Flags] operator[SEP] identifier[isDefaultMethod] operator[SEP] identifier[flags] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[operationsToImplement] operator[!=] Other[null] operator[SEP] {
identifier[operationsToImplement] operator[SEP] identifier[put] operator[SEP] identifier[actionKey] , identifier[operation] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[Flags] operator[SEP] identifier[isFinal] operator[SEP] identifier[flags] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[finalOperations] operator[!=] Other[null] operator[SEP] {
identifier[finalOperations] operator[SEP] identifier[put] operator[SEP] identifier[actionKey] , identifier[operation] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[operationsToImplement] operator[!=] Other[null] operator[SEP] {
identifier[operationsToImplement] operator[SEP] identifier[remove] operator[SEP] identifier[actionKey] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[overridableOperations] operator[!=] Other[null] operator[SEP] {
identifier[overridableOperations] operator[SEP] identifier[put] operator[SEP] identifier[actionKey] , identifier[operation] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[operationsToImplement] operator[!=] Other[null] operator[SEP] {
identifier[operationsToImplement] operator[SEP] identifier[remove] operator[SEP] identifier[actionKey] operator[SEP] operator[SEP]
}
}
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[checkForConstructors] operator[&&] identifier[operation] operator[SEP] identifier[isConstructor] operator[SEP] operator[SEP] operator[&&] identifier[superConstructors] operator[!=] Other[null] operator[SEP] {
Keyword[final] identifier[ActionParameterTypes] identifier[sig] operator[=] Keyword[this] operator[SEP] identifier[actionPrototypeProvider] operator[SEP] identifier[createParameterTypes] operator[SEP] identifier[Flags] operator[SEP] identifier[isVarargs] operator[SEP] identifier[operation] operator[SEP] identifier[getFlags] operator[SEP] operator[SEP] operator[SEP] , identifier[getFormalParameterProvider] operator[SEP] identifier[operation] operator[SEP] operator[SEP] operator[SEP] identifier[superConstructors] operator[SEP] identifier[put] operator[SEP] identifier[sig] , identifier[operation] operator[SEP] operator[SEP]
}
}
}
Keyword[if] operator[SEP] identifier[inheritedFields] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] Keyword[final] identifier[IField] identifier[field] operator[:] identifier[type] operator[SEP] identifier[getFields] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[Flags] operator[SEP] identifier[isStatic] operator[SEP] identifier[field] operator[SEP] identifier[getFlags] operator[SEP] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[Utils] operator[SEP] identifier[isHiddenMember] operator[SEP] identifier[field] operator[SEP] identifier[getElementName] operator[SEP] operator[SEP] operator[SEP] operator[&&] identifier[isVisible] operator[SEP] identifier[typeFinder] , identifier[type] , identifier[field] operator[SEP] operator[SEP] {
identifier[inheritedFields] operator[SEP] identifier[putIfAbsent] operator[SEP] identifier[field] operator[SEP] identifier[getElementName] operator[SEP] operator[SEP] , identifier[field] operator[SEP] operator[SEP]
}
}
}
}
identifier[statuses] operator[SEP] identifier[addAll] operator[SEP] identifier[typeIterator] operator[SEP] identifier[getStatuses] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[statuses] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[plugin] operator[SEP] identifier[createOkStatus] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[statuses] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[1] operator[SEP] {
Keyword[return] identifier[statuses] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[return] identifier[plugin] operator[SEP] identifier[createMultiStatus] operator[SEP] identifier[statuses] operator[SEP] operator[SEP]
}
|
private static void setValue(
Object value,
Field field,
Object destination,
GenericXml genericXml,
Map<String, Object> destinationMap,
String name) {
if (field != null) {
FieldInfo.setFieldValue(field, destination, value);
} else if (genericXml != null) {
genericXml.set(name, value);
} else {
destinationMap.put(name, value);
}
} | class class_name[name] begin[{]
method[setValue, return_type[void], modifier[private static], parameter[value, field, destination, genericXml, destinationMap, name]] begin[{]
if[binary_operation[member[.field], !=, literal[null]]] begin[{]
call[FieldInfo.setFieldValue, parameter[member[.field], member[.destination], member[.value]]]
else begin[{]
if[binary_operation[member[.genericXml], !=, literal[null]]] begin[{]
call[genericXml.set, parameter[member[.name], member[.value]]]
else begin[{]
call[destinationMap.put, parameter[member[.name], member[.value]]]
end[}]
end[}]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[void] identifier[setValue] operator[SEP] identifier[Object] identifier[value] , identifier[Field] identifier[field] , identifier[Object] identifier[destination] , identifier[GenericXml] identifier[genericXml] , identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[destinationMap] , identifier[String] identifier[name] operator[SEP] {
Keyword[if] operator[SEP] identifier[field] operator[!=] Other[null] operator[SEP] {
identifier[FieldInfo] operator[SEP] identifier[setFieldValue] operator[SEP] identifier[field] , identifier[destination] , identifier[value] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[genericXml] operator[!=] Other[null] operator[SEP] {
identifier[genericXml] operator[SEP] identifier[set] operator[SEP] identifier[name] , identifier[value] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[destinationMap] operator[SEP] identifier[put] operator[SEP] identifier[name] , identifier[value] operator[SEP] operator[SEP]
}
}
|
public Action fromJSON(JSONObject in) throws JSONConverterException {
String id = requiredString(in, ACTION_ID_LABEL);
Action a;
switch (id) {
case "bootVM":
a = bootVMFromJSON(in);
break;
case "shutdownVM":
a = shutdownVMFromJSON(in);
break;
case "shutdownNode":
a = shutdownNodeFromJSON(in);
break;
case "bootNode":
a = bootNodeFromJSON(in);
break;
case "forgeVM":
a = forgeVMFromJSON(in);
break;
case "killVM":
a = killVMFromJSON(in);
break;
case "migrateVM":
a = migrateVMFromJSON(in);
break;
case "resumeVM":
a = resumeVMFromJSON(in);
break;
case "suspendVM":
a = suspendVMFromJSON(in);
break;
case RC_ALLOCATE_LABEL:
a = allocateFromJSON(in);
break;
default:
throw new JSONConverterException("Unsupported action '" + id + "'");
}
attachEvents(a, in);
return a;
} | class class_name[name] begin[{]
method[fromJSON, return_type[type[Action]], modifier[public], parameter[in]] begin[{]
local_variable[type[String], id]
local_variable[type[Action], a]
SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="bootVM")], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=bootVMFromJSON, 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="shutdownVM")], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=shutdownVMFromJSON, 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="shutdownNode")], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=shutdownNodeFromJSON, 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="bootNode")], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=bootNodeFromJSON, 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="forgeVM")], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=forgeVMFromJSON, 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="killVM")], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=killVMFromJSON, 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="migrateVM")], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=migrateVMFromJSON, 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="resumeVM")], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=resumeVMFromJSON, 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="suspendVM")], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=suspendVMFromJSON, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['RC_ALLOCATE_LABEL'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=allocateFromJSON, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unsupported action '"), operandr=MemberReference(member=id, 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=JSONConverterException, sub_type=None)), label=None)])], expression=MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
call[.attachEvents, parameter[member[.a], member[.in]]]
return[member[.a]]
end[}]
END[}] | Keyword[public] identifier[Action] identifier[fromJSON] operator[SEP] identifier[JSONObject] identifier[in] operator[SEP] Keyword[throws] identifier[JSONConverterException] {
identifier[String] identifier[id] operator[=] identifier[requiredString] operator[SEP] identifier[in] , identifier[ACTION_ID_LABEL] operator[SEP] operator[SEP] identifier[Action] identifier[a] operator[SEP] Keyword[switch] operator[SEP] identifier[id] operator[SEP] {
Keyword[case] literal[String] operator[:] identifier[a] operator[=] identifier[bootVMFromJSON] operator[SEP] identifier[in] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] literal[String] operator[:] identifier[a] operator[=] identifier[shutdownVMFromJSON] operator[SEP] identifier[in] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] literal[String] operator[:] identifier[a] operator[=] identifier[shutdownNodeFromJSON] operator[SEP] identifier[in] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] literal[String] operator[:] identifier[a] operator[=] identifier[bootNodeFromJSON] operator[SEP] identifier[in] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] literal[String] operator[:] identifier[a] operator[=] identifier[forgeVMFromJSON] operator[SEP] identifier[in] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] literal[String] operator[:] identifier[a] operator[=] identifier[killVMFromJSON] operator[SEP] identifier[in] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] literal[String] operator[:] identifier[a] operator[=] identifier[migrateVMFromJSON] operator[SEP] identifier[in] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] literal[String] operator[:] identifier[a] operator[=] identifier[resumeVMFromJSON] operator[SEP] identifier[in] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] literal[String] operator[:] identifier[a] operator[=] identifier[suspendVMFromJSON] operator[SEP] identifier[in] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[RC_ALLOCATE_LABEL] operator[:] identifier[a] operator[=] identifier[allocateFromJSON] operator[SEP] identifier[in] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[throw] Keyword[new] identifier[JSONConverterException] operator[SEP] literal[String] operator[+] identifier[id] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[attachEvents] operator[SEP] identifier[a] , identifier[in] operator[SEP] operator[SEP] Keyword[return] identifier[a] operator[SEP]
}
|
private static IDisconfUpdate getIDisconfUpdateInstance(Class<?> disconfUpdateServiceClass, Registry registry) {
Object iDisconfUpdate = registry.getFirstByType(disconfUpdateServiceClass, true);
if (iDisconfUpdate == null) {
return null;
}
return (IDisconfUpdate) iDisconfUpdate;
} | class class_name[name] begin[{]
method[getIDisconfUpdateInstance, return_type[type[IDisconfUpdate]], modifier[private static], parameter[disconfUpdateServiceClass, registry]] begin[{]
local_variable[type[Object], iDisconfUpdate]
if[binary_operation[member[.iDisconfUpdate], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
return[Cast(expression=MemberReference(member=iDisconfUpdate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=IDisconfUpdate, sub_type=None))]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[IDisconfUpdate] identifier[getIDisconfUpdateInstance] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[disconfUpdateServiceClass] , identifier[Registry] identifier[registry] operator[SEP] {
identifier[Object] identifier[iDisconfUpdate] operator[=] identifier[registry] operator[SEP] identifier[getFirstByType] operator[SEP] identifier[disconfUpdateServiceClass] , literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[iDisconfUpdate] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[return] operator[SEP] identifier[IDisconfUpdate] operator[SEP] identifier[iDisconfUpdate] operator[SEP]
}
|
@Override
public void onClose(Status status, Metadata trailers) {
if (status.getCause() instanceof StreamWaitTimeoutException) {
StreamWaitTimeoutException timeoutException = (StreamWaitTimeoutException) status.getCause();
switch(timeoutException.getState()) {
case WAITING:
operationSpan.addAnnotation("Received an WAITING timeout.");
handleTimeoutError(status);
return;
case IDLE:
operationSpan.addAnnotation("Received an IDLE timeout.");
((IdleResumingCallController) callWrapper).setIsIdle();
return;
default:
// continue with onClose.
break;
}
}
super.onClose(status, trailers);
} | class class_name[name] begin[{]
method[onClose, return_type[void], modifier[public], parameter[status, trailers]] begin[{]
if[binary_operation[call[status.getCause, parameter[]], instanceof, type[StreamWaitTimeoutException]]] begin[{]
local_variable[type[StreamWaitTimeoutException], timeoutException]
SwitchStatement(cases=[SwitchStatementCase(case=['WAITING'], statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Received an WAITING timeout.")], member=addAnnotation, postfix_operators=[], prefix_operators=[], qualifier=operationSpan, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=status, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=handleTimeoutError, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)]), SwitchStatementCase(case=['IDLE'], statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Received an IDLE timeout.")], member=addAnnotation, postfix_operators=[], prefix_operators=[], qualifier=operationSpan, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Cast(expression=MemberReference(member=callWrapper, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=IdleResumingCallController, sub_type=None)), label=None), ReturnStatement(expression=None, label=None)]), SwitchStatementCase(case=[], statements=[BreakStatement(goto=None, label=None)])], expression=MethodInvocation(arguments=[], member=getState, postfix_operators=[], prefix_operators=[], qualifier=timeoutException, selectors=[], type_arguments=None), label=None)
else begin[{]
None
end[}]
SuperMethodInvocation(arguments=[MemberReference(member=status, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=trailers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=onClose, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onClose] operator[SEP] identifier[Status] identifier[status] , identifier[Metadata] identifier[trailers] operator[SEP] {
Keyword[if] operator[SEP] identifier[status] operator[SEP] identifier[getCause] operator[SEP] operator[SEP] Keyword[instanceof] identifier[StreamWaitTimeoutException] operator[SEP] {
identifier[StreamWaitTimeoutException] identifier[timeoutException] operator[=] operator[SEP] identifier[StreamWaitTimeoutException] operator[SEP] identifier[status] operator[SEP] identifier[getCause] operator[SEP] operator[SEP] operator[SEP] Keyword[switch] operator[SEP] identifier[timeoutException] operator[SEP] identifier[getState] operator[SEP] operator[SEP] operator[SEP] {
Keyword[case] identifier[WAITING] operator[:] identifier[operationSpan] operator[SEP] identifier[addAnnotation] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[handleTimeoutError] operator[SEP] identifier[status] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[case] identifier[IDLE] operator[:] identifier[operationSpan] operator[SEP] identifier[addAnnotation] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[IdleResumingCallController] operator[SEP] identifier[callWrapper] operator[SEP] operator[SEP] identifier[setIsIdle] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[default] operator[:] Keyword[break] operator[SEP]
}
}
Keyword[super] operator[SEP] identifier[onClose] operator[SEP] identifier[status] , identifier[trailers] operator[SEP] operator[SEP]
}
|
protected boolean handleJsonBody(ActionRuntime runtime, VirtualForm virtualForm) {
final ActionFormMeta formMeta = virtualForm.getFormMeta();
if (formMeta.isJsonBodyMapping()) {
if (formMeta.isRootSymbolForm()) {
mappingJsonBody(runtime, virtualForm, prepareJsonFromRequestBody(virtualForm));
} else if (formMeta.isTypedListForm()) {
mappingListJsonBody(runtime, virtualForm, prepareJsonFromRequestBody(virtualForm));
}
// basically no way here (but no exception just in case)
}
return false;
} | class class_name[name] begin[{]
method[handleJsonBody, return_type[type[boolean]], modifier[protected], parameter[runtime, virtualForm]] begin[{]
local_variable[type[ActionFormMeta], formMeta]
if[call[formMeta.isJsonBodyMapping, parameter[]]] begin[{]
if[call[formMeta.isRootSymbolForm, parameter[]]] begin[{]
call[.mappingJsonBody, parameter[member[.runtime], member[.virtualForm], call[.prepareJsonFromRequestBody, parameter[member[.virtualForm]]]]]
else begin[{]
if[call[formMeta.isTypedListForm, parameter[]]] begin[{]
call[.mappingListJsonBody, parameter[member[.runtime], member[.virtualForm], call[.prepareJsonFromRequestBody, parameter[member[.virtualForm]]]]]
else begin[{]
None
end[}]
end[}]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[protected] Keyword[boolean] identifier[handleJsonBody] operator[SEP] identifier[ActionRuntime] identifier[runtime] , identifier[VirtualForm] identifier[virtualForm] operator[SEP] {
Keyword[final] identifier[ActionFormMeta] identifier[formMeta] operator[=] identifier[virtualForm] operator[SEP] identifier[getFormMeta] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[formMeta] operator[SEP] identifier[isJsonBodyMapping] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[formMeta] operator[SEP] identifier[isRootSymbolForm] operator[SEP] operator[SEP] operator[SEP] {
identifier[mappingJsonBody] operator[SEP] identifier[runtime] , identifier[virtualForm] , identifier[prepareJsonFromRequestBody] operator[SEP] identifier[virtualForm] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[formMeta] operator[SEP] identifier[isTypedListForm] operator[SEP] operator[SEP] operator[SEP] {
identifier[mappingListJsonBody] operator[SEP] identifier[runtime] , identifier[virtualForm] , identifier[prepareJsonFromRequestBody] operator[SEP] identifier[virtualForm] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public void write(@NonNull Resource resource) throws IOException {
try (JsonWriter writer = Json.createWriter(resource)) {
writer.beginDocument();
writer.property("id", getId());
writer.property("content", toString());
if (attributes.size() > 0) {
writer.beginObject("attributes");
for (Map.Entry<AttributeType, Val> entry : attributeEntrySet()) {
writer.property(entry.getKey().name(), entry.getKey().getValueType().encode(entry.getValue()));
}
writer.endObject();
}
if (annotationSet.size() > 0) {
writer.beginObject("completed");
for (AnnotatableType type : getAnnotationSet().getCompleted()) {
writer.property(type.canonicalName(), getAnnotationSet().getAnnotationProvider(type));
}
writer.endObject();
writer.beginArray("annotations");
for (Annotation annotation : annotationSet) {
writer.beginObject();
writer.property("type", annotation.getType().name());
writer.property("start", annotation.start());
writer.property("end", annotation.end());
writer.property("id", annotation.getId());
if (Config.get("Annotation.writeContent").asBooleanValue(false)) {
writer.property("content", annotation.toString());
}
if (annotation.getAttributeMap().size() > 0) {
writer.beginObject("attributes");
for (Map.Entry<AttributeType, Val> entry : annotation.attributeEntrySet()) {
writer.property(entry.getKey().name(),
entry.getKey().getValueType().encode(entry.getValue()));
}
writer.endObject();
}
Collection<Relation> relations = annotation.relations();
if (relations.size() > 0) {
writer.beginArray("relations");
for (Relation relation : relations) {
writer.beginObject();
writer.property("type", relation.getType());
writer.property("value", relation.getValue());
writer.property("target", relation.getTarget());
writer.endObject();
}
writer.endArray();
}
writer.endObject();
}
writer.endArray();
}
writer.endDocument();
}
} | class class_name[name] begin[{]
method[write, return_type[void], modifier[public], parameter[resource]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=beginDocument, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="id"), MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=property, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="content"), MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=property, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=attributes, selectors=[], type_arguments=None), 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=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="attributes")], member=beginObject, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[MethodInvocation(arguments=[], member=name, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[MethodInvocation(arguments=[], member=getValueType, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None)], member=encode, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=property, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=attributeEntrySet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=AttributeType, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Val, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=endObject, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=annotationSet, selectors=[], type_arguments=None), 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=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="completed")], member=beginObject, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=canonicalName, postfix_operators=[], prefix_operators=[], qualifier=type, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getAnnotationSet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getAnnotationProvider, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=property, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getAnnotationSet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getCompleted, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=type)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=AnnotatableType, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=endObject, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="annotations")], member=beginArray, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=beginObject, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="type"), MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=annotation, selectors=[MethodInvocation(arguments=[], member=name, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=property, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="start"), MethodInvocation(arguments=[], member=start, postfix_operators=[], prefix_operators=[], qualifier=annotation, selectors=[], type_arguments=None)], member=property, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="end"), MethodInvocation(arguments=[], member=end, postfix_operators=[], prefix_operators=[], qualifier=annotation, selectors=[], type_arguments=None)], member=property, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="id"), MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=annotation, selectors=[], type_arguments=None)], member=property, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Annotation.writeContent")], member=get, postfix_operators=[], prefix_operators=[], qualifier=Config, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=asBooleanValue, 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=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="content"), MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=annotation, selectors=[], type_arguments=None)], member=property, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getAttributeMap, postfix_operators=[], prefix_operators=[], qualifier=annotation, selectors=[MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), 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="attributes")], member=beginObject, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[MethodInvocation(arguments=[], member=name, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[MethodInvocation(arguments=[], member=getValueType, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None)], member=encode, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=property, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=attributeEntrySet, postfix_operators=[], prefix_operators=[], qualifier=annotation, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=AttributeType, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Val, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=endObject, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=relations, postfix_operators=[], prefix_operators=[], qualifier=annotation, selectors=[], type_arguments=None), name=relations)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Relation, sub_type=None))], dimensions=[], name=Collection, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=relations, selectors=[], type_arguments=None), 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=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="relations")], member=beginArray, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=beginObject, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="type"), MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=relation, selectors=[], type_arguments=None)], member=property, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="value"), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=relation, selectors=[], type_arguments=None)], member=property, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="target"), MethodInvocation(arguments=[], member=getTarget, postfix_operators=[], prefix_operators=[], qualifier=relation, selectors=[], type_arguments=None)], member=property, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=endObject, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=relations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=relation)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Relation, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=endArray, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[], member=endObject, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=annotationSet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=annotation)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Annotation, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=endArray, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[], member=endDocument, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=writer, type=ReferenceType(arguments=None, dimensions=[], name=JsonWriter, sub_type=None), value=MethodInvocation(arguments=[MemberReference(member=resource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createWriter, postfix_operators=[], prefix_operators=[], qualifier=Json, selectors=[], type_arguments=None))])
end[}]
END[}] | Keyword[public] Keyword[void] identifier[write] operator[SEP] annotation[@] identifier[NonNull] identifier[Resource] identifier[resource] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[try] operator[SEP] identifier[JsonWriter] identifier[writer] operator[=] identifier[Json] operator[SEP] identifier[createWriter] operator[SEP] identifier[resource] operator[SEP] operator[SEP] {
identifier[writer] operator[SEP] identifier[beginDocument] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[property] operator[SEP] literal[String] , identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[property] operator[SEP] literal[String] , identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[attributes] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[writer] operator[SEP] identifier[beginObject] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[AttributeType] , identifier[Val] operator[>] identifier[entry] operator[:] identifier[attributeEntrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[writer] operator[SEP] identifier[property] operator[SEP] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[name] operator[SEP] operator[SEP] , identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[getValueType] operator[SEP] operator[SEP] operator[SEP] identifier[encode] operator[SEP] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[writer] operator[SEP] identifier[endObject] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[annotationSet] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[writer] operator[SEP] identifier[beginObject] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[AnnotatableType] identifier[type] operator[:] identifier[getAnnotationSet] operator[SEP] operator[SEP] operator[SEP] identifier[getCompleted] operator[SEP] operator[SEP] operator[SEP] {
identifier[writer] operator[SEP] identifier[property] operator[SEP] identifier[type] operator[SEP] identifier[canonicalName] operator[SEP] operator[SEP] , identifier[getAnnotationSet] operator[SEP] operator[SEP] operator[SEP] identifier[getAnnotationProvider] operator[SEP] identifier[type] operator[SEP] operator[SEP] operator[SEP]
}
identifier[writer] operator[SEP] identifier[endObject] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[beginArray] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Annotation] identifier[annotation] operator[:] identifier[annotationSet] operator[SEP] {
identifier[writer] operator[SEP] identifier[beginObject] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[property] operator[SEP] literal[String] , identifier[annotation] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[property] operator[SEP] literal[String] , identifier[annotation] operator[SEP] identifier[start] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[property] operator[SEP] literal[String] , identifier[annotation] operator[SEP] identifier[end] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[property] operator[SEP] literal[String] , identifier[annotation] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Config] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[asBooleanValue] operator[SEP] literal[boolean] operator[SEP] operator[SEP] {
identifier[writer] operator[SEP] identifier[property] operator[SEP] literal[String] , identifier[annotation] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[annotation] operator[SEP] identifier[getAttributeMap] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[writer] operator[SEP] identifier[beginObject] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[AttributeType] , identifier[Val] operator[>] identifier[entry] operator[:] identifier[annotation] operator[SEP] identifier[attributeEntrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[writer] operator[SEP] identifier[property] operator[SEP] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[name] operator[SEP] operator[SEP] , identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[getValueType] operator[SEP] operator[SEP] operator[SEP] identifier[encode] operator[SEP] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[writer] operator[SEP] identifier[endObject] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Collection] operator[<] identifier[Relation] operator[>] identifier[relations] operator[=] identifier[annotation] operator[SEP] identifier[relations] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[relations] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[writer] operator[SEP] identifier[beginArray] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Relation] identifier[relation] operator[:] identifier[relations] operator[SEP] {
identifier[writer] operator[SEP] identifier[beginObject] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[property] operator[SEP] literal[String] , identifier[relation] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[property] operator[SEP] literal[String] , identifier[relation] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[property] operator[SEP] literal[String] , identifier[relation] operator[SEP] identifier[getTarget] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[endObject] operator[SEP] operator[SEP] operator[SEP]
}
identifier[writer] operator[SEP] identifier[endArray] operator[SEP] operator[SEP] operator[SEP]
}
identifier[writer] operator[SEP] identifier[endObject] operator[SEP] operator[SEP] operator[SEP]
}
identifier[writer] operator[SEP] identifier[endArray] operator[SEP] operator[SEP] operator[SEP]
}
identifier[writer] operator[SEP] identifier[endDocument] operator[SEP] operator[SEP] operator[SEP]
}
}
|
static String hex0(final byte x) {
final char tab[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'a', 'b', 'c', 'd', 'e', 'f' };
int uint;
if (x < 0) {
uint = x & 0x7F;
uint |= 1 << 7;
} else {
uint = x;
}
return "" + tab[uint >>> 4] + tab[uint & 0xF];
} | class class_name[name] begin[{]
method[hex0, return_type[type[String]], modifier[static], parameter[x]] begin[{]
local_variable[type[char], tab]
local_variable[type[int], uint]
if[binary_operation[member[.x], <, literal[0]]] begin[{]
assign[member[.uint], binary_operation[member[.x], &, literal[0x7F]]]
assign[member[.uint], binary_operation[literal[1], <<, literal[7]]]
else begin[{]
assign[member[.uint], member[.x]]
end[}]
return[binary_operation[binary_operation[literal[""], +, member[.tab]], +, member[.tab]]]
end[}]
END[}] | Keyword[static] identifier[String] identifier[hex0] operator[SEP] Keyword[final] Keyword[byte] identifier[x] operator[SEP] {
Keyword[final] Keyword[char] identifier[tab] operator[SEP] operator[SEP] operator[=] {
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] , literal[String]
} operator[SEP] Keyword[int] identifier[uint] operator[SEP] Keyword[if] operator[SEP] identifier[x] operator[<] Other[0] operator[SEP] {
identifier[uint] operator[=] identifier[x] operator[&] literal[Integer] operator[SEP] identifier[uint] operator[|=] Other[1] operator[<<] Other[7] operator[SEP]
}
Keyword[else] {
identifier[uint] operator[=] identifier[x] operator[SEP]
}
Keyword[return] literal[String] operator[+] identifier[tab] operator[SEP] identifier[uint] operator[>] operator[>] operator[>] Other[4] operator[SEP] operator[+] identifier[tab] operator[SEP] identifier[uint] operator[&] literal[Integer] operator[SEP] operator[SEP]
}
|
public T build() {
T obj = createInstance();
try {
for (Step step : steps) {
if (step.isBuilderMethodCall()) {
callMethod(this, step);
} else {
callMethod(obj, step);
}
}
} catch (Exception e) {
throw new Siren4JRuntimeException(e);
}
postProcess(obj);
validate(obj);
return obj;
} | class class_name[name] begin[{]
method[build, return_type[type[T]], modifier[public], parameter[]] begin[{]
local_variable[type[T], obj]
TryStatement(block=[ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=isBuilderMethodCall, postfix_operators=[], prefix_operators=[], qualifier=step, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=obj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=step, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=callMethod, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=step, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=callMethod, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=steps, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=step)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Step, sub_type=None))), 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=Siren4JRuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
call[.postProcess, parameter[member[.obj]]]
call[.validate, parameter[member[.obj]]]
return[member[.obj]]
end[}]
END[}] | Keyword[public] identifier[T] identifier[build] operator[SEP] operator[SEP] {
identifier[T] identifier[obj] operator[=] identifier[createInstance] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[for] operator[SEP] identifier[Step] identifier[step] operator[:] identifier[steps] operator[SEP] {
Keyword[if] operator[SEP] identifier[step] operator[SEP] identifier[isBuilderMethodCall] operator[SEP] operator[SEP] operator[SEP] {
identifier[callMethod] operator[SEP] Keyword[this] , identifier[step] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[callMethod] operator[SEP] identifier[obj] , identifier[step] operator[SEP] operator[SEP]
}
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[Siren4JRuntimeException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
identifier[postProcess] operator[SEP] identifier[obj] operator[SEP] operator[SEP] identifier[validate] operator[SEP] identifier[obj] operator[SEP] operator[SEP] Keyword[return] identifier[obj] operator[SEP]
}
|
public MonetaryFormat roundingMode(RoundingMode roundingMode) {
if (roundingMode == this.roundingMode)
return this;
else
return new MonetaryFormat(negativeSign, positiveSign, zeroDigit, decimalMark, minDecimals, decimalGroups,
shift, roundingMode, codes, codeSeparator, codePrefixed);
} | class class_name[name] begin[{]
method[roundingMode, return_type[type[MonetaryFormat]], modifier[public], parameter[roundingMode]] begin[{]
if[binary_operation[member[.roundingMode], ==, THIS[member[None.roundingMode]]]] begin[{]
return[THIS[]]
else begin[{]
return[ClassCreator(arguments=[MemberReference(member=negativeSign, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=positiveSign, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=zeroDigit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=decimalMark, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=minDecimals, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=decimalGroups, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=shift, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=roundingMode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=codes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=codeSeparator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=codePrefixed, 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=MonetaryFormat, sub_type=None))]
end[}]
end[}]
END[}] | Keyword[public] identifier[MonetaryFormat] identifier[roundingMode] operator[SEP] identifier[RoundingMode] identifier[roundingMode] operator[SEP] {
Keyword[if] operator[SEP] identifier[roundingMode] operator[==] Keyword[this] operator[SEP] identifier[roundingMode] operator[SEP] Keyword[return] Keyword[this] operator[SEP] Keyword[else] Keyword[return] Keyword[new] identifier[MonetaryFormat] operator[SEP] identifier[negativeSign] , identifier[positiveSign] , identifier[zeroDigit] , identifier[decimalMark] , identifier[minDecimals] , identifier[decimalGroups] , identifier[shift] , identifier[roundingMode] , identifier[codes] , identifier[codeSeparator] , identifier[codePrefixed] operator[SEP] operator[SEP]
}
|
static public SimpleGraph getMoleculeGraph(IAtomContainer molecule) {
SimpleGraph graph = new SimpleGraph();
for (int i = 0; i < molecule.getAtomCount(); i++) {
IAtom atom = molecule.getAtom(i);
graph.addVertex(atom);
}
for (int i = 0; i < molecule.getBondCount(); i++) {
IBond bond = molecule.getBond(i);
/*
* int order = (int) bond.getOrder(); for (int j=0; j<order; j++) {
* graph.addEdge(bond.getAtoms()[0], bond.getAtoms()[1]); }
*/
graph.addEdge(bond.getBegin(), bond.getEnd());
}
return graph;
} | class class_name[name] begin[{]
method[getMoleculeGraph, return_type[type[SimpleGraph]], modifier[public static], parameter[molecule]] begin[{]
local_variable[type[SimpleGraph], graph]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getAtom, postfix_operators=[], prefix_operators=[], qualifier=molecule, selectors=[], type_arguments=None), name=atom)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IAtom, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=atom, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addVertex, postfix_operators=[], prefix_operators=[], qualifier=graph, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getAtomCount, postfix_operators=[], prefix_operators=[], qualifier=molecule, 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)
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getBond, postfix_operators=[], prefix_operators=[], qualifier=molecule, selectors=[], type_arguments=None), name=bond)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IBond, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getBegin, postfix_operators=[], prefix_operators=[], qualifier=bond, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getEnd, postfix_operators=[], prefix_operators=[], qualifier=bond, selectors=[], type_arguments=None)], member=addEdge, postfix_operators=[], prefix_operators=[], qualifier=graph, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getBondCount, postfix_operators=[], prefix_operators=[], qualifier=molecule, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.graph]]
end[}]
END[}] | Keyword[static] Keyword[public] identifier[SimpleGraph] identifier[getMoleculeGraph] operator[SEP] identifier[IAtomContainer] identifier[molecule] operator[SEP] {
identifier[SimpleGraph] identifier[graph] operator[=] Keyword[new] identifier[SimpleGraph] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[molecule] operator[SEP] identifier[getAtomCount] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[IAtom] identifier[atom] operator[=] identifier[molecule] operator[SEP] identifier[getAtom] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[graph] operator[SEP] identifier[addVertex] operator[SEP] identifier[atom] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[molecule] operator[SEP] identifier[getBondCount] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[IBond] identifier[bond] operator[=] identifier[molecule] operator[SEP] identifier[getBond] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[graph] operator[SEP] identifier[addEdge] operator[SEP] identifier[bond] operator[SEP] identifier[getBegin] operator[SEP] operator[SEP] , identifier[bond] operator[SEP] identifier[getEnd] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[graph] operator[SEP]
}
|
public static long[] random(int card, int capacity, Random random) {
if(card < 0 || card > capacity) {
throw new IllegalArgumentException("Cannot set " + card + " out of " + capacity + " bits.");
}
// FIXME: Avoid recomputing the cardinality.
if(card < capacity >>> 1) {
long[] bitset = BitsUtil.zero(capacity);
for(int todo = card; todo > 0; //
todo = (todo == 1) ? (card - cardinality(bitset)) : (todo - 1)) {
setI(bitset, random.nextInt(capacity));
}
return bitset;
}
else {
long[] bitset = BitsUtil.ones(capacity);
for(int todo = capacity - card; todo > 0; //
todo = (todo == 1) ? (cardinality(bitset) - card) : (todo - 1)) {
clearI(bitset, random.nextInt(capacity));
}
return bitset;
}
} | class class_name[name] begin[{]
method[random, return_type[type[long]], modifier[public static], parameter[card, capacity, random]] begin[{]
if[binary_operation[binary_operation[member[.card], <, literal[0]], ||, binary_operation[member[.card], >, member[.capacity]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot set "), operandr=MemberReference(member=card, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" out of "), operator=+), operandr=MemberReference(member=capacity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" bits."), 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)
else begin[{]
None
end[}]
if[binary_operation[member[.card], <, binary_operation[member[.capacity], >>>, literal[1]]]] begin[{]
local_variable[type[long], bitset]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=bitset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=capacity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=nextInt, postfix_operators=[], prefix_operators=[], qualifier=random, selectors=[], type_arguments=None)], member=setI, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=todo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=card, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=todo)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[Assignment(expressionl=MemberReference(member=todo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=todo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator===), if_false=BinaryOperation(operandl=MemberReference(member=todo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), if_true=BinaryOperation(operandl=MemberReference(member=card, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[MemberReference(member=bitset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=cardinality, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=-)))]), label=None)
return[member[.bitset]]
else begin[{]
local_variable[type[long], bitset]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=bitset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=capacity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=nextInt, postfix_operators=[], prefix_operators=[], qualifier=random, selectors=[], type_arguments=None)], member=clearI, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=todo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=BinaryOperation(operandl=MemberReference(member=capacity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=card, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), name=todo)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[Assignment(expressionl=MemberReference(member=todo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=todo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator===), if_false=BinaryOperation(operandl=MemberReference(member=todo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), if_true=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=bitset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=cardinality, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operandr=MemberReference(member=card, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-)))]), label=None)
return[member[.bitset]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[long] operator[SEP] operator[SEP] identifier[random] operator[SEP] Keyword[int] identifier[card] , Keyword[int] identifier[capacity] , identifier[Random] identifier[random] operator[SEP] {
Keyword[if] operator[SEP] identifier[card] operator[<] Other[0] operator[||] identifier[card] operator[>] identifier[capacity] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[card] operator[+] literal[String] operator[+] identifier[capacity] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[card] operator[<] identifier[capacity] operator[>] operator[>] operator[>] Other[1] operator[SEP] {
Keyword[long] operator[SEP] operator[SEP] identifier[bitset] operator[=] identifier[BitsUtil] operator[SEP] identifier[zero] operator[SEP] identifier[capacity] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[todo] operator[=] identifier[card] operator[SEP] identifier[todo] operator[>] Other[0] operator[SEP] identifier[todo] operator[=] operator[SEP] identifier[todo] operator[==] Other[1] operator[SEP] operator[?] operator[SEP] identifier[card] operator[-] identifier[cardinality] operator[SEP] identifier[bitset] operator[SEP] operator[SEP] operator[:] operator[SEP] identifier[todo] operator[-] Other[1] operator[SEP] operator[SEP] {
identifier[setI] operator[SEP] identifier[bitset] , identifier[random] operator[SEP] identifier[nextInt] operator[SEP] identifier[capacity] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[bitset] operator[SEP]
}
Keyword[else] {
Keyword[long] operator[SEP] operator[SEP] identifier[bitset] operator[=] identifier[BitsUtil] operator[SEP] identifier[ones] operator[SEP] identifier[capacity] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[todo] operator[=] identifier[capacity] operator[-] identifier[card] operator[SEP] identifier[todo] operator[>] Other[0] operator[SEP] identifier[todo] operator[=] operator[SEP] identifier[todo] operator[==] Other[1] operator[SEP] operator[?] operator[SEP] identifier[cardinality] operator[SEP] identifier[bitset] operator[SEP] operator[-] identifier[card] operator[SEP] operator[:] operator[SEP] identifier[todo] operator[-] Other[1] operator[SEP] operator[SEP] {
identifier[clearI] operator[SEP] identifier[bitset] , identifier[random] operator[SEP] identifier[nextInt] operator[SEP] identifier[capacity] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[bitset] operator[SEP]
}
}
|
public void setReturnObject(PrintWriter out, Object objReturn)
{
String strReturn = null;
if (objReturn instanceof Map)
{
Map<String, Object> map = (Map)objReturn;
JSONObject jsonObj = AjaxProxyTask.mapToJsonObject(map);
strReturn = AjaxProxyTask.jsonObjectToReturnString(jsonObj);
}
else if (objReturn instanceof BaseMessage)
{
BaseMessage message = (BaseMessage)objReturn;
String strMessage = (String)message.get("message");
BaseMessageHeader messageHeader = message.getMessageHeader();
String strQueueName = messageHeader.getQueueName();
String strQueueType = messageHeader.getQueueType();
Integer intRegID = messageHeader.getRegistryIDMatch();
JSONObject jsonObj = new JSONObject();
try {
jsonObj.put("message", strMessage);
jsonObj.put(MessageConstants.QUEUE_NAME, strQueueName);
jsonObj.put(MessageConstants.QUEUE_TYPE, strQueueType);
if (intRegID != null)
jsonObj.put("id", intRegID.toString());
} catch (JSONException e) {
e.printStackTrace();
}
strReturn = AjaxProxyTask.jsonObjectToReturnString(jsonObj);
}
else if (objReturn instanceof BaseMessageFilter)
{
Integer intFilterID = ((BaseMessageFilter)objReturn).getFilterID();
if (intFilterID != null) // If registry ID is null.
strReturn = intFilterID.toString();
Integer intRegistryFilterID = ((BaseMessageFilter)objReturn).getRegistryID();
if (intRegistryFilterID != null) // Always
strReturn = intRegistryFilterID.toString();
}
else if (objReturn instanceof RemoteException)
{
try {
this.setErrorReturn(out, (RemoteException)objReturn);
return;
} catch (RemoteException ex) {
// Never
}
}
else
{
//? String strReturn = org.jbundle.thin.base.remote.proxy.transport.BaseTransport.convertObjectToString(objReturn);
//? strReturn = org.jbundle.thin.base.remote.proxy.transport.Base64Encoder.encode(strReturn);
if (objReturn != null)
strReturn = objReturn.toString();
}
this.setReturnString(out, strReturn);
} | class class_name[name] begin[{]
method[setReturnObject, return_type[void], modifier[public], parameter[out, objReturn]] begin[{]
local_variable[type[String], strReturn]
if[binary_operation[member[.objReturn], instanceof, type[Map]]] begin[{]
local_variable[type[Map], map]
local_variable[type[JSONObject], jsonObj]
assign[member[.strReturn], call[AjaxProxyTask.jsonObjectToReturnString, parameter[member[.jsonObj]]]]
else begin[{]
if[binary_operation[member[.objReturn], instanceof, type[BaseMessage]]] begin[{]
local_variable[type[BaseMessage], message]
local_variable[type[String], strMessage]
local_variable[type[BaseMessageHeader], messageHeader]
local_variable[type[String], strQueueName]
local_variable[type[String], strQueueType]
local_variable[type[Integer], intRegID]
local_variable[type[JSONObject], jsonObj]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="message"), MemberReference(member=strMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=jsonObj, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=QUEUE_NAME, postfix_operators=[], prefix_operators=[], qualifier=MessageConstants, selectors=[]), MemberReference(member=strQueueName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=jsonObj, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=QUEUE_TYPE, postfix_operators=[], prefix_operators=[], qualifier=MessageConstants, selectors=[]), MemberReference(member=strQueueType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=jsonObj, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=intRegID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="id"), MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=intRegID, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=jsonObj, selectors=[], type_arguments=None), label=None))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['JSONException']))], finally_block=None, label=None, resources=None)
assign[member[.strReturn], call[AjaxProxyTask.jsonObjectToReturnString, parameter[member[.jsonObj]]]]
else begin[{]
if[binary_operation[member[.objReturn], instanceof, type[BaseMessageFilter]]] begin[{]
local_variable[type[Integer], intFilterID]
if[binary_operation[member[.intFilterID], !=, literal[null]]] begin[{]
assign[member[.strReturn], call[intFilterID.toString, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[Integer], intRegistryFilterID]
if[binary_operation[member[.intRegistryFilterID], !=, literal[null]]] begin[{]
assign[member[.strReturn], call[intRegistryFilterID.toString, parameter[]]]
else begin[{]
None
end[}]
else begin[{]
if[binary_operation[member[.objReturn], instanceof, type[RemoteException]]] begin[{]
TryStatement(block=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Cast(expression=MemberReference(member=objReturn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=RemoteException, sub_type=None))], member=setErrorReturn, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), ReturnStatement(expression=None, label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['RemoteException']))], finally_block=None, label=None, resources=None)
else begin[{]
if[binary_operation[member[.objReturn], !=, literal[null]]] begin[{]
assign[member[.strReturn], call[objReturn.toString, parameter[]]]
else begin[{]
None
end[}]
end[}]
end[}]
end[}]
end[}]
THIS[call[None.setReturnString, parameter[member[.out], member[.strReturn]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setReturnObject] operator[SEP] identifier[PrintWriter] identifier[out] , identifier[Object] identifier[objReturn] operator[SEP] {
identifier[String] identifier[strReturn] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[objReturn] Keyword[instanceof] identifier[Map] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[map] operator[=] operator[SEP] identifier[Map] operator[SEP] identifier[objReturn] operator[SEP] identifier[JSONObject] identifier[jsonObj] operator[=] identifier[AjaxProxyTask] operator[SEP] identifier[mapToJsonObject] operator[SEP] identifier[map] operator[SEP] operator[SEP] identifier[strReturn] operator[=] identifier[AjaxProxyTask] operator[SEP] identifier[jsonObjectToReturnString] operator[SEP] identifier[jsonObj] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[objReturn] Keyword[instanceof] identifier[BaseMessage] operator[SEP] {
identifier[BaseMessage] identifier[message] operator[=] operator[SEP] identifier[BaseMessage] operator[SEP] identifier[objReturn] operator[SEP] identifier[String] identifier[strMessage] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[message] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[BaseMessageHeader] identifier[messageHeader] operator[=] identifier[message] operator[SEP] identifier[getMessageHeader] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[strQueueName] operator[=] identifier[messageHeader] operator[SEP] identifier[getQueueName] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[strQueueType] operator[=] identifier[messageHeader] operator[SEP] identifier[getQueueType] operator[SEP] operator[SEP] operator[SEP] identifier[Integer] identifier[intRegID] operator[=] identifier[messageHeader] operator[SEP] identifier[getRegistryIDMatch] operator[SEP] operator[SEP] operator[SEP] identifier[JSONObject] identifier[jsonObj] operator[=] Keyword[new] identifier[JSONObject] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[jsonObj] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[strMessage] operator[SEP] operator[SEP] identifier[jsonObj] operator[SEP] identifier[put] operator[SEP] identifier[MessageConstants] operator[SEP] identifier[QUEUE_NAME] , identifier[strQueueName] operator[SEP] operator[SEP] identifier[jsonObj] operator[SEP] identifier[put] operator[SEP] identifier[MessageConstants] operator[SEP] identifier[QUEUE_TYPE] , identifier[strQueueType] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[intRegID] operator[!=] Other[null] operator[SEP] identifier[jsonObj] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[intRegID] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[JSONException] identifier[e] operator[SEP] {
identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
identifier[strReturn] operator[=] identifier[AjaxProxyTask] operator[SEP] identifier[jsonObjectToReturnString] operator[SEP] identifier[jsonObj] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[objReturn] Keyword[instanceof] identifier[BaseMessageFilter] operator[SEP] {
identifier[Integer] identifier[intFilterID] operator[=] operator[SEP] operator[SEP] identifier[BaseMessageFilter] operator[SEP] identifier[objReturn] operator[SEP] operator[SEP] identifier[getFilterID] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[intFilterID] operator[!=] Other[null] operator[SEP] identifier[strReturn] operator[=] identifier[intFilterID] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[Integer] identifier[intRegistryFilterID] operator[=] operator[SEP] operator[SEP] identifier[BaseMessageFilter] operator[SEP] identifier[objReturn] operator[SEP] operator[SEP] identifier[getRegistryID] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[intRegistryFilterID] operator[!=] Other[null] operator[SEP] identifier[strReturn] operator[=] identifier[intRegistryFilterID] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[objReturn] Keyword[instanceof] identifier[RemoteException] operator[SEP] {
Keyword[try] {
Keyword[this] operator[SEP] identifier[setErrorReturn] operator[SEP] identifier[out] , operator[SEP] identifier[RemoteException] operator[SEP] identifier[objReturn] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[RemoteException] identifier[ex] operator[SEP] {
}
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[objReturn] operator[!=] Other[null] operator[SEP] identifier[strReturn] operator[=] identifier[objReturn] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[setReturnString] operator[SEP] identifier[out] , identifier[strReturn] operator[SEP] operator[SEP]
}
|
public final void renderMessageString() {
Object[] coreFields = event.getFieldsToLog();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < coreFields.length + xFields.length; ++i) {
if (i > 0) {
sb.append(fieldSeperator);
}
Object field = i < coreFields.length ? coreFields[i] : xFields[i - coreFields.length];
renderObject(sb, field);
}
messageString = sb.toString();
} | class class_name[name] begin[{]
method[renderMessageString, return_type[void], modifier[final public], parameter[]] begin[{]
local_variable[type[Object], coreFields]
local_variable[type[StringBuilder], sb]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=i, 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=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=fieldSeperator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=coreFields, selectors=[]), operator=<), if_false=MemberReference(member=xFields, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=coreFields, selectors=[]), operator=-))]), if_true=MemberReference(member=coreFields, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), name=field)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=sb, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=renderObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=coreFields, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=xFields, selectors=[]), operator=+), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)
assign[member[.messageString], call[sb.toString, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[void] identifier[renderMessageString] operator[SEP] operator[SEP] {
identifier[Object] operator[SEP] operator[SEP] identifier[coreFields] operator[=] identifier[event] operator[SEP] identifier[getFieldsToLog] operator[SEP] operator[SEP] 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[coreFields] operator[SEP] identifier[length] operator[+] identifier[xFields] operator[SEP] identifier[length] operator[SEP] operator[++] identifier[i] operator[SEP] {
Keyword[if] operator[SEP] identifier[i] operator[>] Other[0] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[fieldSeperator] operator[SEP] operator[SEP]
}
identifier[Object] identifier[field] operator[=] identifier[i] operator[<] identifier[coreFields] operator[SEP] identifier[length] operator[?] identifier[coreFields] operator[SEP] identifier[i] operator[SEP] operator[:] identifier[xFields] operator[SEP] identifier[i] operator[-] identifier[coreFields] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[renderObject] operator[SEP] identifier[sb] , identifier[field] operator[SEP] operator[SEP]
}
identifier[messageString] operator[=] identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public double interpolate(double... x) {
if (x.length != this.x[0].length) {
throw new IllegalArgumentException(String.format("Invalid input vector size: %d, expected: %d", x.length, this.x[0].length));
}
double sum = 0.0, sumw = 0.0;
for (int i = 0; i < this.x.length; i++) {
double f = rbf.f(Math.distance(x, this.x[i]));
sumw += w[i] * f;
sum += f;
}
return normalized ? sumw / sum : sumw;
} | class class_name[name] begin[{]
method[interpolate, return_type[type[double]], modifier[public], parameter[x]] begin[{]
if[binary_operation[member[x.length], !=, THIS[member[None.x]ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))member[None.length]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid input vector size: %d, expected: %d"), MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=x, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=x, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), MemberReference(member=length, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=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)
else begin[{]
None
end[}]
local_variable[type[double], sum]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=x, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=distance, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None)], member=f, postfix_operators=[], prefix_operators=[], qualifier=rbf, selectors=[], type_arguments=None), name=f)], modifiers=set(), type=BasicType(dimensions=[], name=double)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=sumw, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=BinaryOperation(operandl=MemberReference(member=w, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=sum, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=x, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MemberReference(member=length, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=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[TernaryExpression(condition=MemberReference(member=normalized, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=MemberReference(member=sumw, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=BinaryOperation(operandl=MemberReference(member=sumw, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=sum, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=/))]
end[}]
END[}] | Keyword[public] Keyword[double] identifier[interpolate] operator[SEP] Keyword[double] operator[...] identifier[x] operator[SEP] {
Keyword[if] operator[SEP] identifier[x] operator[SEP] identifier[length] operator[!=] Keyword[this] operator[SEP] identifier[x] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[length] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[x] operator[SEP] identifier[length] , Keyword[this] operator[SEP] identifier[x] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[double] identifier[sum] operator[=] literal[Float] , identifier[sumw] operator[=] literal[Float] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] Keyword[this] operator[SEP] identifier[x] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[double] identifier[f] operator[=] identifier[rbf] operator[SEP] identifier[f] operator[SEP] identifier[Math] operator[SEP] identifier[distance] operator[SEP] identifier[x] , Keyword[this] operator[SEP] identifier[x] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[sumw] operator[+=] identifier[w] operator[SEP] identifier[i] operator[SEP] operator[*] identifier[f] operator[SEP] identifier[sum] operator[+=] identifier[f] operator[SEP]
}
Keyword[return] identifier[normalized] operator[?] identifier[sumw] operator[/] identifier[sum] operator[:] identifier[sumw] operator[SEP]
}
|
private int calcLastPage(int total, int pageSize) {
if (total == 0) {
return firstPage;
} else {
final int zeroBasedPageNo = total % pageSize > 0
? total / pageSize
: total / pageSize - 1;
return firstPage + zeroBasedPageNo;
}
} | class class_name[name] begin[{]
method[calcLastPage, return_type[type[int]], modifier[private], parameter[total, pageSize]] begin[{]
if[binary_operation[member[.total], ==, literal[0]]] begin[{]
return[member[.firstPage]]
else begin[{]
local_variable[type[int], zeroBasedPageNo]
return[binary_operation[member[.firstPage], +, member[.zeroBasedPageNo]]]
end[}]
end[}]
END[}] | Keyword[private] Keyword[int] identifier[calcLastPage] operator[SEP] Keyword[int] identifier[total] , Keyword[int] identifier[pageSize] operator[SEP] {
Keyword[if] operator[SEP] identifier[total] operator[==] Other[0] operator[SEP] {
Keyword[return] identifier[firstPage] operator[SEP]
}
Keyword[else] {
Keyword[final] Keyword[int] identifier[zeroBasedPageNo] operator[=] identifier[total] operator[%] identifier[pageSize] operator[>] Other[0] operator[?] identifier[total] operator[/] identifier[pageSize] operator[:] identifier[total] operator[/] identifier[pageSize] operator[-] Other[1] operator[SEP] Keyword[return] identifier[firstPage] operator[+] identifier[zeroBasedPageNo] operator[SEP]
}
}
|
private void cleanMixedAttributes() {
currentFieldAttributes.remove(HttpHeaderValues.CHARSET);
currentFieldAttributes.remove(HttpHeaderNames.CONTENT_LENGTH);
currentFieldAttributes.remove(HttpHeaderNames.CONTENT_TRANSFER_ENCODING);
currentFieldAttributes.remove(HttpHeaderNames.CONTENT_TYPE);
currentFieldAttributes.remove(HttpHeaderValues.FILENAME);
} | class class_name[name] begin[{]
method[cleanMixedAttributes, return_type[void], modifier[private], parameter[]] begin[{]
call[currentFieldAttributes.remove, parameter[member[HttpHeaderValues.CHARSET]]]
call[currentFieldAttributes.remove, parameter[member[HttpHeaderNames.CONTENT_LENGTH]]]
call[currentFieldAttributes.remove, parameter[member[HttpHeaderNames.CONTENT_TRANSFER_ENCODING]]]
call[currentFieldAttributes.remove, parameter[member[HttpHeaderNames.CONTENT_TYPE]]]
call[currentFieldAttributes.remove, parameter[member[HttpHeaderValues.FILENAME]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[cleanMixedAttributes] operator[SEP] operator[SEP] {
identifier[currentFieldAttributes] operator[SEP] identifier[remove] operator[SEP] identifier[HttpHeaderValues] operator[SEP] identifier[CHARSET] operator[SEP] operator[SEP] identifier[currentFieldAttributes] operator[SEP] identifier[remove] operator[SEP] identifier[HttpHeaderNames] operator[SEP] identifier[CONTENT_LENGTH] operator[SEP] operator[SEP] identifier[currentFieldAttributes] operator[SEP] identifier[remove] operator[SEP] identifier[HttpHeaderNames] operator[SEP] identifier[CONTENT_TRANSFER_ENCODING] operator[SEP] operator[SEP] identifier[currentFieldAttributes] operator[SEP] identifier[remove] operator[SEP] identifier[HttpHeaderNames] operator[SEP] identifier[CONTENT_TYPE] operator[SEP] operator[SEP] identifier[currentFieldAttributes] operator[SEP] identifier[remove] operator[SEP] identifier[HttpHeaderValues] operator[SEP] identifier[FILENAME] operator[SEP] operator[SEP]
}
|
@Override
public boolean accept(Path file) {
String name = file.getFileName().toString();
// check exact match
int index = Collections.binarySearch(matches, name);
if (index >= 0) {
return false;
}
// check prefix
index = Collections.binarySearch(prefixes, name);
if (index >= 0) {
return false;
}
if (index < -1) {
// The < 0 index gives the first index greater than name
int firstLessIndex = -2 - index;
String prefix = prefixes.get(firstLessIndex);
// If name starts with an ignored prefix ignore name
if (name.startsWith(prefix)) {
return false;
}
}
// check suffix
index = Collections.binarySearch(suffixes, name, reverseComparator);
if (index >= 0) {
return false;
}
if (index < -1) {
// The < 0 index gives the first index greater than name
int firstLessIndex = -2 - index;
String suffix = suffixes.get(firstLessIndex);
// If name ends with an ignored suffix ignore name
if (name.endsWith(suffix)) {
return false;
}
}
// everything checks out.
return true;
} | class class_name[name] begin[{]
method[accept, return_type[type[boolean]], modifier[public], parameter[file]] begin[{]
local_variable[type[String], name]
local_variable[type[int], index]
if[binary_operation[member[.index], >=, literal[0]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
assign[member[.index], call[Collections.binarySearch, parameter[member[.prefixes], member[.name]]]]
if[binary_operation[member[.index], >=, literal[0]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[member[.index], <, literal[1]]] begin[{]
local_variable[type[int], firstLessIndex]
local_variable[type[String], prefix]
if[call[name.startsWith, parameter[member[.prefix]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
assign[member[.index], call[Collections.binarySearch, parameter[member[.suffixes], member[.name], member[.reverseComparator]]]]
if[binary_operation[member[.index], >=, literal[0]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[member[.index], <, literal[1]]] begin[{]
local_variable[type[int], firstLessIndex]
local_variable[type[String], suffix]
if[call[name.endsWith, parameter[member[.suffix]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[literal[true]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[accept] operator[SEP] identifier[Path] identifier[file] operator[SEP] {
identifier[String] identifier[name] operator[=] identifier[file] operator[SEP] identifier[getFileName] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[index] operator[=] identifier[Collections] operator[SEP] identifier[binarySearch] operator[SEP] identifier[matches] , identifier[name] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[index] operator[>=] Other[0] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[index] operator[=] identifier[Collections] operator[SEP] identifier[binarySearch] operator[SEP] identifier[prefixes] , identifier[name] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[index] operator[>=] Other[0] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[index] operator[<] operator[-] Other[1] operator[SEP] {
Keyword[int] identifier[firstLessIndex] operator[=] operator[-] Other[2] operator[-] identifier[index] operator[SEP] identifier[String] identifier[prefix] operator[=] identifier[prefixes] operator[SEP] identifier[get] operator[SEP] identifier[firstLessIndex] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[name] operator[SEP] identifier[startsWith] operator[SEP] identifier[prefix] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
identifier[index] operator[=] identifier[Collections] operator[SEP] identifier[binarySearch] operator[SEP] identifier[suffixes] , identifier[name] , identifier[reverseComparator] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[index] operator[>=] Other[0] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[index] operator[<] operator[-] Other[1] operator[SEP] {
Keyword[int] identifier[firstLessIndex] operator[=] operator[-] Other[2] operator[-] identifier[index] operator[SEP] identifier[String] identifier[suffix] operator[=] identifier[suffixes] operator[SEP] identifier[get] operator[SEP] identifier[firstLessIndex] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[name] operator[SEP] identifier[endsWith] operator[SEP] identifier[suffix] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public PlotCanvas setMargin(double margin) {
if (margin < 0.0 || margin >= 0.3) {
throw new IllegalArgumentException("Invalid margin: " + margin);
}
this.margin = margin;
repaint();
return this;
} | class class_name[name] begin[{]
method[setMargin, return_type[type[PlotCanvas]], modifier[public], parameter[margin]] begin[{]
if[binary_operation[binary_operation[member[.margin], <, literal[0.0]], ||, binary_operation[member[.margin], >=, literal[0.3]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid margin: "), operandr=MemberReference(member=margin, 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=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[THIS[member[None.margin]], member[.margin]]
call[.repaint, parameter[]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[PlotCanvas] identifier[setMargin] operator[SEP] Keyword[double] identifier[margin] operator[SEP] {
Keyword[if] operator[SEP] identifier[margin] operator[<] literal[Float] operator[||] identifier[margin] operator[>=] literal[Float] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[margin] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[margin] operator[=] identifier[margin] operator[SEP] identifier[repaint] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
private void pushJDBCSupport(CodeBuilder b) {
b.loadThis();
b.loadField(StorableGenerator.SUPPORT_FIELD_NAME, TypeDesc.forClass(TriggerSupport.class));
b.checkCast(TypeDesc.forClass(JDBCSupport.class));
} | class class_name[name] begin[{]
method[pushJDBCSupport, return_type[void], modifier[private], parameter[b]] begin[{]
call[b.loadThis, parameter[]]
call[b.loadField, parameter[member[StorableGenerator.SUPPORT_FIELD_NAME], call[TypeDesc.forClass, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TriggerSupport, sub_type=None))]]]]
call[b.checkCast, parameter[call[TypeDesc.forClass, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JDBCSupport, sub_type=None))]]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[pushJDBCSupport] operator[SEP] identifier[CodeBuilder] identifier[b] operator[SEP] {
identifier[b] operator[SEP] identifier[loadThis] operator[SEP] operator[SEP] operator[SEP] identifier[b] operator[SEP] identifier[loadField] operator[SEP] identifier[StorableGenerator] operator[SEP] identifier[SUPPORT_FIELD_NAME] , identifier[TypeDesc] operator[SEP] identifier[forClass] operator[SEP] identifier[TriggerSupport] operator[SEP] Keyword[class] operator[SEP] operator[SEP] operator[SEP] identifier[b] operator[SEP] identifier[checkCast] operator[SEP] identifier[TypeDesc] operator[SEP] identifier[forClass] operator[SEP] identifier[JDBCSupport] operator[SEP] Keyword[class] operator[SEP] operator[SEP] operator[SEP]
}
|
public static void lazyAppend(Element parent, Element child) {
if (!parent.contains(child)) {
parent.appendChild(child);
}
} | class class_name[name] begin[{]
method[lazyAppend, return_type[void], modifier[public static], parameter[parent, child]] begin[{]
if[call[parent.contains, parameter[member[.child]]]] begin[{]
call[parent.appendChild, parameter[member[.child]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[lazyAppend] operator[SEP] identifier[Element] identifier[parent] , identifier[Element] identifier[child] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[parent] operator[SEP] identifier[contains] operator[SEP] identifier[child] operator[SEP] operator[SEP] {
identifier[parent] operator[SEP] identifier[appendChild] operator[SEP] identifier[child] operator[SEP] operator[SEP]
}
}
|
public JSONWriter objectEnd() throws IOException {
writer.write(JSON.RBRACE);
state = stack.pop();
return this;
} | class class_name[name] begin[{]
method[objectEnd, return_type[type[JSONWriter]], modifier[public], parameter[]] begin[{]
call[writer.write, parameter[member[JSON.RBRACE]]]
assign[member[.state], call[stack.pop, parameter[]]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[JSONWriter] identifier[objectEnd] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[writer] operator[SEP] identifier[write] operator[SEP] identifier[JSON] operator[SEP] identifier[RBRACE] operator[SEP] operator[SEP] identifier[state] operator[=] identifier[stack] operator[SEP] identifier[pop] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
@Override
public void paint(final RenderContext renderContext) {
// Check interceptor is enabled
if (!DebugValidateXML.isEnabled()) {
super.paint(renderContext);
return;
}
if (!(renderContext instanceof WebXmlRenderContext)) {
LOG.warn("Unable to validate against a " + renderContext);
super.paint(renderContext);
return;
}
LOG.debug("Validate XML Interceptor: Start");
WebXmlRenderContext webRenderContext = (WebXmlRenderContext) renderContext;
PrintWriter writer = webRenderContext.getWriter();
// Generate XML
StringWriter tempBuffer = new StringWriter();
PrintWriter tempWriter = new PrintWriter(tempBuffer);
WebXmlRenderContext tempContext = new WebXmlRenderContext(tempWriter, UIContextHolder.
getCurrent().getLocale());
super.paint(tempContext);
String xml = tempBuffer.toString();
// If no errors, check against the schema
String error = DebugValidateXML.validateXMLAgainstSchema(xml);
if (error != null) {
// XML is NOT valid, so Report Errors and Wrap the original XML
LOG.debug("Validate XML Interceptor: XML Has Errors");
writer.println("<div>");
writer.println("<div>");
writer.println("Invalid XML");
writer.println("<ul><li>" + WebUtilities.encode(error) + "</li></ul>");
writer.println("<br/>");
writer.println("</div>");
// If a schema error detected, Wrap XML so line numbers reported in validation message are correct
String testXML = DebugValidateXML.wrapXMLInRootElement(xml);
paintOriginalXML(testXML, writer);
writer.println("</div>");
} else {
// XML is valid
writer.write(xml);
}
LOG.debug("Validate XML Interceptor: Finished");
} | class class_name[name] begin[{]
method[paint, return_type[void], modifier[public], parameter[renderContext]] begin[{]
if[call[DebugValidateXML.isEnabled, parameter[]]] begin[{]
SuperMethodInvocation(arguments=[MemberReference(member=renderContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=paint, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
return[None]
else begin[{]
None
end[}]
if[binary_operation[member[.renderContext], instanceof, type[WebXmlRenderContext]]] begin[{]
call[LOG.warn, parameter[binary_operation[literal["Unable to validate against a "], +, member[.renderContext]]]]
SuperMethodInvocation(arguments=[MemberReference(member=renderContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=paint, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
return[None]
else begin[{]
None
end[}]
call[LOG.debug, parameter[literal["Validate XML Interceptor: Start"]]]
local_variable[type[WebXmlRenderContext], webRenderContext]
local_variable[type[PrintWriter], writer]
local_variable[type[StringWriter], tempBuffer]
local_variable[type[PrintWriter], tempWriter]
local_variable[type[WebXmlRenderContext], tempContext]
SuperMethodInvocation(arguments=[MemberReference(member=tempContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=paint, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
local_variable[type[String], xml]
local_variable[type[String], error]
if[binary_operation[member[.error], !=, literal[null]]] begin[{]
call[LOG.debug, parameter[literal["Validate XML Interceptor: XML Has Errors"]]]
call[writer.println, parameter[literal["<div>"]]]
call[writer.println, parameter[literal["<div>"]]]
call[writer.println, parameter[literal["Invalid XML"]]]
call[writer.println, parameter[binary_operation[binary_operation[literal["<ul><li>"], +, call[WebUtilities.encode, parameter[member[.error]]]], +, literal["</li></ul>"]]]]
call[writer.println, parameter[literal["<br/>"]]]
call[writer.println, parameter[literal["</div>"]]]
local_variable[type[String], testXML]
call[.paintOriginalXML, parameter[member[.testXML], member[.writer]]]
call[writer.println, parameter[literal["</div>"]]]
else begin[{]
call[writer.write, parameter[member[.xml]]]
end[}]
call[LOG.debug, parameter[literal["Validate XML Interceptor: Finished"]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[paint] operator[SEP] Keyword[final] identifier[RenderContext] identifier[renderContext] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[DebugValidateXML] operator[SEP] identifier[isEnabled] operator[SEP] operator[SEP] operator[SEP] {
Keyword[super] operator[SEP] identifier[paint] operator[SEP] identifier[renderContext] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[renderContext] Keyword[instanceof] identifier[WebXmlRenderContext] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] identifier[renderContext] operator[SEP] operator[SEP] Keyword[super] operator[SEP] identifier[paint] operator[SEP] identifier[renderContext] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
identifier[LOG] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[WebXmlRenderContext] identifier[webRenderContext] operator[=] operator[SEP] identifier[WebXmlRenderContext] operator[SEP] identifier[renderContext] operator[SEP] identifier[PrintWriter] identifier[writer] operator[=] identifier[webRenderContext] operator[SEP] identifier[getWriter] operator[SEP] operator[SEP] operator[SEP] identifier[StringWriter] identifier[tempBuffer] operator[=] Keyword[new] identifier[StringWriter] operator[SEP] operator[SEP] operator[SEP] identifier[PrintWriter] identifier[tempWriter] operator[=] Keyword[new] identifier[PrintWriter] operator[SEP] identifier[tempBuffer] operator[SEP] operator[SEP] identifier[WebXmlRenderContext] identifier[tempContext] operator[=] Keyword[new] identifier[WebXmlRenderContext] operator[SEP] identifier[tempWriter] , identifier[UIContextHolder] operator[SEP] identifier[getCurrent] operator[SEP] operator[SEP] operator[SEP] identifier[getLocale] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[super] operator[SEP] identifier[paint] operator[SEP] identifier[tempContext] operator[SEP] operator[SEP] identifier[String] identifier[xml] operator[=] identifier[tempBuffer] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[error] operator[=] identifier[DebugValidateXML] operator[SEP] identifier[validateXMLAgainstSchema] operator[SEP] identifier[xml] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[error] operator[!=] Other[null] operator[SEP] {
identifier[LOG] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[WebUtilities] operator[SEP] identifier[encode] operator[SEP] identifier[error] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] identifier[testXML] operator[=] identifier[DebugValidateXML] operator[SEP] identifier[wrapXMLInRootElement] operator[SEP] identifier[xml] operator[SEP] operator[SEP] identifier[paintOriginalXML] operator[SEP] identifier[testXML] , identifier[writer] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[writer] operator[SEP] identifier[write] operator[SEP] identifier[xml] operator[SEP] operator[SEP]
}
identifier[LOG] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
public Packer setInsetTop(final int val) {
Insets i = gc.insets;
if (i == null) {
i = new Insets(0, 0, 0, 0);
}
gc.insets = new Insets(val, i.left, i.bottom, i.right);
setConstraints(comp, gc);
return this;
} | class class_name[name] begin[{]
method[setInsetTop, return_type[type[Packer]], modifier[public], parameter[val]] begin[{]
local_variable[type[Insets], i]
if[binary_operation[member[.i], ==, literal[null]]] begin[{]
assign[member[.i], ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), 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=Insets, sub_type=None))]
else begin[{]
None
end[}]
assign[member[gc.insets], ClassCreator(arguments=[MemberReference(member=val, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=left, postfix_operators=[], prefix_operators=[], qualifier=i, selectors=[]), MemberReference(member=bottom, postfix_operators=[], prefix_operators=[], qualifier=i, selectors=[]), MemberReference(member=right, postfix_operators=[], prefix_operators=[], qualifier=i, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Insets, sub_type=None))]
call[.setConstraints, parameter[member[.comp], member[.gc]]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[Packer] identifier[setInsetTop] operator[SEP] Keyword[final] Keyword[int] identifier[val] operator[SEP] {
identifier[Insets] identifier[i] operator[=] identifier[gc] operator[SEP] identifier[insets] operator[SEP] Keyword[if] operator[SEP] identifier[i] operator[==] Other[null] operator[SEP] {
identifier[i] operator[=] Keyword[new] identifier[Insets] operator[SEP] Other[0] , Other[0] , Other[0] , Other[0] operator[SEP] operator[SEP]
}
identifier[gc] operator[SEP] identifier[insets] operator[=] Keyword[new] identifier[Insets] operator[SEP] identifier[val] , identifier[i] operator[SEP] identifier[left] , identifier[i] operator[SEP] identifier[bottom] , identifier[i] operator[SEP] identifier[right] operator[SEP] operator[SEP] identifier[setConstraints] operator[SEP] identifier[comp] , identifier[gc] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public int iterateObjects(HashtableAction action, int index, int length)
throws IOException,
EOFException,
FileManagerException,
ClassNotFoundException,
HashtableOnDiskException {
return walkHash(action, RETRIEVE_ALL, index, length);
} | class class_name[name] begin[{]
method[iterateObjects, return_type[type[int]], modifier[public], parameter[action, index, length]] begin[{]
return[call[.walkHash, parameter[member[.action], member[.RETRIEVE_ALL], member[.index], member[.length]]]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[iterateObjects] operator[SEP] identifier[HashtableAction] identifier[action] , Keyword[int] identifier[index] , Keyword[int] identifier[length] operator[SEP] Keyword[throws] identifier[IOException] , identifier[EOFException] , identifier[FileManagerException] , identifier[ClassNotFoundException] , identifier[HashtableOnDiskException] {
Keyword[return] identifier[walkHash] operator[SEP] identifier[action] , identifier[RETRIEVE_ALL] , identifier[index] , identifier[length] operator[SEP] operator[SEP]
}
|
protected Map<String,Object> buildParameters(XmlObject msgdoc, Map<String,String> metaInfo, Process processVO) {
Map<String,Object> params = null;
Variable requestVO = processVO.getVariable("request");
if (requestVO != null && requestVO.getVariableCategory() == 1) {
params = new HashMap<String,Object>();
String vartype = requestVO.getType();
try {
com.centurylink.mdw.variable.VariableTranslator translator = VariableTranslator.getTranslator(getPackage(), vartype);
if (translator instanceof DocumentReferenceTranslator) {
DocumentReferenceTranslator docTranslator = (DocumentReferenceTranslator)translator;;
Object document = docTranslator.realToObject(msgdoc.xmlText());
DocumentReference docRef = createDocument(vartype, document, OwnerType.DOCUMENT, new Long(metaInfo.get(Listener.METAINFO_DOCUMENT_ID)), new Long(0), null, null);
params.put("request", docRef.toString());
}
else {
params.put("request", msgdoc.xmlText());
}
} catch (Exception ex) {
logger.severeException(ex.getMessage(), ex);
return null;
}
}
return params;
} | class class_name[name] begin[{]
method[buildParameters, return_type[type[Map]], modifier[protected], parameter[msgdoc, metaInfo, processVO]] begin[{]
local_variable[type[Map], params]
local_variable[type[Variable], requestVO]
if[binary_operation[binary_operation[member[.requestVO], !=, literal[null]], &&, binary_operation[call[requestVO.getVariableCategory, parameter[]], ==, literal[1]]]] begin[{]
assign[member[.params], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=None, name=HashMap, sub_type=None))]
local_variable[type[String], vartype]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getPackage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=vartype, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getTranslator, postfix_operators=[], prefix_operators=[], qualifier=VariableTranslator, selectors=[], type_arguments=None), name=translator)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=com, sub_type=ReferenceType(arguments=None, dimensions=None, name=centurylink, sub_type=ReferenceType(arguments=None, dimensions=None, name=mdw, sub_type=ReferenceType(arguments=None, dimensions=None, name=variable, sub_type=ReferenceType(arguments=None, dimensions=None, name=VariableTranslator, sub_type=None)))))), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=translator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=DocumentReferenceTranslator, sub_type=None), operator=instanceof), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="request"), MethodInvocation(arguments=[], member=xmlText, postfix_operators=[], prefix_operators=[], qualifier=msgdoc, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=params, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=translator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=DocumentReferenceTranslator, sub_type=None)), name=docTranslator)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DocumentReferenceTranslator, sub_type=None)), Statement(label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=xmlText, postfix_operators=[], prefix_operators=[], qualifier=msgdoc, selectors=[], type_arguments=None)], member=realToObject, postfix_operators=[], prefix_operators=[], qualifier=docTranslator, selectors=[], type_arguments=None), name=document)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=vartype, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=document, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=DOCUMENT, postfix_operators=[], prefix_operators=[], qualifier=OwnerType, selectors=[]), ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=METAINFO_DOCUMENT_ID, postfix_operators=[], prefix_operators=[], qualifier=Listener, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=metaInfo, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Long, sub_type=None)), ClassCreator(arguments=[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=Long, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=createDocument, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=docRef)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DocumentReference, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="request"), MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=docRef, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=params, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=ex, selectors=[], type_arguments=None), MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=severeException, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Exception']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
return[member[.params]]
end[}]
END[}] | Keyword[protected] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[buildParameters] operator[SEP] identifier[XmlObject] identifier[msgdoc] , identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[metaInfo] , identifier[Process] identifier[processVO] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[params] operator[=] Other[null] operator[SEP] identifier[Variable] identifier[requestVO] operator[=] identifier[processVO] operator[SEP] identifier[getVariable] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[requestVO] operator[!=] Other[null] operator[&&] identifier[requestVO] operator[SEP] identifier[getVariableCategory] operator[SEP] operator[SEP] operator[==] Other[1] operator[SEP] {
identifier[params] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[Object] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[vartype] operator[=] identifier[requestVO] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[com] operator[SEP] identifier[centurylink] operator[SEP] identifier[mdw] operator[SEP] identifier[variable] operator[SEP] identifier[VariableTranslator] identifier[translator] operator[=] identifier[VariableTranslator] operator[SEP] identifier[getTranslator] operator[SEP] identifier[getPackage] operator[SEP] operator[SEP] , identifier[vartype] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[translator] Keyword[instanceof] identifier[DocumentReferenceTranslator] operator[SEP] {
identifier[DocumentReferenceTranslator] identifier[docTranslator] operator[=] operator[SEP] identifier[DocumentReferenceTranslator] operator[SEP] identifier[translator] operator[SEP] operator[SEP] identifier[Object] identifier[document] operator[=] identifier[docTranslator] operator[SEP] identifier[realToObject] operator[SEP] identifier[msgdoc] operator[SEP] identifier[xmlText] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[DocumentReference] identifier[docRef] operator[=] identifier[createDocument] operator[SEP] identifier[vartype] , identifier[document] , identifier[OwnerType] operator[SEP] identifier[DOCUMENT] , Keyword[new] identifier[Long] operator[SEP] identifier[metaInfo] operator[SEP] identifier[get] operator[SEP] identifier[Listener] operator[SEP] identifier[METAINFO_DOCUMENT_ID] operator[SEP] operator[SEP] , Keyword[new] identifier[Long] operator[SEP] Other[0] operator[SEP] , Other[null] , Other[null] operator[SEP] operator[SEP] identifier[params] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[docRef] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[params] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[msgdoc] operator[SEP] identifier[xmlText] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ex] operator[SEP] {
identifier[logger] operator[SEP] identifier[severeException] operator[SEP] identifier[ex] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[ex] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
}
Keyword[return] identifier[params] operator[SEP]
}
|
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case SimpleAntlrPackage.UNTIL_ELEMENT__LEFT:
return basicSetLeft(null, msgs);
case SimpleAntlrPackage.UNTIL_ELEMENT__RIGHT:
return basicSetRight(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
} | class class_name[name] begin[{]
method[eInverseRemove, return_type[type[NotificationChain]], modifier[public], parameter[otherEnd, featureID, msgs]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=UNTIL_ELEMENT__LEFT, postfix_operators=[], prefix_operators=[], qualifier=SimpleAntlrPackage, selectors=[])], statements=[ReturnStatement(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=msgs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=basicSetLeft, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[MemberReference(member=UNTIL_ELEMENT__RIGHT, postfix_operators=[], prefix_operators=[], qualifier=SimpleAntlrPackage, selectors=[])], statements=[ReturnStatement(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=msgs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=basicSetRight, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])], expression=MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
return[SuperMethodInvocation(arguments=[MemberReference(member=otherEnd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=msgs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=eInverseRemove, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[NotificationChain] identifier[eInverseRemove] operator[SEP] identifier[InternalEObject] identifier[otherEnd] , Keyword[int] identifier[featureID] , identifier[NotificationChain] identifier[msgs] operator[SEP] {
Keyword[switch] operator[SEP] identifier[featureID] operator[SEP] {
Keyword[case] identifier[SimpleAntlrPackage] operator[SEP] identifier[UNTIL_ELEMENT__LEFT] operator[:] Keyword[return] identifier[basicSetLeft] operator[SEP] Other[null] , identifier[msgs] operator[SEP] operator[SEP] Keyword[case] identifier[SimpleAntlrPackage] operator[SEP] identifier[UNTIL_ELEMENT__RIGHT] operator[:] Keyword[return] identifier[basicSetRight] operator[SEP] Other[null] , identifier[msgs] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[super] operator[SEP] identifier[eInverseRemove] operator[SEP] identifier[otherEnd] , identifier[featureID] , identifier[msgs] operator[SEP] operator[SEP]
}
|
public static String upstreamToString(Channel upstream) {
if (upstream == null) {
linkedRemaining.set(null);
return "";
}
if (linkedRemaining.get() == null) {
linkedRemaining.set(1);
}
if (linkedRemaining.get() <= 0) {
linkedRemaining.set(null);
return "↔…";
}
linkedRemaining.set(linkedRemaining.get() - 1);
// Build continuation.
StringBuilder builder = new StringBuilder();
builder.append('↔')
.append(Channel.toString(upstream));
linkedRemaining.set(null);
return builder.toString();
} | class class_name[name] begin[{]
method[upstreamToString, return_type[type[String]], modifier[public static], parameter[upstream]] begin[{]
if[binary_operation[member[.upstream], ==, literal[null]]] begin[{]
call[linkedRemaining.set, parameter[literal[null]]]
return[literal[""]]
else begin[{]
None
end[}]
if[binary_operation[call[linkedRemaining.get, parameter[]], ==, literal[null]]] begin[{]
call[linkedRemaining.set, parameter[literal[1]]]
else begin[{]
None
end[}]
if[binary_operation[call[linkedRemaining.get, parameter[]], <=, literal[0]]] begin[{]
call[linkedRemaining.set, parameter[literal[null]]]
return[literal["↔…"]]
else begin[{]
None
end[}]
call[linkedRemaining.set, parameter[binary_operation[call[linkedRemaining.get, parameter[]], -, literal[1]]]]
local_variable[type[StringBuilder], builder]
call[builder.append, parameter[literal['↔']]]
call[linkedRemaining.set, parameter[literal[null]]]
return[call[builder.toString, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[upstreamToString] operator[SEP] identifier[Channel] identifier[upstream] operator[SEP] {
Keyword[if] operator[SEP] identifier[upstream] operator[==] Other[null] operator[SEP] {
identifier[linkedRemaining] operator[SEP] identifier[set] operator[SEP] Other[null] operator[SEP] operator[SEP] Keyword[return] literal[String] operator[SEP]
}
Keyword[if] operator[SEP] identifier[linkedRemaining] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
identifier[linkedRemaining] operator[SEP] identifier[set] operator[SEP] Other[1] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[linkedRemaining] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[<=] Other[0] operator[SEP] {
identifier[linkedRemaining] operator[SEP] identifier[set] operator[SEP] Other[null] operator[SEP] operator[SEP] Keyword[return] literal[String] operator[SEP]
}
identifier[linkedRemaining] operator[SEP] identifier[set] operator[SEP] identifier[linkedRemaining] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] identifier[StringBuilder] identifier[builder] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[Channel] operator[SEP] identifier[toString] operator[SEP] identifier[upstream] operator[SEP] operator[SEP] operator[SEP] identifier[linkedRemaining] operator[SEP] identifier[set] operator[SEP] Other[null] operator[SEP] operator[SEP] Keyword[return] identifier[builder] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public <T> T head(final Class<T> type, final Consumer<HttpConfig> configuration) {
return type.cast(interceptors.get(HttpVerb.HEAD).apply(configureRequest(type, HttpVerb.HEAD, configuration), this::doHead));
} | class class_name[name] begin[{]
method[head, return_type[type[T]], modifier[public], parameter[type, configuration]] begin[{]
return[call[type.cast, parameter[call[interceptors.get, parameter[member[HttpVerb.HEAD]]]]]]
end[}]
END[}] | Keyword[public] operator[<] identifier[T] operator[>] identifier[T] identifier[head] operator[SEP] Keyword[final] identifier[Class] operator[<] identifier[T] operator[>] identifier[type] , Keyword[final] identifier[Consumer] operator[<] identifier[HttpConfig] operator[>] identifier[configuration] operator[SEP] {
Keyword[return] identifier[type] operator[SEP] identifier[cast] operator[SEP] identifier[interceptors] operator[SEP] identifier[get] operator[SEP] identifier[HttpVerb] operator[SEP] identifier[HEAD] operator[SEP] operator[SEP] identifier[apply] operator[SEP] identifier[configureRequest] operator[SEP] identifier[type] , identifier[HttpVerb] operator[SEP] identifier[HEAD] , identifier[configuration] operator[SEP] , Keyword[this] operator[::] identifier[doHead] operator[SEP] operator[SEP] operator[SEP]
}
|
public void marshall(UpdateDomainContactPrivacyRequest updateDomainContactPrivacyRequest, ProtocolMarshaller protocolMarshaller) {
if (updateDomainContactPrivacyRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateDomainContactPrivacyRequest.getDomainName(), DOMAINNAME_BINDING);
protocolMarshaller.marshall(updateDomainContactPrivacyRequest.getAdminPrivacy(), ADMINPRIVACY_BINDING);
protocolMarshaller.marshall(updateDomainContactPrivacyRequest.getRegistrantPrivacy(), REGISTRANTPRIVACY_BINDING);
protocolMarshaller.marshall(updateDomainContactPrivacyRequest.getTechPrivacy(), TECHPRIVACY_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[updateDomainContactPrivacyRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.updateDomainContactPrivacyRequest], ==, 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=getDomainName, postfix_operators=[], prefix_operators=[], qualifier=updateDomainContactPrivacyRequest, selectors=[], type_arguments=None), MemberReference(member=DOMAINNAME_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=getAdminPrivacy, postfix_operators=[], prefix_operators=[], qualifier=updateDomainContactPrivacyRequest, selectors=[], type_arguments=None), MemberReference(member=ADMINPRIVACY_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=getRegistrantPrivacy, postfix_operators=[], prefix_operators=[], qualifier=updateDomainContactPrivacyRequest, selectors=[], type_arguments=None), MemberReference(member=REGISTRANTPRIVACY_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=getTechPrivacy, postfix_operators=[], prefix_operators=[], qualifier=updateDomainContactPrivacyRequest, selectors=[], type_arguments=None), MemberReference(member=TECHPRIVACY_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[UpdateDomainContactPrivacyRequest] identifier[updateDomainContactPrivacyRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[updateDomainContactPrivacyRequest] 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[updateDomainContactPrivacyRequest] operator[SEP] identifier[getDomainName] operator[SEP] operator[SEP] , identifier[DOMAINNAME_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[updateDomainContactPrivacyRequest] operator[SEP] identifier[getAdminPrivacy] operator[SEP] operator[SEP] , identifier[ADMINPRIVACY_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[updateDomainContactPrivacyRequest] operator[SEP] identifier[getRegistrantPrivacy] operator[SEP] operator[SEP] , identifier[REGISTRANTPRIVACY_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[updateDomainContactPrivacyRequest] operator[SEP] identifier[getTechPrivacy] operator[SEP] operator[SEP] , identifier[TECHPRIVACY_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 void stop() {
this.eventManager.fireEvent(EventType.SERVER_STOPPING, new Event().attribute("blade", this));
this.server.stopAndWait();
this.eventManager.fireEvent(EventType.SERVER_STOPPED, new Event().attribute("blade", this));
} | class class_name[name] begin[{]
method[stop, return_type[void], modifier[public], parameter[]] begin[{]
THIS[member[None.eventManager]call[None.fireEvent, parameter[member[EventType.SERVER_STOPPING], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="blade"), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=attribute, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Event, sub_type=None))]]]
THIS[member[None.server]call[None.stopAndWait, parameter[]]]
THIS[member[None.eventManager]call[None.fireEvent, parameter[member[EventType.SERVER_STOPPED], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="blade"), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=attribute, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Event, sub_type=None))]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[stop] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[eventManager] operator[SEP] identifier[fireEvent] operator[SEP] identifier[EventType] operator[SEP] identifier[SERVER_STOPPING] , Keyword[new] identifier[Event] operator[SEP] operator[SEP] operator[SEP] identifier[attribute] operator[SEP] literal[String] , Keyword[this] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[server] operator[SEP] identifier[stopAndWait] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[eventManager] operator[SEP] identifier[fireEvent] operator[SEP] identifier[EventType] operator[SEP] identifier[SERVER_STOPPED] , Keyword[new] identifier[Event] operator[SEP] operator[SEP] operator[SEP] identifier[attribute] operator[SEP] literal[String] , Keyword[this] operator[SEP] operator[SEP] operator[SEP]
}
|
static public void writeStringAsCharArray(Writer writer, String str) throws IOException {
writeStringAsCharArray(writer, str, 0, str.length());
} | class class_name[name] begin[{]
method[writeStringAsCharArray, return_type[void], modifier[public static], parameter[writer, str]] begin[{]
call[.writeStringAsCharArray, parameter[member[.writer], member[.str], literal[0], call[str.length, parameter[]]]]
end[}]
END[}] | Keyword[static] Keyword[public] Keyword[void] identifier[writeStringAsCharArray] operator[SEP] identifier[Writer] identifier[writer] , identifier[String] identifier[str] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[writeStringAsCharArray] operator[SEP] identifier[writer] , identifier[str] , Other[0] , identifier[str] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private static Region skew(Region t) {
if (t.left.level == t.level) {
t = rotateWithLeftChild(t);
}
return t;
} | class class_name[name] begin[{]
method[skew, return_type[type[Region]], modifier[private static], parameter[t]] begin[{]
if[binary_operation[member[t.left.level], ==, member[t.level]]] begin[{]
assign[member[.t], call[.rotateWithLeftChild, parameter[member[.t]]]]
else begin[{]
None
end[}]
return[member[.t]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[Region] identifier[skew] operator[SEP] identifier[Region] identifier[t] operator[SEP] {
Keyword[if] operator[SEP] identifier[t] operator[SEP] identifier[left] operator[SEP] identifier[level] operator[==] identifier[t] operator[SEP] identifier[level] operator[SEP] {
identifier[t] operator[=] identifier[rotateWithLeftChild] operator[SEP] identifier[t] operator[SEP] operator[SEP]
}
Keyword[return] identifier[t] operator[SEP]
}
|
public void setTVSIZE(Integer newTVSIZE) {
Integer oldTVSIZE = tvsize;
tvsize = newTVSIZE;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AfplibPackage.TILE_TOCRG__TVSIZE, oldTVSIZE, tvsize));
} | class class_name[name] begin[{]
method[setTVSIZE, return_type[void], modifier[public], parameter[newTVSIZE]] begin[{]
local_variable[type[Integer], oldTVSIZE]
assign[member[.tvsize], member[.newTVSIZE]]
if[call[.eNotificationRequired, parameter[]]] begin[{]
call[.eNotify, parameter[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=SET, postfix_operators=[], prefix_operators=[], qualifier=Notification, selectors=[]), MemberReference(member=TILE_TOCRG__TVSIZE, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[]), MemberReference(member=oldTVSIZE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tvsize, 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=ENotificationImpl, sub_type=None))]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setTVSIZE] operator[SEP] identifier[Integer] identifier[newTVSIZE] operator[SEP] {
identifier[Integer] identifier[oldTVSIZE] operator[=] identifier[tvsize] operator[SEP] identifier[tvsize] operator[=] identifier[newTVSIZE] operator[SEP] Keyword[if] operator[SEP] identifier[eNotificationRequired] operator[SEP] operator[SEP] operator[SEP] identifier[eNotify] operator[SEP] Keyword[new] identifier[ENotificationImpl] operator[SEP] Keyword[this] , identifier[Notification] operator[SEP] identifier[SET] , identifier[AfplibPackage] operator[SEP] identifier[TILE_TOCRG__TVSIZE] , identifier[oldTVSIZE] , identifier[tvsize] operator[SEP] operator[SEP] operator[SEP]
}
|
public Observable<StorageAccountInner> createAsync(String resourceGroupName, String accountName, StorageAccountCreateParameters parameters) {
return createWithServiceResponseAsync(resourceGroupName, accountName, parameters).map(new Func1<ServiceResponse<StorageAccountInner>, StorageAccountInner>() {
@Override
public StorageAccountInner call(ServiceResponse<StorageAccountInner> response) {
return response.body();
}
});
} | class class_name[name] begin[{]
method[createAsync, return_type[type[Observable]], modifier[public], parameter[resourceGroupName, accountName, parameters]] begin[{]
return[call[.createWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.accountName], member[.parameters]]]]
end[}]
END[}] | Keyword[public] identifier[Observable] operator[<] identifier[StorageAccountInner] operator[>] identifier[createAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[accountName] , identifier[StorageAccountCreateParameters] identifier[parameters] operator[SEP] {
Keyword[return] identifier[createWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[accountName] , identifier[parameters] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[ServiceResponse] operator[<] identifier[StorageAccountInner] operator[>] , identifier[StorageAccountInner] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[StorageAccountInner] identifier[call] operator[SEP] identifier[ServiceResponse] operator[<] identifier[StorageAccountInner] operator[>] identifier[response] operator[SEP] {
Keyword[return] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
public Duration getDuration(FastTrackField type)
{
Double value = (Double) getObject(type);
return value == null ? null : Duration.getInstance(value.doubleValue(), m_table.getDurationTimeUnit());
} | class class_name[name] begin[{]
method[getDuration, return_type[type[Duration]], modifier[public], parameter[type]] begin[{]
local_variable[type[Double], value]
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=[MethodInvocation(arguments=[], member=doubleValue, postfix_operators=[], prefix_operators=[], qualifier=value, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getDurationTimeUnit, postfix_operators=[], prefix_operators=[], qualifier=m_table, selectors=[], type_arguments=None)], member=getInstance, postfix_operators=[], prefix_operators=[], qualifier=Duration, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
end[}]
END[}] | Keyword[public] identifier[Duration] identifier[getDuration] operator[SEP] identifier[FastTrackField] identifier[type] operator[SEP] {
identifier[Double] identifier[value] operator[=] operator[SEP] identifier[Double] operator[SEP] identifier[getObject] operator[SEP] identifier[type] operator[SEP] operator[SEP] Keyword[return] identifier[value] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[Duration] operator[SEP] identifier[getInstance] operator[SEP] identifier[value] operator[SEP] identifier[doubleValue] operator[SEP] operator[SEP] , identifier[m_table] operator[SEP] identifier[getDurationTimeUnit] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public DescribeTimeToLiveResult describeTimeToLive(DescribeTimeToLiveRequest request) {
request = beforeClientExecution(request);
return executeDescribeTimeToLive(request);
} | class class_name[name] begin[{]
method[describeTimeToLive, return_type[type[DescribeTimeToLiveResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeDescribeTimeToLive, parameter[member[.request]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[DescribeTimeToLiveResult] identifier[describeTimeToLive] operator[SEP] identifier[DescribeTimeToLiveRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeDescribeTimeToLive] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
public static MessageCreator creator(final com.twilio.type.PhoneNumber to,
final String messagingServiceSid,
final List<URI> mediaUrl) {
return new MessageCreator(to, messagingServiceSid, mediaUrl);
} | class class_name[name] begin[{]
method[creator, return_type[type[MessageCreator]], modifier[public static], parameter[to, messagingServiceSid, mediaUrl]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=to, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=messagingServiceSid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=mediaUrl, 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=MessageCreator, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[MessageCreator] identifier[creator] operator[SEP] Keyword[final] identifier[com] operator[SEP] identifier[twilio] operator[SEP] identifier[type] operator[SEP] identifier[PhoneNumber] identifier[to] , Keyword[final] identifier[String] identifier[messagingServiceSid] , Keyword[final] identifier[List] operator[<] identifier[URI] operator[>] identifier[mediaUrl] operator[SEP] {
Keyword[return] Keyword[new] identifier[MessageCreator] operator[SEP] identifier[to] , identifier[messagingServiceSid] , identifier[mediaUrl] operator[SEP] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.