code stringlengths 63 466k | code_sememe stringlengths 141 3.79M | token_type stringlengths 274 1.23M |
|---|---|---|
public List<Acl> listBlobAcls(String bucketName, String blobName, long blobGeneration) {
// [START listBlobAcls]
BlobId blobId = BlobId.of(bucketName, blobName, blobGeneration);
List<Acl> acls = storage.listAcls(blobId);
for (Acl acl : acls) {
// do something with ACL entry
}
// [END listBlobAcls]
return acls;
} | class class_name[name] begin[{]
method[listBlobAcls, return_type[type[List]], modifier[public], parameter[bucketName, blobName, blobGeneration]] begin[{]
local_variable[type[BlobId], blobId]
local_variable[type[List], acls]
ForStatement(body=BlockStatement(label=None, statements=[]), control=EnhancedForControl(iterable=MemberReference(member=acls, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=acl)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Acl, sub_type=None))), label=None)
return[member[.acls]]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[Acl] operator[>] identifier[listBlobAcls] operator[SEP] identifier[String] identifier[bucketName] , identifier[String] identifier[blobName] , Keyword[long] identifier[blobGeneration] operator[SEP] {
identifier[BlobId] identifier[blobId] operator[=] identifier[BlobId] operator[SEP] identifier[of] operator[SEP] identifier[bucketName] , identifier[blobName] , identifier[blobGeneration] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Acl] operator[>] identifier[acls] operator[=] identifier[storage] operator[SEP] identifier[listAcls] operator[SEP] identifier[blobId] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Acl] identifier[acl] operator[:] identifier[acls] operator[SEP] {
}
Keyword[return] identifier[acls] operator[SEP]
}
|
@Override
public void visitClassContext(ClassContext classContext) {
try {
clsContext = classContext;
JavaClass cls = classContext.getJavaClass();
if (cls.isInterface())
return;
superClasses = cls.getSuperClasses();
cls.accept(this);
} catch (ClassNotFoundException cnfe) {
bugReporter.reportMissingClass(cnfe);
} finally {
clsContext = null;
superClasses = null;
}
} | class class_name[name] begin[{]
method[visitClassContext, return_type[void], modifier[public], parameter[classContext]] begin[{]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=clsContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=classContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getJavaClass, postfix_operators=[], prefix_operators=[], qualifier=classContext, selectors=[], type_arguments=None), name=cls)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JavaClass, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=isInterface, postfix_operators=[], prefix_operators=[], qualifier=cls, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=ReturnStatement(expression=None, label=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=superClasses, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getSuperClasses, postfix_operators=[], prefix_operators=[], qualifier=cls, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=accept, postfix_operators=[], prefix_operators=[], qualifier=cls, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=cnfe, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=reportMissingClass, postfix_operators=[], prefix_operators=[], qualifier=bugReporter, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=cnfe, types=['ClassNotFoundException']))], finally_block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=clsContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=superClasses, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None)], label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[visitClassContext] operator[SEP] identifier[ClassContext] identifier[classContext] operator[SEP] {
Keyword[try] {
identifier[clsContext] operator[=] identifier[classContext] operator[SEP] identifier[JavaClass] identifier[cls] operator[=] identifier[classContext] operator[SEP] identifier[getJavaClass] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cls] operator[SEP] identifier[isInterface] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[superClasses] operator[=] identifier[cls] operator[SEP] identifier[getSuperClasses] operator[SEP] operator[SEP] operator[SEP] identifier[cls] operator[SEP] identifier[accept] operator[SEP] Keyword[this] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ClassNotFoundException] identifier[cnfe] operator[SEP] {
identifier[bugReporter] operator[SEP] identifier[reportMissingClass] operator[SEP] identifier[cnfe] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[clsContext] operator[=] Other[null] operator[SEP] identifier[superClasses] operator[=] Other[null] operator[SEP]
}
}
|
private static String getAlgorithmUsage(String algorithmName) {
StrBuilder strBuilder = new StrBuilder();
Driver algorithm = driverFactory.get(algorithmName);
strBuilder
.appendNewLine()
.appendNewLine()
.appendln(algorithm.getLongDescription())
.appendNewLine()
.append("usage: flink run examples/flink-gelly-examples_<version>.jar --algorithm ")
.append(algorithmName)
.append(" [algorithm options] --input <input> [input options] --output <output> [output options]")
.appendNewLine()
.appendNewLine()
.appendln("Available inputs:");
for (Input input : inputFactory) {
strBuilder
.append(" --input ")
.append(input.getName())
.append(" ")
.appendln(input.getUsage());
}
String algorithmParameterization = algorithm.getUsage();
if (algorithmParameterization.length() > 0) {
strBuilder
.appendNewLine()
.appendln("Algorithm configuration:")
.append(" ")
.appendln(algorithm.getUsage());
}
strBuilder
.appendNewLine()
.appendln("Available outputs:");
for (Output output : outputFactory) {
strBuilder
.append(" --output ")
.append(output.getName())
.append(" ")
.appendln(output.getUsage());
}
return strBuilder
.appendNewLine()
.toString();
} | class class_name[name] begin[{]
method[getAlgorithmUsage, return_type[type[String]], modifier[private static], parameter[algorithmName]] begin[{]
local_variable[type[StrBuilder], strBuilder]
local_variable[type[Driver], algorithm]
call[strBuilder.appendNewLine, parameter[]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" --input ")], member=append, postfix_operators=[], prefix_operators=[], qualifier=strBuilder, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None)], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" ")], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getUsage, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None)], member=appendln, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=inputFactory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=input)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Input, sub_type=None))), label=None)
local_variable[type[String], algorithmParameterization]
if[binary_operation[call[algorithmParameterization.length, parameter[]], >, literal[0]]] begin[{]
call[strBuilder.appendNewLine, parameter[]]
else begin[{]
None
end[}]
call[strBuilder.appendNewLine, parameter[]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" --output ")], member=append, postfix_operators=[], prefix_operators=[], qualifier=strBuilder, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=output, selectors=[], type_arguments=None)], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" ")], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getUsage, postfix_operators=[], prefix_operators=[], qualifier=output, selectors=[], type_arguments=None)], member=appendln, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=outputFactory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=output)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Output, sub_type=None))), label=None)
return[call[strBuilder.appendNewLine, parameter[]]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[String] identifier[getAlgorithmUsage] operator[SEP] identifier[String] identifier[algorithmName] operator[SEP] {
identifier[StrBuilder] identifier[strBuilder] operator[=] Keyword[new] identifier[StrBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[Driver] identifier[algorithm] operator[=] identifier[driverFactory] operator[SEP] identifier[get] operator[SEP] identifier[algorithmName] operator[SEP] operator[SEP] identifier[strBuilder] operator[SEP] identifier[appendNewLine] operator[SEP] operator[SEP] operator[SEP] identifier[appendNewLine] operator[SEP] operator[SEP] operator[SEP] identifier[appendln] operator[SEP] identifier[algorithm] operator[SEP] identifier[getLongDescription] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[appendNewLine] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[algorithmName] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[appendNewLine] operator[SEP] operator[SEP] operator[SEP] identifier[appendNewLine] operator[SEP] operator[SEP] operator[SEP] identifier[appendln] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Input] identifier[input] operator[:] identifier[inputFactory] operator[SEP] {
identifier[strBuilder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[input] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[appendln] operator[SEP] identifier[input] operator[SEP] identifier[getUsage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[String] identifier[algorithmParameterization] operator[=] identifier[algorithm] operator[SEP] identifier[getUsage] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[algorithmParameterization] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[strBuilder] operator[SEP] identifier[appendNewLine] operator[SEP] operator[SEP] operator[SEP] identifier[appendln] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[appendln] operator[SEP] identifier[algorithm] operator[SEP] identifier[getUsage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[strBuilder] operator[SEP] identifier[appendNewLine] operator[SEP] operator[SEP] operator[SEP] identifier[appendln] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Output] identifier[output] operator[:] identifier[outputFactory] operator[SEP] {
identifier[strBuilder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[output] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[appendln] operator[SEP] identifier[output] operator[SEP] identifier[getUsage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[strBuilder] operator[SEP] identifier[appendNewLine] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public boolean relative(int rows) throws SQLException {
checkClosed();
checkNotForwardOnly();
if (isOnInsertRow || isRowUpdated) {
throw Util.sqlExceptionSQL(ErrorCode.X_24513);
}
return navigator.relative(rows);
} | class class_name[name] begin[{]
method[relative, return_type[type[boolean]], modifier[public], parameter[rows]] begin[{]
call[.checkClosed, parameter[]]
call[.checkNotForwardOnly, parameter[]]
if[binary_operation[member[.isOnInsertRow], ||, member[.isRowUpdated]]] begin[{]
ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=X_24513, postfix_operators=[], prefix_operators=[], qualifier=ErrorCode, selectors=[])], member=sqlExceptionSQL, postfix_operators=[], prefix_operators=[], qualifier=Util, selectors=[], type_arguments=None), label=None)
else begin[{]
None
end[}]
return[call[navigator.relative, parameter[member[.rows]]]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[relative] operator[SEP] Keyword[int] identifier[rows] operator[SEP] Keyword[throws] identifier[SQLException] {
identifier[checkClosed] operator[SEP] operator[SEP] operator[SEP] identifier[checkNotForwardOnly] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isOnInsertRow] operator[||] identifier[isRowUpdated] operator[SEP] {
Keyword[throw] identifier[Util] operator[SEP] identifier[sqlExceptionSQL] operator[SEP] identifier[ErrorCode] operator[SEP] identifier[X_24513] operator[SEP] operator[SEP]
}
Keyword[return] identifier[navigator] operator[SEP] identifier[relative] operator[SEP] identifier[rows] operator[SEP] operator[SEP]
}
|
@Override
public void initialize() {
super.initialize();
// create synth style factory
setStyleFactory(new SynthStyleFactory() {
@Override
public SynthStyle getStyle(JComponent c, Region r) {
SynthStyle style = getSeaGlassStyle(c, r);
if (!(style instanceof SeaGlassStyle)) {
style = new SeaGlassStyleWrapper(style);
}
return style;
}
});
} | class class_name[name] begin[{]
method[initialize, return_type[void], modifier[public], parameter[]] begin[{]
SuperMethodInvocation(arguments=[], member=initialize, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
call[.setStyleFactory, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getSeaGlassStyle, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=style)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SynthStyle, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=style, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=SeaGlassStyle, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=style, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=style, 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=SeaGlassStyleWrapper, sub_type=None))), label=None)])), ReturnStatement(expression=MemberReference(member=style, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], documentation=None, modifiers={'public'}, name=getStyle, parameters=[FormalParameter(annotations=[], modifiers=set(), name=c, type=ReferenceType(arguments=None, dimensions=[], name=JComponent, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=r, type=ReferenceType(arguments=None, dimensions=[], name=Region, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=None, dimensions=[], name=SynthStyle, sub_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=SynthStyleFactory, sub_type=None))]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[initialize] operator[SEP] operator[SEP] {
Keyword[super] operator[SEP] identifier[initialize] operator[SEP] operator[SEP] operator[SEP] identifier[setStyleFactory] operator[SEP] Keyword[new] identifier[SynthStyleFactory] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[SynthStyle] identifier[getStyle] operator[SEP] identifier[JComponent] identifier[c] , identifier[Region] identifier[r] operator[SEP] {
identifier[SynthStyle] identifier[style] operator[=] identifier[getSeaGlassStyle] operator[SEP] identifier[c] , identifier[r] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[style] Keyword[instanceof] identifier[SeaGlassStyle] operator[SEP] operator[SEP] {
identifier[style] operator[=] Keyword[new] identifier[SeaGlassStyleWrapper] operator[SEP] identifier[style] operator[SEP] operator[SEP]
}
Keyword[return] identifier[style] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
@Nonnull
public static <T> List<T> asList(@Nullable T... objects) {
final List<T> result;
if (objects == null) {
result = new ArrayList<>();
} else {
final int initialCapacity = Math.max(16, ((objects.length + 2) / 3) * 4);
result = new ArrayList<>(initialCapacity);
result.addAll(new ArrayWrapper<>(objects));
}
return result;
} | class class_name[name] begin[{]
method[asList, return_type[type[List]], modifier[public static], parameter[objects]] begin[{]
local_variable[type[List], result]
if[binary_operation[member[.objects], ==, literal[null]]] begin[{]
assign[member[.result], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ArrayList, sub_type=None))]
else begin[{]
local_variable[type[int], initialCapacity]
assign[member[.result], ClassCreator(arguments=[MemberReference(member=initialCapacity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ArrayList, sub_type=None))]
call[result.addAll, parameter[ClassCreator(arguments=[MemberReference(member=objects, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ArrayWrapper, sub_type=None))]]
end[}]
return[member[.result]]
end[}]
END[}] | annotation[@] identifier[Nonnull] Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[List] operator[<] identifier[T] operator[>] identifier[asList] operator[SEP] annotation[@] identifier[Nullable] identifier[T] operator[...] identifier[objects] operator[SEP] {
Keyword[final] identifier[List] operator[<] identifier[T] operator[>] identifier[result] operator[SEP] Keyword[if] operator[SEP] identifier[objects] operator[==] Other[null] operator[SEP] {
identifier[result] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[final] Keyword[int] identifier[initialCapacity] operator[=] identifier[Math] operator[SEP] identifier[max] operator[SEP] Other[16] , operator[SEP] operator[SEP] identifier[objects] operator[SEP] identifier[length] operator[+] Other[2] operator[SEP] operator[/] Other[3] operator[SEP] operator[*] Other[4] operator[SEP] operator[SEP] identifier[result] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] identifier[initialCapacity] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[addAll] operator[SEP] Keyword[new] identifier[ArrayWrapper] operator[<] operator[>] operator[SEP] identifier[objects] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public List<Path> getServices() {
return (services == null)
? null
: services.stream().map(File::toPath).collect(Collectors.toList());
} | class class_name[name] begin[{]
method[getServices, return_type[type[List]], modifier[public], parameter[]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=services, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[], member=stream, postfix_operators=[], prefix_operators=[], qualifier=services, selectors=[MethodInvocation(arguments=[MethodReference(expression=MemberReference(member=File, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), method=MemberReference(member=toPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type_arguments=[])], member=map, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toList, postfix_operators=[], prefix_operators=[], qualifier=Collectors, selectors=[], type_arguments=None)], member=collect, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[Path] operator[>] identifier[getServices] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP] identifier[services] operator[==] Other[null] operator[SEP] operator[?] Other[null] operator[:] identifier[services] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[File] operator[::] identifier[toPath] operator[SEP] operator[SEP] identifier[collect] operator[SEP] identifier[Collectors] operator[SEP] identifier[toList] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public Entry createFolder(String path) {
OAuthRequest request = new OAuthRequest(Verb.GET, FILE_OPS_CREATE_FOLDER_URL);
request.addQuerystringParameter("root", "dropbox");
request.addQuerystringParameter("path", encode(path));
service.signRequest(accessToken, request);
String content = checkCreateFolder(request.send()).getBody();
return Json.parse(content, Entry.class);
} | class class_name[name] begin[{]
method[createFolder, return_type[type[Entry]], modifier[public], parameter[path]] begin[{]
local_variable[type[OAuthRequest], request]
call[request.addQuerystringParameter, parameter[literal["root"], literal["dropbox"]]]
call[request.addQuerystringParameter, parameter[literal["path"], call[.encode, parameter[member[.path]]]]]
call[service.signRequest, parameter[member[.accessToken], member[.request]]]
local_variable[type[String], content]
return[call[Json.parse, parameter[member[.content], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Entry, sub_type=None))]]]
end[}]
END[}] | Keyword[public] identifier[Entry] identifier[createFolder] operator[SEP] identifier[String] identifier[path] operator[SEP] {
identifier[OAuthRequest] identifier[request] operator[=] Keyword[new] identifier[OAuthRequest] operator[SEP] identifier[Verb] operator[SEP] identifier[GET] , identifier[FILE_OPS_CREATE_FOLDER_URL] operator[SEP] operator[SEP] identifier[request] operator[SEP] identifier[addQuerystringParameter] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[request] operator[SEP] identifier[addQuerystringParameter] operator[SEP] literal[String] , identifier[encode] operator[SEP] identifier[path] operator[SEP] operator[SEP] operator[SEP] identifier[service] operator[SEP] identifier[signRequest] operator[SEP] identifier[accessToken] , identifier[request] operator[SEP] operator[SEP] identifier[String] identifier[content] operator[=] identifier[checkCreateFolder] operator[SEP] identifier[request] operator[SEP] identifier[send] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getBody] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[Json] operator[SEP] identifier[parse] operator[SEP] identifier[content] , identifier[Entry] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
|
@Override
public void onCycleComplete(com.netflix.hollow.api.producer.Status status, HollowProducer.ReadState readState, long version, Duration elapsed) {
boolean isCycleSuccess;
long cycleEndTimeNano = System.nanoTime();
if (status.getType() == com.netflix.hollow.api.producer.Status.StatusType.SUCCESS) {
isCycleSuccess = true;
consecutiveFailures = 0l;
lastCycleSuccessTimeNanoOptional = OptionalLong.of(cycleEndTimeNano);
} else {
isCycleSuccess = false;
consecutiveFailures ++;
}
cycleMetricsBuilder
.setConsecutiveFailures(consecutiveFailures)
.setCycleDurationMillis(elapsed.toMillis())
.setIsCycleSuccess(isCycleSuccess);
lastCycleSuccessTimeNanoOptional.ifPresent(cycleMetricsBuilder::setLastCycleSuccessTimeNano);
cycleMetricsReporting(cycleMetricsBuilder.build());
} | class class_name[name] begin[{]
method[onCycleComplete, return_type[void], modifier[public], parameter[status, readState, version, elapsed]] begin[{]
local_variable[type[boolean], isCycleSuccess]
local_variable[type[long], cycleEndTimeNano]
if[binary_operation[call[status.getType, parameter[]], ==, member[com.netflix.hollow.api.producer.Status.StatusType.SUCCESS]]] begin[{]
assign[member[.isCycleSuccess], literal[true]]
assign[member[.consecutiveFailures], literal[0l]]
assign[member[.lastCycleSuccessTimeNanoOptional], call[OptionalLong.of, parameter[member[.cycleEndTimeNano]]]]
else begin[{]
assign[member[.isCycleSuccess], literal[false]]
member[.consecutiveFailures]
end[}]
call[cycleMetricsBuilder.setConsecutiveFailures, parameter[member[.consecutiveFailures]]]
call[lastCycleSuccessTimeNanoOptional.ifPresent, parameter[MethodReference(expression=MemberReference(member=cycleMetricsBuilder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), method=MemberReference(member=setLastCycleSuccessTimeNano, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type_arguments=[])]]
call[.cycleMetricsReporting, parameter[call[cycleMetricsBuilder.build, parameter[]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onCycleComplete] operator[SEP] identifier[com] operator[SEP] identifier[netflix] operator[SEP] identifier[hollow] operator[SEP] identifier[api] operator[SEP] identifier[producer] operator[SEP] identifier[Status] identifier[status] , identifier[HollowProducer] operator[SEP] identifier[ReadState] identifier[readState] , Keyword[long] identifier[version] , identifier[Duration] identifier[elapsed] operator[SEP] {
Keyword[boolean] identifier[isCycleSuccess] operator[SEP] Keyword[long] identifier[cycleEndTimeNano] operator[=] identifier[System] operator[SEP] identifier[nanoTime] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[status] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[==] identifier[com] operator[SEP] identifier[netflix] operator[SEP] identifier[hollow] operator[SEP] identifier[api] operator[SEP] identifier[producer] operator[SEP] identifier[Status] operator[SEP] identifier[StatusType] operator[SEP] identifier[SUCCESS] operator[SEP] {
identifier[isCycleSuccess] operator[=] literal[boolean] operator[SEP] identifier[consecutiveFailures] operator[=] Other[0l] operator[SEP] identifier[lastCycleSuccessTimeNanoOptional] operator[=] identifier[OptionalLong] operator[SEP] identifier[of] operator[SEP] identifier[cycleEndTimeNano] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[isCycleSuccess] operator[=] literal[boolean] operator[SEP] identifier[consecutiveFailures] operator[++] operator[SEP]
}
identifier[cycleMetricsBuilder] operator[SEP] identifier[setConsecutiveFailures] operator[SEP] identifier[consecutiveFailures] operator[SEP] operator[SEP] identifier[setCycleDurationMillis] operator[SEP] identifier[elapsed] operator[SEP] identifier[toMillis] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setIsCycleSuccess] operator[SEP] identifier[isCycleSuccess] operator[SEP] operator[SEP] identifier[lastCycleSuccessTimeNanoOptional] operator[SEP] identifier[ifPresent] operator[SEP] identifier[cycleMetricsBuilder] operator[::] identifier[setLastCycleSuccessTimeNano] operator[SEP] operator[SEP] identifier[cycleMetricsReporting] operator[SEP] identifier[cycleMetricsBuilder] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private void readObject(ObjectInputStream in)
throws IOException, ClassNotFoundException, NoSuchMethodException {
componentType = ClassRef.read(in);
} | class class_name[name] begin[{]
method[readObject, return_type[void], modifier[private], parameter[in]] begin[{]
assign[member[.componentType], call[ClassRef.read, parameter[member[.in]]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[readObject] operator[SEP] identifier[ObjectInputStream] identifier[in] operator[SEP] Keyword[throws] identifier[IOException] , identifier[ClassNotFoundException] , identifier[NoSuchMethodException] {
identifier[componentType] operator[=] identifier[ClassRef] operator[SEP] identifier[read] operator[SEP] identifier[in] operator[SEP] operator[SEP]
}
|
@Override
public boolean hasNext()
{
if (fetchSize != 0 && (count % fetchSize) == 0)
{
try
{
results = populateEntities(entityMetadata, client);
count = 0;
}
catch (Exception e)
{
throw new PersistenceException("Error while scrolling over results, Caused by :.", e);
}
}
if (results != null && !results.isEmpty() && count < results.size())
{
return true;
}
return false;
} | class class_name[name] begin[{]
method[hasNext, return_type[type[boolean]], modifier[public], parameter[]] begin[{]
if[binary_operation[binary_operation[member[.fetchSize], !=, literal[0]], &&, binary_operation[binary_operation[member[.count], %, member[.fetchSize]], ==, literal[0]]]] begin[{]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=results, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=entityMetadata, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=client, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=populateEntities, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error while scrolling over results, Caused by :."), 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=PersistenceException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
if[binary_operation[binary_operation[binary_operation[member[.results], !=, literal[null]], &&, call[results.isEmpty, parameter[]]], &&, binary_operation[member[.count], <, call[results.size, parameter[]]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[hasNext] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[fetchSize] operator[!=] Other[0] operator[&&] operator[SEP] identifier[count] operator[%] identifier[fetchSize] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[try] {
identifier[results] operator[=] identifier[populateEntities] operator[SEP] identifier[entityMetadata] , identifier[client] operator[SEP] operator[SEP] identifier[count] operator[=] Other[0] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[PersistenceException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[results] operator[!=] Other[null] operator[&&] operator[!] identifier[results] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[&&] identifier[count] operator[<] identifier[results] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
@SuppressWarnings("unchecked")
public Template getTemplate(String name, Locale locale, String encoding, Object args) throws IOException, ParseException {
name = UrlUtils.cleanName(name);
locale = cleanLocale(locale);
Map<Object, Object> cache = this.cache; // safe copy reference
if (cache == null) {
return parseTemplate(null, name, locale, encoding, args);
}
Resource resource = null;
long lastModified;
if (reloadable) {
resource = loadResource(name, locale, encoding);
lastModified = resource.getLastModified();
} else {
lastModified = Long.MIN_VALUE;
}
String key = name;
if (locale != null || encoding != null) {
StringBuilder buf = new StringBuilder(name.length() + 20);
buf.append(name);
if (locale != null) {
buf.append("_");
buf.append(locale);
}
if (encoding != null) {
buf.append("_");
buf.append(encoding);
}
key = buf.toString();
}
VolatileReference<Template> reference = (VolatileReference<Template>) cache.get(key);
if (reference == null) {
if (cache instanceof ConcurrentMap) {
reference = new VolatileReference<Template>(); // quickly
VolatileReference<Template> old = (VolatileReference<Template>) ((ConcurrentMap<Object, Object>) cache).putIfAbsent(key, reference);
if (old != null) { // duplicate
reference = old;
}
} else {
synchronized (cache) { // cache lock
reference = (VolatileReference<Template>) cache.get(key);
if (reference == null) { // double check
reference = new VolatileReference<Template>(); // quickly
cache.put(key, reference);
}
}
}
}
assert (reference != null);
Template template = reference.get();
if (template == null || template.getLastModified() < lastModified) {
synchronized (reference) { // reference lock
template = reference.get();
if (template == null || template.getLastModified() < lastModified) { // double check
template = parseTemplate(resource, name, locale, encoding, args); // slowly
reference.set(template);
}
}
}
assert (template != null);
return template;
} | class class_name[name] begin[{]
method[getTemplate, return_type[type[Template]], modifier[public], parameter[name, locale, encoding, args]] begin[{]
assign[member[.name], call[UrlUtils.cleanName, parameter[member[.name]]]]
assign[member[.locale], call[.cleanLocale, parameter[member[.locale]]]]
local_variable[type[Map], cache]
if[binary_operation[member[.cache], ==, literal[null]]] begin[{]
return[call[.parseTemplate, parameter[literal[null], member[.name], member[.locale], member[.encoding], member[.args]]]]
else begin[{]
None
end[}]
local_variable[type[Resource], resource]
local_variable[type[long], lastModified]
if[member[.reloadable]] begin[{]
assign[member[.resource], call[.loadResource, parameter[member[.name], member[.locale], member[.encoding]]]]
assign[member[.lastModified], call[resource.getLastModified, parameter[]]]
else begin[{]
assign[member[.lastModified], member[Long.MIN_VALUE]]
end[}]
local_variable[type[String], key]
if[binary_operation[binary_operation[member[.locale], !=, literal[null]], ||, binary_operation[member[.encoding], !=, literal[null]]]] begin[{]
local_variable[type[StringBuilder], buf]
call[buf.append, parameter[member[.name]]]
if[binary_operation[member[.locale], !=, literal[null]]] begin[{]
call[buf.append, parameter[literal["_"]]]
call[buf.append, parameter[member[.locale]]]
else begin[{]
None
end[}]
if[binary_operation[member[.encoding], !=, literal[null]]] begin[{]
call[buf.append, parameter[literal["_"]]]
call[buf.append, parameter[member[.encoding]]]
else begin[{]
None
end[}]
assign[member[.key], call[buf.toString, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[VolatileReference], reference]
if[binary_operation[member[.reference], ==, literal[null]]] begin[{]
if[binary_operation[member[.cache], instanceof, type[ConcurrentMap]]] begin[{]
assign[member[.reference], 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=Template, sub_type=None))], dimensions=None, name=VolatileReference, sub_type=None))]
local_variable[type[VolatileReference], old]
if[binary_operation[member[.old], !=, literal[null]]] begin[{]
assign[member[.reference], member[.old]]
else begin[{]
None
end[}]
else begin[{]
SYNCHRONIZED[member[.cache]] BEGIN[{]
assign[member[.reference], Cast(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=cache, selectors=[], type_arguments=None), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Template, sub_type=None))], dimensions=[], name=VolatileReference, sub_type=None))]
if[binary_operation[member[.reference], ==, literal[null]]] begin[{]
assign[member[.reference], 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=Template, sub_type=None))], dimensions=None, name=VolatileReference, sub_type=None))]
call[cache.put, parameter[member[.key], member[.reference]]]
else begin[{]
None
end[}]
END[}]
end[}]
else begin[{]
None
end[}]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=reference, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None, value=None)
local_variable[type[Template], template]
if[binary_operation[binary_operation[member[.template], ==, literal[null]], ||, binary_operation[call[template.getLastModified, parameter[]], <, member[.lastModified]]]] begin[{]
SYNCHRONIZED[member[.reference]] BEGIN[{]
assign[member[.template], call[reference.get, parameter[]]]
if[binary_operation[binary_operation[member[.template], ==, literal[null]], ||, binary_operation[call[template.getLastModified, parameter[]], <, member[.lastModified]]]] begin[{]
assign[member[.template], call[.parseTemplate, parameter[member[.resource], member[.name], member[.locale], member[.encoding], member[.args]]]]
call[reference.set, parameter[member[.template]]]
else begin[{]
None
end[}]
END[}]
else begin[{]
None
end[}]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=template, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None, value=None)
return[member[.template]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] identifier[Template] identifier[getTemplate] operator[SEP] identifier[String] identifier[name] , identifier[Locale] identifier[locale] , identifier[String] identifier[encoding] , identifier[Object] identifier[args] operator[SEP] Keyword[throws] identifier[IOException] , identifier[ParseException] {
identifier[name] operator[=] identifier[UrlUtils] operator[SEP] identifier[cleanName] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[locale] operator[=] identifier[cleanLocale] operator[SEP] identifier[locale] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[Object] , identifier[Object] operator[>] identifier[cache] operator[=] Keyword[this] operator[SEP] identifier[cache] operator[SEP] Keyword[if] operator[SEP] identifier[cache] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[parseTemplate] operator[SEP] Other[null] , identifier[name] , identifier[locale] , identifier[encoding] , identifier[args] operator[SEP] operator[SEP]
}
identifier[Resource] identifier[resource] operator[=] Other[null] operator[SEP] Keyword[long] identifier[lastModified] operator[SEP] Keyword[if] operator[SEP] identifier[reloadable] operator[SEP] {
identifier[resource] operator[=] identifier[loadResource] operator[SEP] identifier[name] , identifier[locale] , identifier[encoding] operator[SEP] operator[SEP] identifier[lastModified] operator[=] identifier[resource] operator[SEP] identifier[getLastModified] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[lastModified] operator[=] identifier[Long] operator[SEP] identifier[MIN_VALUE] operator[SEP]
}
identifier[String] identifier[key] operator[=] identifier[name] operator[SEP] Keyword[if] operator[SEP] identifier[locale] operator[!=] Other[null] operator[||] identifier[encoding] operator[!=] Other[null] operator[SEP] {
identifier[StringBuilder] identifier[buf] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] identifier[name] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[+] Other[20] operator[SEP] operator[SEP] identifier[buf] operator[SEP] identifier[append] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[locale] operator[!=] Other[null] operator[SEP] {
identifier[buf] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[buf] operator[SEP] identifier[append] operator[SEP] identifier[locale] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[encoding] operator[!=] Other[null] operator[SEP] {
identifier[buf] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[buf] operator[SEP] identifier[append] operator[SEP] identifier[encoding] operator[SEP] operator[SEP]
}
identifier[key] operator[=] identifier[buf] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
identifier[VolatileReference] operator[<] identifier[Template] operator[>] identifier[reference] operator[=] operator[SEP] identifier[VolatileReference] operator[<] identifier[Template] operator[>] operator[SEP] identifier[cache] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[reference] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[cache] Keyword[instanceof] identifier[ConcurrentMap] operator[SEP] {
identifier[reference] operator[=] Keyword[new] identifier[VolatileReference] operator[<] identifier[Template] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[VolatileReference] operator[<] identifier[Template] operator[>] identifier[old] operator[=] operator[SEP] identifier[VolatileReference] operator[<] identifier[Template] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[ConcurrentMap] operator[<] identifier[Object] , identifier[Object] operator[>] operator[SEP] identifier[cache] operator[SEP] operator[SEP] identifier[putIfAbsent] operator[SEP] identifier[key] , identifier[reference] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[old] operator[!=] Other[null] operator[SEP] {
identifier[reference] operator[=] identifier[old] operator[SEP]
}
}
Keyword[else] {
Keyword[synchronized] operator[SEP] identifier[cache] operator[SEP] {
identifier[reference] operator[=] operator[SEP] identifier[VolatileReference] operator[<] identifier[Template] operator[>] operator[SEP] identifier[cache] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[reference] operator[==] Other[null] operator[SEP] {
identifier[reference] operator[=] Keyword[new] identifier[VolatileReference] operator[<] identifier[Template] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[cache] operator[SEP] identifier[put] operator[SEP] identifier[key] , identifier[reference] operator[SEP] operator[SEP]
}
}
}
}
Keyword[assert] operator[SEP] identifier[reference] operator[!=] Other[null] operator[SEP] operator[SEP] identifier[Template] identifier[template] operator[=] identifier[reference] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[template] operator[==] Other[null] operator[||] identifier[template] operator[SEP] identifier[getLastModified] operator[SEP] operator[SEP] operator[<] identifier[lastModified] operator[SEP] {
Keyword[synchronized] operator[SEP] identifier[reference] operator[SEP] {
identifier[template] operator[=] identifier[reference] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[template] operator[==] Other[null] operator[||] identifier[template] operator[SEP] identifier[getLastModified] operator[SEP] operator[SEP] operator[<] identifier[lastModified] operator[SEP] {
identifier[template] operator[=] identifier[parseTemplate] operator[SEP] identifier[resource] , identifier[name] , identifier[locale] , identifier[encoding] , identifier[args] operator[SEP] operator[SEP] identifier[reference] operator[SEP] identifier[set] operator[SEP] identifier[template] operator[SEP] operator[SEP]
}
}
}
Keyword[assert] operator[SEP] identifier[template] operator[!=] Other[null] operator[SEP] operator[SEP] Keyword[return] identifier[template] operator[SEP]
}
|
public static <K, V> boolean any(Map<K, V> self, @ClosureParams(MapEntryOrKeyValue.class) Closure<?> predicate) {
BooleanClosureWrapper bcw = new BooleanClosureWrapper(predicate);
for (Map.Entry<K, V> entry : self.entrySet()) {
if (bcw.callForMap(entry)) {
return true;
}
}
return false;
} | class class_name[name] begin[{]
method[any, return_type[type[boolean]], modifier[public static], parameter[self, predicate]] begin[{]
local_variable[type[BooleanClosureWrapper], bcw]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=entry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=callForMap, postfix_operators=[], prefix_operators=[], qualifier=bcw, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=self, 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=K, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=V, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
return[literal[false]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[K] , identifier[V] operator[>] Keyword[boolean] identifier[any] operator[SEP] identifier[Map] operator[<] identifier[K] , identifier[V] operator[>] identifier[self] , annotation[@] identifier[ClosureParams] operator[SEP] identifier[MapEntryOrKeyValue] operator[SEP] Keyword[class] operator[SEP] identifier[Closure] operator[<] operator[?] operator[>] identifier[predicate] operator[SEP] {
identifier[BooleanClosureWrapper] identifier[bcw] operator[=] Keyword[new] identifier[BooleanClosureWrapper] operator[SEP] identifier[predicate] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[K] , identifier[V] operator[>] identifier[entry] operator[:] identifier[self] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[bcw] operator[SEP] identifier[callForMap] operator[SEP] identifier[entry] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
@GwtIncompatible("Unnecessary")
private ImmutableList<JSError> deduplicateIjsFiles(
List<FlagEntry<JsSourceType>> files, List<String> moduleRoots, boolean hasModuleSpecs) {
ImmutableList.Builder<JSError> errors = ImmutableList.builder();
// First pass: collect the (module root relative) names of --js and --weakdep files.
Map<String, String> relativeToAbsoluteName = new HashMap<>();
for (FlagEntry<JsSourceType> file : files) {
// TODO(tjgq): Handle zip files.
if (file.flag == JsSourceType.JS || file.flag == JsSourceType.WEAKDEP) {
String absoluteName = file.value;
String relativeName = getModuleRootRelativeName(absoluteName, moduleRoots);
relativeToAbsoluteName.put(relativeName, absoluteName);
}
}
// Second pass: drop --ijs files whose (module root relative) name matches a --js or --weakdep
// file.
Iterator<FlagEntry<JsSourceType>> iterator = files.iterator();
while (iterator.hasNext()) {
FlagEntry<JsSourceType> file = iterator.next();
if (file.flag == JsSourceType.IJS) {
if (hasModuleSpecs) {
throw new FlagUsageException("--ijs is incompatible with --chunk or --module.");
}
String absoluteName = file.value;
if (!absoluteName.endsWith(".i.js")) {
errors.add(JSError.make(IjsErrors.BAD_IJS_FILE_NAME, absoluteName));
continue;
}
String relativeName = getModuleRootRelativeName(absoluteName, moduleRoots);
String relativeNonIjsName =
relativeName.substring(0, relativeName.length() - ".i.js".length());
if (relativeToAbsoluteName.containsKey(relativeNonIjsName)) {
errors.add(
JSError.make(
IjsErrors.CONFLICTING_IJS_FILE,
relativeToAbsoluteName.get(relativeNonIjsName),
absoluteName));
iterator.remove();
}
}
}
return errors.build();
} | class class_name[name] begin[{]
method[deduplicateIjsFiles, return_type[type[ImmutableList]], modifier[private], parameter[files, moduleRoots, hasModuleSpecs]] begin[{]
local_variable[type[ImmutableList], errors]
local_variable[type[Map], relativeToAbsoluteName]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=flag, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[]), operandr=MemberReference(member=JS, postfix_operators=[], prefix_operators=[], qualifier=JsSourceType, selectors=[]), operator===), operandr=BinaryOperation(operandl=MemberReference(member=flag, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[]), operandr=MemberReference(member=WEAKDEP, postfix_operators=[], prefix_operators=[], qualifier=JsSourceType, selectors=[]), operator===), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[]), name=absoluteName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=absoluteName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=moduleRoots, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getModuleRootRelativeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=relativeName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=relativeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=absoluteName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=relativeToAbsoluteName, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=files, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=file)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=JsSourceType, sub_type=None))], dimensions=[], name=FlagEntry, sub_type=None))), label=None)
local_variable[type[Iterator], iterator]
while[call[iterator.hasNext, parameter[]]] begin[{]
local_variable[type[FlagEntry], file]
if[binary_operation[member[file.flag], ==, member[JsSourceType.IJS]]] begin[{]
if[member[.hasModuleSpecs]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="--ijs is incompatible with --chunk or --module.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FlagUsageException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[String], absoluteName]
if[call[absoluteName.endsWith, parameter[literal[".i.js"]]]] begin[{]
call[errors.add, parameter[call[JSError.make, parameter[member[IjsErrors.BAD_IJS_FILE_NAME], member[.absoluteName]]]]]
ContinueStatement(goto=None, label=None)
else begin[{]
None
end[}]
local_variable[type[String], relativeName]
local_variable[type[String], relativeNonIjsName]
if[call[relativeToAbsoluteName.containsKey, parameter[member[.relativeNonIjsName]]]] begin[{]
call[errors.add, parameter[call[JSError.make, parameter[member[IjsErrors.CONFLICTING_IJS_FILE], call[relativeToAbsoluteName.get, parameter[member[.relativeNonIjsName]]], member[.absoluteName]]]]]
call[iterator.remove, parameter[]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
return[call[errors.build, parameter[]]]
end[}]
END[}] | annotation[@] identifier[GwtIncompatible] operator[SEP] literal[String] operator[SEP] Keyword[private] identifier[ImmutableList] operator[<] identifier[JSError] operator[>] identifier[deduplicateIjsFiles] operator[SEP] identifier[List] operator[<] identifier[FlagEntry] operator[<] identifier[JsSourceType] operator[>] operator[>] identifier[files] , identifier[List] operator[<] identifier[String] operator[>] identifier[moduleRoots] , Keyword[boolean] identifier[hasModuleSpecs] operator[SEP] {
identifier[ImmutableList] operator[SEP] identifier[Builder] operator[<] identifier[JSError] operator[>] identifier[errors] operator[=] identifier[ImmutableList] operator[SEP] identifier[builder] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[relativeToAbsoluteName] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[FlagEntry] operator[<] identifier[JsSourceType] operator[>] identifier[file] operator[:] identifier[files] operator[SEP] {
Keyword[if] operator[SEP] identifier[file] operator[SEP] identifier[flag] operator[==] identifier[JsSourceType] operator[SEP] identifier[JS] operator[||] identifier[file] operator[SEP] identifier[flag] operator[==] identifier[JsSourceType] operator[SEP] identifier[WEAKDEP] operator[SEP] {
identifier[String] identifier[absoluteName] operator[=] identifier[file] operator[SEP] identifier[value] operator[SEP] identifier[String] identifier[relativeName] operator[=] identifier[getModuleRootRelativeName] operator[SEP] identifier[absoluteName] , identifier[moduleRoots] operator[SEP] operator[SEP] identifier[relativeToAbsoluteName] operator[SEP] identifier[put] operator[SEP] identifier[relativeName] , identifier[absoluteName] operator[SEP] operator[SEP]
}
}
identifier[Iterator] operator[<] identifier[FlagEntry] operator[<] identifier[JsSourceType] operator[>] operator[>] identifier[iterator] operator[=] identifier[files] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[iterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[FlagEntry] operator[<] identifier[JsSourceType] operator[>] identifier[file] operator[=] identifier[iterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[file] operator[SEP] identifier[flag] operator[==] identifier[JsSourceType] operator[SEP] identifier[IJS] operator[SEP] {
Keyword[if] operator[SEP] identifier[hasModuleSpecs] operator[SEP] {
Keyword[throw] Keyword[new] identifier[FlagUsageException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[String] identifier[absoluteName] operator[=] identifier[file] operator[SEP] identifier[value] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[absoluteName] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[errors] operator[SEP] identifier[add] operator[SEP] identifier[JSError] operator[SEP] identifier[make] operator[SEP] identifier[IjsErrors] operator[SEP] identifier[BAD_IJS_FILE_NAME] , identifier[absoluteName] operator[SEP] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
identifier[String] identifier[relativeName] operator[=] identifier[getModuleRootRelativeName] operator[SEP] identifier[absoluteName] , identifier[moduleRoots] operator[SEP] operator[SEP] identifier[String] identifier[relativeNonIjsName] operator[=] identifier[relativeName] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[relativeName] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] literal[String] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[relativeToAbsoluteName] operator[SEP] identifier[containsKey] operator[SEP] identifier[relativeNonIjsName] operator[SEP] operator[SEP] {
identifier[errors] operator[SEP] identifier[add] operator[SEP] identifier[JSError] operator[SEP] identifier[make] operator[SEP] identifier[IjsErrors] operator[SEP] identifier[CONFLICTING_IJS_FILE] , identifier[relativeToAbsoluteName] operator[SEP] identifier[get] operator[SEP] identifier[relativeNonIjsName] operator[SEP] , identifier[absoluteName] operator[SEP] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] identifier[remove] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[errors] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
|
public Object generateUpgradedDefinition(String resourceGroupName, String workflowName, String targetSchemaVersion) {
return generateUpgradedDefinitionWithServiceResponseAsync(resourceGroupName, workflowName, targetSchemaVersion).toBlocking().single().body();
} | class class_name[name] begin[{]
method[generateUpgradedDefinition, return_type[type[Object]], modifier[public], parameter[resourceGroupName, workflowName, targetSchemaVersion]] begin[{]
return[call[.generateUpgradedDefinitionWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.workflowName], member[.targetSchemaVersion]]]]
end[}]
END[}] | Keyword[public] identifier[Object] identifier[generateUpgradedDefinition] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[workflowName] , identifier[String] identifier[targetSchemaVersion] operator[SEP] {
Keyword[return] identifier[generateUpgradedDefinitionWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[workflowName] , identifier[targetSchemaVersion] operator[SEP] operator[SEP] identifier[toBlocking] operator[SEP] operator[SEP] operator[SEP] identifier[single] operator[SEP] operator[SEP] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
|
private void associateConnection(ManagedConnectionFactory mcf,
Subject subject,
ConnectionRequestInfo cri,
Object connection) throws ResourceException {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(this, tc, "associateConnection");
UOWCurrent uowCurrent = (UOWCurrent) _pm.connectorSvc.transactionManager;
UOWCoordinator uowCoord = uowCurrent == null ? null : uowCurrent.getUOWCoord();
MCWrapper mcWrapper = null;
Object credTokenObj = null;
try { // Begin processing to get connection
// Perform any security setup that may be needed
// before we proceed to get a connection.
credTokenObj = securityHelper.beforeGettingConnection(subject, cri);
// Get an appropriate wrappered ManangedConnection.
mcWrapper = allocateMCWrapper(mcf, cri,
subject,
uowCoord);
} // end try block
finally {
// A "finally" clause is implemented to ensure
// any thread identity pushed to the OS
// thread is removed and the original identity
// is restored.
if (credTokenObj != null) {
securityHelper.afterGettingConnection(subject, cri, credTokenObj);
}
}
involveMCInTran(mcWrapper, uowCoord, this);
// Reassociate the handle which was passed in with the ManagedConnection (via MCWrapper).
// Note: since associateConnection is called to reassociate a smart handle which is
// currently not associated to any MC, the fromMCWrapper parm in the call below will
// be null.
reassociateConnectionHandle(connection, null, mcWrapper, uowCoord);
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(this, tc, "associateConnection");
} | class class_name[name] begin[{]
method[associateConnection, return_type[void], modifier[private], parameter[mcf, subject, cri, connection]] begin[{]
local_variable[type[boolean], isTraceOn]
if[binary_operation[member[.isTraceOn], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[Tr.entry, parameter[THIS[], member[.tc], literal["associateConnection"]]]
else begin[{]
None
end[}]
local_variable[type[UOWCurrent], uowCurrent]
local_variable[type[UOWCoordinator], uowCoord]
local_variable[type[MCWrapper], mcWrapper]
local_variable[type[Object], credTokenObj]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=credTokenObj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=subject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=cri, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=beforeGettingConnection, postfix_operators=[], prefix_operators=[], qualifier=securityHelper, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=mcWrapper, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=mcf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=cri, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=subject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=uowCoord, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=allocateMCWrapper, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)], catches=None, finally_block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=credTokenObj, 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=subject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=cri, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=credTokenObj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=afterGettingConnection, postfix_operators=[], prefix_operators=[], qualifier=securityHelper, selectors=[], type_arguments=None), label=None)]))], label=None, resources=None)
call[.involveMCInTran, parameter[member[.mcWrapper], member[.uowCoord], THIS[]]]
call[.reassociateConnectionHandle, parameter[member[.connection], literal[null], member[.mcWrapper], member[.uowCoord]]]
if[binary_operation[member[.isTraceOn], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[Tr.exit, parameter[THIS[], member[.tc], literal["associateConnection"]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[associateConnection] operator[SEP] identifier[ManagedConnectionFactory] identifier[mcf] , identifier[Subject] identifier[subject] , identifier[ConnectionRequestInfo] identifier[cri] , identifier[Object] identifier[connection] operator[SEP] Keyword[throws] identifier[ResourceException] {
Keyword[final] Keyword[boolean] identifier[isTraceOn] operator[=] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isTraceOn] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[entry] operator[SEP] Keyword[this] , identifier[tc] , literal[String] operator[SEP] operator[SEP] identifier[UOWCurrent] identifier[uowCurrent] operator[=] operator[SEP] identifier[UOWCurrent] operator[SEP] identifier[_pm] operator[SEP] identifier[connectorSvc] operator[SEP] identifier[transactionManager] operator[SEP] identifier[UOWCoordinator] identifier[uowCoord] operator[=] identifier[uowCurrent] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[uowCurrent] operator[SEP] identifier[getUOWCoord] operator[SEP] operator[SEP] operator[SEP] identifier[MCWrapper] identifier[mcWrapper] operator[=] Other[null] operator[SEP] identifier[Object] identifier[credTokenObj] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[credTokenObj] operator[=] identifier[securityHelper] operator[SEP] identifier[beforeGettingConnection] operator[SEP] identifier[subject] , identifier[cri] operator[SEP] operator[SEP] identifier[mcWrapper] operator[=] identifier[allocateMCWrapper] operator[SEP] identifier[mcf] , identifier[cri] , identifier[subject] , identifier[uowCoord] operator[SEP] operator[SEP]
}
Keyword[finally] {
Keyword[if] operator[SEP] identifier[credTokenObj] operator[!=] Other[null] operator[SEP] {
identifier[securityHelper] operator[SEP] identifier[afterGettingConnection] operator[SEP] identifier[subject] , identifier[cri] , identifier[credTokenObj] operator[SEP] operator[SEP]
}
}
identifier[involveMCInTran] operator[SEP] identifier[mcWrapper] , identifier[uowCoord] , Keyword[this] operator[SEP] operator[SEP] identifier[reassociateConnectionHandle] operator[SEP] identifier[connection] , Other[null] , identifier[mcWrapper] , identifier[uowCoord] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isTraceOn] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[exit] operator[SEP] Keyword[this] , identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
|
public <T> T[] getAll(Map<String, Object> data, String attr, Class<T> clazz) {
return convert((Object[]) data.get(attr), clazz);
} | class class_name[name] begin[{]
method[getAll, return_type[type[T]], modifier[public], parameter[data, attr, clazz]] begin[{]
return[call[.convert, parameter[Cast(expression=MethodInvocation(arguments=[MemberReference(member=attr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[None], name=Object, sub_type=None)), member[.clazz]]]]
end[}]
END[}] | Keyword[public] operator[<] identifier[T] operator[>] identifier[T] operator[SEP] operator[SEP] identifier[getAll] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[data] , identifier[String] identifier[attr] , identifier[Class] operator[<] identifier[T] operator[>] identifier[clazz] operator[SEP] {
Keyword[return] identifier[convert] operator[SEP] operator[SEP] identifier[Object] operator[SEP] operator[SEP] operator[SEP] identifier[data] operator[SEP] identifier[get] operator[SEP] identifier[attr] operator[SEP] , identifier[clazz] operator[SEP] operator[SEP]
}
|
private void createRemoteListenerDeactivateOnException(
final boolean initialAttempt) {
final String methodName = "createRemoteListenerDeactivateOnException";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName, Boolean
.valueOf(initialAttempt));
}
try {
createRemoteListener(initialAttempt);
} catch (final ResourceException exception) {
FFDCFilter.processException(exception, CLASS_NAME + "."
+ methodName, FFDC_PROBE_7, this);
SibTr.error(TRACE, "CONNECT_FAILED_CWSIV0783", new Object[] {
_endpointConfiguration.getDestination()
.getDestinationName(),
_endpointConfiguration.getBusName(), this, exception });
deactivate();
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName);
}
} | class class_name[name] begin[{]
method[createRemoteListenerDeactivateOnException, return_type[void], modifier[private], parameter[initialAttempt]] begin[{]
local_variable[type[String], methodName]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[TRACE.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[THIS[], member[.TRACE], member[.methodName], call[Boolean.valueOf, parameter[member[.initialAttempt]]]]]
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=initialAttempt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createRemoteListener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=exception, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=CLASS_NAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="."), operator=+), operandr=MemberReference(member=methodName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=FFDC_PROBE_7, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=processException, postfix_operators=[], prefix_operators=[], qualifier=FFDCFilter, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=TRACE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CONNECT_FAILED_CWSIV0783"), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MethodInvocation(arguments=[], member=getDestination, postfix_operators=[], prefix_operators=[], qualifier=_endpointConfiguration, selectors=[MethodInvocation(arguments=[], member=getDestinationName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MethodInvocation(arguments=[], member=getBusName, postfix_operators=[], prefix_operators=[], qualifier=_endpointConfiguration, selectors=[], type_arguments=None), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=exception, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))], member=error, postfix_operators=[], prefix_operators=[], qualifier=SibTr, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=deactivate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=exception, types=['ResourceException']))], finally_block=None, label=None, resources=None)
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[TRACE.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[THIS[], member[.TRACE], member[.methodName]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[createRemoteListenerDeactivateOnException] operator[SEP] Keyword[final] Keyword[boolean] identifier[initialAttempt] operator[SEP] {
Keyword[final] identifier[String] identifier[methodName] operator[=] literal[String] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[TRACE] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] Keyword[this] , identifier[TRACE] , identifier[methodName] , identifier[Boolean] operator[SEP] identifier[valueOf] operator[SEP] identifier[initialAttempt] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[createRemoteListener] operator[SEP] identifier[initialAttempt] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[ResourceException] identifier[exception] operator[SEP] {
identifier[FFDCFilter] operator[SEP] identifier[processException] operator[SEP] identifier[exception] , identifier[CLASS_NAME] operator[+] literal[String] operator[+] identifier[methodName] , identifier[FFDC_PROBE_7] , Keyword[this] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[error] operator[SEP] identifier[TRACE] , literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[_endpointConfiguration] operator[SEP] identifier[getDestination] operator[SEP] operator[SEP] operator[SEP] identifier[getDestinationName] operator[SEP] operator[SEP] , identifier[_endpointConfiguration] operator[SEP] identifier[getBusName] operator[SEP] operator[SEP] , Keyword[this] , identifier[exception]
} operator[SEP] operator[SEP] identifier[deactivate] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[TRACE] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] Keyword[this] , identifier[TRACE] , identifier[methodName] operator[SEP] operator[SEP]
}
}
|
public final String getDecodedString() throws TLVParserException {
byte[] data = getContent();
if (!(data.length > 0 && data[data.length - 1] == '\0')) {
throw new TLVParserException("String must be null terminated");
}
try {
return Util.decodeString(data, 0, data.length - 1);
} catch (CharacterCodingException e) {
throw new TLVParserException("Malformed UTF-8 data", e);
}
} | class class_name[name] begin[{]
method[getDecodedString, return_type[type[String]], modifier[final public], parameter[]] begin[{]
local_variable[type[byte], data]
if[binary_operation[binary_operation[member[data.length], >, literal[0]], &&, binary_operation[member[.data], ==, literal['\0']]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="String must be null terminated")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TLVParserException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-)], member=decodeString, postfix_operators=[], prefix_operators=[], qualifier=Util, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Malformed UTF-8 data"), 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=TLVParserException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['CharacterCodingException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[final] identifier[String] identifier[getDecodedString] operator[SEP] operator[SEP] Keyword[throws] identifier[TLVParserException] {
Keyword[byte] operator[SEP] operator[SEP] identifier[data] operator[=] identifier[getContent] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[data] operator[SEP] identifier[length] operator[>] Other[0] operator[&&] identifier[data] operator[SEP] identifier[data] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] operator[==] literal[String] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[TLVParserException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
Keyword[return] identifier[Util] operator[SEP] identifier[decodeString] operator[SEP] identifier[data] , Other[0] , identifier[data] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[CharacterCodingException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[TLVParserException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public Matrix4x3d translate(Vector3fc offset) {
return translate(offset.x(), offset.y(), offset.z());
} | class class_name[name] begin[{]
method[translate, return_type[type[Matrix4x3d]], modifier[public], parameter[offset]] begin[{]
return[call[.translate, parameter[call[offset.x, parameter[]], call[offset.y, parameter[]], call[offset.z, parameter[]]]]]
end[}]
END[}] | Keyword[public] identifier[Matrix4x3d] identifier[translate] operator[SEP] identifier[Vector3fc] identifier[offset] operator[SEP] {
Keyword[return] identifier[translate] operator[SEP] identifier[offset] operator[SEP] identifier[x] operator[SEP] operator[SEP] , identifier[offset] operator[SEP] identifier[y] operator[SEP] operator[SEP] , identifier[offset] operator[SEP] identifier[z] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
protected String remoteHttpHost(ChannelHandlerContext ctx) {
if (remoteHttpHost == null) {
SocketAddress addr = ctx.channel().remoteAddress();
if (addr instanceof InetSocketAddress) {
InetSocketAddress inetAddr = (InetSocketAddress) addr;
remoteHttpHost = inetAddr.getAddress().getHostAddress() + ":" + inetAddr.getPort();
} else {
remoteHttpHost = addr.toString();
}
}
return remoteHttpHost;
} | class class_name[name] begin[{]
method[remoteHttpHost, return_type[type[String]], modifier[protected], parameter[ctx]] begin[{]
if[binary_operation[member[.remoteHttpHost], ==, literal[null]]] begin[{]
local_variable[type[SocketAddress], addr]
if[binary_operation[member[.addr], instanceof, type[InetSocketAddress]]] begin[{]
local_variable[type[InetSocketAddress], inetAddr]
assign[member[.remoteHttpHost], binary_operation[binary_operation[call[inetAddr.getAddress, parameter[]], +, literal[":"]], +, call[inetAddr.getPort, parameter[]]]]
else begin[{]
assign[member[.remoteHttpHost], call[addr.toString, parameter[]]]
end[}]
else begin[{]
None
end[}]
return[member[.remoteHttpHost]]
end[}]
END[}] | Keyword[protected] identifier[String] identifier[remoteHttpHost] operator[SEP] identifier[ChannelHandlerContext] identifier[ctx] operator[SEP] {
Keyword[if] operator[SEP] identifier[remoteHttpHost] operator[==] Other[null] operator[SEP] {
identifier[SocketAddress] identifier[addr] operator[=] identifier[ctx] operator[SEP] identifier[channel] operator[SEP] operator[SEP] operator[SEP] identifier[remoteAddress] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[addr] Keyword[instanceof] identifier[InetSocketAddress] operator[SEP] {
identifier[InetSocketAddress] identifier[inetAddr] operator[=] operator[SEP] identifier[InetSocketAddress] operator[SEP] identifier[addr] operator[SEP] identifier[remoteHttpHost] operator[=] identifier[inetAddr] operator[SEP] identifier[getAddress] operator[SEP] operator[SEP] operator[SEP] identifier[getHostAddress] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[inetAddr] operator[SEP] identifier[getPort] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[remoteHttpHost] operator[=] identifier[addr] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[remoteHttpHost] operator[SEP]
}
|
void unscheduleQuartzJob(String jobId, String jobGroup) throws SchedulerException {
quartzScheduler.unscheduleJob(TriggerKey.triggerKey(jobId, jobGroup));
} | class class_name[name] begin[{]
method[unscheduleQuartzJob, return_type[void], modifier[default], parameter[jobId, jobGroup]] begin[{]
call[quartzScheduler.unscheduleJob, parameter[call[TriggerKey.triggerKey, parameter[member[.jobId], member[.jobGroup]]]]]
end[}]
END[}] | Keyword[void] identifier[unscheduleQuartzJob] operator[SEP] identifier[String] identifier[jobId] , identifier[String] identifier[jobGroup] operator[SEP] Keyword[throws] identifier[SchedulerException] {
identifier[quartzScheduler] operator[SEP] identifier[unscheduleJob] operator[SEP] identifier[TriggerKey] operator[SEP] identifier[triggerKey] operator[SEP] identifier[jobId] , identifier[jobGroup] operator[SEP] operator[SEP] operator[SEP]
}
|
@SuppressWarnings("PMD.UseVarargs")
public void add(EventBase<?> event, Channel[] channels) {
add(new EventChannelsTuple(event, channels));
} | class class_name[name] begin[{]
method[add, return_type[void], modifier[public], parameter[event, channels]] begin[{]
call[.add, parameter[ClassCreator(arguments=[MemberReference(member=event, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=channels, 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=EventChannelsTuple, sub_type=None))]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[void] identifier[add] operator[SEP] identifier[EventBase] operator[<] operator[?] operator[>] identifier[event] , identifier[Channel] operator[SEP] operator[SEP] identifier[channels] operator[SEP] {
identifier[add] operator[SEP] Keyword[new] identifier[EventChannelsTuple] operator[SEP] identifier[event] , identifier[channels] operator[SEP] operator[SEP] operator[SEP]
}
|
public static Span[] dropOverlappingSpans(final Span[] spans) {
final List<Span> sortedSpans = new ArrayList<Span>(spans.length);
Collections.addAll(sortedSpans, spans);
Collections.sort(sortedSpans);
final Iterator<Span> it = sortedSpans.iterator();
Span lastSpan = null;
while (it.hasNext()) {
Span span = it.next();
if (lastSpan != null) {
if (lastSpan.intersects(span)) {
it.remove();
span = lastSpan;
}
}
lastSpan = span;
}
return sortedSpans.toArray(new Span[sortedSpans.size()]);
} | class class_name[name] begin[{]
method[dropOverlappingSpans, return_type[type[Span]], modifier[public static], parameter[spans]] begin[{]
local_variable[type[List], sortedSpans]
call[Collections.addAll, parameter[member[.sortedSpans], member[.spans]]]
call[Collections.sort, parameter[member[.sortedSpans]]]
local_variable[type[Iterator], it]
local_variable[type[Span], lastSpan]
while[call[it.hasNext, parameter[]]] begin[{]
local_variable[type[Span], span]
if[binary_operation[member[.lastSpan], !=, literal[null]]] begin[{]
if[call[lastSpan.intersects, parameter[member[.span]]]] begin[{]
call[it.remove, parameter[]]
assign[member[.span], member[.lastSpan]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
assign[member[.lastSpan], member[.span]]
end[}]
return[call[sortedSpans.toArray, parameter[ArrayCreator(dimensions=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=sortedSpans, selectors=[], type_arguments=None)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Span, sub_type=None))]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Span] operator[SEP] operator[SEP] identifier[dropOverlappingSpans] operator[SEP] Keyword[final] identifier[Span] operator[SEP] operator[SEP] identifier[spans] operator[SEP] {
Keyword[final] identifier[List] operator[<] identifier[Span] operator[>] identifier[sortedSpans] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Span] operator[>] operator[SEP] identifier[spans] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[Collections] operator[SEP] identifier[addAll] operator[SEP] identifier[sortedSpans] , identifier[spans] operator[SEP] operator[SEP] identifier[Collections] operator[SEP] identifier[sort] operator[SEP] identifier[sortedSpans] operator[SEP] operator[SEP] Keyword[final] identifier[Iterator] operator[<] identifier[Span] operator[>] identifier[it] operator[=] identifier[sortedSpans] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[Span] identifier[lastSpan] operator[=] Other[null] operator[SEP] Keyword[while] operator[SEP] identifier[it] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[Span] identifier[span] operator[=] identifier[it] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[lastSpan] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[lastSpan] operator[SEP] identifier[intersects] operator[SEP] identifier[span] operator[SEP] operator[SEP] {
identifier[it] operator[SEP] identifier[remove] operator[SEP] operator[SEP] operator[SEP] identifier[span] operator[=] identifier[lastSpan] operator[SEP]
}
}
identifier[lastSpan] operator[=] identifier[span] operator[SEP]
}
Keyword[return] identifier[sortedSpans] operator[SEP] identifier[toArray] operator[SEP] Keyword[new] identifier[Span] operator[SEP] identifier[sortedSpans] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@JsonIgnore
public <E extends HalRepresentation> List<E> getItemsBy(final String rel, final Class<E> asType) {
return getItemsBy(rel).stream().map(asType::cast).collect(toList());
} | class class_name[name] begin[{]
method[getItemsBy, return_type[type[List]], modifier[public], parameter[rel, asType]] begin[{]
return[call[.getItemsBy, parameter[member[.rel]]]]
end[}]
END[}] | annotation[@] identifier[JsonIgnore] Keyword[public] operator[<] identifier[E] Keyword[extends] identifier[HalRepresentation] operator[>] identifier[List] operator[<] identifier[E] operator[>] identifier[getItemsBy] operator[SEP] Keyword[final] identifier[String] identifier[rel] , Keyword[final] identifier[Class] operator[<] identifier[E] operator[>] identifier[asType] operator[SEP] {
Keyword[return] identifier[getItemsBy] operator[SEP] identifier[rel] operator[SEP] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[asType] operator[::] identifier[cast] operator[SEP] operator[SEP] identifier[collect] operator[SEP] identifier[toList] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private static double getBiasL2RegularizationFromConfig(Map<String, Object> layerConfig,
boolean enforceTrainingConfig,
KerasLayerConfiguration conf)
throws UnsupportedKerasConfigurationException, InvalidKerasConfigurationException {
Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, conf);
if (innerConfig.containsKey(conf.getLAYER_FIELD_B_REGULARIZER())) {
Map<String, Object> regularizerConfig =
(Map<String, Object>) innerConfig.get(conf.getLAYER_FIELD_B_REGULARIZER());
if (regularizerConfig != null && regularizerConfig.containsKey(conf.getREGULARIZATION_TYPE_L2()))
throw new UnsupportedKerasConfigurationException("L2 regularization for bias parameter not supported");
}
return 0.0;
} | class class_name[name] begin[{]
method[getBiasL2RegularizationFromConfig, return_type[type[double]], modifier[private static], parameter[layerConfig, enforceTrainingConfig, conf]] begin[{]
local_variable[type[Map], innerConfig]
if[call[innerConfig.containsKey, parameter[call[conf.getLAYER_FIELD_B_REGULARIZER, parameter[]]]]] begin[{]
local_variable[type[Map], regularizerConfig]
if[binary_operation[binary_operation[member[.regularizerConfig], !=, literal[null]], &&, call[regularizerConfig.containsKey, parameter[call[conf.getREGULARIZATION_TYPE_L2, parameter[]]]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="L2 regularization for bias parameter not supported")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UnsupportedKerasConfigurationException, sub_type=None)), label=None)
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[literal[0.0]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[double] identifier[getBiasL2RegularizationFromConfig] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[layerConfig] , Keyword[boolean] identifier[enforceTrainingConfig] , identifier[KerasLayerConfiguration] identifier[conf] operator[SEP] Keyword[throws] identifier[UnsupportedKerasConfigurationException] , identifier[InvalidKerasConfigurationException] {
identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[innerConfig] operator[=] identifier[KerasLayerUtils] operator[SEP] identifier[getInnerLayerConfigFromConfig] operator[SEP] identifier[layerConfig] , identifier[conf] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[innerConfig] operator[SEP] identifier[containsKey] operator[SEP] identifier[conf] operator[SEP] identifier[getLAYER_FIELD_B_REGULARIZER] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[regularizerConfig] operator[=] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] operator[SEP] identifier[innerConfig] operator[SEP] identifier[get] operator[SEP] identifier[conf] operator[SEP] identifier[getLAYER_FIELD_B_REGULARIZER] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[regularizerConfig] operator[!=] Other[null] operator[&&] identifier[regularizerConfig] operator[SEP] identifier[containsKey] operator[SEP] identifier[conf] operator[SEP] identifier[getREGULARIZATION_TYPE_L2] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[UnsupportedKerasConfigurationException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] literal[Float] operator[SEP]
}
|
public static String getSimpleClassName(final Object object) {
return object != null ? object.getClass().getSimpleName() : NULL_STRING;
} | class class_name[name] begin[{]
method[getSimpleClassName, return_type[type[String]], modifier[public static], parameter[object]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=object, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=MemberReference(member=NULL_STRING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=object, selectors=[MethodInvocation(arguments=[], member=getSimpleName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getSimpleClassName] operator[SEP] Keyword[final] identifier[Object] identifier[object] operator[SEP] {
Keyword[return] identifier[object] operator[!=] Other[null] operator[?] identifier[object] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[:] identifier[NULL_STRING] operator[SEP]
}
|
public void marshall(ClusterMetadata clusterMetadata, ProtocolMarshaller protocolMarshaller) {
if (clusterMetadata == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(clusterMetadata.getClusterId(), CLUSTERID_BINDING);
protocolMarshaller.marshall(clusterMetadata.getDescription(), DESCRIPTION_BINDING);
protocolMarshaller.marshall(clusterMetadata.getKmsKeyARN(), KMSKEYARN_BINDING);
protocolMarshaller.marshall(clusterMetadata.getRoleARN(), ROLEARN_BINDING);
protocolMarshaller.marshall(clusterMetadata.getClusterState(), CLUSTERSTATE_BINDING);
protocolMarshaller.marshall(clusterMetadata.getJobType(), JOBTYPE_BINDING);
protocolMarshaller.marshall(clusterMetadata.getSnowballType(), SNOWBALLTYPE_BINDING);
protocolMarshaller.marshall(clusterMetadata.getCreationDate(), CREATIONDATE_BINDING);
protocolMarshaller.marshall(clusterMetadata.getResources(), RESOURCES_BINDING);
protocolMarshaller.marshall(clusterMetadata.getAddressId(), ADDRESSID_BINDING);
protocolMarshaller.marshall(clusterMetadata.getShippingOption(), SHIPPINGOPTION_BINDING);
protocolMarshaller.marshall(clusterMetadata.getNotification(), NOTIFICATION_BINDING);
protocolMarshaller.marshall(clusterMetadata.getForwardingAddressId(), FORWARDINGADDRESSID_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[clusterMetadata, protocolMarshaller]] begin[{]
if[binary_operation[member[.clusterMetadata], ==, 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=getClusterId, postfix_operators=[], prefix_operators=[], qualifier=clusterMetadata, selectors=[], type_arguments=None), MemberReference(member=CLUSTERID_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=getDescription, postfix_operators=[], prefix_operators=[], qualifier=clusterMetadata, selectors=[], type_arguments=None), MemberReference(member=DESCRIPTION_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=getKmsKeyARN, postfix_operators=[], prefix_operators=[], qualifier=clusterMetadata, selectors=[], type_arguments=None), MemberReference(member=KMSKEYARN_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=getRoleARN, postfix_operators=[], prefix_operators=[], qualifier=clusterMetadata, selectors=[], type_arguments=None), MemberReference(member=ROLEARN_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=getClusterState, postfix_operators=[], prefix_operators=[], qualifier=clusterMetadata, selectors=[], type_arguments=None), MemberReference(member=CLUSTERSTATE_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=getJobType, postfix_operators=[], prefix_operators=[], qualifier=clusterMetadata, selectors=[], type_arguments=None), MemberReference(member=JOBTYPE_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=getSnowballType, postfix_operators=[], prefix_operators=[], qualifier=clusterMetadata, selectors=[], type_arguments=None), MemberReference(member=SNOWBALLTYPE_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getCreationDate, postfix_operators=[], prefix_operators=[], qualifier=clusterMetadata, selectors=[], type_arguments=None), MemberReference(member=CREATIONDATE_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getResources, postfix_operators=[], prefix_operators=[], qualifier=clusterMetadata, selectors=[], type_arguments=None), MemberReference(member=RESOURCES_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=getAddressId, postfix_operators=[], prefix_operators=[], qualifier=clusterMetadata, selectors=[], type_arguments=None), MemberReference(member=ADDRESSID_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=getShippingOption, postfix_operators=[], prefix_operators=[], qualifier=clusterMetadata, selectors=[], type_arguments=None), MemberReference(member=SHIPPINGOPTION_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=getNotification, postfix_operators=[], prefix_operators=[], qualifier=clusterMetadata, selectors=[], type_arguments=None), MemberReference(member=NOTIFICATION_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=getForwardingAddressId, postfix_operators=[], prefix_operators=[], qualifier=clusterMetadata, selectors=[], type_arguments=None), MemberReference(member=FORWARDINGADDRESSID_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[ClusterMetadata] identifier[clusterMetadata] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[clusterMetadata] 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[clusterMetadata] operator[SEP] identifier[getClusterId] operator[SEP] operator[SEP] , identifier[CLUSTERID_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[clusterMetadata] operator[SEP] identifier[getDescription] operator[SEP] operator[SEP] , identifier[DESCRIPTION_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[clusterMetadata] operator[SEP] identifier[getKmsKeyARN] operator[SEP] operator[SEP] , identifier[KMSKEYARN_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[clusterMetadata] operator[SEP] identifier[getRoleARN] operator[SEP] operator[SEP] , identifier[ROLEARN_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[clusterMetadata] operator[SEP] identifier[getClusterState] operator[SEP] operator[SEP] , identifier[CLUSTERSTATE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[clusterMetadata] operator[SEP] identifier[getJobType] operator[SEP] operator[SEP] , identifier[JOBTYPE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[clusterMetadata] operator[SEP] identifier[getSnowballType] operator[SEP] operator[SEP] , identifier[SNOWBALLTYPE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[clusterMetadata] operator[SEP] identifier[getCreationDate] operator[SEP] operator[SEP] , identifier[CREATIONDATE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[clusterMetadata] operator[SEP] identifier[getResources] operator[SEP] operator[SEP] , identifier[RESOURCES_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[clusterMetadata] operator[SEP] identifier[getAddressId] operator[SEP] operator[SEP] , identifier[ADDRESSID_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[clusterMetadata] operator[SEP] identifier[getShippingOption] operator[SEP] operator[SEP] , identifier[SHIPPINGOPTION_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[clusterMetadata] operator[SEP] identifier[getNotification] operator[SEP] operator[SEP] , identifier[NOTIFICATION_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[clusterMetadata] operator[SEP] identifier[getForwardingAddressId] operator[SEP] operator[SEP] , identifier[FORWARDINGADDRESSID_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 updateFromEntry(UpdateInodeDirectoryEntry entry) {
if (entry.hasDefaultAcl()) {
setDefaultACL(
(DefaultAccessControlList) ProtoUtils.fromProto(entry.getDefaultAcl()));
}
if (entry.hasDirectChildrenLoaded()) {
setDirectChildrenLoaded(entry.getDirectChildrenLoaded());
}
if (entry.hasMountPoint()) {
setMountPoint(entry.getMountPoint());
}
} | class class_name[name] begin[{]
method[updateFromEntry, return_type[void], modifier[public], parameter[entry]] begin[{]
if[call[entry.hasDefaultAcl, parameter[]]] begin[{]
call[.setDefaultACL, parameter[Cast(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getDefaultAcl, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None)], member=fromProto, postfix_operators=[], prefix_operators=[], qualifier=ProtoUtils, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=DefaultAccessControlList, sub_type=None))]]
else begin[{]
None
end[}]
if[call[entry.hasDirectChildrenLoaded, parameter[]]] begin[{]
call[.setDirectChildrenLoaded, parameter[call[entry.getDirectChildrenLoaded, parameter[]]]]
else begin[{]
None
end[}]
if[call[entry.hasMountPoint, parameter[]]] begin[{]
call[.setMountPoint, parameter[call[entry.getMountPoint, parameter[]]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[updateFromEntry] operator[SEP] identifier[UpdateInodeDirectoryEntry] identifier[entry] operator[SEP] {
Keyword[if] operator[SEP] identifier[entry] operator[SEP] identifier[hasDefaultAcl] operator[SEP] operator[SEP] operator[SEP] {
identifier[setDefaultACL] operator[SEP] operator[SEP] identifier[DefaultAccessControlList] operator[SEP] identifier[ProtoUtils] operator[SEP] identifier[fromProto] operator[SEP] identifier[entry] operator[SEP] identifier[getDefaultAcl] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[entry] operator[SEP] identifier[hasDirectChildrenLoaded] operator[SEP] operator[SEP] operator[SEP] {
identifier[setDirectChildrenLoaded] operator[SEP] identifier[entry] operator[SEP] identifier[getDirectChildrenLoaded] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[entry] operator[SEP] identifier[hasMountPoint] operator[SEP] operator[SEP] operator[SEP] {
identifier[setMountPoint] operator[SEP] identifier[entry] operator[SEP] identifier[getMountPoint] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public void localRollback()
{
log.info("Rollback was called, do rollback on current connection " + con);
if (!this.isInLocalTransaction)
{
throw new PersistenceBrokerException("Not in transaction, cannot abort");
}
try
{
//truncate the local transaction
this.isInLocalTransaction = false;
if(!broker.isManaged())
{
if (batchCon != null)
{
batchCon.rollback();
}
else if (con != null && !con.isClosed())
{
con.rollback();
}
}
else
{
if(log.isEnabledFor(Logger.INFO)) log.info(
"Found managed environment setting in PB, will ignore rollback call on connection, this should be done by JTA");
}
}
catch (SQLException e)
{
log.error("Rollback on the underlying connection failed", e);
}
finally
{
try
{
restoreAutoCommitState();
}
catch(OJBRuntimeException ignore)
{
// Ignore or log exception
}
releaseConnection();
}
} | class class_name[name] begin[{]
method[localRollback, return_type[void], modifier[public], parameter[]] begin[{]
call[log.info, parameter[binary_operation[literal["Rollback was called, do rollback on current connection "], +, member[.con]]]]
if[THIS[member[None.isInLocalTransaction]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Not in transaction, cannot abort")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PersistenceBrokerException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=isInLocalTransaction, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=isManaged, postfix_operators=[], prefix_operators=['!'], qualifier=broker, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=INFO, postfix_operators=[], prefix_operators=[], qualifier=Logger, selectors=[])], member=isEnabledFor, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Found managed environment setting in PB, will ignore rollback call on connection, this should be done by JTA")], member=info, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None))]), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=batchCon, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=con, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[], member=isClosed, postfix_operators=[], prefix_operators=['!'], qualifier=con, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=rollback, postfix_operators=[], prefix_operators=[], qualifier=con, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=rollback, postfix_operators=[], prefix_operators=[], qualifier=batchCon, selectors=[], type_arguments=None), label=None)]))]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Rollback on the underlying connection failed"), 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=['SQLException']))], finally_block=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=restoreAutoCommitState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ignore, types=['OJBRuntimeException']))], finally_block=None, label=None, resources=None), StatementExpression(expression=MethodInvocation(arguments=[], member=releaseConnection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[localRollback] operator[SEP] operator[SEP] {
identifier[log] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[con] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] Keyword[this] operator[SEP] identifier[isInLocalTransaction] operator[SEP] {
Keyword[throw] Keyword[new] identifier[PersistenceBrokerException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
Keyword[this] operator[SEP] identifier[isInLocalTransaction] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[broker] operator[SEP] identifier[isManaged] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[batchCon] operator[!=] Other[null] operator[SEP] {
identifier[batchCon] operator[SEP] identifier[rollback] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[con] operator[!=] Other[null] operator[&&] operator[!] identifier[con] operator[SEP] identifier[isClosed] operator[SEP] operator[SEP] operator[SEP] {
identifier[con] operator[SEP] identifier[rollback] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[log] operator[SEP] identifier[isEnabledFor] operator[SEP] identifier[Logger] operator[SEP] identifier[INFO] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[info] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[SQLException] identifier[e] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[finally] {
Keyword[try] {
identifier[restoreAutoCommitState] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[OJBRuntimeException] identifier[ignore] operator[SEP] {
}
identifier[releaseConnection] operator[SEP] operator[SEP] operator[SEP]
}
}
|
private void setAnchor(GraphicsObject object) {
if (object.hasRole(HasMarker.TYPE)) {
Bbox userBounds = object.getRole(Resizable.TYPE).getUserBounds();
Coordinate midLow = GraphicsUtil.getPosition(userBounds, BboxPosition.MIDDLE_LOW);
Coordinate midLowScreen = getObjectContainer().transform(midLow, RenderSpace.USER, RenderSpace.SCREEN);
Coordinate anchorPos = getObjectContainer()
.transform(new Coordinate(midLowScreen.getX(), midLowScreen.getY() + 20), RenderSpace.SCREEN,
RenderSpace.USER);
object.getRole(HasMarker.TYPE).getMarker().setUserPosition(anchorPos);
}
} | class class_name[name] begin[{]
method[setAnchor, return_type[void], modifier[private], parameter[object]] begin[{]
if[call[object.hasRole, parameter[member[HasMarker.TYPE]]]] begin[{]
local_variable[type[Bbox], userBounds]
local_variable[type[Coordinate], midLow]
local_variable[type[Coordinate], midLowScreen]
local_variable[type[Coordinate], anchorPos]
call[object.getRole, parameter[member[HasMarker.TYPE]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[setAnchor] operator[SEP] identifier[GraphicsObject] identifier[object] operator[SEP] {
Keyword[if] operator[SEP] identifier[object] operator[SEP] identifier[hasRole] operator[SEP] identifier[HasMarker] operator[SEP] identifier[TYPE] operator[SEP] operator[SEP] {
identifier[Bbox] identifier[userBounds] operator[=] identifier[object] operator[SEP] identifier[getRole] operator[SEP] identifier[Resizable] operator[SEP] identifier[TYPE] operator[SEP] operator[SEP] identifier[getUserBounds] operator[SEP] operator[SEP] operator[SEP] identifier[Coordinate] identifier[midLow] operator[=] identifier[GraphicsUtil] operator[SEP] identifier[getPosition] operator[SEP] identifier[userBounds] , identifier[BboxPosition] operator[SEP] identifier[MIDDLE_LOW] operator[SEP] operator[SEP] identifier[Coordinate] identifier[midLowScreen] operator[=] identifier[getObjectContainer] operator[SEP] operator[SEP] operator[SEP] identifier[transform] operator[SEP] identifier[midLow] , identifier[RenderSpace] operator[SEP] identifier[USER] , identifier[RenderSpace] operator[SEP] identifier[SCREEN] operator[SEP] operator[SEP] identifier[Coordinate] identifier[anchorPos] operator[=] identifier[getObjectContainer] operator[SEP] operator[SEP] operator[SEP] identifier[transform] operator[SEP] Keyword[new] identifier[Coordinate] operator[SEP] identifier[midLowScreen] operator[SEP] identifier[getX] operator[SEP] operator[SEP] , identifier[midLowScreen] operator[SEP] identifier[getY] operator[SEP] operator[SEP] operator[+] Other[20] operator[SEP] , identifier[RenderSpace] operator[SEP] identifier[SCREEN] , identifier[RenderSpace] operator[SEP] identifier[USER] operator[SEP] operator[SEP] identifier[object] operator[SEP] identifier[getRole] operator[SEP] identifier[HasMarker] operator[SEP] identifier[TYPE] operator[SEP] operator[SEP] identifier[getMarker] operator[SEP] operator[SEP] operator[SEP] identifier[setUserPosition] operator[SEP] identifier[anchorPos] operator[SEP] operator[SEP]
}
}
|
public AsciiSequenceView wrap(final DirectBuffer buffer, final int offset, final int length)
{
this.buffer = buffer;
this.offset = offset;
this.length = length;
return this;
} | class class_name[name] begin[{]
method[wrap, return_type[type[AsciiSequenceView]], modifier[public], parameter[buffer, offset, length]] begin[{]
assign[THIS[member[None.buffer]], member[.buffer]]
assign[THIS[member[None.offset]], member[.offset]]
assign[THIS[member[None.length]], member[.length]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[AsciiSequenceView] identifier[wrap] operator[SEP] Keyword[final] identifier[DirectBuffer] identifier[buffer] , Keyword[final] Keyword[int] identifier[offset] , Keyword[final] Keyword[int] identifier[length] operator[SEP] {
Keyword[this] operator[SEP] identifier[buffer] operator[=] identifier[buffer] operator[SEP] Keyword[this] operator[SEP] identifier[offset] operator[=] identifier[offset] operator[SEP] Keyword[this] operator[SEP] identifier[length] operator[=] identifier[length] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public static String replaceAll(
String pattern, CharSequence input, String replacement) {
input = new InterruptibleCharSequence(input);
Matcher m = getMatcher(pattern, input);
String res = m.replaceAll(replacement);
recycleMatcher(m);
return res;
} | class class_name[name] begin[{]
method[replaceAll, return_type[type[String]], modifier[public static], parameter[pattern, input, replacement]] begin[{]
assign[member[.input], ClassCreator(arguments=[MemberReference(member=input, 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=InterruptibleCharSequence, sub_type=None))]
local_variable[type[Matcher], m]
local_variable[type[String], res]
call[.recycleMatcher, parameter[member[.m]]]
return[member[.res]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[replaceAll] operator[SEP] identifier[String] identifier[pattern] , identifier[CharSequence] identifier[input] , identifier[String] identifier[replacement] operator[SEP] {
identifier[input] operator[=] Keyword[new] identifier[InterruptibleCharSequence] operator[SEP] identifier[input] operator[SEP] operator[SEP] identifier[Matcher] identifier[m] operator[=] identifier[getMatcher] operator[SEP] identifier[pattern] , identifier[input] operator[SEP] operator[SEP] identifier[String] identifier[res] operator[=] identifier[m] operator[SEP] identifier[replaceAll] operator[SEP] identifier[replacement] operator[SEP] operator[SEP] identifier[recycleMatcher] operator[SEP] identifier[m] operator[SEP] operator[SEP] Keyword[return] identifier[res] operator[SEP]
}
|
boolean requestAccounts(Callback callback) {
boolean isSuccessful = false;
Session session = Session.getActiveSession();
if (session != null && session.isOpened()) {
// Construct fields to request.
Bundle params = new Bundle();
params.putString(ACCOUNTS_LISTING_FEILDS_KEY, ACCOUNTS_LISTING_FIELDS_VALUE);
// Construct and execute albums listing request.
Request request = new Request(session, ACCOUNTS_LISTING_GRAPH_PATH, params, HttpMethod.GET, callback);
request.executeAsync();
isSuccessful = true;
}
return isSuccessful;
} | class class_name[name] begin[{]
method[requestAccounts, return_type[type[boolean]], modifier[default], parameter[callback]] begin[{]
local_variable[type[boolean], isSuccessful]
local_variable[type[Session], session]
if[binary_operation[binary_operation[member[.session], !=, literal[null]], &&, call[session.isOpened, parameter[]]]] begin[{]
local_variable[type[Bundle], params]
call[params.putString, parameter[member[.ACCOUNTS_LISTING_FEILDS_KEY], member[.ACCOUNTS_LISTING_FIELDS_VALUE]]]
local_variable[type[Request], request]
call[request.executeAsync, parameter[]]
assign[member[.isSuccessful], literal[true]]
else begin[{]
None
end[}]
return[member[.isSuccessful]]
end[}]
END[}] | Keyword[boolean] identifier[requestAccounts] operator[SEP] identifier[Callback] identifier[callback] operator[SEP] {
Keyword[boolean] identifier[isSuccessful] operator[=] literal[boolean] operator[SEP] identifier[Session] identifier[session] operator[=] identifier[Session] operator[SEP] identifier[getActiveSession] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[session] operator[!=] Other[null] operator[&&] identifier[session] operator[SEP] identifier[isOpened] operator[SEP] operator[SEP] operator[SEP] {
identifier[Bundle] identifier[params] operator[=] Keyword[new] identifier[Bundle] operator[SEP] operator[SEP] operator[SEP] identifier[params] operator[SEP] identifier[putString] operator[SEP] identifier[ACCOUNTS_LISTING_FEILDS_KEY] , identifier[ACCOUNTS_LISTING_FIELDS_VALUE] operator[SEP] operator[SEP] identifier[Request] identifier[request] operator[=] Keyword[new] identifier[Request] operator[SEP] identifier[session] , identifier[ACCOUNTS_LISTING_GRAPH_PATH] , identifier[params] , identifier[HttpMethod] operator[SEP] identifier[GET] , identifier[callback] operator[SEP] operator[SEP] identifier[request] operator[SEP] identifier[executeAsync] operator[SEP] operator[SEP] operator[SEP] identifier[isSuccessful] operator[=] literal[boolean] operator[SEP]
}
Keyword[return] identifier[isSuccessful] operator[SEP]
}
|
protected void startPrefixMapping(String prefix, String namespace) throws SAXException {
if (getContentHandler() != null) {
if (prefix == null) {
prefix = "";
}
if (!StringUtils.hasLength(namespace)) {
return;
}
if (!namespace.equals(namespaces.get(prefix))) {
getContentHandler().startPrefixMapping(prefix, namespace);
namespaces.put(prefix, namespace);
}
}
} | class class_name[name] begin[{]
method[startPrefixMapping, return_type[void], modifier[protected], parameter[prefix, namespace]] begin[{]
if[binary_operation[call[.getContentHandler, parameter[]], !=, literal[null]]] begin[{]
if[binary_operation[member[.prefix], ==, literal[null]]] begin[{]
assign[member[.prefix], literal[""]]
else begin[{]
None
end[}]
if[call[StringUtils.hasLength, parameter[member[.namespace]]]] begin[{]
return[None]
else begin[{]
None
end[}]
if[call[namespace.equals, parameter[call[namespaces.get, parameter[member[.prefix]]]]]] begin[{]
call[.getContentHandler, parameter[]]
call[namespaces.put, parameter[member[.prefix], member[.namespace]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[startPrefixMapping] operator[SEP] identifier[String] identifier[prefix] , identifier[String] identifier[namespace] operator[SEP] Keyword[throws] identifier[SAXException] {
Keyword[if] operator[SEP] identifier[getContentHandler] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[prefix] operator[==] Other[null] operator[SEP] {
identifier[prefix] operator[=] literal[String] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[StringUtils] operator[SEP] identifier[hasLength] operator[SEP] identifier[namespace] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[namespace] operator[SEP] identifier[equals] operator[SEP] identifier[namespaces] operator[SEP] identifier[get] operator[SEP] identifier[prefix] operator[SEP] operator[SEP] operator[SEP] {
identifier[getContentHandler] operator[SEP] operator[SEP] operator[SEP] identifier[startPrefixMapping] operator[SEP] identifier[prefix] , identifier[namespace] operator[SEP] operator[SEP] identifier[namespaces] operator[SEP] identifier[put] operator[SEP] identifier[prefix] , identifier[namespace] operator[SEP] operator[SEP]
}
}
}
|
public RFuture<ByteBuffer> getBytes (final String path) {
final RPromise<ByteBuffer> result = exec.deferredPromise();
exec.invokeAsync(new Runnable() {
public void run () {
try {
result.succeed(getBytesSync(path));
} catch (Throwable t) {
result.fail(t);
}
}
});
return result;
} | class class_name[name] begin[{]
method[getBytes, return_type[type[RFuture]], modifier[public], parameter[path]] begin[{]
local_variable[type[RPromise], result]
call[exec.invokeAsync, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[], body=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getBytesSync, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=succeed, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=fail, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=t, 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))]]
return[member[.result]]
end[}]
END[}] | Keyword[public] identifier[RFuture] operator[<] identifier[ByteBuffer] operator[>] identifier[getBytes] operator[SEP] Keyword[final] identifier[String] identifier[path] operator[SEP] {
Keyword[final] identifier[RPromise] operator[<] identifier[ByteBuffer] operator[>] identifier[result] operator[=] identifier[exec] operator[SEP] identifier[deferredPromise] operator[SEP] operator[SEP] operator[SEP] identifier[exec] operator[SEP] identifier[invokeAsync] operator[SEP] Keyword[new] identifier[Runnable] operator[SEP] operator[SEP] {
Keyword[public] Keyword[void] identifier[run] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[result] operator[SEP] identifier[succeed] operator[SEP] identifier[getBytesSync] operator[SEP] identifier[path] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
identifier[result] operator[SEP] identifier[fail] operator[SEP] identifier[t] operator[SEP] operator[SEP]
}
}
} operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
public void writeExternal(PofWriter writer)
throws IOException {
super.writeExternal(writer);
writer.writeObject(10, numInc);
writer.writeBoolean(11, fPostInc);
} | class class_name[name] begin[{]
method[writeExternal, return_type[void], modifier[public], parameter[writer]] begin[{]
SuperMethodInvocation(arguments=[MemberReference(member=writer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeExternal, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
call[writer.writeObject, parameter[literal[10], member[.numInc]]]
call[writer.writeBoolean, parameter[literal[11], member[.fPostInc]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[writeExternal] operator[SEP] identifier[PofWriter] identifier[writer] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[super] operator[SEP] identifier[writeExternal] operator[SEP] identifier[writer] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[writeObject] operator[SEP] Other[10] , identifier[numInc] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[writeBoolean] operator[SEP] Other[11] , identifier[fPostInc] operator[SEP] operator[SEP]
}
|
protected final FilterBeanDescriptor<?, ?> getFilterBeanDescriptorForClassUnbounded(Class<?> filterClass) {
for (FilterBeanDescriptor<?, ?> descriptor : getFilterBeanDescriptors()) {
if (filterClass == descriptor.getComponentClass()) {
return descriptor;
}
}
return notFoundFilter(filterClass);
} | class class_name[name] begin[{]
method[getFilterBeanDescriptorForClassUnbounded, return_type[type[FilterBeanDescriptor]], modifier[final protected], parameter[filterClass]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=filterClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getComponentClass, postfix_operators=[], prefix_operators=[], qualifier=descriptor, selectors=[], type_arguments=None), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=descriptor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getFilterBeanDescriptors, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=descriptor)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None), TypeArgument(pattern_type=?, type=None)], dimensions=[], name=FilterBeanDescriptor, sub_type=None))), label=None)
return[call[.notFoundFilter, parameter[member[.filterClass]]]]
end[}]
END[}] | Keyword[protected] Keyword[final] identifier[FilterBeanDescriptor] operator[<] operator[?] , operator[?] operator[>] identifier[getFilterBeanDescriptorForClassUnbounded] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[filterClass] operator[SEP] {
Keyword[for] operator[SEP] identifier[FilterBeanDescriptor] operator[<] operator[?] , operator[?] operator[>] identifier[descriptor] operator[:] identifier[getFilterBeanDescriptors] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[filterClass] operator[==] identifier[descriptor] operator[SEP] identifier[getComponentClass] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[descriptor] operator[SEP]
}
}
Keyword[return] identifier[notFoundFilter] operator[SEP] identifier[filterClass] operator[SEP] operator[SEP]
}
|
public static Specification<JpaTarget> hasInstalledOrAssignedDistributionSet(@NotNull final Long distributionId) {
return (targetRoot, query, cb) -> cb.or(
cb.equal(targetRoot.get(JpaTarget_.installedDistributionSet).get(JpaDistributionSet_.id),
distributionId),
cb.equal(targetRoot.<JpaDistributionSet> get(JpaTarget_.assignedDistributionSet)
.get(JpaDistributionSet_.id), distributionId));
} | class class_name[name] begin[{]
method[hasInstalledOrAssignedDistributionSet, return_type[type[Specification]], modifier[public static], parameter[distributionId]] begin[{]
return[LambdaExpression(body=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=installedDistributionSet, postfix_operators=[], prefix_operators=[], qualifier=JpaTarget_, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=targetRoot, selectors=[MethodInvocation(arguments=[MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=JpaDistributionSet_, selectors=[])], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MemberReference(member=distributionId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equal, postfix_operators=[], prefix_operators=[], qualifier=cb, selectors=[], type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=assignedDistributionSet, postfix_operators=[], prefix_operators=[], qualifier=JpaTarget_, selectors=[])], member=targetRoot, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=JpaDistributionSet_, selectors=[])], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=JpaDistributionSet, sub_type=None))]), MemberReference(member=distributionId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equal, postfix_operators=[], prefix_operators=[], qualifier=cb, selectors=[], type_arguments=None)], member=or, postfix_operators=[], prefix_operators=[], qualifier=cb, selectors=[], type_arguments=None), parameters=[InferredFormalParameter(name=targetRoot), InferredFormalParameter(name=query), InferredFormalParameter(name=cb)])]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Specification] operator[<] identifier[JpaTarget] operator[>] identifier[hasInstalledOrAssignedDistributionSet] operator[SEP] annotation[@] identifier[NotNull] Keyword[final] identifier[Long] identifier[distributionId] operator[SEP] {
Keyword[return] operator[SEP] identifier[targetRoot] , identifier[query] , identifier[cb] operator[SEP] operator[->] identifier[cb] operator[SEP] identifier[or] operator[SEP] identifier[cb] operator[SEP] identifier[equal] operator[SEP] identifier[targetRoot] operator[SEP] identifier[get] operator[SEP] identifier[JpaTarget_] operator[SEP] identifier[installedDistributionSet] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[JpaDistributionSet_] operator[SEP] identifier[id] operator[SEP] , identifier[distributionId] operator[SEP] , identifier[cb] operator[SEP] identifier[equal] operator[SEP] identifier[targetRoot] operator[SEP] operator[<] identifier[JpaDistributionSet] operator[>] identifier[get] operator[SEP] identifier[JpaTarget_] operator[SEP] identifier[assignedDistributionSet] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[JpaDistributionSet_] operator[SEP] identifier[id] operator[SEP] , identifier[distributionId] operator[SEP] operator[SEP] operator[SEP]
}
|
public String getMessage() {
StringBuffer result = new StringBuffer();
Iterator<IOException> itr = problems.iterator();
while(itr.hasNext()) {
result.append(itr.next().getMessage());
if (itr.hasNext()) {
result.append("\n");
}
}
return result.toString();
} | class class_name[name] begin[{]
method[getMessage, return_type[type[String]], modifier[public], parameter[]] begin[{]
local_variable[type[StringBuffer], result]
local_variable[type[Iterator], itr]
while[call[itr.hasNext, parameter[]]] begin[{]
call[result.append, parameter[call[itr.next, parameter[]]]]
if[call[itr.hasNext, parameter[]]] begin[{]
call[result.append, parameter[literal["\n"]]]
else begin[{]
None
end[}]
end[}]
return[call[result.toString, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getMessage] operator[SEP] operator[SEP] {
identifier[StringBuffer] identifier[result] operator[=] Keyword[new] identifier[StringBuffer] operator[SEP] operator[SEP] operator[SEP] identifier[Iterator] operator[<] identifier[IOException] operator[>] identifier[itr] operator[=] identifier[problems] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[itr] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[result] operator[SEP] identifier[append] operator[SEP] identifier[itr] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[itr] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[result] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[result] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
protected void addField(FieldEditor editor) {
if (fields == null) {
fields = new ArrayList<FieldEditor>();
}
// Set the actual preference name based on the current selection
// in the Kie Navigator tree view. The preference name is constructed
// from the path to the selected tree node by getPreferenceName().
String name = editor.getPreferenceName();
editor.setPreferenceName(getPreferenceName(name));
fields.add(editor);
} | class class_name[name] begin[{]
method[addField, return_type[void], modifier[protected], parameter[editor]] begin[{]
if[binary_operation[member[.fields], ==, literal[null]]] begin[{]
assign[member[.fields], 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=FieldEditor, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[String], name]
call[editor.setPreferenceName, parameter[call[.getPreferenceName, parameter[member[.name]]]]]
call[fields.add, parameter[member[.editor]]]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[addField] operator[SEP] identifier[FieldEditor] identifier[editor] operator[SEP] {
Keyword[if] operator[SEP] identifier[fields] operator[==] Other[null] operator[SEP] {
identifier[fields] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[FieldEditor] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
identifier[String] identifier[name] operator[=] identifier[editor] operator[SEP] identifier[getPreferenceName] operator[SEP] operator[SEP] operator[SEP] identifier[editor] operator[SEP] identifier[setPreferenceName] operator[SEP] identifier[getPreferenceName] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] identifier[fields] operator[SEP] identifier[add] operator[SEP] identifier[editor] operator[SEP] operator[SEP]
}
|
public final void addChildAfter(Node newChild, @Nullable Node node) {
checkArgument(newChild.next == null, "The new child node has next siblings.");
checkArgument(newChild.previous == null, "The new child node has previous siblings.");
// NOTE: newChild.next remains null
newChild.previous = newChild;
addChildrenAfter(newChild, node);
} | class class_name[name] begin[{]
method[addChildAfter, return_type[void], modifier[final public], parameter[newChild, node]] begin[{]
call[.checkArgument, parameter[binary_operation[member[newChild.next], ==, literal[null]], literal["The new child node has next siblings."]]]
call[.checkArgument, parameter[binary_operation[member[newChild.previous], ==, literal[null]], literal["The new child node has previous siblings."]]]
assign[member[newChild.previous], member[.newChild]]
call[.addChildrenAfter, parameter[member[.newChild], member[.node]]]
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[void] identifier[addChildAfter] operator[SEP] identifier[Node] identifier[newChild] , annotation[@] identifier[Nullable] identifier[Node] identifier[node] operator[SEP] {
identifier[checkArgument] operator[SEP] identifier[newChild] operator[SEP] identifier[next] operator[==] Other[null] , literal[String] operator[SEP] operator[SEP] identifier[checkArgument] operator[SEP] identifier[newChild] operator[SEP] identifier[previous] operator[==] Other[null] , literal[String] operator[SEP] operator[SEP] identifier[newChild] operator[SEP] identifier[previous] operator[=] identifier[newChild] operator[SEP] identifier[addChildrenAfter] operator[SEP] identifier[newChild] , identifier[node] operator[SEP] operator[SEP]
}
|
@Override
public GetSubscriptionStateResult getSubscriptionState(GetSubscriptionStateRequest request) {
request = beforeClientExecution(request);
return executeGetSubscriptionState(request);
} | class class_name[name] begin[{]
method[getSubscriptionState, return_type[type[GetSubscriptionStateResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeGetSubscriptionState, parameter[member[.request]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[GetSubscriptionStateResult] identifier[getSubscriptionState] operator[SEP] identifier[GetSubscriptionStateRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeGetSubscriptionState] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
@Override
public List<Image> getImageBulk(ImagePlotShape shape, Double sparsity, Model... models)
throws JsonProcessingException, ApiException {
return getImageBulk(null, null, shape, sparsity, models);
} | class class_name[name] begin[{]
method[getImageBulk, return_type[type[List]], modifier[public], parameter[shape, sparsity, models]] begin[{]
return[call[.getImageBulk, parameter[literal[null], literal[null], member[.shape], member[.sparsity], member[.models]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[List] operator[<] identifier[Image] operator[>] identifier[getImageBulk] operator[SEP] identifier[ImagePlotShape] identifier[shape] , identifier[Double] identifier[sparsity] , identifier[Model] operator[...] identifier[models] operator[SEP] Keyword[throws] identifier[JsonProcessingException] , identifier[ApiException] {
Keyword[return] identifier[getImageBulk] operator[SEP] Other[null] , Other[null] , identifier[shape] , identifier[sparsity] , identifier[models] operator[SEP] operator[SEP]
}
|
private JSONArray mapRelations(String oid) {
// We want our parsed data for reading
JsonSimple formData = parsedFormData(oid);
if (formData == null) {
log.error("Error parsing form data");
return null;
}
// And raw data to see existing relations and write new ones
JsonSimple rawData = getDataFromStorage(oid);
if (rawData == null) {
log.error("Error reading data from storage");
return null;
}
// Existing relationship data
JSONArray relations = rawData.writeArray("relationships");
boolean changed = false;
// For all configured relationships
for (String baseField : relationFields.keySet()) {
JsonSimple relationConfig = relationFields.get(baseField);
// Find the path we need to look under for our related object
List<String> basePath = relationConfig.getStringList("path");
if (basePath == null || basePath.isEmpty()) {
log.error("Ignoring invalid relationship '{}'. No 'path'"
+ " provided in configuration", baseField);
continue;
}
// Get our base object
Object object = formData.getPath(basePath.toArray());
if (object instanceof JsonObject) {
// And process it
JsonObject newRelation = lookForRelation(oid, baseField,
relationConfig, new JsonSimple((JsonObject) object));
if (newRelation != null
&& !isKnownRelation(relations, newRelation)) {
log.info("Adding relation: '{}' => '{}'", baseField,
newRelation.get("identifier"));
relations.add(newRelation);
changed = true;
}
}
// If base path points at an array
if (object instanceof JSONArray) {
// Try every entry
for (Object loopObject : (JSONArray) object) {
if (loopObject instanceof JsonObject) {
JsonObject newRelation = lookForRelation(oid,
baseField, relationConfig, new JsonSimple(
(JsonObject) loopObject));
if (newRelation != null
&& !isKnownRelation(relations, newRelation)) {
log.info("Adding relation: '{}' => '{}'",
baseField, newRelation.get("identifier"));
relations.add(newRelation);
changed = true;
}
}
}
}
}
// Do we need to store our object again?
if (changed) {
try {
saveObjectData(rawData, oid);
} catch (TransactionException ex) {
log.error("Error updating object '{}' in storage: ", oid, ex);
return null;
}
}
return relations;
} | class class_name[name] begin[{]
method[mapRelations, return_type[type[JSONArray]], modifier[private], parameter[oid]] begin[{]
local_variable[type[JsonSimple], formData]
if[binary_operation[member[.formData], ==, literal[null]]] begin[{]
call[log.error, parameter[literal["Error parsing form data"]]]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[JsonSimple], rawData]
if[binary_operation[member[.rawData], ==, literal[null]]] begin[{]
call[log.error, parameter[literal["Error reading data from storage"]]]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[JSONArray], relations]
local_variable[type[boolean], changed]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=baseField, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=relationFields, selectors=[], type_arguments=None), name=relationConfig)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JsonSimple, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="path")], member=getStringList, postfix_operators=[], prefix_operators=[], qualifier=relationConfig, selectors=[], type_arguments=None), name=basePath)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=List, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=basePath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operandr=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=[], qualifier=basePath, selectors=[], type_arguments=None), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Ignoring invalid relationship '{}'. No 'path'"), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" provided in configuration"), operator=+), MemberReference(member=baseField, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toArray, postfix_operators=[], prefix_operators=[], qualifier=basePath, selectors=[], type_arguments=None)], member=getPath, postfix_operators=[], prefix_operators=[], qualifier=formData, selectors=[], type_arguments=None), name=object)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=object, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=JsonObject, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=oid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=baseField, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=relationConfig, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[Cast(expression=MemberReference(member=object, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=JsonObject, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JsonSimple, sub_type=None))], member=lookForRelation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=newRelation)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JsonObject, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=newRelation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[MemberReference(member=relations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newRelation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isKnownRelation, 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=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Adding relation: '{}' => '{}'"), MemberReference(member=baseField, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="identifier")], member=get, postfix_operators=[], prefix_operators=[], qualifier=newRelation, selectors=[], type_arguments=None)], member=info, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=newRelation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=relations, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=changed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)]))])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=object, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=JSONArray, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=loopObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=JsonObject, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=oid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=baseField, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=relationConfig, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[Cast(expression=MemberReference(member=loopObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=JsonObject, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JsonSimple, sub_type=None))], member=lookForRelation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=newRelation)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JsonObject, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=newRelation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[MemberReference(member=relations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newRelation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isKnownRelation, 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=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Adding relation: '{}' => '{}'"), MemberReference(member=baseField, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="identifier")], member=get, postfix_operators=[], prefix_operators=[], qualifier=newRelation, selectors=[], type_arguments=None)], member=info, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=newRelation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=relations, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=changed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)]))]))]), control=EnhancedForControl(iterable=Cast(expression=MemberReference(member=object, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=JSONArray, sub_type=None)), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=loopObject)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=relationFields, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=baseField)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
if[member[.changed]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=rawData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=oid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=saveObjectData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error updating object '{}' in storage: "), MemberReference(member=oid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=log, 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=['TransactionException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
return[member[.relations]]
end[}]
END[}] | Keyword[private] identifier[JSONArray] identifier[mapRelations] operator[SEP] identifier[String] identifier[oid] operator[SEP] {
identifier[JsonSimple] identifier[formData] operator[=] identifier[parsedFormData] operator[SEP] identifier[oid] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[formData] operator[==] Other[null] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
identifier[JsonSimple] identifier[rawData] operator[=] identifier[getDataFromStorage] operator[SEP] identifier[oid] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[rawData] operator[==] Other[null] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
identifier[JSONArray] identifier[relations] operator[=] identifier[rawData] operator[SEP] identifier[writeArray] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[boolean] identifier[changed] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[baseField] operator[:] identifier[relationFields] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[JsonSimple] identifier[relationConfig] operator[=] identifier[relationFields] operator[SEP] identifier[get] operator[SEP] identifier[baseField] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[basePath] operator[=] identifier[relationConfig] operator[SEP] identifier[getStringList] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[basePath] operator[==] Other[null] operator[||] identifier[basePath] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] literal[String] , identifier[baseField] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
identifier[Object] identifier[object] operator[=] identifier[formData] operator[SEP] identifier[getPath] operator[SEP] identifier[basePath] operator[SEP] identifier[toArray] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[object] Keyword[instanceof] identifier[JsonObject] operator[SEP] {
identifier[JsonObject] identifier[newRelation] operator[=] identifier[lookForRelation] operator[SEP] identifier[oid] , identifier[baseField] , identifier[relationConfig] , Keyword[new] identifier[JsonSimple] operator[SEP] operator[SEP] identifier[JsonObject] operator[SEP] identifier[object] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[newRelation] operator[!=] Other[null] operator[&&] operator[!] identifier[isKnownRelation] operator[SEP] identifier[relations] , identifier[newRelation] operator[SEP] operator[SEP] {
identifier[log] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[baseField] , identifier[newRelation] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[relations] operator[SEP] identifier[add] operator[SEP] identifier[newRelation] operator[SEP] operator[SEP] identifier[changed] operator[=] literal[boolean] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[object] Keyword[instanceof] identifier[JSONArray] operator[SEP] {
Keyword[for] operator[SEP] identifier[Object] identifier[loopObject] operator[:] operator[SEP] identifier[JSONArray] operator[SEP] identifier[object] operator[SEP] {
Keyword[if] operator[SEP] identifier[loopObject] Keyword[instanceof] identifier[JsonObject] operator[SEP] {
identifier[JsonObject] identifier[newRelation] operator[=] identifier[lookForRelation] operator[SEP] identifier[oid] , identifier[baseField] , identifier[relationConfig] , Keyword[new] identifier[JsonSimple] operator[SEP] operator[SEP] identifier[JsonObject] operator[SEP] identifier[loopObject] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[newRelation] operator[!=] Other[null] operator[&&] operator[!] identifier[isKnownRelation] operator[SEP] identifier[relations] , identifier[newRelation] operator[SEP] operator[SEP] {
identifier[log] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[baseField] , identifier[newRelation] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[relations] operator[SEP] identifier[add] operator[SEP] identifier[newRelation] operator[SEP] operator[SEP] identifier[changed] operator[=] literal[boolean] operator[SEP]
}
}
}
}
}
Keyword[if] operator[SEP] identifier[changed] operator[SEP] {
Keyword[try] {
identifier[saveObjectData] operator[SEP] identifier[rawData] , identifier[oid] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[TransactionException] identifier[ex] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[oid] , identifier[ex] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
}
Keyword[return] identifier[relations] operator[SEP]
}
|
public List<GitlabJob> getPipelineJobs(GitlabProject project, Integer pipelineId) {
return getPipelineJobs(project.getId(), pipelineId);
} | class class_name[name] begin[{]
method[getPipelineJobs, return_type[type[List]], modifier[public], parameter[project, pipelineId]] begin[{]
return[call[.getPipelineJobs, parameter[call[project.getId, parameter[]], member[.pipelineId]]]]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[GitlabJob] operator[>] identifier[getPipelineJobs] operator[SEP] identifier[GitlabProject] identifier[project] , identifier[Integer] identifier[pipelineId] operator[SEP] {
Keyword[return] identifier[getPipelineJobs] operator[SEP] identifier[project] operator[SEP] identifier[getId] operator[SEP] operator[SEP] , identifier[pipelineId] operator[SEP] operator[SEP]
}
|
private void createCvt(FontFileReader in) throws IOException {
TTFDirTabEntry entry = (TTFDirTabEntry)dirTabs.get("cvt ");
if (entry != null) {
pad4();
seekTab(in, "cvt ", 0);
System.arraycopy(in.getBytes((int)entry.getOffset(), (int)entry.getLength()),
0, output, currentPos, (int)entry.getLength());
int checksum = getCheckSum(currentPos, (int)entry.getLength());
writeULong(cvtDirOffset, checksum);
writeULong(cvtDirOffset + 4, currentPos);
writeULong(cvtDirOffset + 8, (int)entry.getLength());
currentPos += (int)entry.getLength();
realSize += (int)entry.getLength();
} else {
throw new IOException("Can't find cvt table");
}
} | class class_name[name] begin[{]
method[createCvt, return_type[void], modifier[private], parameter[in]] begin[{]
local_variable[type[TTFDirTabEntry], entry]
if[binary_operation[member[.entry], !=, literal[null]]] begin[{]
call[.pad4, parameter[]]
call[.seekTab, parameter[member[.in], literal["cvt "], literal[0]]]
call[System.arraycopy, parameter[call[in.getBytes, parameter[Cast(expression=MethodInvocation(arguments=[], member=getOffset, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=int)), Cast(expression=MethodInvocation(arguments=[], member=getLength, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=int))]], literal[0], member[.output], member[.currentPos], Cast(expression=MethodInvocation(arguments=[], member=getLength, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=int))]]
local_variable[type[int], checksum]
call[.writeULong, parameter[member[.cvtDirOffset], member[.checksum]]]
call[.writeULong, parameter[binary_operation[member[.cvtDirOffset], +, literal[4]], member[.currentPos]]]
call[.writeULong, parameter[binary_operation[member[.cvtDirOffset], +, literal[8]], Cast(expression=MethodInvocation(arguments=[], member=getLength, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=int))]]
assign[member[.currentPos], Cast(expression=MethodInvocation(arguments=[], member=getLength, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=int))]
assign[member[.realSize], Cast(expression=MethodInvocation(arguments=[], member=getLength, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=int))]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Can't find cvt table")], 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)
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[createCvt] operator[SEP] identifier[FontFileReader] identifier[in] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[TTFDirTabEntry] identifier[entry] operator[=] operator[SEP] identifier[TTFDirTabEntry] operator[SEP] identifier[dirTabs] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[entry] operator[!=] Other[null] operator[SEP] {
identifier[pad4] operator[SEP] operator[SEP] operator[SEP] identifier[seekTab] operator[SEP] identifier[in] , literal[String] , Other[0] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[in] operator[SEP] identifier[getBytes] operator[SEP] operator[SEP] Keyword[int] operator[SEP] identifier[entry] operator[SEP] identifier[getOffset] operator[SEP] operator[SEP] , operator[SEP] Keyword[int] operator[SEP] identifier[entry] operator[SEP] identifier[getLength] operator[SEP] operator[SEP] operator[SEP] , Other[0] , identifier[output] , identifier[currentPos] , operator[SEP] Keyword[int] operator[SEP] identifier[entry] operator[SEP] identifier[getLength] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[checksum] operator[=] identifier[getCheckSum] operator[SEP] identifier[currentPos] , operator[SEP] Keyword[int] operator[SEP] identifier[entry] operator[SEP] identifier[getLength] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[writeULong] operator[SEP] identifier[cvtDirOffset] , identifier[checksum] operator[SEP] operator[SEP] identifier[writeULong] operator[SEP] identifier[cvtDirOffset] operator[+] Other[4] , identifier[currentPos] operator[SEP] operator[SEP] identifier[writeULong] operator[SEP] identifier[cvtDirOffset] operator[+] Other[8] , operator[SEP] Keyword[int] operator[SEP] identifier[entry] operator[SEP] identifier[getLength] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[currentPos] operator[+=] operator[SEP] Keyword[int] operator[SEP] identifier[entry] operator[SEP] identifier[getLength] operator[SEP] operator[SEP] operator[SEP] identifier[realSize] operator[+=] operator[SEP] Keyword[int] operator[SEP] identifier[entry] operator[SEP] identifier[getLength] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
|
public static Object toPrimitiveArray(Object[] array) {
Class primitiveType;
if (array.length > 0) {
LOG.debug("很可能array是用new Object[length]()构造的,这个时候array.getClass().getComponentType()返回的是Object类型,这不是我们期望的" +
"我们希望使用元素的实际类型,这里有一个风险点,即数组类型不一致,后面可能就会抛出类型转换异常");
primitiveType = Reflection.getPrimitiveType(array[0].getClass());
} else {
primitiveType = Reflection.getPrimitiveType(array.getClass().getComponentType());
}
Object primitiveArray = Array.newInstance(primitiveType, array.length);
for (int i = 0; i < array.length; i++) {
Array.set(primitiveArray, i, array[i]);
}
return primitiveArray;
} | class class_name[name] begin[{]
method[toPrimitiveArray, return_type[type[Object]], modifier[public static], parameter[array]] begin[{]
local_variable[type[Class], primitiveType]
if[binary_operation[member[array.length], >, literal[0]]] begin[{]
call[LOG.debug, parameter[binary_operation[literal["很可能array是用new Object[length]()构造的,这个时候array.getClass().getComponentType()返回的是Object类型,这不是我们期望的"], +, literal["我们希望使用元素的实际类型,这里有一个风险点,即数组类型不一致,后面可能就会抛出类型转换异常"]]]]
assign[member[.primitiveType], call[Reflection.getPrimitiveType, parameter[member[.array]]]]
else begin[{]
assign[member[.primitiveType], call[Reflection.getPrimitiveType, parameter[call[array.getClass, parameter[]]]]]
end[}]
local_variable[type[Object], primitiveArray]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=primitiveArray, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=array, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=set, postfix_operators=[], prefix_operators=[], qualifier=Array, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=array, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.primitiveArray]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Object] identifier[toPrimitiveArray] operator[SEP] identifier[Object] operator[SEP] operator[SEP] identifier[array] operator[SEP] {
identifier[Class] identifier[primitiveType] operator[SEP] Keyword[if] operator[SEP] identifier[array] operator[SEP] identifier[length] operator[>] Other[0] operator[SEP] {
identifier[LOG] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] literal[String] operator[SEP] operator[SEP] identifier[primitiveType] operator[=] identifier[Reflection] operator[SEP] identifier[getPrimitiveType] operator[SEP] identifier[array] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[primitiveType] operator[=] identifier[Reflection] operator[SEP] identifier[getPrimitiveType] operator[SEP] identifier[array] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getComponentType] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Object] identifier[primitiveArray] operator[=] identifier[Array] operator[SEP] identifier[newInstance] operator[SEP] identifier[primitiveType] , identifier[array] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[array] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[Array] operator[SEP] identifier[set] operator[SEP] identifier[primitiveArray] , identifier[i] , identifier[array] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[primitiveArray] operator[SEP]
}
|
private void assertLibrary(ClassLoader loader, boolean sslEnabled) {
Class<?> MongoClient = loadClass(loader, com_mongodb_MongoClient);
int minor = -1, major = -1;
if (MongoClient == null) {
// Version 1.0 of the mongo driver used these static variables, but were deprecated in a subsequent release.
// If getMajor/MinorVersion doesn't exist, will check for these fields.
Class<?> Mongo = loadClass(loader, "com.mongodb.Mongo");
// If we can't find either class, die
if (Mongo == null) {
// CWKKD0014.missing.driver=CWKKD0014E: The {0} service was unable to locate the required MongoDB driver classes at shared library {1}.
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0014.missing.driver", MONGO, libraryRef.getService().id()));
}
major = getVersionFromMongo(Mongo, "MAJOR_VERSION");
minor = getVersionFromMongo(Mongo, "MINOR_VERSION");
} else {
major = getVersionFromMongoClient(MongoClient, "getMajorVersion");
minor = getVersionFromMongoClient(MongoClient, "getMinorVersion");
}
final int MIN_MAJOR = 2;
final int MIN_MINOR = 10;
final int SSL_MIN_MINOR = 11;
final int CERT_AUTH_MIN_MINOR = 12;
if (useCertAuth && ((major < MIN_MAJOR) || (major == MIN_MAJOR && minor < CERT_AUTH_MIN_MINOR))) {
Tr.error(tc, "CWKKD0023.ssl.certauth.incompatible.driver", MONGO, id, libraryRef.getService().id(),
MIN_MAJOR + "." + CERT_AUTH_MIN_MINOR, major + "." + minor);
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0023.ssl.certauth.incompatible.driver", MONGO, id, libraryRef.getService().id(),
MIN_MAJOR + "." + CERT_AUTH_MIN_MINOR, major + "." + minor));
}
if (sslEnabled && ((major < MIN_MAJOR) || (major == MIN_MAJOR && minor < SSL_MIN_MINOR))) {
Tr.error(tc, "CWKKD0017.ssl.incompatible.driver", MONGO, id, libraryRef.getService().id(),
MIN_MAJOR + "." + SSL_MIN_MINOR, major + "." + minor);
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0017.ssl.incompatible.driver", MONGO, id, libraryRef.getService().id(),
MIN_MAJOR + "." + SSL_MIN_MINOR, major + "." + minor));
}
if (major > MIN_MAJOR || (major == MIN_MAJOR && minor >= MIN_MINOR)) {
return;
}
// CWKKD0013.unsupported.driver=CWKKD0013E: The {0} service encountered down level version of the MongoDB
// driver at shared library {1}. Expected a minimum level of {2}, but found {3}.
Tr.error(tc, "CWKKD0013.unsupported.driver", MONGO, libraryRef.getService().id(),
MIN_MAJOR + "." + MIN_MINOR, major + "." + minor);
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0013.unsupported.driver", MONGO, libraryRef.getService().id(),
MIN_MAJOR + "." + MIN_MINOR, major + "." + minor));
} | class class_name[name] begin[{]
method[assertLibrary, return_type[void], modifier[private], parameter[loader, sslEnabled]] begin[{]
local_variable[type[Class], MongoClient]
local_variable[type[int], minor]
if[binary_operation[member[.MongoClient], ==, literal[null]]] begin[{]
local_variable[type[Class], Mongo]
if[binary_operation[member[.Mongo], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CWKKD0014.missing.driver"), MemberReference(member=MONGO, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getService, postfix_operators=[], prefix_operators=[], qualifier=libraryRef, selectors=[MethodInvocation(arguments=[], member=id, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=formatMessage, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[member[.major], call[.getVersionFromMongo, parameter[member[.Mongo], literal["MAJOR_VERSION"]]]]
assign[member[.minor], call[.getVersionFromMongo, parameter[member[.Mongo], literal["MINOR_VERSION"]]]]
else begin[{]
assign[member[.major], call[.getVersionFromMongoClient, parameter[member[.MongoClient], literal["getMajorVersion"]]]]
assign[member[.minor], call[.getVersionFromMongoClient, parameter[member[.MongoClient], literal["getMinorVersion"]]]]
end[}]
local_variable[type[int], MIN_MAJOR]
local_variable[type[int], MIN_MINOR]
local_variable[type[int], SSL_MIN_MINOR]
local_variable[type[int], CERT_AUTH_MIN_MINOR]
if[binary_operation[member[.useCertAuth], &&, binary_operation[binary_operation[member[.major], <, member[.MIN_MAJOR]], ||, binary_operation[binary_operation[member[.major], ==, member[.MIN_MAJOR]], &&, binary_operation[member[.minor], <, member[.CERT_AUTH_MIN_MINOR]]]]]] begin[{]
call[Tr.error, parameter[member[.tc], literal["CWKKD0023.ssl.certauth.incompatible.driver"], member[.MONGO], member[.id], call[libraryRef.getService, parameter[]], binary_operation[binary_operation[member[.MIN_MAJOR], +, literal["."]], +, member[.CERT_AUTH_MIN_MINOR]], binary_operation[binary_operation[member[.major], +, literal["."]], +, member[.minor]]]]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CWKKD0023.ssl.certauth.incompatible.driver"), MemberReference(member=MONGO, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getService, postfix_operators=[], prefix_operators=[], qualifier=libraryRef, selectors=[MethodInvocation(arguments=[], member=id, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=MIN_MAJOR, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="."), operator=+), operandr=MemberReference(member=CERT_AUTH_MIN_MINOR, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=major, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="."), operator=+), operandr=MemberReference(member=minor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=formatMessage, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.sslEnabled], &&, binary_operation[binary_operation[member[.major], <, member[.MIN_MAJOR]], ||, binary_operation[binary_operation[member[.major], ==, member[.MIN_MAJOR]], &&, binary_operation[member[.minor], <, member[.SSL_MIN_MINOR]]]]]] begin[{]
call[Tr.error, parameter[member[.tc], literal["CWKKD0017.ssl.incompatible.driver"], member[.MONGO], member[.id], call[libraryRef.getService, parameter[]], binary_operation[binary_operation[member[.MIN_MAJOR], +, literal["."]], +, member[.SSL_MIN_MINOR]], binary_operation[binary_operation[member[.major], +, literal["."]], +, member[.minor]]]]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CWKKD0017.ssl.incompatible.driver"), MemberReference(member=MONGO, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getService, postfix_operators=[], prefix_operators=[], qualifier=libraryRef, selectors=[MethodInvocation(arguments=[], member=id, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=MIN_MAJOR, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="."), operator=+), operandr=MemberReference(member=SSL_MIN_MINOR, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=major, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="."), operator=+), operandr=MemberReference(member=minor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=formatMessage, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.major], >, member[.MIN_MAJOR]], ||, binary_operation[binary_operation[member[.major], ==, member[.MIN_MAJOR]], &&, binary_operation[member[.minor], >=, member[.MIN_MINOR]]]]] begin[{]
return[None]
else begin[{]
None
end[}]
call[Tr.error, parameter[member[.tc], literal["CWKKD0013.unsupported.driver"], member[.MONGO], call[libraryRef.getService, parameter[]], binary_operation[binary_operation[member[.MIN_MAJOR], +, literal["."]], +, member[.MIN_MINOR]], binary_operation[binary_operation[member[.major], +, literal["."]], +, member[.minor]]]]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CWKKD0013.unsupported.driver"), MemberReference(member=MONGO, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getService, postfix_operators=[], prefix_operators=[], qualifier=libraryRef, selectors=[MethodInvocation(arguments=[], member=id, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=MIN_MAJOR, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="."), operator=+), operandr=MemberReference(member=MIN_MINOR, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=major, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="."), operator=+), operandr=MemberReference(member=minor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=formatMessage, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[assertLibrary] operator[SEP] identifier[ClassLoader] identifier[loader] , Keyword[boolean] identifier[sslEnabled] operator[SEP] {
identifier[Class] operator[<] operator[?] operator[>] identifier[MongoClient] operator[=] identifier[loadClass] operator[SEP] identifier[loader] , identifier[com_mongodb_MongoClient] operator[SEP] operator[SEP] Keyword[int] identifier[minor] operator[=] operator[-] Other[1] , identifier[major] operator[=] operator[-] Other[1] operator[SEP] Keyword[if] operator[SEP] identifier[MongoClient] operator[==] Other[null] operator[SEP] {
identifier[Class] operator[<] operator[?] operator[>] identifier[Mongo] operator[=] identifier[loadClass] operator[SEP] identifier[loader] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Mongo] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[Tr] operator[SEP] identifier[formatMessage] operator[SEP] identifier[tc] , literal[String] , identifier[MONGO] , identifier[libraryRef] operator[SEP] identifier[getService] operator[SEP] operator[SEP] operator[SEP] identifier[id] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[major] operator[=] identifier[getVersionFromMongo] operator[SEP] identifier[Mongo] , literal[String] operator[SEP] operator[SEP] identifier[minor] operator[=] identifier[getVersionFromMongo] operator[SEP] identifier[Mongo] , literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[major] operator[=] identifier[getVersionFromMongoClient] operator[SEP] identifier[MongoClient] , literal[String] operator[SEP] operator[SEP] identifier[minor] operator[=] identifier[getVersionFromMongoClient] operator[SEP] identifier[MongoClient] , literal[String] operator[SEP] operator[SEP]
}
Keyword[final] Keyword[int] identifier[MIN_MAJOR] operator[=] Other[2] operator[SEP] Keyword[final] Keyword[int] identifier[MIN_MINOR] operator[=] Other[10] operator[SEP] Keyword[final] Keyword[int] identifier[SSL_MIN_MINOR] operator[=] Other[11] operator[SEP] Keyword[final] Keyword[int] identifier[CERT_AUTH_MIN_MINOR] operator[=] Other[12] operator[SEP] Keyword[if] operator[SEP] identifier[useCertAuth] operator[&&] operator[SEP] operator[SEP] identifier[major] operator[<] identifier[MIN_MAJOR] operator[SEP] operator[||] operator[SEP] identifier[major] operator[==] identifier[MIN_MAJOR] operator[&&] identifier[minor] operator[<] identifier[CERT_AUTH_MIN_MINOR] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[error] operator[SEP] identifier[tc] , literal[String] , identifier[MONGO] , identifier[id] , identifier[libraryRef] operator[SEP] identifier[getService] operator[SEP] operator[SEP] operator[SEP] identifier[id] operator[SEP] operator[SEP] , identifier[MIN_MAJOR] operator[+] literal[String] operator[+] identifier[CERT_AUTH_MIN_MINOR] , identifier[major] operator[+] literal[String] operator[+] identifier[minor] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[Tr] operator[SEP] identifier[formatMessage] operator[SEP] identifier[tc] , literal[String] , identifier[MONGO] , identifier[id] , identifier[libraryRef] operator[SEP] identifier[getService] operator[SEP] operator[SEP] operator[SEP] identifier[id] operator[SEP] operator[SEP] , identifier[MIN_MAJOR] operator[+] literal[String] operator[+] identifier[CERT_AUTH_MIN_MINOR] , identifier[major] operator[+] literal[String] operator[+] identifier[minor] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[sslEnabled] operator[&&] operator[SEP] operator[SEP] identifier[major] operator[<] identifier[MIN_MAJOR] operator[SEP] operator[||] operator[SEP] identifier[major] operator[==] identifier[MIN_MAJOR] operator[&&] identifier[minor] operator[<] identifier[SSL_MIN_MINOR] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[error] operator[SEP] identifier[tc] , literal[String] , identifier[MONGO] , identifier[id] , identifier[libraryRef] operator[SEP] identifier[getService] operator[SEP] operator[SEP] operator[SEP] identifier[id] operator[SEP] operator[SEP] , identifier[MIN_MAJOR] operator[+] literal[String] operator[+] identifier[SSL_MIN_MINOR] , identifier[major] operator[+] literal[String] operator[+] identifier[minor] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[Tr] operator[SEP] identifier[formatMessage] operator[SEP] identifier[tc] , literal[String] , identifier[MONGO] , identifier[id] , identifier[libraryRef] operator[SEP] identifier[getService] operator[SEP] operator[SEP] operator[SEP] identifier[id] operator[SEP] operator[SEP] , identifier[MIN_MAJOR] operator[+] literal[String] operator[+] identifier[SSL_MIN_MINOR] , identifier[major] operator[+] literal[String] operator[+] identifier[minor] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[major] operator[>] identifier[MIN_MAJOR] operator[||] operator[SEP] identifier[major] operator[==] identifier[MIN_MAJOR] operator[&&] identifier[minor] operator[>=] identifier[MIN_MINOR] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[Tr] operator[SEP] identifier[error] operator[SEP] identifier[tc] , literal[String] , identifier[MONGO] , identifier[libraryRef] operator[SEP] identifier[getService] operator[SEP] operator[SEP] operator[SEP] identifier[id] operator[SEP] operator[SEP] , identifier[MIN_MAJOR] operator[+] literal[String] operator[+] identifier[MIN_MINOR] , identifier[major] operator[+] literal[String] operator[+] identifier[minor] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[Tr] operator[SEP] identifier[formatMessage] operator[SEP] identifier[tc] , literal[String] , identifier[MONGO] , identifier[libraryRef] operator[SEP] identifier[getService] operator[SEP] operator[SEP] operator[SEP] identifier[id] operator[SEP] operator[SEP] , identifier[MIN_MAJOR] operator[+] literal[String] operator[+] identifier[MIN_MINOR] , identifier[major] operator[+] literal[String] operator[+] identifier[minor] operator[SEP] operator[SEP] operator[SEP]
}
|
@Deprecated
@SuppressLint("NewApi")
public static void setBackground(View v, Drawable d) {
ViewCompat.setBackground(v, d);
} | class class_name[name] begin[{]
method[setBackground, return_type[void], modifier[public static], parameter[v, d]] begin[{]
call[ViewCompat.setBackground, parameter[member[.v], member[.d]]]
end[}]
END[}] | annotation[@] identifier[Deprecated] annotation[@] identifier[SuppressLint] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[static] Keyword[void] identifier[setBackground] operator[SEP] identifier[View] identifier[v] , identifier[Drawable] identifier[d] operator[SEP] {
identifier[ViewCompat] operator[SEP] identifier[setBackground] operator[SEP] identifier[v] , identifier[d] operator[SEP] operator[SEP]
}
|
public java.util.List<AssociationFilter> getAssociationFilterList() {
if (associationFilterList == null) {
associationFilterList = new com.amazonaws.internal.SdkInternalList<AssociationFilter>();
}
return associationFilterList;
} | class class_name[name] begin[{]
method[getAssociationFilterList, return_type[type[java]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.associationFilterList], ==, literal[null]]] begin[{]
assign[member[.associationFilterList], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=com, sub_type=ReferenceType(arguments=None, dimensions=None, name=amazonaws, sub_type=ReferenceType(arguments=None, dimensions=None, name=internal, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=AssociationFilter, sub_type=None))], dimensions=None, name=SdkInternalList, sub_type=None)))))]
else begin[{]
None
end[}]
return[member[.associationFilterList]]
end[}]
END[}] | Keyword[public] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[List] operator[<] identifier[AssociationFilter] operator[>] identifier[getAssociationFilterList] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[associationFilterList] operator[==] Other[null] operator[SEP] {
identifier[associationFilterList] operator[=] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[AssociationFilter] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[associationFilterList] operator[SEP]
}
|
public static FlowContext createFlowContext(final String uuid) {
if (null == uuid) {
throw new IllegalArgumentException("Flow context cannot be null");
}
final FlowContext flowContext = new FlowContextImpl(uuid);
addFlowContext(flowContext);
return flowContext;
} | class class_name[name] begin[{]
method[createFlowContext, return_type[type[FlowContext]], modifier[public static], parameter[uuid]] begin[{]
if[binary_operation[literal[null], ==, member[.uuid]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Flow context 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[FlowContext], flowContext]
call[.addFlowContext, parameter[member[.flowContext]]]
return[member[.flowContext]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[FlowContext] identifier[createFlowContext] operator[SEP] Keyword[final] identifier[String] identifier[uuid] operator[SEP] {
Keyword[if] operator[SEP] Other[null] operator[==] identifier[uuid] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[final] identifier[FlowContext] identifier[flowContext] operator[=] Keyword[new] identifier[FlowContextImpl] operator[SEP] identifier[uuid] operator[SEP] operator[SEP] identifier[addFlowContext] operator[SEP] identifier[flowContext] operator[SEP] operator[SEP] Keyword[return] identifier[flowContext] operator[SEP]
}
|
private Object convert(JsonNode node, TypeInformation<?> info) {
if (info == Types.VOID || node.isNull()) {
return null;
} else if (info == Types.BOOLEAN) {
return node.asBoolean();
} else if (info == Types.STRING) {
return node.asText();
} else if (info == Types.BIG_DEC) {
return node.decimalValue();
} else if (info == Types.BIG_INT) {
return node.bigIntegerValue();
} else if (info == Types.SQL_DATE) {
return Date.valueOf(node.asText());
} else if (info == Types.SQL_TIME) {
// according to RFC 3339 every full-time must have a timezone;
// until we have full timezone support, we only support UTC;
// users can parse their time as string as a workaround
final String time = node.asText();
if (time.indexOf('Z') < 0 || time.indexOf('.') >= 0) {
throw new IllegalStateException(
"Invalid time format. Only a time in UTC timezone without milliseconds is supported yet. " +
"Format: HH:mm:ss'Z'");
}
return Time.valueOf(time.substring(0, time.length() - 1));
} else if (info == Types.SQL_TIMESTAMP) {
// according to RFC 3339 every date-time must have a timezone;
// until we have full timezone support, we only support UTC;
// users can parse their time as string as a workaround
final String timestamp = node.asText();
if (timestamp.indexOf('Z') < 0) {
throw new IllegalStateException(
"Invalid timestamp format. Only a timestamp in UTC timezone is supported yet. " +
"Format: yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
}
return Timestamp.valueOf(timestamp.substring(0, timestamp.length() - 1).replace('T', ' '));
} else if (info instanceof RowTypeInfo) {
return convertRow(node, (RowTypeInfo) info);
} else if (info instanceof ObjectArrayTypeInfo) {
return convertObjectArray(node, ((ObjectArrayTypeInfo) info).getComponentInfo());
} else if (info instanceof BasicArrayTypeInfo) {
return convertObjectArray(node, ((BasicArrayTypeInfo) info).getComponentInfo());
} else if (info instanceof PrimitiveArrayTypeInfo &&
((PrimitiveArrayTypeInfo) info).getComponentType() == Types.BYTE) {
return convertByteArray(node);
} else {
// for types that were specified without JSON schema
// e.g. POJOs
try {
return objectMapper.treeToValue(node, info.getTypeClass());
} catch (JsonProcessingException e) {
throw new IllegalStateException("Unsupported type information '" + info + "' for node: " + node);
}
}
} | class class_name[name] begin[{]
method[convert, return_type[type[Object]], modifier[private], parameter[node, info]] begin[{]
if[binary_operation[binary_operation[member[.info], ==, member[Types.VOID]], ||, call[node.isNull, parameter[]]]] begin[{]
return[literal[null]]
else begin[{]
if[binary_operation[member[.info], ==, member[Types.BOOLEAN]]] begin[{]
return[call[node.asBoolean, parameter[]]]
else begin[{]
if[binary_operation[member[.info], ==, member[Types.STRING]]] begin[{]
return[call[node.asText, parameter[]]]
else begin[{]
if[binary_operation[member[.info], ==, member[Types.BIG_DEC]]] begin[{]
return[call[node.decimalValue, parameter[]]]
else begin[{]
if[binary_operation[member[.info], ==, member[Types.BIG_INT]]] begin[{]
return[call[node.bigIntegerValue, parameter[]]]
else begin[{]
if[binary_operation[member[.info], ==, member[Types.SQL_DATE]]] begin[{]
return[call[Date.valueOf, parameter[call[node.asText, parameter[]]]]]
else begin[{]
if[binary_operation[member[.info], ==, member[Types.SQL_TIME]]] begin[{]
local_variable[type[String], time]
if[binary_operation[binary_operation[call[time.indexOf, parameter[literal['Z']]], <, literal[0]], ||, binary_operation[call[time.indexOf, parameter[literal['.']]], >=, literal[0]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid time format. Only a time in UTC timezone without milliseconds is supported yet. "), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Format: HH:mm:ss'Z'"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[call[Time.valueOf, parameter[call[time.substring, parameter[literal[0], binary_operation[call[time.length, parameter[]], -, literal[1]]]]]]]
else begin[{]
if[binary_operation[member[.info], ==, member[Types.SQL_TIMESTAMP]]] begin[{]
local_variable[type[String], timestamp]
if[binary_operation[call[timestamp.indexOf, parameter[literal['Z']]], <, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid timestamp format. Only a timestamp in UTC timezone is supported yet. "), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Format: yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[call[Timestamp.valueOf, parameter[call[timestamp.substring, parameter[literal[0], binary_operation[call[timestamp.length, parameter[]], -, literal[1]]]]]]]
else begin[{]
if[binary_operation[member[.info], instanceof, type[RowTypeInfo]]] begin[{]
return[call[.convertRow, parameter[member[.node], Cast(expression=MemberReference(member=info, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=RowTypeInfo, sub_type=None))]]]
else begin[{]
if[binary_operation[member[.info], instanceof, type[ObjectArrayTypeInfo]]] begin[{]
return[call[.convertObjectArray, parameter[member[.node], Cast(expression=MemberReference(member=info, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ObjectArrayTypeInfo, sub_type=None))]]]
else begin[{]
if[binary_operation[member[.info], instanceof, type[BasicArrayTypeInfo]]] begin[{]
return[call[.convertObjectArray, parameter[member[.node], Cast(expression=MemberReference(member=info, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=BasicArrayTypeInfo, sub_type=None))]]]
else begin[{]
if[binary_operation[binary_operation[member[.info], instanceof, type[PrimitiveArrayTypeInfo]], &&, binary_operation[Cast(expression=MemberReference(member=info, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=PrimitiveArrayTypeInfo, sub_type=None)), ==, member[Types.BYTE]]]] begin[{]
return[call[.convertByteArray, parameter[member[.node]]]]
else begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getTypeClass, postfix_operators=[], prefix_operators=[], qualifier=info, selectors=[], type_arguments=None)], member=treeToValue, postfix_operators=[], prefix_operators=[], qualifier=objectMapper, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unsupported type information '"), operandr=MemberReference(member=info, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' for node: "), operator=+), operandr=MemberReference(member=node, 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=IllegalStateException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['JsonProcessingException']))], finally_block=None, label=None, resources=None)
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
END[}] | Keyword[private] identifier[Object] identifier[convert] operator[SEP] identifier[JsonNode] identifier[node] , identifier[TypeInformation] operator[<] operator[?] operator[>] identifier[info] operator[SEP] {
Keyword[if] operator[SEP] identifier[info] operator[==] identifier[Types] operator[SEP] identifier[VOID] operator[||] identifier[node] operator[SEP] identifier[isNull] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[info] operator[==] identifier[Types] operator[SEP] identifier[BOOLEAN] operator[SEP] {
Keyword[return] identifier[node] operator[SEP] identifier[asBoolean] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[info] operator[==] identifier[Types] operator[SEP] identifier[STRING] operator[SEP] {
Keyword[return] identifier[node] operator[SEP] identifier[asText] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[info] operator[==] identifier[Types] operator[SEP] identifier[BIG_DEC] operator[SEP] {
Keyword[return] identifier[node] operator[SEP] identifier[decimalValue] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[info] operator[==] identifier[Types] operator[SEP] identifier[BIG_INT] operator[SEP] {
Keyword[return] identifier[node] operator[SEP] identifier[bigIntegerValue] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[info] operator[==] identifier[Types] operator[SEP] identifier[SQL_DATE] operator[SEP] {
Keyword[return] identifier[Date] operator[SEP] identifier[valueOf] operator[SEP] identifier[node] operator[SEP] identifier[asText] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[info] operator[==] identifier[Types] operator[SEP] identifier[SQL_TIME] operator[SEP] {
Keyword[final] identifier[String] identifier[time] operator[=] identifier[node] operator[SEP] identifier[asText] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[time] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[<] Other[0] operator[||] identifier[time] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[>=] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[Time] operator[SEP] identifier[valueOf] operator[SEP] identifier[time] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[time] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[info] operator[==] identifier[Types] operator[SEP] identifier[SQL_TIMESTAMP] operator[SEP] {
Keyword[final] identifier[String] identifier[timestamp] operator[=] identifier[node] operator[SEP] identifier[asText] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[timestamp] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[<] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[Timestamp] operator[SEP] identifier[valueOf] operator[SEP] identifier[timestamp] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[timestamp] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[info] Keyword[instanceof] identifier[RowTypeInfo] operator[SEP] {
Keyword[return] identifier[convertRow] operator[SEP] identifier[node] , operator[SEP] identifier[RowTypeInfo] operator[SEP] identifier[info] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[info] Keyword[instanceof] identifier[ObjectArrayTypeInfo] operator[SEP] {
Keyword[return] identifier[convertObjectArray] operator[SEP] identifier[node] , operator[SEP] operator[SEP] identifier[ObjectArrayTypeInfo] operator[SEP] identifier[info] operator[SEP] operator[SEP] identifier[getComponentInfo] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[info] Keyword[instanceof] identifier[BasicArrayTypeInfo] operator[SEP] {
Keyword[return] identifier[convertObjectArray] operator[SEP] identifier[node] , operator[SEP] operator[SEP] identifier[BasicArrayTypeInfo] operator[SEP] identifier[info] operator[SEP] operator[SEP] identifier[getComponentInfo] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[info] Keyword[instanceof] identifier[PrimitiveArrayTypeInfo] operator[&&] operator[SEP] operator[SEP] identifier[PrimitiveArrayTypeInfo] operator[SEP] identifier[info] operator[SEP] operator[SEP] identifier[getComponentType] operator[SEP] operator[SEP] operator[==] identifier[Types] operator[SEP] identifier[BYTE] operator[SEP] {
Keyword[return] identifier[convertByteArray] operator[SEP] identifier[node] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[try] {
Keyword[return] identifier[objectMapper] operator[SEP] identifier[treeToValue] operator[SEP] identifier[node] , identifier[info] operator[SEP] identifier[getTypeClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[JsonProcessingException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] identifier[info] operator[+] literal[String] operator[+] identifier[node] operator[SEP] operator[SEP]
}
}
}
|
public CertificateBundle updateCertificate(String vaultBaseUrl, String certificateName, String certificateVersion, CertificatePolicy certificatePolicy, CertificateAttributes certificateAttributes, Map<String, String> tags) {
return updateCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName, certificateVersion, certificatePolicy, certificateAttributes, tags).toBlocking().single().body();
} | class class_name[name] begin[{]
method[updateCertificate, return_type[type[CertificateBundle]], modifier[public], parameter[vaultBaseUrl, certificateName, certificateVersion, certificatePolicy, certificateAttributes, tags]] begin[{]
return[call[.updateCertificateWithServiceResponseAsync, parameter[member[.vaultBaseUrl], member[.certificateName], member[.certificateVersion], member[.certificatePolicy], member[.certificateAttributes], member[.tags]]]]
end[}]
END[}] | Keyword[public] identifier[CertificateBundle] identifier[updateCertificate] operator[SEP] identifier[String] identifier[vaultBaseUrl] , identifier[String] identifier[certificateName] , identifier[String] identifier[certificateVersion] , identifier[CertificatePolicy] identifier[certificatePolicy] , identifier[CertificateAttributes] identifier[certificateAttributes] , identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[tags] operator[SEP] {
Keyword[return] identifier[updateCertificateWithServiceResponseAsync] operator[SEP] identifier[vaultBaseUrl] , identifier[certificateName] , identifier[certificateVersion] , identifier[certificatePolicy] , identifier[certificateAttributes] , identifier[tags] operator[SEP] operator[SEP] identifier[toBlocking] operator[SEP] operator[SEP] operator[SEP] identifier[single] operator[SEP] operator[SEP] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
|
public static TraceComponent register(Class<?> aClass, String group, String bundle) {
TraceComponent tc = new TraceComponent(aClass, group, bundle);
com.ibm.websphere.ras.TrConfigurator.registerTraceComponent(tc);
return tc;
} | class class_name[name] begin[{]
method[register, return_type[type[TraceComponent]], modifier[public static], parameter[aClass, group, bundle]] begin[{]
local_variable[type[TraceComponent], tc]
call[com.ibm.websphere.ras.TrConfigurator.registerTraceComponent, parameter[member[.tc]]]
return[member[.tc]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[TraceComponent] identifier[register] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[aClass] , identifier[String] identifier[group] , identifier[String] identifier[bundle] operator[SEP] {
identifier[TraceComponent] identifier[tc] operator[=] Keyword[new] identifier[TraceComponent] operator[SEP] identifier[aClass] , identifier[group] , identifier[bundle] operator[SEP] operator[SEP] identifier[com] operator[SEP] identifier[ibm] operator[SEP] identifier[websphere] operator[SEP] identifier[ras] operator[SEP] identifier[TrConfigurator] operator[SEP] identifier[registerTraceComponent] operator[SEP] identifier[tc] operator[SEP] operator[SEP] Keyword[return] identifier[tc] operator[SEP]
}
|
public static String getTimeoutMessage(long timeout, TimeUnit unit) {
return String.format("Timeout of %d %s reached", timeout, requireNonNull(unit, "unit"));
} | class class_name[name] begin[{]
method[getTimeoutMessage, return_type[type[String]], modifier[public static], parameter[timeout, unit]] begin[{]
return[call[String.format, parameter[literal["Timeout of %d %s reached"], member[.timeout], call[.requireNonNull, parameter[member[.unit], literal["unit"]]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getTimeoutMessage] operator[SEP] Keyword[long] identifier[timeout] , identifier[TimeUnit] identifier[unit] operator[SEP] {
Keyword[return] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[timeout] , identifier[requireNonNull] operator[SEP] identifier[unit] , literal[String] operator[SEP] operator[SEP] operator[SEP]
}
|
public static Number power(Long self, Integer exponent) {
if (exponent >= 0) {
BigInteger answer = BigInteger.valueOf(self).pow(exponent);
if (answer.compareTo(BI_LONG_MIN) >= 0 && answer.compareTo(BI_LONG_MAX) <= 0) {
return answer.longValue();
} else {
return answer;
}
} else {
return power(self, (double) exponent);
}
} | class class_name[name] begin[{]
method[power, return_type[type[Number]], modifier[public static], parameter[self, exponent]] begin[{]
if[binary_operation[member[.exponent], >=, literal[0]]] begin[{]
local_variable[type[BigInteger], answer]
if[binary_operation[binary_operation[call[answer.compareTo, parameter[member[.BI_LONG_MIN]]], >=, literal[0]], &&, binary_operation[call[answer.compareTo, parameter[member[.BI_LONG_MAX]]], <=, literal[0]]]] begin[{]
return[call[answer.longValue, parameter[]]]
else begin[{]
return[member[.answer]]
end[}]
else begin[{]
return[call[.power, parameter[member[.self], Cast(expression=MemberReference(member=exponent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=double))]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Number] identifier[power] operator[SEP] identifier[Long] identifier[self] , identifier[Integer] identifier[exponent] operator[SEP] {
Keyword[if] operator[SEP] identifier[exponent] operator[>=] Other[0] operator[SEP] {
identifier[BigInteger] identifier[answer] operator[=] identifier[BigInteger] operator[SEP] identifier[valueOf] operator[SEP] identifier[self] operator[SEP] operator[SEP] identifier[pow] operator[SEP] identifier[exponent] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[answer] operator[SEP] identifier[compareTo] operator[SEP] identifier[BI_LONG_MIN] operator[SEP] operator[>=] Other[0] operator[&&] identifier[answer] operator[SEP] identifier[compareTo] operator[SEP] identifier[BI_LONG_MAX] operator[SEP] operator[<=] Other[0] operator[SEP] {
Keyword[return] identifier[answer] operator[SEP] identifier[longValue] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[answer] operator[SEP]
}
}
Keyword[else] {
Keyword[return] identifier[power] operator[SEP] identifier[self] , operator[SEP] Keyword[double] operator[SEP] identifier[exponent] operator[SEP] operator[SEP]
}
}
|
@Override
public Set<InputStream> getResourcesAsStream(final String path) throws IOException
{
// For local paths, try to resolve the path relative to the folder of the master file
// N.B. Assumes paths are sensible, not .//someFile.xml
if (path.startsWith("./"))
{
final Set<InputStream> streams = inner.getResourcesAsStream(folder + path.substring(2));
if (streams != null && !streams.isEmpty())
return streams;
}
return inner.getResourcesAsStream(path);
} | class class_name[name] begin[{]
method[getResourcesAsStream, return_type[type[Set]], modifier[public], parameter[path]] begin[{]
if[call[path.startsWith, parameter[literal["./"]]]] begin[{]
local_variable[type[Set], streams]
if[binary_operation[binary_operation[member[.streams], !=, literal[null]], &&, call[streams.isEmpty, parameter[]]]] begin[{]
return[member[.streams]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[call[inner.getResourcesAsStream, parameter[member[.path]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Set] operator[<] identifier[InputStream] operator[>] identifier[getResourcesAsStream] operator[SEP] Keyword[final] identifier[String] identifier[path] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[path] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[final] identifier[Set] operator[<] identifier[InputStream] operator[>] identifier[streams] operator[=] identifier[inner] operator[SEP] identifier[getResourcesAsStream] operator[SEP] identifier[folder] operator[+] identifier[path] operator[SEP] identifier[substring] operator[SEP] Other[2] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[streams] operator[!=] Other[null] operator[&&] operator[!] identifier[streams] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[streams] operator[SEP]
}
Keyword[return] identifier[inner] operator[SEP] identifier[getResourcesAsStream] operator[SEP] identifier[path] operator[SEP] operator[SEP]
}
|
public static Set<String> getResourceNames(File dir) {
Set<String> resourceNames = new HashSet<String>();
// If the path is not valid throw an exception
String[] resArray = dir.list();
if (resArray != null) {
// Make the returned dirs end with '/', to match a servletcontext
// behavior.
for (int i = 0; i < resArray.length; i++) {
if (new File(dir, resArray[i]).isDirectory())
resArray[i] += '/';
}
resourceNames.addAll(Arrays.asList(resArray));
}
return resourceNames;
} | class class_name[name] begin[{]
method[getResourceNames, return_type[type[Set]], modifier[public static], parameter[dir]] begin[{]
local_variable[type[Set], resourceNames]
local_variable[type[String], resArray]
if[binary_operation[member[.resArray], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=ClassCreator(arguments=[MemberReference(member=dir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=resArray, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=isDirectory, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=File, sub_type=None)), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=resArray, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type=+=, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='/')), 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=resArray, 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)
call[resourceNames.addAll, parameter[call[Arrays.asList, parameter[member[.resArray]]]]]
else begin[{]
None
end[}]
return[member[.resourceNames]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Set] operator[<] identifier[String] operator[>] identifier[getResourceNames] operator[SEP] identifier[File] identifier[dir] operator[SEP] {
identifier[Set] operator[<] identifier[String] operator[>] identifier[resourceNames] operator[=] Keyword[new] identifier[HashSet] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[resArray] operator[=] identifier[dir] operator[SEP] identifier[list] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[resArray] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[resArray] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] Keyword[new] identifier[File] operator[SEP] identifier[dir] , identifier[resArray] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] identifier[isDirectory] operator[SEP] operator[SEP] operator[SEP] identifier[resArray] operator[SEP] identifier[i] operator[SEP] operator[+=] literal[String] operator[SEP]
}
identifier[resourceNames] operator[SEP] identifier[addAll] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[resArray] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[resourceNames] operator[SEP]
}
|
public static UnsafeSliceFactory getInstance()
{
// see setAccessible() in AccessibleObject
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(ACCESS_PERMISSION);
}
return INSTANCE;
} | class class_name[name] begin[{]
method[getInstance, return_type[type[UnsafeSliceFactory]], modifier[public static], parameter[]] begin[{]
local_variable[type[SecurityManager], sm]
if[binary_operation[member[.sm], !=, literal[null]]] begin[{]
call[sm.checkPermission, parameter[member[.ACCESS_PERMISSION]]]
else begin[{]
None
end[}]
return[member[.INSTANCE]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[UnsafeSliceFactory] identifier[getInstance] operator[SEP] operator[SEP] {
identifier[SecurityManager] identifier[sm] operator[=] identifier[System] operator[SEP] identifier[getSecurityManager] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[sm] operator[!=] Other[null] operator[SEP] {
identifier[sm] operator[SEP] identifier[checkPermission] operator[SEP] identifier[ACCESS_PERMISSION] operator[SEP] operator[SEP]
}
Keyword[return] identifier[INSTANCE] operator[SEP]
}
|
static void serialize(DataOutput out, Serializers serializers)
throws IOException {
StringBuilder msg = new StringBuilder(String.format("Serialize %d serializer classes:", serializers.serializers.values().size()));
int size = serializers.serializers.values().size();
out.writeInt(size);
if (size > 0) {
for (SerializerWrapper sw : serializers.serializers.values()) {
int index = sw.index;
String name = sw.serializer.getClass().getName();
out.writeInt(index);
out.writeUTF(name);
msg.append(String.format("%n (%d) %s", index, name));
}
LOGGER.info(msg.toString());
}
} | class class_name[name] begin[{]
method[serialize, return_type[void], modifier[static], parameter[out, serializers]] begin[{]
local_variable[type[StringBuilder], msg]
local_variable[type[int], size]
call[out.writeInt, parameter[member[.size]]]
if[binary_operation[member[.size], >, literal[0]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=sw, selectors=[]), name=index)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=sw.serializer, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=name)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeInt, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeUTF, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="%n (%d) %s"), MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=msg, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=values, postfix_operators=[], prefix_operators=[], qualifier=serializers.serializers, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=sw)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SerializerWrapper, sub_type=None))), label=None)
call[LOGGER.info, parameter[call[msg.toString, parameter[]]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[static] Keyword[void] identifier[serialize] operator[SEP] identifier[DataOutput] identifier[out] , identifier[Serializers] identifier[serializers] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[StringBuilder] identifier[msg] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[serializers] operator[SEP] identifier[serializers] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[size] operator[=] identifier[serializers] operator[SEP] identifier[serializers] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[writeInt] operator[SEP] identifier[size] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[size] operator[>] Other[0] operator[SEP] {
Keyword[for] operator[SEP] identifier[SerializerWrapper] identifier[sw] operator[:] identifier[serializers] operator[SEP] identifier[serializers] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] {
Keyword[int] identifier[index] operator[=] identifier[sw] operator[SEP] identifier[index] operator[SEP] identifier[String] identifier[name] operator[=] identifier[sw] operator[SEP] identifier[serializer] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[writeInt] operator[SEP] identifier[index] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[writeUTF] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[msg] operator[SEP] identifier[append] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[index] , identifier[name] operator[SEP] operator[SEP] operator[SEP]
}
identifier[LOGGER] operator[SEP] identifier[info] operator[SEP] identifier[msg] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static <T> Flux<T> toFlux(EventPublisher<T> eventPublisher) {
DirectProcessor<T> directProcessor = DirectProcessor.create();
eventPublisher.onEvent(directProcessor::onNext);
return directProcessor;
} | class class_name[name] begin[{]
method[toFlux, return_type[type[Flux]], modifier[public static], parameter[eventPublisher]] begin[{]
local_variable[type[DirectProcessor], directProcessor]
call[eventPublisher.onEvent, parameter[MethodReference(expression=MemberReference(member=directProcessor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), method=MemberReference(member=onNext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type_arguments=[])]]
return[member[.directProcessor]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[Flux] operator[<] identifier[T] operator[>] identifier[toFlux] operator[SEP] identifier[EventPublisher] operator[<] identifier[T] operator[>] identifier[eventPublisher] operator[SEP] {
identifier[DirectProcessor] operator[<] identifier[T] operator[>] identifier[directProcessor] operator[=] identifier[DirectProcessor] operator[SEP] identifier[create] operator[SEP] operator[SEP] operator[SEP] identifier[eventPublisher] operator[SEP] identifier[onEvent] operator[SEP] identifier[directProcessor] operator[::] identifier[onNext] operator[SEP] operator[SEP] Keyword[return] identifier[directProcessor] operator[SEP]
}
|
@Override
public List<String> getConstraintMapping() {
List<String> result = new ArrayList<String>();
for (String constraintMappingString : constraintMapping) {
if (constraintMappingString != null) {
constraintMappingString = constraintMappingString.trim();
}
result.add(constraintMappingString);
}
return result;
} | class class_name[name] begin[{]
method[getConstraintMapping, return_type[type[List]], modifier[public], parameter[]] begin[{]
local_variable[type[List], result]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=constraintMappingString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=constraintMappingString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=trim, postfix_operators=[], prefix_operators=[], qualifier=constraintMappingString, selectors=[], type_arguments=None)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=constraintMappingString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=constraintMapping, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=constraintMappingString)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[member[.result]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[List] operator[<] identifier[String] operator[>] identifier[getConstraintMapping] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[String] operator[>] identifier[result] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[constraintMappingString] operator[:] identifier[constraintMapping] operator[SEP] {
Keyword[if] operator[SEP] identifier[constraintMappingString] operator[!=] Other[null] operator[SEP] {
identifier[constraintMappingString] operator[=] identifier[constraintMappingString] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP]
}
identifier[result] operator[SEP] identifier[add] operator[SEP] identifier[constraintMappingString] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public static <T extends Object> T[] insert (T[] values, T value, int index)
{
@SuppressWarnings("unchecked")
T[] nvalues = (T[])Array.newInstance(values.getClass().getComponentType(), values.length+1);
if (index > 0) {
System.arraycopy(values, 0, nvalues, 0, index);
}
nvalues[index] = value;
if (index < values.length) {
System.arraycopy(values, index, nvalues, index+1, values.length-index);
}
return nvalues;
} | class class_name[name] begin[{]
method[insert, return_type[type[T]], modifier[public static], parameter[values, value, index]] begin[{]
local_variable[type[T], nvalues]
if[binary_operation[member[.index], >, literal[0]]] begin[{]
call[System.arraycopy, parameter[member[.values], literal[0], member[.nvalues], literal[0], member[.index]]]
else begin[{]
None
end[}]
assign[member[.nvalues], member[.value]]
if[binary_operation[member[.index], <, member[values.length]]] begin[{]
call[System.arraycopy, parameter[member[.values], member[.index], member[.nvalues], binary_operation[member[.index], +, literal[1]], binary_operation[member[values.length], -, member[.index]]]]
else begin[{]
None
end[}]
return[member[.nvalues]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] Keyword[extends] identifier[Object] operator[>] identifier[T] operator[SEP] operator[SEP] identifier[insert] operator[SEP] identifier[T] operator[SEP] operator[SEP] identifier[values] , identifier[T] identifier[value] , Keyword[int] identifier[index] operator[SEP] {
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] identifier[T] operator[SEP] operator[SEP] identifier[nvalues] operator[=] operator[SEP] identifier[T] operator[SEP] operator[SEP] operator[SEP] identifier[Array] operator[SEP] identifier[newInstance] operator[SEP] identifier[values] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getComponentType] operator[SEP] operator[SEP] , identifier[values] operator[SEP] identifier[length] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[index] operator[>] Other[0] operator[SEP] {
identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[values] , Other[0] , identifier[nvalues] , Other[0] , identifier[index] operator[SEP] operator[SEP]
}
identifier[nvalues] operator[SEP] identifier[index] operator[SEP] operator[=] identifier[value] operator[SEP] Keyword[if] operator[SEP] identifier[index] operator[<] identifier[values] operator[SEP] identifier[length] operator[SEP] {
identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[values] , identifier[index] , identifier[nvalues] , identifier[index] operator[+] Other[1] , identifier[values] operator[SEP] identifier[length] operator[-] identifier[index] operator[SEP] operator[SEP]
}
Keyword[return] identifier[nvalues] operator[SEP]
}
|
public static Prop useFirstFound(String... fileNames) {
for (String fn : fileNames) {
try {
return use(fn, Const.DEFAULT_ENCODING);
} catch (Exception e) {
continue ;
}
}
throw new IllegalArgumentException("没有配置文件可被使用");
} | class class_name[name] begin[{]
method[useFirstFound, return_type[type[Prop]], modifier[public static], parameter[fileNames]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=fn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=DEFAULT_ENCODING, postfix_operators=[], prefix_operators=[], qualifier=Const, selectors=[])], member=use, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ContinueStatement(goto=None, label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)]), control=EnhancedForControl(iterable=MemberReference(member=fileNames, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=fn)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="没有配置文件可被使用")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Prop] identifier[useFirstFound] operator[SEP] identifier[String] operator[...] identifier[fileNames] operator[SEP] {
Keyword[for] operator[SEP] identifier[String] identifier[fn] operator[:] identifier[fileNames] operator[SEP] {
Keyword[try] {
Keyword[return] identifier[use] operator[SEP] identifier[fn] , identifier[Const] operator[SEP] identifier[DEFAULT_ENCODING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[continue] operator[SEP]
}
}
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
@BetaApi
public final Operation insertNetworkEndpointGroup(
String zone, NetworkEndpointGroup networkEndpointGroupResource) {
InsertNetworkEndpointGroupHttpRequest request =
InsertNetworkEndpointGroupHttpRequest.newBuilder()
.setZone(zone)
.setNetworkEndpointGroupResource(networkEndpointGroupResource)
.build();
return insertNetworkEndpointGroup(request);
} | class class_name[name] begin[{]
method[insertNetworkEndpointGroup, return_type[type[Operation]], modifier[final public], parameter[zone, networkEndpointGroupResource]] begin[{]
local_variable[type[InsertNetworkEndpointGroupHttpRequest], request]
return[call[.insertNetworkEndpointGroup, parameter[member[.request]]]]
end[}]
END[}] | annotation[@] identifier[BetaApi] Keyword[public] Keyword[final] identifier[Operation] identifier[insertNetworkEndpointGroup] operator[SEP] identifier[String] identifier[zone] , identifier[NetworkEndpointGroup] identifier[networkEndpointGroupResource] operator[SEP] {
identifier[InsertNetworkEndpointGroupHttpRequest] identifier[request] operator[=] identifier[InsertNetworkEndpointGroupHttpRequest] operator[SEP] identifier[newBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[setZone] operator[SEP] identifier[zone] operator[SEP] operator[SEP] identifier[setNetworkEndpointGroupResource] operator[SEP] identifier[networkEndpointGroupResource] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[insertNetworkEndpointGroup] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
protected void sequence_ParameterReference(ISerializationContext context, ParameterReference semanticObject) {
if (errorAcceptor != null) {
if (transientValues.isValueTransient(semanticObject, XtextPackage.Literals.PARAMETER_REFERENCE__PARAMETER) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XtextPackage.Literals.PARAMETER_REFERENCE__PARAMETER));
}
SequenceFeeder feeder = createSequencerFeeder(context, semanticObject);
feeder.accept(grammarAccess.getParameterReferenceAccess().getParameterParameterIDTerminalRuleCall_0_1(), semanticObject.eGet(XtextPackage.Literals.PARAMETER_REFERENCE__PARAMETER, false));
feeder.finish();
} | class class_name[name] begin[{]
method[sequence_ParameterReference, return_type[void], modifier[protected], parameter[context, semanticObject]] begin[{]
if[binary_operation[member[.errorAcceptor], !=, literal[null]]] begin[{]
if[binary_operation[call[transientValues.isValueTransient, parameter[member[.semanticObject], member[XtextPackage.Literals.PARAMETER_REFERENCE__PARAMETER]]], ==, member[ValueTransient.YES]]] begin[{]
call[errorAcceptor.accept, parameter[call[diagnosticProvider.createFeatureValueMissing, parameter[member[.semanticObject], member[XtextPackage.Literals.PARAMETER_REFERENCE__PARAMETER]]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
local_variable[type[SequenceFeeder], feeder]
call[feeder.accept, parameter[call[grammarAccess.getParameterReferenceAccess, parameter[]], call[semanticObject.eGet, parameter[member[XtextPackage.Literals.PARAMETER_REFERENCE__PARAMETER], literal[false]]]]]
call[feeder.finish, parameter[]]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[sequence_ParameterReference] operator[SEP] identifier[ISerializationContext] identifier[context] , identifier[ParameterReference] identifier[semanticObject] operator[SEP] {
Keyword[if] operator[SEP] identifier[errorAcceptor] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[transientValues] operator[SEP] identifier[isValueTransient] operator[SEP] identifier[semanticObject] , identifier[XtextPackage] operator[SEP] identifier[Literals] operator[SEP] identifier[PARAMETER_REFERENCE__PARAMETER] operator[SEP] operator[==] identifier[ValueTransient] operator[SEP] identifier[YES] operator[SEP] identifier[errorAcceptor] operator[SEP] identifier[accept] operator[SEP] identifier[diagnosticProvider] operator[SEP] identifier[createFeatureValueMissing] operator[SEP] identifier[semanticObject] , identifier[XtextPackage] operator[SEP] identifier[Literals] operator[SEP] identifier[PARAMETER_REFERENCE__PARAMETER] operator[SEP] operator[SEP] operator[SEP]
}
identifier[SequenceFeeder] identifier[feeder] operator[=] identifier[createSequencerFeeder] operator[SEP] identifier[context] , identifier[semanticObject] operator[SEP] operator[SEP] identifier[feeder] operator[SEP] identifier[accept] operator[SEP] identifier[grammarAccess] operator[SEP] identifier[getParameterReferenceAccess] operator[SEP] operator[SEP] operator[SEP] identifier[getParameterParameterIDTerminalRuleCall_0_1] operator[SEP] operator[SEP] , identifier[semanticObject] operator[SEP] identifier[eGet] operator[SEP] identifier[XtextPackage] operator[SEP] identifier[Literals] operator[SEP] identifier[PARAMETER_REFERENCE__PARAMETER] , literal[boolean] operator[SEP] operator[SEP] operator[SEP] identifier[feeder] operator[SEP] identifier[finish] operator[SEP] operator[SEP] operator[SEP]
}
|
public void marshall(CreateAddressRequest createAddressRequest, ProtocolMarshaller protocolMarshaller) {
if (createAddressRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createAddressRequest.getAddress(), ADDRESS_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[createAddressRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.createAddressRequest], ==, 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=getAddress, postfix_operators=[], prefix_operators=[], qualifier=createAddressRequest, selectors=[], type_arguments=None), MemberReference(member=ADDRESS_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[CreateAddressRequest] identifier[createAddressRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[createAddressRequest] 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[createAddressRequest] operator[SEP] identifier[getAddress] operator[SEP] operator[SEP] , identifier[ADDRESS_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 String getAbsolutePath(String path) {
String p = path;
File f = new File(p);
if (!f.isAbsolute()) {
String basePath = FilenameUtils.getFullPath(changeSet.getChangeLog().getPhysicalFilePath());
p = FilenameUtils.normalize(basePath + p);
}
return p;
} | class class_name[name] begin[{]
method[getAbsolutePath, return_type[type[String]], modifier[public], parameter[path]] begin[{]
local_variable[type[String], p]
local_variable[type[File], f]
if[call[f.isAbsolute, parameter[]]] begin[{]
local_variable[type[String], basePath]
assign[member[.p], call[FilenameUtils.normalize, parameter[binary_operation[member[.basePath], +, member[.p]]]]]
else begin[{]
None
end[}]
return[member[.p]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getAbsolutePath] operator[SEP] identifier[String] identifier[path] operator[SEP] {
identifier[String] identifier[p] operator[=] identifier[path] operator[SEP] identifier[File] identifier[f] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[p] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[f] operator[SEP] identifier[isAbsolute] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[basePath] operator[=] identifier[FilenameUtils] operator[SEP] identifier[getFullPath] operator[SEP] identifier[changeSet] operator[SEP] identifier[getChangeLog] operator[SEP] operator[SEP] operator[SEP] identifier[getPhysicalFilePath] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[p] operator[=] identifier[FilenameUtils] operator[SEP] identifier[normalize] operator[SEP] identifier[basePath] operator[+] identifier[p] operator[SEP] operator[SEP]
}
Keyword[return] identifier[p] operator[SEP]
}
|
public Observable<SnapshotInner> beginUpdateAsync(String resourceGroupName, String snapshotName, SnapshotUpdate snapshot) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, snapshotName, snapshot).map(new Func1<ServiceResponse<SnapshotInner>, SnapshotInner>() {
@Override
public SnapshotInner call(ServiceResponse<SnapshotInner> response) {
return response.body();
}
});
} | class class_name[name] begin[{]
method[beginUpdateAsync, return_type[type[Observable]], modifier[public], parameter[resourceGroupName, snapshotName, snapshot]] begin[{]
return[call[.beginUpdateWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.snapshotName], member[.snapshot]]]]
end[}]
END[}] | Keyword[public] identifier[Observable] operator[<] identifier[SnapshotInner] operator[>] identifier[beginUpdateAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[snapshotName] , identifier[SnapshotUpdate] identifier[snapshot] operator[SEP] {
Keyword[return] identifier[beginUpdateWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[snapshotName] , identifier[snapshot] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[ServiceResponse] operator[<] identifier[SnapshotInner] operator[>] , identifier[SnapshotInner] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[SnapshotInner] identifier[call] operator[SEP] identifier[ServiceResponse] operator[<] identifier[SnapshotInner] operator[>] identifier[response] operator[SEP] {
Keyword[return] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
public static void closeQuietly(final Reader aReader) {
if (aReader != null) {
try {
aReader.close();
} catch (final IOException details) {
LOGGER.error(details.getMessage(), details);
}
}
} | class class_name[name] begin[{]
method[closeQuietly, return_type[void], modifier[public static], parameter[aReader]] begin[{]
if[binary_operation[member[.aReader], !=, literal[null]]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=aReader, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=details, selectors=[], type_arguments=None), MemberReference(member=details, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=details, types=['IOException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[closeQuietly] operator[SEP] Keyword[final] identifier[Reader] identifier[aReader] operator[SEP] {
Keyword[if] operator[SEP] identifier[aReader] operator[!=] Other[null] operator[SEP] {
Keyword[try] {
identifier[aReader] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[IOException] identifier[details] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[error] operator[SEP] identifier[details] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[details] operator[SEP] operator[SEP]
}
}
}
|
public static String usingAuthentication(String url) {
if (authenticationTypes.BASIC.toString().equals(getInstance().authenticationType)) {
return url.replace("://", "://" + getLogin() + ":" + getPassword() + "@");
}
return url;
} | class class_name[name] begin[{]
method[usingAuthentication, return_type[type[String]], modifier[public static], parameter[url]] begin[{]
if[call[authenticationTypes.BASIC.toString, parameter[]]] begin[{]
return[call[url.replace, parameter[literal["://"], binary_operation[binary_operation[binary_operation[binary_operation[literal["://"], +, call[.getLogin, parameter[]]], +, literal[":"]], +, call[.getPassword, parameter[]]], +, literal["@"]]]]]
else begin[{]
None
end[}]
return[member[.url]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[usingAuthentication] operator[SEP] identifier[String] identifier[url] operator[SEP] {
Keyword[if] operator[SEP] identifier[authenticationTypes] operator[SEP] identifier[BASIC] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] identifier[authenticationType] operator[SEP] operator[SEP] {
Keyword[return] identifier[url] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[+] identifier[getLogin] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[getPassword] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[url] operator[SEP]
}
|
private byte[] bufS(int len, int id_sz, int val_sz,boolean na_sparse){
long NA = CXIChunk.NA(val_sz);
int elem_size = id_sz+val_sz;
byte [] res = MemoryManager.malloc1(CXIChunk._OFF + _sparseLen*elem_size);
UnsafeUtils.set4(res,0,len);
res[4] = (byte)id_sz;
res[5] = (byte)val_sz;
res[6] = na_sparse?(byte)1:0;
if(na_sparse)res[6] = (byte)1;
for(int i = 0; i < _sparseLen; ++i){
if(id_sz == 2) UnsafeUtils.set2(res,CXIChunk._OFF+i*elem_size+0,(short)_id[i]);
else UnsafeUtils.set4(res,CXIChunk._OFF+i*elem_size+0,_id[i]);
long val = isNA2(i)?NA:_ms.get(i);
switch(val_sz){
case 0: break; // no value store dfor binary chunks
case 2: UnsafeUtils.set2(res,CXIChunk._OFF+i*elem_size+id_sz,(short)val); break;
case 4: UnsafeUtils.set4(res,CXIChunk._OFF+i*elem_size+id_sz,(int)val); break;
case 8: UnsafeUtils.set8(res,CXIChunk._OFF+i*elem_size+id_sz,val); break;
default: throw H2O.unimpl();
}
}
return res;
} | class class_name[name] begin[{]
method[bufS, return_type[type[byte]], modifier[private], parameter[len, id_sz, val_sz, na_sparse]] begin[{]
local_variable[type[long], NA]
local_variable[type[int], elem_size]
local_variable[type[byte], res]
call[UnsafeUtils.set4, parameter[member[.res], literal[0], member[.len]]]
assign[member[.res], Cast(expression=MemberReference(member=id_sz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=byte))]
assign[member[.res], Cast(expression=MemberReference(member=val_sz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=byte))]
assign[member[.res], TernaryExpression(condition=MemberReference(member=na_sparse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), if_true=Cast(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), type=BasicType(dimensions=[], name=byte)))]
if[member[.na_sparse]] begin[{]
assign[member[.res], Cast(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), type=BasicType(dimensions=[], name=byte))]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=id_sz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator===), else_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=res, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=_OFF, postfix_operators=[], prefix_operators=[], qualifier=CXIChunk, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=elem_size, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=+), MemberReference(member=_id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=set4, postfix_operators=[], prefix_operators=[], qualifier=UnsafeUtils, selectors=[], type_arguments=None), label=None), label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=res, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=_OFF, postfix_operators=[], prefix_operators=[], qualifier=CXIChunk, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=elem_size, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=+), Cast(expression=MemberReference(member=_id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type=BasicType(dimensions=[], name=short))], member=set2, postfix_operators=[], prefix_operators=[], qualifier=UnsafeUtils, selectors=[], type_arguments=None), label=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=TernaryExpression(condition=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isNA2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), if_false=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=_ms, selectors=[], type_arguments=None), if_true=MemberReference(member=NA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), name=val)], modifiers=set(), type=BasicType(dimensions=[], name=long)), SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], statements=[BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=res, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=_OFF, postfix_operators=[], prefix_operators=[], qualifier=CXIChunk, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=elem_size, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operator=+), operandr=MemberReference(member=id_sz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), Cast(expression=MemberReference(member=val, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=short))], member=set2, postfix_operators=[], prefix_operators=[], qualifier=UnsafeUtils, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4)], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=res, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=_OFF, postfix_operators=[], prefix_operators=[], qualifier=CXIChunk, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=elem_size, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operator=+), operandr=MemberReference(member=id_sz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), Cast(expression=MemberReference(member=val, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=int))], member=set4, postfix_operators=[], prefix_operators=[], qualifier=UnsafeUtils, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8)], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=res, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=_OFF, postfix_operators=[], prefix_operators=[], qualifier=CXIChunk, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=elem_size, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operator=+), operandr=MemberReference(member=id_sz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=val, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=set8, postfix_operators=[], prefix_operators=[], qualifier=UnsafeUtils, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=MethodInvocation(arguments=[], member=unimpl, postfix_operators=[], prefix_operators=[], qualifier=H2O, selectors=[], type_arguments=None), label=None)])], expression=MemberReference(member=val_sz, 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=_sparseLen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)
return[member[.res]]
end[}]
END[}] | Keyword[private] Keyword[byte] operator[SEP] operator[SEP] identifier[bufS] operator[SEP] Keyword[int] identifier[len] , Keyword[int] identifier[id_sz] , Keyword[int] identifier[val_sz] , Keyword[boolean] identifier[na_sparse] operator[SEP] {
Keyword[long] identifier[NA] operator[=] identifier[CXIChunk] operator[SEP] identifier[NA] operator[SEP] identifier[val_sz] operator[SEP] operator[SEP] Keyword[int] identifier[elem_size] operator[=] identifier[id_sz] operator[+] identifier[val_sz] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[res] operator[=] identifier[MemoryManager] operator[SEP] identifier[malloc1] operator[SEP] identifier[CXIChunk] operator[SEP] identifier[_OFF] operator[+] identifier[_sparseLen] operator[*] identifier[elem_size] operator[SEP] operator[SEP] identifier[UnsafeUtils] operator[SEP] identifier[set4] operator[SEP] identifier[res] , Other[0] , identifier[len] operator[SEP] operator[SEP] identifier[res] operator[SEP] Other[4] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] identifier[id_sz] operator[SEP] identifier[res] operator[SEP] Other[5] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] identifier[val_sz] operator[SEP] identifier[res] operator[SEP] Other[6] operator[SEP] operator[=] identifier[na_sparse] operator[?] operator[SEP] Keyword[byte] operator[SEP] Other[1] operator[:] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[na_sparse] operator[SEP] identifier[res] operator[SEP] Other[6] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] Other[1] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[_sparseLen] operator[SEP] operator[++] identifier[i] operator[SEP] {
Keyword[if] operator[SEP] identifier[id_sz] operator[==] Other[2] operator[SEP] identifier[UnsafeUtils] operator[SEP] identifier[set2] operator[SEP] identifier[res] , identifier[CXIChunk] operator[SEP] identifier[_OFF] operator[+] identifier[i] operator[*] identifier[elem_size] operator[+] Other[0] , operator[SEP] Keyword[short] operator[SEP] identifier[_id] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] Keyword[else] identifier[UnsafeUtils] operator[SEP] identifier[set4] operator[SEP] identifier[res] , identifier[CXIChunk] operator[SEP] identifier[_OFF] operator[+] identifier[i] operator[*] identifier[elem_size] operator[+] Other[0] , identifier[_id] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[val] operator[=] identifier[isNA2] operator[SEP] identifier[i] operator[SEP] operator[?] identifier[NA] operator[:] identifier[_ms] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[switch] operator[SEP] identifier[val_sz] operator[SEP] {
Keyword[case] Other[0] operator[:] Keyword[break] operator[SEP] Keyword[case] Other[2] operator[:] identifier[UnsafeUtils] operator[SEP] identifier[set2] operator[SEP] identifier[res] , identifier[CXIChunk] operator[SEP] identifier[_OFF] operator[+] identifier[i] operator[*] identifier[elem_size] operator[+] identifier[id_sz] , operator[SEP] Keyword[short] operator[SEP] identifier[val] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] Other[4] operator[:] identifier[UnsafeUtils] operator[SEP] identifier[set4] operator[SEP] identifier[res] , identifier[CXIChunk] operator[SEP] identifier[_OFF] operator[+] identifier[i] operator[*] identifier[elem_size] operator[+] identifier[id_sz] , operator[SEP] Keyword[int] operator[SEP] identifier[val] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] Other[8] operator[:] identifier[UnsafeUtils] operator[SEP] identifier[set8] operator[SEP] identifier[res] , identifier[CXIChunk] operator[SEP] identifier[_OFF] operator[+] identifier[i] operator[*] identifier[elem_size] operator[+] identifier[id_sz] , identifier[val] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[throw] identifier[H2O] operator[SEP] identifier[unimpl] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[res] operator[SEP]
}
|
public AuthConfig createAuthConfig(boolean isPush, boolean skipExtendedAuth, Map authConfig, Settings settings, String user, String registry)
throws MojoExecutionException {
AuthConfig ret = createStandardAuthConfig(isPush, authConfig, settings, user, registry);
if (ret != null) {
if (registry == null || skipExtendedAuth) {
return ret;
}
try {
return extendedAuthentication(ret, registry);
} catch (IOException e) {
throw new MojoExecutionException(e.getMessage(), e);
}
}
// Finally check ~/.docker/config.json
ret = getAuthConfigFromDockerConfig(registry);
if (ret != null) {
log.debug("AuthConfig: credentials from ~/.docker/config.json");
return ret;
}
log.debug("AuthConfig: no credentials found");
return null;
} | class class_name[name] begin[{]
method[createAuthConfig, return_type[type[AuthConfig]], modifier[public], parameter[isPush, skipExtendedAuth, authConfig, settings, user, registry]] begin[{]
local_variable[type[AuthConfig], ret]
if[binary_operation[member[.ret], !=, literal[null]]] begin[{]
if[binary_operation[binary_operation[member[.registry], ==, literal[null]], ||, member[.skipExtendedAuth]]] begin[{]
return[member[.ret]]
else begin[{]
None
end[}]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=ret, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=registry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=extendedAuthentication, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), 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=MojoExecutionException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
assign[member[.ret], call[.getAuthConfigFromDockerConfig, parameter[member[.registry]]]]
if[binary_operation[member[.ret], !=, literal[null]]] begin[{]
call[log.debug, parameter[literal["AuthConfig: credentials from ~/.docker/config.json"]]]
return[member[.ret]]
else begin[{]
None
end[}]
call[log.debug, parameter[literal["AuthConfig: no credentials found"]]]
return[literal[null]]
end[}]
END[}] | Keyword[public] identifier[AuthConfig] identifier[createAuthConfig] operator[SEP] Keyword[boolean] identifier[isPush] , Keyword[boolean] identifier[skipExtendedAuth] , identifier[Map] identifier[authConfig] , identifier[Settings] identifier[settings] , identifier[String] identifier[user] , identifier[String] identifier[registry] operator[SEP] Keyword[throws] identifier[MojoExecutionException] {
identifier[AuthConfig] identifier[ret] operator[=] identifier[createStandardAuthConfig] operator[SEP] identifier[isPush] , identifier[authConfig] , identifier[settings] , identifier[user] , identifier[registry] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ret] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[registry] operator[==] Other[null] operator[||] identifier[skipExtendedAuth] operator[SEP] {
Keyword[return] identifier[ret] operator[SEP]
}
Keyword[try] {
Keyword[return] identifier[extendedAuthentication] operator[SEP] identifier[ret] , identifier[registry] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[MojoExecutionException] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
identifier[ret] operator[=] identifier[getAuthConfigFromDockerConfig] operator[SEP] identifier[registry] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ret] operator[!=] Other[null] operator[SEP] {
identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[ret] operator[SEP]
}
identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
|
public void terminating()
{
try
{
stateLock.writeLock().lock();
if (state == State.Running)
{
state = State.Shutdown;
stateChange.signalAll();
}
}
finally
{
stateLock.writeLock().unlock();
}
} | class class_name[name] begin[{]
method[terminating, return_type[void], modifier[public], parameter[]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=writeLock, postfix_operators=[], prefix_operators=[], qualifier=stateLock, selectors=[MethodInvocation(arguments=[], member=lock, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=state, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=Running, postfix_operators=[], prefix_operators=[], qualifier=State, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=state, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=Shutdown, postfix_operators=[], prefix_operators=[], qualifier=State, selectors=[])), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=signalAll, postfix_operators=[], prefix_operators=[], qualifier=stateChange, selectors=[], type_arguments=None), label=None)]))], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=writeLock, postfix_operators=[], prefix_operators=[], qualifier=stateLock, selectors=[MethodInvocation(arguments=[], member=unlock, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[terminating] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[stateLock] operator[SEP] identifier[writeLock] operator[SEP] operator[SEP] operator[SEP] identifier[lock] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[==] identifier[State] operator[SEP] identifier[Running] operator[SEP] {
identifier[state] operator[=] identifier[State] operator[SEP] identifier[Shutdown] operator[SEP] identifier[stateChange] operator[SEP] identifier[signalAll] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[finally] {
identifier[stateLock] operator[SEP] identifier[writeLock] operator[SEP] operator[SEP] operator[SEP] identifier[unlock] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public int getIdentifierMaximumLength() {
try {
if (getDatabaseMajorVersion() < ORACLE_12C_MAJOR_VERSION) {
return SHORT_IDENTIFIERS_LENGTH;
}
else if ((getDatabaseMajorVersion() == ORACLE_12C_MAJOR_VERSION) && (getDatabaseMinorVersion() <= 1)) {
return SHORT_IDENTIFIERS_LENGTH;
} else {
return LONG_IDENTIFIERS_LEGNTH;
}
} catch (DatabaseException ex) {
throw new UnexpectedLiquibaseException("Cannot determine the Oracle database version number", ex);
}
} | class class_name[name] begin[{]
method[getIdentifierMaximumLength, return_type[type[int]], modifier[public], parameter[]] begin[{]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getDatabaseMajorVersion, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operandr=MemberReference(member=ORACLE_12C_MAJOR_VERSION, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), else_statement=IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getDatabaseMajorVersion, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operandr=MemberReference(member=ORACLE_12C_MAJOR_VERSION, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getDatabaseMinorVersion, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=<=), operator=&&), else_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=LONG_IDENTIFIERS_LEGNTH, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=SHORT_IDENTIFIERS_LENGTH, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=SHORT_IDENTIFIERS_LENGTH, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot determine the Oracle database version number"), 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=UnexpectedLiquibaseException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['DatabaseException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[int] identifier[getIdentifierMaximumLength] operator[SEP] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[getDatabaseMajorVersion] operator[SEP] operator[SEP] operator[<] identifier[ORACLE_12C_MAJOR_VERSION] operator[SEP] {
Keyword[return] identifier[SHORT_IDENTIFIERS_LENGTH] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] operator[SEP] identifier[getDatabaseMajorVersion] operator[SEP] operator[SEP] operator[==] identifier[ORACLE_12C_MAJOR_VERSION] operator[SEP] operator[&&] operator[SEP] identifier[getDatabaseMinorVersion] operator[SEP] operator[SEP] operator[<=] Other[1] operator[SEP] operator[SEP] {
Keyword[return] identifier[SHORT_IDENTIFIERS_LENGTH] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[LONG_IDENTIFIERS_LEGNTH] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[DatabaseException] identifier[ex] operator[SEP] {
Keyword[throw] Keyword[new] identifier[UnexpectedLiquibaseException] operator[SEP] literal[String] , identifier[ex] operator[SEP] operator[SEP]
}
}
|
public boolean installClustersOfClass(final ODatabaseInternal iDatabase, final OClass iClass,
OModifiableDistributedConfiguration cfg) {
final String databaseName = iDatabase.getName();
if (iClass.isAbstract())
return false;
// INIT THE DATABASE IF NEEDED
getMessageService().registerDatabase(databaseName, cfg);
return executeInDistributedDatabaseLock(databaseName, 20000, cfg,
new OCallable<Boolean, OModifiableDistributedConfiguration>() {
@Override
public Boolean call(final OModifiableDistributedConfiguration lastCfg) {
final Set<String> availableNodes = getAvailableNodeNames(iDatabase.getName());
final List<String> cluster2Create = clusterAssignmentStrategy
.assignClusterOwnershipOfClass(iDatabase, lastCfg, iClass, availableNodes, true);
final Map<OClass, List<String>> cluster2CreateMap = new HashMap<OClass, List<String>>(1);
cluster2CreateMap.put(iClass, cluster2Create);
createClusters(iDatabase, cluster2CreateMap, lastCfg);
return true;
}
});
} | class class_name[name] begin[{]
method[installClustersOfClass, return_type[type[boolean]], modifier[public], parameter[iDatabase, iClass, cfg]] begin[{]
local_variable[type[String], databaseName]
if[call[iClass.isAbstract, parameter[]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
call[.getMessageService, parameter[]]
return[call[.executeInDistributedDatabaseLock, parameter[member[.databaseName], literal[20000], member[.cfg], ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=iDatabase, selectors=[], type_arguments=None)], member=getAvailableNodeNames, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=availableNodes)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=Set, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=iDatabase, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=lastCfg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=iClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=availableNodes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=assignClusterOwnershipOfClass, postfix_operators=[], prefix_operators=[], qualifier=clusterAssignmentStrategy, selectors=[], type_arguments=None), name=cluster2Create)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=List, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], 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=OClass, sub_type=None)), 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=HashMap, sub_type=None)), name=cluster2CreateMap)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=OClass, sub_type=None)), 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=[], name=Map, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=iClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=cluster2Create, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=cluster2CreateMap, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=iDatabase, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=cluster2CreateMap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=lastCfg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createClusters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)], documentation=None, modifiers={'public'}, name=call, parameters=[FormalParameter(annotations=[], modifiers={'final'}, name=lastCfg, type=ReferenceType(arguments=None, dimensions=[], name=OModifiableDistributedConfiguration, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=None, dimensions=[], name=Boolean, 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=Boolean, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=OModifiableDistributedConfiguration, sub_type=None))], dimensions=None, name=OCallable, sub_type=None))]]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[installClustersOfClass] operator[SEP] Keyword[final] identifier[ODatabaseInternal] identifier[iDatabase] , Keyword[final] identifier[OClass] identifier[iClass] , identifier[OModifiableDistributedConfiguration] identifier[cfg] operator[SEP] {
Keyword[final] identifier[String] identifier[databaseName] operator[=] identifier[iDatabase] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[iClass] operator[SEP] identifier[isAbstract] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP] identifier[getMessageService] operator[SEP] operator[SEP] operator[SEP] identifier[registerDatabase] operator[SEP] identifier[databaseName] , identifier[cfg] operator[SEP] operator[SEP] Keyword[return] identifier[executeInDistributedDatabaseLock] operator[SEP] identifier[databaseName] , Other[20000] , identifier[cfg] , Keyword[new] identifier[OCallable] operator[<] identifier[Boolean] , identifier[OModifiableDistributedConfiguration] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Boolean] identifier[call] operator[SEP] Keyword[final] identifier[OModifiableDistributedConfiguration] identifier[lastCfg] operator[SEP] {
Keyword[final] identifier[Set] operator[<] identifier[String] operator[>] identifier[availableNodes] operator[=] identifier[getAvailableNodeNames] operator[SEP] identifier[iDatabase] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[String] operator[>] identifier[cluster2Create] operator[=] identifier[clusterAssignmentStrategy] operator[SEP] identifier[assignClusterOwnershipOfClass] operator[SEP] identifier[iDatabase] , identifier[lastCfg] , identifier[iClass] , identifier[availableNodes] , literal[boolean] operator[SEP] operator[SEP] Keyword[final] identifier[Map] operator[<] identifier[OClass] , identifier[List] operator[<] identifier[String] operator[>] operator[>] identifier[cluster2CreateMap] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[OClass] , identifier[List] operator[<] identifier[String] operator[>] operator[>] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[cluster2CreateMap] operator[SEP] identifier[put] operator[SEP] identifier[iClass] , identifier[cluster2Create] operator[SEP] operator[SEP] identifier[createClusters] operator[SEP] identifier[iDatabase] , identifier[cluster2CreateMap] , identifier[lastCfg] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
@BetaApi
public final ListRoutesPagedResponse listRoutes(ProjectName project) {
ListRoutesHttpRequest request =
ListRoutesHttpRequest.newBuilder()
.setProject(project == null ? null : project.toString())
.build();
return listRoutes(request);
} | class class_name[name] begin[{]
method[listRoutes, return_type[type[ListRoutesPagedResponse]], modifier[final public], parameter[project]] begin[{]
local_variable[type[ListRoutesHttpRequest], request]
return[call[.listRoutes, parameter[member[.request]]]]
end[}]
END[}] | annotation[@] identifier[BetaApi] Keyword[public] Keyword[final] identifier[ListRoutesPagedResponse] identifier[listRoutes] operator[SEP] identifier[ProjectName] identifier[project] operator[SEP] {
identifier[ListRoutesHttpRequest] identifier[request] operator[=] identifier[ListRoutesHttpRequest] operator[SEP] identifier[newBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[setProject] operator[SEP] identifier[project] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[project] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[listRoutes] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
private void clearParentsCache(Entity entity) {
try {
String xpath = null;
if (entity instanceof DataSource) {
// find all reports and charts with this DataSource
xpath = "//nextServer//*[@dataSource='" + entity.getId() + "']";
} else if (entity instanceof Report) {
// find all schedulers with this report
xpath = "//nextServer/scheduler/*[@report='" + entity.getId() + "']";
}
if (xpath != null) {
NodeIterator nodes = getTemplate().query(xpath).getNodes();
while (nodes.hasNext()) {
entitiesCache.remove(nodes.nextNode().getIdentifier());
}
}
// if entity is inside a drill down we have to clear the master
// report (with drillDown list)
// first parent is 'drillDownEntities' node; second parent is the
// actual report/chart
if ((entity instanceof Report) || (entity instanceof Chart)) {
xpath = " //nextServer//drillDownEntities/*[@entity='" + entity.getId() + "']";
if (xpath != null) {
NodeIterator nodes = getTemplate().query(xpath).getNodes();
while (nodes.hasNext()) {
entitiesCache.remove(nodes.nextNode().getParent().getParent().getIdentifier());
}
}
}
} catch (RepositoryException e) {
throw convertJcrAccessException(e);
}
} | class class_name[name] begin[{]
method[clearParentsCache, return_type[void], modifier[private], parameter[entity]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=xpath)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=entity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=DataSource, sub_type=None), operator=instanceof), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=entity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=Report, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=xpath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="//nextServer/scheduler/*[@report='"), operandr=MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=entity, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="']"), operator=+)), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=xpath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="//nextServer//*[@dataSource='"), operandr=MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=entity, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="']"), operator=+)), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=xpath, 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=MethodInvocation(arguments=[], member=getTemplate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=xpath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=query, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getNodes, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=nodes)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=NodeIterator, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=nextNode, postfix_operators=[], prefix_operators=[], qualifier=nodes, selectors=[MethodInvocation(arguments=[], member=getIdentifier, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=remove, postfix_operators=[], prefix_operators=[], qualifier=entitiesCache, selectors=[], type_arguments=None), label=None)]), condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=nodes, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=entity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=Report, sub_type=None), operator=instanceof), operandr=BinaryOperation(operandl=MemberReference(member=entity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=Chart, sub_type=None), operator=instanceof), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=xpath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" //nextServer//drillDownEntities/*[@entity='"), operandr=MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=entity, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="']"), operator=+)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=xpath, 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=MethodInvocation(arguments=[], member=getTemplate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=xpath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=query, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getNodes, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=nodes)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=NodeIterator, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=nextNode, postfix_operators=[], prefix_operators=[], qualifier=nodes, selectors=[MethodInvocation(arguments=[], member=getParent, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getParent, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getIdentifier, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=remove, postfix_operators=[], prefix_operators=[], qualifier=entitiesCache, selectors=[], type_arguments=None), label=None)]), condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=nodes, selectors=[], type_arguments=None), label=None)]))]))], catches=[CatchClause(block=[ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=convertJcrAccessException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['RepositoryException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[clearParentsCache] operator[SEP] identifier[Entity] identifier[entity] operator[SEP] {
Keyword[try] {
identifier[String] identifier[xpath] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[entity] Keyword[instanceof] identifier[DataSource] operator[SEP] {
identifier[xpath] operator[=] literal[String] operator[+] identifier[entity] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[entity] Keyword[instanceof] identifier[Report] operator[SEP] {
identifier[xpath] operator[=] literal[String] operator[+] identifier[entity] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP]
}
Keyword[if] operator[SEP] identifier[xpath] operator[!=] Other[null] operator[SEP] {
identifier[NodeIterator] identifier[nodes] operator[=] identifier[getTemplate] operator[SEP] operator[SEP] operator[SEP] identifier[query] operator[SEP] identifier[xpath] operator[SEP] operator[SEP] identifier[getNodes] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[nodes] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[entitiesCache] operator[SEP] identifier[remove] operator[SEP] identifier[nodes] operator[SEP] identifier[nextNode] operator[SEP] operator[SEP] operator[SEP] identifier[getIdentifier] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] operator[SEP] identifier[entity] Keyword[instanceof] identifier[Report] operator[SEP] operator[||] operator[SEP] identifier[entity] Keyword[instanceof] identifier[Chart] operator[SEP] operator[SEP] {
identifier[xpath] operator[=] literal[String] operator[+] identifier[entity] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] Keyword[if] operator[SEP] identifier[xpath] operator[!=] Other[null] operator[SEP] {
identifier[NodeIterator] identifier[nodes] operator[=] identifier[getTemplate] operator[SEP] operator[SEP] operator[SEP] identifier[query] operator[SEP] identifier[xpath] operator[SEP] operator[SEP] identifier[getNodes] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[nodes] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[entitiesCache] operator[SEP] identifier[remove] operator[SEP] identifier[nodes] operator[SEP] identifier[nextNode] operator[SEP] operator[SEP] operator[SEP] identifier[getParent] operator[SEP] operator[SEP] operator[SEP] identifier[getParent] operator[SEP] operator[SEP] operator[SEP] identifier[getIdentifier] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
Keyword[catch] operator[SEP] identifier[RepositoryException] identifier[e] operator[SEP] {
Keyword[throw] identifier[convertJcrAccessException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
protected final String renderTagId(HttpServletRequest request, String tagId, AbstractHtmlState state)
{
assert(_trs.tagId != null);
state.id = getIdForTagId(tagId);
String script = renderDefaultJavaScript(request, state.id);
return script;
} | class class_name[name] begin[{]
method[renderTagId, return_type[type[String]], modifier[final protected], parameter[request, tagId, state]] begin[{]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=tagId, postfix_operators=[], prefix_operators=[], qualifier=_trs, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None, value=None)
assign[member[state.id], call[.getIdForTagId, parameter[member[.tagId]]]]
local_variable[type[String], script]
return[member[.script]]
end[}]
END[}] | Keyword[protected] Keyword[final] identifier[String] identifier[renderTagId] operator[SEP] identifier[HttpServletRequest] identifier[request] , identifier[String] identifier[tagId] , identifier[AbstractHtmlState] identifier[state] operator[SEP] {
Keyword[assert] operator[SEP] identifier[_trs] operator[SEP] identifier[tagId] operator[!=] Other[null] operator[SEP] operator[SEP] identifier[state] operator[SEP] identifier[id] operator[=] identifier[getIdForTagId] operator[SEP] identifier[tagId] operator[SEP] operator[SEP] identifier[String] identifier[script] operator[=] identifier[renderDefaultJavaScript] operator[SEP] identifier[request] , identifier[state] operator[SEP] identifier[id] operator[SEP] operator[SEP] Keyword[return] identifier[script] operator[SEP]
}
|
@Override
public void sawOpcode(int seen) {
ImmutabilityType imType = null;
try {
stack.precomputation(this);
switch (seen) {
case Const.INVOKESTATIC:
case Const.INVOKEINTERFACE:
case Const.INVOKESPECIAL:
case Const.INVOKEVIRTUAL: {
String className = getClassConstantOperand();
String methodName = getNameConstantOperand();
String signature = getSigConstantOperand();
MethodInfo mi = Statistics.getStatistics().getMethodStatistics(className, methodName, signature);
imType = mi.getImmutabilityType();
if (seen == Const.INVOKEINTERFACE) {
Integer collectionOffset = MODIFYING_METHODS.get(new QMethod(methodName, signature));
if ((collectionOffset != null) && CollectionUtils.isListSetMap(className) && (stack.getStackDepth() > collectionOffset.intValue())) {
OpcodeStack.Item item = stack.getStackItem(collectionOffset.intValue());
ImmutabilityType type = (ImmutabilityType) item.getUserValue();
if ((type == ImmutabilityType.IMMUTABLE)
|| ((type == ImmutabilityType.POSSIBLY_IMMUTABLE) && (reportedType != ImmutabilityType.POSSIBLY_IMMUTABLE))) {
bugReporter.reportBug(new BugInstance(this, BugType.MUC_MODIFYING_UNMODIFIABLE_COLLECTION.name(),
(type == ImmutabilityType.IMMUTABLE) ? HIGH_PRIORITY : NORMAL_PRIORITY).addClass(this).addMethod(this)
.addSourceLine(this));
if (type == ImmutabilityType.IMMUTABLE) {
throw new StopOpcodeParsingException();
}
reportedType = type;
}
}
}
}
break;
default:
break;
}
} catch (ClassNotFoundException cnfe) {
bugReporter.reportMissingClass(cnfe);
} finally {
stack.sawOpcode(this, seen);
if ((imType != null) && (stack.getStackDepth() > 0)) {
OpcodeStack.Item item = stack.getStackItem(0);
item.setUserValue(imType);
}
}
} | class class_name[name] begin[{]
method[sawOpcode, return_type[void], modifier[public], parameter[seen]] begin[{]
local_variable[type[ImmutabilityType], imType]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=precomputation, postfix_operators=[], prefix_operators=[], qualifier=stack, selectors=[], type_arguments=None), label=None), SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=INVOKESTATIC, postfix_operators=[], prefix_operators=[], qualifier=Const, selectors=[]), MemberReference(member=INVOKEINTERFACE, postfix_operators=[], prefix_operators=[], qualifier=Const, selectors=[]), MemberReference(member=INVOKESPECIAL, postfix_operators=[], prefix_operators=[], qualifier=Const, selectors=[]), MemberReference(member=INVOKEVIRTUAL, postfix_operators=[], prefix_operators=[], qualifier=Const, selectors=[])], statements=[BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getClassConstantOperand, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=className)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getNameConstantOperand, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=methodName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getSigConstantOperand, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=signature)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getStatistics, postfix_operators=[], prefix_operators=[], qualifier=Statistics, selectors=[MethodInvocation(arguments=[MemberReference(member=className, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=methodName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=signature, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getMethodStatistics, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=mi)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MethodInfo, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=imType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getImmutabilityType, postfix_operators=[], prefix_operators=[], qualifier=mi, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=seen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=INVOKEINTERFACE, postfix_operators=[], prefix_operators=[], qualifier=Const, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=methodName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=signature, 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=QMethod, sub_type=None))], member=get, postfix_operators=[], prefix_operators=[], qualifier=MODIFYING_METHODS, selectors=[], type_arguments=None), name=collectionOffset)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=collectionOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[MemberReference(member=className, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isListSetMap, postfix_operators=[], prefix_operators=[], qualifier=CollectionUtils, selectors=[], type_arguments=None), operator=&&), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getStackDepth, postfix_operators=[], prefix_operators=[], qualifier=stack, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=intValue, postfix_operators=[], prefix_operators=[], qualifier=collectionOffset, selectors=[], type_arguments=None), operator=>), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=intValue, postfix_operators=[], prefix_operators=[], qualifier=collectionOffset, selectors=[], type_arguments=None)], member=getStackItem, postfix_operators=[], prefix_operators=[], qualifier=stack, selectors=[], type_arguments=None), name=item)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=OpcodeStack, sub_type=ReferenceType(arguments=None, dimensions=None, name=Item, sub_type=None))), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[], member=getUserValue, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=ImmutabilityType, sub_type=None)), name=type)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ImmutabilityType, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=IMMUTABLE, postfix_operators=[], prefix_operators=[], qualifier=ImmutabilityType, selectors=[]), operator===), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=POSSIBLY_IMMUTABLE, postfix_operators=[], prefix_operators=[], qualifier=ImmutabilityType, selectors=[]), operator===), operandr=BinaryOperation(operandl=MemberReference(member=reportedType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=POSSIBLY_IMMUTABLE, postfix_operators=[], prefix_operators=[], qualifier=ImmutabilityType, selectors=[]), operator=!=), operator=&&), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=BugType.MUC_MODIFYING_UNMODIFIABLE_COLLECTION, selectors=[], type_arguments=None), TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=IMMUTABLE, postfix_operators=[], prefix_operators=[], qualifier=ImmutabilityType, selectors=[]), operator===), if_false=MemberReference(member=NORMAL_PRIORITY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=HIGH_PRIORITY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=addClass, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=addMethod, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=addSourceLine, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=BugInstance, sub_type=None))], member=reportBug, postfix_operators=[], prefix_operators=[], qualifier=bugReporter, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=IMMUTABLE, postfix_operators=[], prefix_operators=[], qualifier=ImmutabilityType, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StopOpcodeParsingException, sub_type=None)), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=reportedType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]))]))]))]), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[BreakStatement(goto=None, label=None)])], expression=MemberReference(member=seen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=cnfe, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=reportMissingClass, postfix_operators=[], prefix_operators=[], qualifier=bugReporter, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=cnfe, types=['ClassNotFoundException']))], finally_block=[StatementExpression(expression=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=seen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=sawOpcode, postfix_operators=[], prefix_operators=[], qualifier=stack, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=imType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getStackDepth, postfix_operators=[], prefix_operators=[], qualifier=stack, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=getStackItem, postfix_operators=[], prefix_operators=[], qualifier=stack, selectors=[], type_arguments=None), name=item)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=OpcodeStack, sub_type=ReferenceType(arguments=None, dimensions=None, name=Item, sub_type=None))), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=imType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setUserValue, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[], type_arguments=None), label=None)]))], label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[sawOpcode] operator[SEP] Keyword[int] identifier[seen] operator[SEP] {
identifier[ImmutabilityType] identifier[imType] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[stack] operator[SEP] identifier[precomputation] operator[SEP] Keyword[this] operator[SEP] operator[SEP] Keyword[switch] operator[SEP] identifier[seen] operator[SEP] {
Keyword[case] identifier[Const] operator[SEP] identifier[INVOKESTATIC] operator[:] Keyword[case] identifier[Const] operator[SEP] identifier[INVOKEINTERFACE] operator[:] Keyword[case] identifier[Const] operator[SEP] identifier[INVOKESPECIAL] operator[:] Keyword[case] identifier[Const] operator[SEP] identifier[INVOKEVIRTUAL] operator[:] {
identifier[String] identifier[className] operator[=] identifier[getClassConstantOperand] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[methodName] operator[=] identifier[getNameConstantOperand] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[signature] operator[=] identifier[getSigConstantOperand] operator[SEP] operator[SEP] operator[SEP] identifier[MethodInfo] identifier[mi] operator[=] identifier[Statistics] operator[SEP] identifier[getStatistics] operator[SEP] operator[SEP] operator[SEP] identifier[getMethodStatistics] operator[SEP] identifier[className] , identifier[methodName] , identifier[signature] operator[SEP] operator[SEP] identifier[imType] operator[=] identifier[mi] operator[SEP] identifier[getImmutabilityType] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[seen] operator[==] identifier[Const] operator[SEP] identifier[INVOKEINTERFACE] operator[SEP] {
identifier[Integer] identifier[collectionOffset] operator[=] identifier[MODIFYING_METHODS] operator[SEP] identifier[get] operator[SEP] Keyword[new] identifier[QMethod] operator[SEP] identifier[methodName] , identifier[signature] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[collectionOffset] operator[!=] Other[null] operator[SEP] operator[&&] identifier[CollectionUtils] operator[SEP] identifier[isListSetMap] operator[SEP] identifier[className] operator[SEP] operator[&&] operator[SEP] identifier[stack] operator[SEP] identifier[getStackDepth] operator[SEP] operator[SEP] operator[>] identifier[collectionOffset] operator[SEP] identifier[intValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[OpcodeStack] operator[SEP] identifier[Item] identifier[item] operator[=] identifier[stack] operator[SEP] identifier[getStackItem] operator[SEP] identifier[collectionOffset] operator[SEP] identifier[intValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[ImmutabilityType] identifier[type] operator[=] operator[SEP] identifier[ImmutabilityType] operator[SEP] identifier[item] operator[SEP] identifier[getUserValue] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[type] operator[==] identifier[ImmutabilityType] operator[SEP] identifier[IMMUTABLE] operator[SEP] operator[||] operator[SEP] operator[SEP] identifier[type] operator[==] identifier[ImmutabilityType] operator[SEP] identifier[POSSIBLY_IMMUTABLE] operator[SEP] operator[&&] operator[SEP] identifier[reportedType] operator[!=] identifier[ImmutabilityType] operator[SEP] identifier[POSSIBLY_IMMUTABLE] operator[SEP] operator[SEP] operator[SEP] {
identifier[bugReporter] operator[SEP] identifier[reportBug] operator[SEP] Keyword[new] identifier[BugInstance] operator[SEP] Keyword[this] , identifier[BugType] operator[SEP] identifier[MUC_MODIFYING_UNMODIFIABLE_COLLECTION] operator[SEP] identifier[name] operator[SEP] operator[SEP] , operator[SEP] identifier[type] operator[==] identifier[ImmutabilityType] operator[SEP] identifier[IMMUTABLE] operator[SEP] operator[?] identifier[HIGH_PRIORITY] operator[:] identifier[NORMAL_PRIORITY] operator[SEP] operator[SEP] identifier[addClass] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[addMethod] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[addSourceLine] operator[SEP] Keyword[this] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[type] operator[==] identifier[ImmutabilityType] operator[SEP] identifier[IMMUTABLE] operator[SEP] {
Keyword[throw] Keyword[new] identifier[StopOpcodeParsingException] operator[SEP] operator[SEP] operator[SEP]
}
identifier[reportedType] operator[=] identifier[type] operator[SEP]
}
}
}
}
Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[break] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[ClassNotFoundException] identifier[cnfe] operator[SEP] {
identifier[bugReporter] operator[SEP] identifier[reportMissingClass] operator[SEP] identifier[cnfe] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[stack] operator[SEP] identifier[sawOpcode] operator[SEP] Keyword[this] , identifier[seen] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[imType] operator[!=] Other[null] operator[SEP] operator[&&] operator[SEP] identifier[stack] operator[SEP] identifier[getStackDepth] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] operator[SEP] {
identifier[OpcodeStack] operator[SEP] identifier[Item] identifier[item] operator[=] identifier[stack] operator[SEP] identifier[getStackItem] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[item] operator[SEP] identifier[setUserValue] operator[SEP] identifier[imType] operator[SEP] operator[SEP]
}
}
}
|
public ServiceFuture<Void> beginExportDataAsync(String resourceGroupName, String name, ExportRDBParameters parameters, final ServiceCallback<Void> serviceCallback) {
return ServiceFuture.fromResponse(beginExportDataWithServiceResponseAsync(resourceGroupName, name, parameters), serviceCallback);
} | class class_name[name] begin[{]
method[beginExportDataAsync, return_type[type[ServiceFuture]], modifier[public], parameter[resourceGroupName, name, parameters, serviceCallback]] begin[{]
return[call[ServiceFuture.fromResponse, parameter[call[.beginExportDataWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.name], member[.parameters]]], member[.serviceCallback]]]]
end[}]
END[}] | Keyword[public] identifier[ServiceFuture] operator[<] identifier[Void] operator[>] identifier[beginExportDataAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[name] , identifier[ExportRDBParameters] identifier[parameters] , Keyword[final] identifier[ServiceCallback] operator[<] identifier[Void] operator[>] identifier[serviceCallback] operator[SEP] {
Keyword[return] identifier[ServiceFuture] operator[SEP] identifier[fromResponse] operator[SEP] identifier[beginExportDataWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[name] , identifier[parameters] operator[SEP] , identifier[serviceCallback] operator[SEP] operator[SEP]
}
|
public void handleEvent(Event event) {
String topic = event.getTopic();
Session session = (Session) event.getProperty(Session.class.getName());
RepositorySession repositoryRession = null;
Thread thisThread = Thread.currentThread();
ClassLoader classloader = thisThread.getContextClassLoader();
// ES might load classes so we had better set the context classloader.
try {
thisThread.setContextClassLoader(this.getClass().getClassLoader());
try {
repositoryRession = new RepositorySessionImpl(session,
repository);
} catch (ClientPoolException e1) {
LOGGER.error(e1.getMessage(), e1);
return;
} catch (StorageClientException e1) {
LOGGER.error(e1.getMessage(), e1);
return;
} catch (AccessDeniedException e1) {
LOGGER.error(e1.getMessage(), e1);
return;
}
LOGGER.debug("Got Event {} {} ", event, handlers);
Collection<IndexingHandler> contentIndexHandler = handlers
.get(topic);
if (contentIndexHandler != null && contentIndexHandler.size() > 0) {
BulkRequestBuilder bulk = client.prepareBulk();
int added = 0;
for (IndexingHandler indexingHandler : contentIndexHandler) {
Collection<InputDocument> documents = indexingHandler
.getDocuments(repositoryRession, event);
for (InputDocument in : documents) {
LOGGER.info("Indexing {} ", in);
if (in.isDelete()) {
bulk.add(client.prepareDelete(in.getIndexName(),
in.getDocumentType(), in.getDocumentId()));
added++;
} else {
try {
IndexRequestBuilder r = client.prepareIndex(
in.getIndexName(),
in.getDocumentType(),
in.getDocumentId());
XContentBuilder d = XContentFactory
.jsonBuilder();
d = d.startObject();
for (Entry<String, Object> e : in.getKeyData()) {
d = d.field(e.getKey(), e.getValue());
}
r.setSource(d.endObject());
bulk.add(r);
added++;
} catch (IOException e) {
LOGGER.error(e.getMessage(), e);
}
}
}
}
if ( added > 0 ) {
BulkResponse resp = bulk.execute().actionGet();
if (resp.hasFailures()) {
for (BulkItemResponse br : Iterables.adaptTo(resp
.iterator())) {
if (br.failed()) {
LOGGER.error("Failed {} {} ", br.getId(),
br.getFailureMessage());
// not going to retry at the moment, just log.
}
}
}
}
}
} finally {
if (repositoryRession != null) {
repositoryRession.logout();
}
thisThread.setContextClassLoader(classloader);
}
} | class class_name[name] begin[{]
method[handleEvent, return_type[void], modifier[public], parameter[event]] begin[{]
local_variable[type[String], topic]
local_variable[type[Session], session]
local_variable[type[RepositorySession], repositoryRession]
local_variable[type[Thread], thisThread]
local_variable[type[ClassLoader], classloader]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getClass, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getClassLoader, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])], member=setContextClassLoader, postfix_operators=[], prefix_operators=[], qualifier=thisThread, selectors=[], type_arguments=None), label=None), TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=repositoryRession, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=session, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=repository, 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=RepositorySessionImpl, sub_type=None))), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e1, selectors=[], type_arguments=None), MemberReference(member=e1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e1, types=['ClientPoolException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e1, selectors=[], type_arguments=None), MemberReference(member=e1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e1, types=['StorageClientException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e1, selectors=[], type_arguments=None), MemberReference(member=e1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e1, types=['AccessDeniedException']))], finally_block=None, label=None, resources=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Got Event {} {} "), MemberReference(member=event, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=handlers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debug, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=topic, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=handlers, selectors=[], type_arguments=None), name=contentIndexHandler)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=IndexingHandler, sub_type=None))], dimensions=[], name=Collection, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=contentIndexHandler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=contentIndexHandler, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=prepareBulk, postfix_operators=[], prefix_operators=[], qualifier=client, selectors=[], type_arguments=None), name=bulk)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BulkRequestBuilder, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=added)], modifiers=set(), type=BasicType(dimensions=[], name=int)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=repositoryRession, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=event, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getDocuments, postfix_operators=[], prefix_operators=[], qualifier=indexingHandler, selectors=[], type_arguments=None), name=documents)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=InputDocument, sub_type=None))], dimensions=[], name=Collection, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Indexing {} "), MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=info, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=isDelete, postfix_operators=[], prefix_operators=[], qualifier=in, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getIndexName, postfix_operators=[], prefix_operators=[], qualifier=in, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getDocumentType, postfix_operators=[], prefix_operators=[], qualifier=in, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getDocumentId, postfix_operators=[], prefix_operators=[], qualifier=in, selectors=[], type_arguments=None)], member=prepareIndex, postfix_operators=[], prefix_operators=[], qualifier=client, selectors=[], type_arguments=None), name=r)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IndexRequestBuilder, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=jsonBuilder, postfix_operators=[], prefix_operators=[], qualifier=XContentFactory, selectors=[], type_arguments=None), name=d)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=XContentBuilder, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=startObject, postfix_operators=[], prefix_operators=[], qualifier=d, selectors=[], type_arguments=None)), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], member=field, postfix_operators=[], prefix_operators=[], qualifier=d, selectors=[], type_arguments=None)), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getKeyData, postfix_operators=[], prefix_operators=[], qualifier=in, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=e)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=[], name=Entry, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=endObject, postfix_operators=[], prefix_operators=[], qualifier=d, selectors=[], type_arguments=None)], member=setSource, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=bulk, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MemberReference(member=added, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getIndexName, postfix_operators=[], prefix_operators=[], qualifier=in, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getDocumentType, postfix_operators=[], prefix_operators=[], qualifier=in, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getDocumentId, postfix_operators=[], prefix_operators=[], qualifier=in, selectors=[], type_arguments=None)], member=prepareDelete, postfix_operators=[], prefix_operators=[], qualifier=client, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=bulk, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MemberReference(member=added, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=documents, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=in)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=InputDocument, sub_type=None))), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=contentIndexHandler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=indexingHandler)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IndexingHandler, sub_type=None))), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=added, 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=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=execute, postfix_operators=[], prefix_operators=[], qualifier=bulk, selectors=[MethodInvocation(arguments=[], member=actionGet, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=resp)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BulkResponse, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=hasFailures, postfix_operators=[], prefix_operators=[], qualifier=resp, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=failed, postfix_operators=[], prefix_operators=[], qualifier=br, selectors=[], 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="Failed {} {} "), MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=br, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getFailureMessage, postfix_operators=[], prefix_operators=[], qualifier=br, selectors=[], type_arguments=None)], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=iterator, postfix_operators=[], prefix_operators=[], qualifier=resp, selectors=[], type_arguments=None)], member=adaptTo, postfix_operators=[], prefix_operators=[], qualifier=Iterables, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=br)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BulkItemResponse, sub_type=None))), label=None)]))]))]))], catches=None, finally_block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=repositoryRession, 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=[], member=logout, postfix_operators=[], prefix_operators=[], qualifier=repositoryRession, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=classloader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setContextClassLoader, postfix_operators=[], prefix_operators=[], qualifier=thisThread, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[handleEvent] operator[SEP] identifier[Event] identifier[event] operator[SEP] {
identifier[String] identifier[topic] operator[=] identifier[event] operator[SEP] identifier[getTopic] operator[SEP] operator[SEP] operator[SEP] identifier[Session] identifier[session] operator[=] operator[SEP] identifier[Session] operator[SEP] identifier[event] operator[SEP] identifier[getProperty] operator[SEP] identifier[Session] operator[SEP] Keyword[class] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[RepositorySession] identifier[repositoryRession] operator[=] Other[null] operator[SEP] identifier[Thread] identifier[thisThread] operator[=] identifier[Thread] operator[SEP] identifier[currentThread] operator[SEP] operator[SEP] operator[SEP] identifier[ClassLoader] identifier[classloader] operator[=] identifier[thisThread] operator[SEP] identifier[getContextClassLoader] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[thisThread] operator[SEP] identifier[setContextClassLoader] operator[SEP] Keyword[this] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getClassLoader] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[repositoryRession] operator[=] Keyword[new] identifier[RepositorySessionImpl] operator[SEP] identifier[session] , identifier[repository] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ClientPoolException] identifier[e1] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[error] operator[SEP] identifier[e1] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e1] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[StorageClientException] identifier[e1] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[error] operator[SEP] identifier[e1] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e1] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[AccessDeniedException] identifier[e1] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[error] operator[SEP] identifier[e1] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e1] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[event] , identifier[handlers] operator[SEP] operator[SEP] identifier[Collection] operator[<] identifier[IndexingHandler] operator[>] identifier[contentIndexHandler] operator[=] identifier[handlers] operator[SEP] identifier[get] operator[SEP] identifier[topic] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[contentIndexHandler] operator[!=] Other[null] operator[&&] identifier[contentIndexHandler] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[BulkRequestBuilder] identifier[bulk] operator[=] identifier[client] operator[SEP] identifier[prepareBulk] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[added] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[IndexingHandler] identifier[indexingHandler] operator[:] identifier[contentIndexHandler] operator[SEP] {
identifier[Collection] operator[<] identifier[InputDocument] operator[>] identifier[documents] operator[=] identifier[indexingHandler] operator[SEP] identifier[getDocuments] operator[SEP] identifier[repositoryRession] , identifier[event] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[InputDocument] identifier[in] operator[:] identifier[documents] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[in] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[in] operator[SEP] identifier[isDelete] operator[SEP] operator[SEP] operator[SEP] {
identifier[bulk] operator[SEP] identifier[add] operator[SEP] identifier[client] operator[SEP] identifier[prepareDelete] operator[SEP] identifier[in] operator[SEP] identifier[getIndexName] operator[SEP] operator[SEP] , identifier[in] operator[SEP] identifier[getDocumentType] operator[SEP] operator[SEP] , identifier[in] operator[SEP] identifier[getDocumentId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[added] operator[++] operator[SEP]
}
Keyword[else] {
Keyword[try] {
identifier[IndexRequestBuilder] identifier[r] operator[=] identifier[client] operator[SEP] identifier[prepareIndex] operator[SEP] identifier[in] operator[SEP] identifier[getIndexName] operator[SEP] operator[SEP] , identifier[in] operator[SEP] identifier[getDocumentType] operator[SEP] operator[SEP] , identifier[in] operator[SEP] identifier[getDocumentId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[XContentBuilder] identifier[d] operator[=] identifier[XContentFactory] operator[SEP] identifier[jsonBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[d] operator[=] identifier[d] operator[SEP] identifier[startObject] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[Object] operator[>] identifier[e] operator[:] identifier[in] operator[SEP] identifier[getKeyData] operator[SEP] operator[SEP] operator[SEP] {
identifier[d] operator[=] identifier[d] operator[SEP] identifier[field] operator[SEP] identifier[e] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[e] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[r] operator[SEP] identifier[setSource] operator[SEP] identifier[d] operator[SEP] identifier[endObject] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[bulk] operator[SEP] identifier[add] operator[SEP] identifier[r] operator[SEP] operator[SEP] identifier[added] operator[++] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[error] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
}
}
Keyword[if] operator[SEP] identifier[added] operator[>] Other[0] operator[SEP] {
identifier[BulkResponse] identifier[resp] operator[=] identifier[bulk] operator[SEP] identifier[execute] operator[SEP] operator[SEP] operator[SEP] identifier[actionGet] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[resp] operator[SEP] identifier[hasFailures] operator[SEP] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[BulkItemResponse] identifier[br] operator[:] identifier[Iterables] operator[SEP] identifier[adaptTo] operator[SEP] identifier[resp] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[br] operator[SEP] identifier[failed] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[br] operator[SEP] identifier[getId] operator[SEP] operator[SEP] , identifier[br] operator[SEP] identifier[getFailureMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
}
}
Keyword[finally] {
Keyword[if] operator[SEP] identifier[repositoryRession] operator[!=] Other[null] operator[SEP] {
identifier[repositoryRession] operator[SEP] identifier[logout] operator[SEP] operator[SEP] operator[SEP]
}
identifier[thisThread] operator[SEP] identifier[setContextClassLoader] operator[SEP] identifier[classloader] operator[SEP] operator[SEP]
}
}
|
private boolean isAlwaysSafeConversion( int fromType,
int toType ) {
if (fromType == toType) return true;
switch (toType) {
case PropertyType.BOOLEAN:
return fromType == PropertyType.BINARY || fromType == PropertyType.STRING;
case PropertyType.DATE:
return fromType == PropertyType.DOUBLE || fromType == PropertyType.LONG;
case PropertyType.DOUBLE:
// Conversion from DATE could result in out-of-range value
return fromType == PropertyType.LONG;
case PropertyType.LONG:
// Conversion from DATE could result in out-of-range value
return fromType == PropertyType.DOUBLE;
case PropertyType.PATH:
return fromType == PropertyType.NAME;
// Values of any type MAY fail when converting to these types
case PropertyType.NAME:
case PropertyType.REFERENCE:
case PropertyType.WEAKREFERENCE:
case org.modeshape.jcr.api.PropertyType.SIMPLE_REFERENCE:
return false;
// Any type can be converted to these types
case PropertyType.BINARY:
case PropertyType.STRING:
case PropertyType.UNDEFINED:
return true;
default:
throw new IllegalStateException("Unexpected state: " + toType);
}
} | class class_name[name] begin[{]
method[isAlwaysSafeConversion, return_type[type[boolean]], modifier[private], parameter[fromType, toType]] begin[{]
if[binary_operation[member[.fromType], ==, member[.toType]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=BOOLEAN, postfix_operators=[], prefix_operators=[], qualifier=PropertyType, selectors=[])], statements=[ReturnStatement(expression=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=fromType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=BINARY, postfix_operators=[], prefix_operators=[], qualifier=PropertyType, selectors=[]), operator===), operandr=BinaryOperation(operandl=MemberReference(member=fromType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=STRING, postfix_operators=[], prefix_operators=[], qualifier=PropertyType, selectors=[]), operator===), operator=||), label=None)]), SwitchStatementCase(case=[MemberReference(member=DATE, postfix_operators=[], prefix_operators=[], qualifier=PropertyType, selectors=[])], statements=[ReturnStatement(expression=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=fromType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=DOUBLE, postfix_operators=[], prefix_operators=[], qualifier=PropertyType, selectors=[]), operator===), operandr=BinaryOperation(operandl=MemberReference(member=fromType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=LONG, postfix_operators=[], prefix_operators=[], qualifier=PropertyType, selectors=[]), operator===), operator=||), label=None)]), SwitchStatementCase(case=[MemberReference(member=DOUBLE, postfix_operators=[], prefix_operators=[], qualifier=PropertyType, selectors=[])], statements=[ReturnStatement(expression=BinaryOperation(operandl=MemberReference(member=fromType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=LONG, postfix_operators=[], prefix_operators=[], qualifier=PropertyType, selectors=[]), operator===), label=None)]), SwitchStatementCase(case=[MemberReference(member=LONG, postfix_operators=[], prefix_operators=[], qualifier=PropertyType, selectors=[])], statements=[ReturnStatement(expression=BinaryOperation(operandl=MemberReference(member=fromType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=DOUBLE, postfix_operators=[], prefix_operators=[], qualifier=PropertyType, selectors=[]), operator===), label=None)]), SwitchStatementCase(case=[MemberReference(member=PATH, postfix_operators=[], prefix_operators=[], qualifier=PropertyType, selectors=[])], statements=[ReturnStatement(expression=BinaryOperation(operandl=MemberReference(member=fromType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=NAME, postfix_operators=[], prefix_operators=[], qualifier=PropertyType, selectors=[]), operator===), label=None)]), SwitchStatementCase(case=[MemberReference(member=NAME, postfix_operators=[], prefix_operators=[], qualifier=PropertyType, selectors=[]), MemberReference(member=REFERENCE, postfix_operators=[], prefix_operators=[], qualifier=PropertyType, selectors=[]), MemberReference(member=WEAKREFERENCE, postfix_operators=[], prefix_operators=[], qualifier=PropertyType, selectors=[]), MemberReference(member=SIMPLE_REFERENCE, postfix_operators=[], prefix_operators=[], qualifier=org.modeshape.jcr.api.PropertyType, selectors=[])], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)]), SwitchStatementCase(case=[MemberReference(member=BINARY, postfix_operators=[], prefix_operators=[], qualifier=PropertyType, selectors=[]), MemberReference(member=STRING, postfix_operators=[], prefix_operators=[], qualifier=PropertyType, selectors=[]), MemberReference(member=UNDEFINED, postfix_operators=[], prefix_operators=[], qualifier=PropertyType, selectors=[])], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unexpected state: "), operandr=MemberReference(member=toType, 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=IllegalStateException, sub_type=None)), label=None)])], expression=MemberReference(member=toType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[isAlwaysSafeConversion] operator[SEP] Keyword[int] identifier[fromType] , Keyword[int] identifier[toType] operator[SEP] {
Keyword[if] operator[SEP] identifier[fromType] operator[==] identifier[toType] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[switch] operator[SEP] identifier[toType] operator[SEP] {
Keyword[case] identifier[PropertyType] operator[SEP] identifier[BOOLEAN] operator[:] Keyword[return] identifier[fromType] operator[==] identifier[PropertyType] operator[SEP] identifier[BINARY] operator[||] identifier[fromType] operator[==] identifier[PropertyType] operator[SEP] identifier[STRING] operator[SEP] Keyword[case] identifier[PropertyType] operator[SEP] identifier[DATE] operator[:] Keyword[return] identifier[fromType] operator[==] identifier[PropertyType] operator[SEP] identifier[DOUBLE] operator[||] identifier[fromType] operator[==] identifier[PropertyType] operator[SEP] identifier[LONG] operator[SEP] Keyword[case] identifier[PropertyType] operator[SEP] identifier[DOUBLE] operator[:] Keyword[return] identifier[fromType] operator[==] identifier[PropertyType] operator[SEP] identifier[LONG] operator[SEP] Keyword[case] identifier[PropertyType] operator[SEP] identifier[LONG] operator[:] Keyword[return] identifier[fromType] operator[==] identifier[PropertyType] operator[SEP] identifier[DOUBLE] operator[SEP] Keyword[case] identifier[PropertyType] operator[SEP] identifier[PATH] operator[:] Keyword[return] identifier[fromType] operator[==] identifier[PropertyType] operator[SEP] identifier[NAME] operator[SEP] Keyword[case] identifier[PropertyType] operator[SEP] identifier[NAME] operator[:] Keyword[case] identifier[PropertyType] operator[SEP] identifier[REFERENCE] operator[:] Keyword[case] identifier[PropertyType] operator[SEP] identifier[WEAKREFERENCE] operator[:] Keyword[case] identifier[org] operator[SEP] identifier[modeshape] operator[SEP] identifier[jcr] operator[SEP] identifier[api] operator[SEP] identifier[PropertyType] operator[SEP] identifier[SIMPLE_REFERENCE] operator[:] Keyword[return] literal[boolean] operator[SEP] Keyword[case] identifier[PropertyType] operator[SEP] identifier[BINARY] operator[:] Keyword[case] identifier[PropertyType] operator[SEP] identifier[STRING] operator[:] Keyword[case] identifier[PropertyType] operator[SEP] identifier[UNDEFINED] operator[:] Keyword[return] literal[boolean] operator[SEP] Keyword[default] operator[:] Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] identifier[toType] operator[SEP] operator[SEP]
}
}
|
public static int compareKey(byte[] key1, byte[] key2) {
return compareKey(key1, key2, Math.min(key1.length, key2.length));
} | class class_name[name] begin[{]
method[compareKey, return_type[type[int]], modifier[public static], parameter[key1, key2]] begin[{]
return[call[.compareKey, parameter[member[.key1], member[.key2], call[Math.min, parameter[member[key1.length], member[key2.length]]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[int] identifier[compareKey] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[key1] , Keyword[byte] operator[SEP] operator[SEP] identifier[key2] operator[SEP] {
Keyword[return] identifier[compareKey] operator[SEP] identifier[key1] , identifier[key2] , identifier[Math] operator[SEP] identifier[min] operator[SEP] identifier[key1] operator[SEP] identifier[length] , identifier[key2] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
|
@SuppressWarnings({ "unchecked", "rawtypes" })
public static Object getPropertyValueOfNewInstance(Class clazz, String propertyName, Class<?> propertyType) {
// validate
if (clazz == null || !StringUtils.hasText(propertyName)) {
return null;
}
try {
return getPropertyOrStaticPropertyOrFieldValue(BeanUtils.instantiateClass(clazz), propertyName);
}
catch (BeanInstantiationException e) {
return null;
}
} | class class_name[name] begin[{]
method[getPropertyValueOfNewInstance, return_type[type[Object]], modifier[public static], parameter[clazz, propertyName, propertyType]] begin[{]
if[binary_operation[binary_operation[member[.clazz], ==, literal[null]], ||, call[StringUtils.hasText, parameter[member[.propertyName]]]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=clazz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=instantiateClass, postfix_operators=[], prefix_operators=[], qualifier=BeanUtils, selectors=[], type_arguments=None), MemberReference(member=propertyName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getPropertyOrStaticPropertyOrFieldValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['BeanInstantiationException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] {
literal[String] , literal[String]
} operator[SEP] Keyword[public] Keyword[static] identifier[Object] identifier[getPropertyValueOfNewInstance] operator[SEP] identifier[Class] identifier[clazz] , identifier[String] identifier[propertyName] , identifier[Class] operator[<] operator[?] operator[>] identifier[propertyType] operator[SEP] {
Keyword[if] operator[SEP] identifier[clazz] operator[==] Other[null] operator[||] operator[!] identifier[StringUtils] operator[SEP] identifier[hasText] operator[SEP] identifier[propertyName] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[try] {
Keyword[return] identifier[getPropertyOrStaticPropertyOrFieldValue] operator[SEP] identifier[BeanUtils] operator[SEP] identifier[instantiateClass] operator[SEP] identifier[clazz] operator[SEP] , identifier[propertyName] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[BeanInstantiationException] identifier[e] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
}
|
public static final Map<String,JarEntry> findClassByJar(JarFile jarFile) throws IOException {
Map<String,JarEntry> map=new HashMap<String,JarEntry>();
if(jarFile==null)
{
throw new RuntimeException("jarFile is Null");
}
String Suffix=".class";
Enumeration<JarEntry> jarEntries = jarFile.entries();
while (jarEntries.hasMoreElements())
{//遍历jar的实体对象
JarEntry jarEntry = jarEntries.nextElement();
if(jarEntry.isDirectory() || !jarEntry.getName().endsWith(Suffix))
{
continue;
}
String jarEntryName = jarEntry.getName(); // 类似:sun/security/internal/interfaces/TlsMasterSecret.class
String className = jarEntryName.substring(0, jarEntryName.length() - Suffix.length());//sun/security/internal/interfaces/TlsMasterSecret
//注意,jar文件里面的只能是/不能是\
className = className.replace("/", ".");//sun.security.internal.interfaces.TlsMasterSecret
map.put(className,jarEntry);
}
return map;
} | class class_name[name] begin[{]
method[findClassByJar, return_type[type[Map]], modifier[final public static], parameter[jarFile]] begin[{]
local_variable[type[Map], map]
if[binary_operation[member[.jarFile], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="jarFile is Null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[String], Suffix]
local_variable[type[Enumeration], jarEntries]
while[call[jarEntries.hasMoreElements, parameter[]]] begin[{]
local_variable[type[JarEntry], jarEntry]
if[binary_operation[call[jarEntry.isDirectory, parameter[]], ||, call[jarEntry.getName, parameter[]]]] begin[{]
ContinueStatement(goto=None, label=None)
else begin[{]
None
end[}]
local_variable[type[String], jarEntryName]
local_variable[type[String], className]
assign[member[.className], call[className.replace, parameter[literal["/"], literal["."]]]]
call[map.put, parameter[member[.className], member[.jarEntry]]]
end[}]
return[member[.map]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[JarEntry] operator[>] identifier[findClassByJar] operator[SEP] identifier[JarFile] identifier[jarFile] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[Map] operator[<] identifier[String] , identifier[JarEntry] operator[>] identifier[map] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[JarEntry] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[jarFile] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[String] identifier[Suffix] operator[=] literal[String] operator[SEP] identifier[Enumeration] operator[<] identifier[JarEntry] operator[>] identifier[jarEntries] operator[=] identifier[jarFile] operator[SEP] identifier[entries] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[jarEntries] operator[SEP] identifier[hasMoreElements] operator[SEP] operator[SEP] operator[SEP] {
identifier[JarEntry] identifier[jarEntry] operator[=] identifier[jarEntries] operator[SEP] identifier[nextElement] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[jarEntry] operator[SEP] identifier[isDirectory] operator[SEP] operator[SEP] operator[||] operator[!] identifier[jarEntry] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[endsWith] operator[SEP] identifier[Suffix] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
identifier[String] identifier[jarEntryName] operator[=] identifier[jarEntry] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[className] operator[=] identifier[jarEntryName] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[jarEntryName] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] identifier[Suffix] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[className] operator[=] identifier[className] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[put] operator[SEP] identifier[className] , identifier[jarEntry] operator[SEP] operator[SEP]
}
Keyword[return] identifier[map] operator[SEP]
}
|
public ServiceFuture<List<DetectorDefinitionInner>> getSiteDetectorAsync(final String resourceGroupName, final String siteName, final String diagnosticCategory, final String detectorName, final ListOperationCallback<DetectorDefinitionInner> serviceCallback) {
return AzureServiceFuture.fromPageResponse(
getSiteDetectorSinglePageAsync(resourceGroupName, siteName, diagnosticCategory, detectorName),
new Func1<String, Observable<ServiceResponse<Page<DetectorDefinitionInner>>>>() {
@Override
public Observable<ServiceResponse<Page<DetectorDefinitionInner>>> call(String nextPageLink) {
return getSiteDetectorNextSinglePageAsync(nextPageLink);
}
},
serviceCallback);
} | class class_name[name] begin[{]
method[getSiteDetectorAsync, return_type[type[ServiceFuture]], modifier[public], parameter[resourceGroupName, siteName, diagnosticCategory, detectorName, serviceCallback]] begin[{]
return[call[AzureServiceFuture.fromPageResponse, parameter[call[.getSiteDetectorSinglePageAsync, parameter[member[.resourceGroupName], member[.siteName], member[.diagnosticCategory], member[.detectorName]]], ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=nextPageLink, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getSiteDetectorNextSinglePageAsync, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=call, parameters=[FormalParameter(annotations=[], modifiers=set(), name=nextPageLink, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=DetectorDefinitionInner, sub_type=None))], dimensions=[], name=Page, sub_type=None))], dimensions=[], name=ServiceResponse, sub_type=None))], dimensions=[], name=Observable, 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=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=DetectorDefinitionInner, sub_type=None))], dimensions=[], name=Page, sub_type=None))], dimensions=[], name=ServiceResponse, sub_type=None))], dimensions=[], name=Observable, sub_type=None))], dimensions=None, name=Func1, sub_type=None)), member[.serviceCallback]]]]
end[}]
END[}] | Keyword[public] identifier[ServiceFuture] operator[<] identifier[List] operator[<] identifier[DetectorDefinitionInner] operator[>] operator[>] identifier[getSiteDetectorAsync] operator[SEP] Keyword[final] identifier[String] identifier[resourceGroupName] , Keyword[final] identifier[String] identifier[siteName] , Keyword[final] identifier[String] identifier[diagnosticCategory] , Keyword[final] identifier[String] identifier[detectorName] , Keyword[final] identifier[ListOperationCallback] operator[<] identifier[DetectorDefinitionInner] operator[>] identifier[serviceCallback] operator[SEP] {
Keyword[return] identifier[AzureServiceFuture] operator[SEP] identifier[fromPageResponse] operator[SEP] identifier[getSiteDetectorSinglePageAsync] operator[SEP] identifier[resourceGroupName] , identifier[siteName] , identifier[diagnosticCategory] , identifier[detectorName] operator[SEP] , Keyword[new] identifier[Func1] operator[<] identifier[String] , identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[DetectorDefinitionInner] operator[>] operator[>] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[DetectorDefinitionInner] operator[>] operator[>] operator[>] identifier[call] operator[SEP] identifier[String] identifier[nextPageLink] operator[SEP] {
Keyword[return] identifier[getSiteDetectorNextSinglePageAsync] operator[SEP] identifier[nextPageLink] operator[SEP] operator[SEP]
}
} , identifier[serviceCallback] operator[SEP] operator[SEP]
}
|
private Object putToRecordStore(Data dataKey, Data dataValue) {
if (hasMapListener) {
return recordStore.put(dataKey, dataValue, DEFAULT_TTL, DEFAULT_MAX_IDLE);
}
recordStore.set(dataKey, dataValue, DEFAULT_TTL, DEFAULT_MAX_IDLE);
return null;
} | class class_name[name] begin[{]
method[putToRecordStore, return_type[type[Object]], modifier[private], parameter[dataKey, dataValue]] begin[{]
if[member[.hasMapListener]] begin[{]
return[call[recordStore.put, parameter[member[.dataKey], member[.dataValue], member[.DEFAULT_TTL], member[.DEFAULT_MAX_IDLE]]]]
else begin[{]
None
end[}]
call[recordStore.set, parameter[member[.dataKey], member[.dataValue], member[.DEFAULT_TTL], member[.DEFAULT_MAX_IDLE]]]
return[literal[null]]
end[}]
END[}] | Keyword[private] identifier[Object] identifier[putToRecordStore] operator[SEP] identifier[Data] identifier[dataKey] , identifier[Data] identifier[dataValue] operator[SEP] {
Keyword[if] operator[SEP] identifier[hasMapListener] operator[SEP] {
Keyword[return] identifier[recordStore] operator[SEP] identifier[put] operator[SEP] identifier[dataKey] , identifier[dataValue] , identifier[DEFAULT_TTL] , identifier[DEFAULT_MAX_IDLE] operator[SEP] operator[SEP]
}
identifier[recordStore] operator[SEP] identifier[set] operator[SEP] identifier[dataKey] , identifier[dataValue] , identifier[DEFAULT_TTL] , identifier[DEFAULT_MAX_IDLE] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
|
public static boolean isTypeOf(final Class<?> lookupClass, final Class<?> targetClass) {
if (targetClass == null || lookupClass == null) {
return false;
}
return targetClass.isAssignableFrom(lookupClass);
} | class class_name[name] begin[{]
method[isTypeOf, return_type[type[boolean]], modifier[public static], parameter[lookupClass, targetClass]] begin[{]
if[binary_operation[binary_operation[member[.targetClass], ==, literal[null]], ||, binary_operation[member[.lookupClass], ==, literal[null]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
return[call[targetClass.isAssignableFrom, parameter[member[.lookupClass]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[isTypeOf] operator[SEP] Keyword[final] identifier[Class] operator[<] operator[?] operator[>] identifier[lookupClass] , Keyword[final] identifier[Class] operator[<] operator[?] operator[>] identifier[targetClass] operator[SEP] {
Keyword[if] operator[SEP] identifier[targetClass] operator[==] Other[null] operator[||] identifier[lookupClass] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] identifier[targetClass] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[lookupClass] operator[SEP] operator[SEP]
}
|
public static br_snmpmanager addmanager(nitro_service client, br_snmpmanager resource) throws Exception
{
return ((br_snmpmanager[]) resource.perform_operation(client, "addmanager"))[0];
} | class class_name[name] begin[{]
method[addmanager, return_type[type[br_snmpmanager]], modifier[public static], parameter[client, resource]] begin[{]
return[Cast(expression=MethodInvocation(arguments=[MemberReference(member=client, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="addmanager")], member=perform_operation, postfix_operators=[], prefix_operators=[], qualifier=resource, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[None], name=br_snmpmanager, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[br_snmpmanager] identifier[addmanager] operator[SEP] identifier[nitro_service] identifier[client] , identifier[br_snmpmanager] identifier[resource] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[return] operator[SEP] operator[SEP] identifier[br_snmpmanager] operator[SEP] operator[SEP] operator[SEP] identifier[resource] operator[SEP] identifier[perform_operation] operator[SEP] identifier[client] , literal[String] operator[SEP] operator[SEP] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
|
public static WatchMonitor create(String path, WatchEvent.Kind<?>... events){
return create(path, 0, events);
} | class class_name[name] begin[{]
method[create, return_type[type[WatchMonitor]], modifier[public static], parameter[path, events]] begin[{]
return[call[.create, parameter[member[.path], literal[0], member[.events]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[WatchMonitor] identifier[create] operator[SEP] identifier[String] identifier[path] , identifier[WatchEvent] operator[SEP] identifier[Kind] operator[<] operator[?] operator[>] operator[...] identifier[events] operator[SEP] {
Keyword[return] identifier[create] operator[SEP] identifier[path] , Other[0] , identifier[events] operator[SEP] operator[SEP]
}
|
private Optional<PushUpBooleanExpressionProposal> makeNodeCentricProposal(CommutativeJoinOrFilterNode providerNode,
ImmutableExpression propagatedExpression,
Optional<ImmutableExpression> nonPropagatedExpression,
IntermediateQuery query,
boolean propagateThroughNextUnionNodeAncestor) {
Optional<JoinOrFilterNode> recipient;
ImmutableSet.Builder<ExplicitVariableProjectionNode> inbetweenProjectorsBuilder = ImmutableSet.builder();
QueryNode currentChildNode;
QueryNode currentParentNode = providerNode;
do {
currentChildNode = currentParentNode;
currentParentNode = query.getParent(currentParentNode)
.orElseThrow(() -> new InvalidIntermediateQueryException("This node must have a parent node"));
if (currentParentNode == query.getRootNode()) {
break;
}
if (currentParentNode instanceof ConstructionNode) {
/* keep track of Construction nodes on the path between provider and recipient */
inbetweenProjectorsBuilder.add((ConstructionNode) currentParentNode);
continue;
}
if (currentParentNode instanceof UnionNode) {
/* optionally propagate the expression through the first encountered UnionNode */
if (propagateThroughNextUnionNodeAncestor) {
propagateThroughNextUnionNodeAncestor = false;
/* keep track of it as an inbetween projector */
inbetweenProjectorsBuilder.add((ExplicitVariableProjectionNode) currentParentNode);
continue;
}
break;
}
if (currentParentNode instanceof LeftJoinNode &&
(query.getOptionalPosition(currentChildNode)
.orElseThrow(() -> new InvalidIntermediateQueryException("The child of a LeftJoin node must have a position"))
== RIGHT)) {
/*
Stop propagation when reaching a LeftJoinNode from its right branch,
and select the leftJoinNode as recipient
*/
return Optional.of(
new PushUpBooleanExpressionProposalImpl(
propagatedExpression,
ImmutableMap.of(providerNode, nonPropagatedExpression),
currentChildNode,
Optional.of((JoinOrFilterNode) currentParentNode),
inbetweenProjectorsBuilder.build()
));
}
}
while (true);
// If no effective propagation
if (currentChildNode == providerNode) {
return Optional.empty();
}
// if we reach this point, the upward propagation up must have been blocked by a union or by the root
recipient = currentChildNode instanceof CommutativeJoinOrFilterNode ?
Optional.of((CommutativeJoinOrFilterNode) currentChildNode) :
Optional.empty();
PushUpBooleanExpressionProposal proposal = new PushUpBooleanExpressionProposalImpl(
propagatedExpression,
ImmutableMap.of(providerNode, nonPropagatedExpression),
currentChildNode,
recipient,
inbetweenProjectorsBuilder.build()
);
// Possibly adjust the proposal, to enforce that the second exception (see the class comments) holds
return adjustProposal(proposal, query);
} | class class_name[name] begin[{]
method[makeNodeCentricProposal, return_type[type[Optional]], modifier[private], parameter[providerNode, propagatedExpression, nonPropagatedExpression, query, propagateThroughNextUnionNodeAncestor]] begin[{]
local_variable[type[Optional], recipient]
local_variable[type[ImmutableSet], inbetweenProjectorsBuilder]
local_variable[type[QueryNode], currentChildNode]
local_variable[type[QueryNode], currentParentNode]
do[literal[true]] begin[{]
assign[member[.currentChildNode], member[.currentParentNode]]
assign[member[.currentParentNode], call[query.getParent, parameter[member[.currentParentNode]]]]
if[binary_operation[member[.currentParentNode], ==, call[query.getRootNode, parameter[]]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.currentParentNode], instanceof, type[ConstructionNode]]] begin[{]
call[inbetweenProjectorsBuilder.add, parameter[Cast(expression=MemberReference(member=currentParentNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ConstructionNode, sub_type=None))]]
ContinueStatement(goto=None, label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.currentParentNode], instanceof, type[UnionNode]]] begin[{]
if[member[.propagateThroughNextUnionNodeAncestor]] begin[{]
assign[member[.propagateThroughNextUnionNodeAncestor], literal[false]]
call[inbetweenProjectorsBuilder.add, parameter[Cast(expression=MemberReference(member=currentParentNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ExplicitVariableProjectionNode, sub_type=None))]]
ContinueStatement(goto=None, label=None)
else begin[{]
None
end[}]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.currentParentNode], instanceof, type[LeftJoinNode]], &&, binary_operation[call[query.getOptionalPosition, parameter[member[.currentChildNode]]], ==, member[.RIGHT]]]] begin[{]
return[call[Optional.of, parameter[ClassCreator(arguments=[MemberReference(member=propagatedExpression, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=providerNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=nonPropagatedExpression, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=of, postfix_operators=[], prefix_operators=[], qualifier=ImmutableMap, selectors=[], type_arguments=None), MemberReference(member=currentChildNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[Cast(expression=MemberReference(member=currentParentNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=JoinOrFilterNode, sub_type=None))], member=of, postfix_operators=[], prefix_operators=[], qualifier=Optional, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=build, postfix_operators=[], prefix_operators=[], qualifier=inbetweenProjectorsBuilder, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PushUpBooleanExpressionProposalImpl, sub_type=None))]]]
else begin[{]
None
end[}]
end[}]
if[binary_operation[member[.currentChildNode], ==, member[.providerNode]]] begin[{]
return[call[Optional.empty, parameter[]]]
else begin[{]
None
end[}]
assign[member[.recipient], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=currentChildNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=CommutativeJoinOrFilterNode, sub_type=None), operator=instanceof), if_false=MethodInvocation(arguments=[], member=empty, postfix_operators=[], prefix_operators=[], qualifier=Optional, selectors=[], type_arguments=None), if_true=MethodInvocation(arguments=[Cast(expression=MemberReference(member=currentChildNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=CommutativeJoinOrFilterNode, sub_type=None))], member=of, postfix_operators=[], prefix_operators=[], qualifier=Optional, selectors=[], type_arguments=None))]
local_variable[type[PushUpBooleanExpressionProposal], proposal]
return[call[.adjustProposal, parameter[member[.proposal], member[.query]]]]
end[}]
END[}] | Keyword[private] identifier[Optional] operator[<] identifier[PushUpBooleanExpressionProposal] operator[>] identifier[makeNodeCentricProposal] operator[SEP] identifier[CommutativeJoinOrFilterNode] identifier[providerNode] , identifier[ImmutableExpression] identifier[propagatedExpression] , identifier[Optional] operator[<] identifier[ImmutableExpression] operator[>] identifier[nonPropagatedExpression] , identifier[IntermediateQuery] identifier[query] , Keyword[boolean] identifier[propagateThroughNextUnionNodeAncestor] operator[SEP] {
identifier[Optional] operator[<] identifier[JoinOrFilterNode] operator[>] identifier[recipient] operator[SEP] identifier[ImmutableSet] operator[SEP] identifier[Builder] operator[<] identifier[ExplicitVariableProjectionNode] operator[>] identifier[inbetweenProjectorsBuilder] operator[=] identifier[ImmutableSet] operator[SEP] identifier[builder] operator[SEP] operator[SEP] operator[SEP] identifier[QueryNode] identifier[currentChildNode] operator[SEP] identifier[QueryNode] identifier[currentParentNode] operator[=] identifier[providerNode] operator[SEP] Keyword[do] {
identifier[currentChildNode] operator[=] identifier[currentParentNode] operator[SEP] identifier[currentParentNode] operator[=] identifier[query] operator[SEP] identifier[getParent] operator[SEP] identifier[currentParentNode] operator[SEP] operator[SEP] identifier[orElseThrow] operator[SEP] operator[SEP] operator[SEP] operator[->] Keyword[new] identifier[InvalidIntermediateQueryException] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[currentParentNode] operator[==] identifier[query] operator[SEP] identifier[getRootNode] operator[SEP] operator[SEP] operator[SEP] {
Keyword[break] operator[SEP]
}
Keyword[if] operator[SEP] identifier[currentParentNode] Keyword[instanceof] identifier[ConstructionNode] operator[SEP] {
identifier[inbetweenProjectorsBuilder] operator[SEP] identifier[add] operator[SEP] operator[SEP] identifier[ConstructionNode] operator[SEP] identifier[currentParentNode] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
Keyword[if] operator[SEP] identifier[currentParentNode] Keyword[instanceof] identifier[UnionNode] operator[SEP] {
Keyword[if] operator[SEP] identifier[propagateThroughNextUnionNodeAncestor] operator[SEP] {
identifier[propagateThroughNextUnionNodeAncestor] operator[=] literal[boolean] operator[SEP] identifier[inbetweenProjectorsBuilder] operator[SEP] identifier[add] operator[SEP] operator[SEP] identifier[ExplicitVariableProjectionNode] operator[SEP] identifier[currentParentNode] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
Keyword[break] operator[SEP]
}
Keyword[if] operator[SEP] identifier[currentParentNode] Keyword[instanceof] identifier[LeftJoinNode] operator[&&] operator[SEP] identifier[query] operator[SEP] identifier[getOptionalPosition] operator[SEP] identifier[currentChildNode] operator[SEP] operator[SEP] identifier[orElseThrow] operator[SEP] operator[SEP] operator[SEP] operator[->] Keyword[new] identifier[InvalidIntermediateQueryException] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[==] identifier[RIGHT] operator[SEP] operator[SEP] {
Keyword[return] identifier[Optional] operator[SEP] identifier[of] operator[SEP] Keyword[new] identifier[PushUpBooleanExpressionProposalImpl] operator[SEP] identifier[propagatedExpression] , identifier[ImmutableMap] operator[SEP] identifier[of] operator[SEP] identifier[providerNode] , identifier[nonPropagatedExpression] operator[SEP] , identifier[currentChildNode] , identifier[Optional] operator[SEP] identifier[of] operator[SEP] operator[SEP] identifier[JoinOrFilterNode] operator[SEP] identifier[currentParentNode] operator[SEP] , identifier[inbetweenProjectorsBuilder] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[while] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[currentChildNode] operator[==] identifier[providerNode] operator[SEP] {
Keyword[return] identifier[Optional] operator[SEP] identifier[empty] operator[SEP] operator[SEP] operator[SEP]
}
identifier[recipient] operator[=] identifier[currentChildNode] Keyword[instanceof] identifier[CommutativeJoinOrFilterNode] operator[?] identifier[Optional] operator[SEP] identifier[of] operator[SEP] operator[SEP] identifier[CommutativeJoinOrFilterNode] operator[SEP] identifier[currentChildNode] operator[SEP] operator[:] identifier[Optional] operator[SEP] identifier[empty] operator[SEP] operator[SEP] operator[SEP] identifier[PushUpBooleanExpressionProposal] identifier[proposal] operator[=] Keyword[new] identifier[PushUpBooleanExpressionProposalImpl] operator[SEP] identifier[propagatedExpression] , identifier[ImmutableMap] operator[SEP] identifier[of] operator[SEP] identifier[providerNode] , identifier[nonPropagatedExpression] operator[SEP] , identifier[currentChildNode] , identifier[recipient] , identifier[inbetweenProjectorsBuilder] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[adjustProposal] operator[SEP] identifier[proposal] , identifier[query] operator[SEP] operator[SEP]
}
|
@SneakyThrows
protected ModelAndView generateResponseForDeviceToken(final HttpServletRequest request,
final HttpServletResponse response,
final OAuth20AccessTokenResponseResult result) {
val model = getDeviceTokenResponseModel(result);
return new ModelAndView(new MappingJackson2JsonView(MAPPER), model);
} | class class_name[name] begin[{]
method[generateResponseForDeviceToken, return_type[type[ModelAndView]], modifier[protected], parameter[request, response, result]] begin[{]
local_variable[type[val], model]
return[ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=MAPPER, 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=MappingJackson2JsonView, sub_type=None)), MemberReference(member=model, 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=ModelAndView, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[SneakyThrows] Keyword[protected] identifier[ModelAndView] identifier[generateResponseForDeviceToken] operator[SEP] Keyword[final] identifier[HttpServletRequest] identifier[request] , Keyword[final] identifier[HttpServletResponse] identifier[response] , Keyword[final] identifier[OAuth20AccessTokenResponseResult] identifier[result] operator[SEP] {
identifier[val] identifier[model] operator[=] identifier[getDeviceTokenResponseModel] operator[SEP] identifier[result] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[ModelAndView] operator[SEP] Keyword[new] identifier[MappingJackson2JsonView] operator[SEP] identifier[MAPPER] operator[SEP] , identifier[model] operator[SEP] operator[SEP]
}
|
public static boolean isCharAtEqual(final String string, final int index, final char charToCompare) {
if ((index < 0) || (index >= string.length())) {
return false;
}
return string.charAt(index) == charToCompare;
} | class class_name[name] begin[{]
method[isCharAtEqual, return_type[type[boolean]], modifier[public static], parameter[string, index, charToCompare]] begin[{]
if[binary_operation[binary_operation[member[.index], <, literal[0]], ||, binary_operation[member[.index], >=, call[string.length, parameter[]]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
return[binary_operation[call[string.charAt, parameter[member[.index]]], ==, member[.charToCompare]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[isCharAtEqual] operator[SEP] Keyword[final] identifier[String] identifier[string] , Keyword[final] Keyword[int] identifier[index] , Keyword[final] Keyword[char] identifier[charToCompare] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[index] operator[<] Other[0] operator[SEP] operator[||] operator[SEP] identifier[index] operator[>=] identifier[string] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] identifier[string] operator[SEP] identifier[charAt] operator[SEP] identifier[index] operator[SEP] operator[==] identifier[charToCompare] operator[SEP]
}
|
private String createString(String f)
{
return
"srcArray="+srcArray+f+
"srcPos="+srcPos+f+
"srcPtr="+srcPtr+f+
"dstArray="+dstArray+f+
"dstPos="+dstPos+f+
"dstPtr="+dstPtr+f+
"extent="+extent+f+
"kind="+cudaMemcpyKind.stringFor(kind);
} | class class_name[name] begin[{]
method[createString, return_type[type[String]], modifier[private], parameter[f]] begin[{]
return[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[literal["srcArray="], +, member[.srcArray]], +, member[.f]], +, literal["srcPos="]], +, member[.srcPos]], +, member[.f]], +, literal["srcPtr="]], +, member[.srcPtr]], +, member[.f]], +, literal["dstArray="]], +, member[.dstArray]], +, member[.f]], +, literal["dstPos="]], +, member[.dstPos]], +, member[.f]], +, literal["dstPtr="]], +, member[.dstPtr]], +, member[.f]], +, literal["extent="]], +, member[.extent]], +, member[.f]], +, literal["kind="]], +, call[cudaMemcpyKind.stringFor, parameter[member[.kind]]]]]
end[}]
END[}] | Keyword[private] identifier[String] identifier[createString] operator[SEP] identifier[String] identifier[f] operator[SEP] {
Keyword[return] literal[String] operator[+] identifier[srcArray] operator[+] identifier[f] operator[+] literal[String] operator[+] identifier[srcPos] operator[+] identifier[f] operator[+] literal[String] operator[+] identifier[srcPtr] operator[+] identifier[f] operator[+] literal[String] operator[+] identifier[dstArray] operator[+] identifier[f] operator[+] literal[String] operator[+] identifier[dstPos] operator[+] identifier[f] operator[+] literal[String] operator[+] identifier[dstPtr] operator[+] identifier[f] operator[+] literal[String] operator[+] identifier[extent] operator[+] identifier[f] operator[+] literal[String] operator[+] identifier[cudaMemcpyKind] operator[SEP] identifier[stringFor] operator[SEP] identifier[kind] operator[SEP] operator[SEP]
}
|
public static boolean hasAttribute(String url, String markup, String selector, String attributeName) {
ensureMarkup(url, markup);
Document document = documents.get(url);
Elements elements = document.select(selector);
return !elements.isEmpty() && elements.hasAttr(attributeName);
} | class class_name[name] begin[{]
method[hasAttribute, return_type[type[boolean]], modifier[public static], parameter[url, markup, selector, attributeName]] begin[{]
call[.ensureMarkup, parameter[member[.url], member[.markup]]]
local_variable[type[Document], document]
local_variable[type[Elements], elements]
return[binary_operation[call[elements.isEmpty, parameter[]], &&, call[elements.hasAttr, parameter[member[.attributeName]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[hasAttribute] operator[SEP] identifier[String] identifier[url] , identifier[String] identifier[markup] , identifier[String] identifier[selector] , identifier[String] identifier[attributeName] operator[SEP] {
identifier[ensureMarkup] operator[SEP] identifier[url] , identifier[markup] operator[SEP] operator[SEP] identifier[Document] identifier[document] operator[=] identifier[documents] operator[SEP] identifier[get] operator[SEP] identifier[url] operator[SEP] operator[SEP] identifier[Elements] identifier[elements] operator[=] identifier[document] operator[SEP] identifier[select] operator[SEP] identifier[selector] operator[SEP] operator[SEP] Keyword[return] operator[!] identifier[elements] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[&&] identifier[elements] operator[SEP] identifier[hasAttr] operator[SEP] identifier[attributeName] operator[SEP] operator[SEP]
}
|
private static String buildJmolSelection(ResidueNumber[] residues) {
StringBuilder cmd = new StringBuilder("select ");
for(ResidueNumber res : residues) {
if(res != null) {
cmd.append(String.format("%d^%s:%s.CA or ", res.getSeqNum(),
res.getInsCode()==null?" ":res.getInsCode(),
res.getChainName()));
}
}
cmd.append("none;");//easier than removing the railing 'or'
return cmd.toString();
} | class class_name[name] begin[{]
method[buildJmolSelection, return_type[type[String]], modifier[private static], parameter[residues]] begin[{]
local_variable[type[StringBuilder], cmd]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=res, 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=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="%d^%s:%s.CA or "), MethodInvocation(arguments=[], member=getSeqNum, postfix_operators=[], prefix_operators=[], qualifier=res, selectors=[], type_arguments=None), TernaryExpression(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getInsCode, postfix_operators=[], prefix_operators=[], qualifier=res, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[], member=getInsCode, postfix_operators=[], prefix_operators=[], qualifier=res, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" ")), MethodInvocation(arguments=[], member=getChainName, postfix_operators=[], prefix_operators=[], qualifier=res, selectors=[], type_arguments=None)], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=cmd, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=residues, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=res)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ResidueNumber, sub_type=None))), label=None)
call[cmd.append, parameter[literal["none;"]]]
return[call[cmd.toString, parameter[]]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[String] identifier[buildJmolSelection] operator[SEP] identifier[ResidueNumber] operator[SEP] operator[SEP] identifier[residues] operator[SEP] {
identifier[StringBuilder] identifier[cmd] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[ResidueNumber] identifier[res] operator[:] identifier[residues] operator[SEP] {
Keyword[if] operator[SEP] identifier[res] operator[!=] Other[null] operator[SEP] {
identifier[cmd] operator[SEP] identifier[append] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[res] operator[SEP] identifier[getSeqNum] operator[SEP] operator[SEP] , identifier[res] operator[SEP] identifier[getInsCode] operator[SEP] operator[SEP] operator[==] Other[null] operator[?] literal[String] operator[:] identifier[res] operator[SEP] identifier[getInsCode] operator[SEP] operator[SEP] , identifier[res] operator[SEP] identifier[getChainName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[cmd] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[cmd] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
private <T> GraphRequest<T> graph(String object, JavaType type, Param... params) {
this.checkForBatchExecution();
// The data is transformed through a chain of wrappers
GraphRequest<T> req =
new GraphRequest<T>(object, params, this.mapper, this.<T>createMappingChain(type));
this.graphRequests.add(req);
return req;
} | class class_name[name] begin[{]
method[graph, return_type[type[GraphRequest]], modifier[private], parameter[object, type, params]] begin[{]
THIS[call[None.checkForBatchExecution, parameter[]]]
local_variable[type[GraphRequest], req]
THIS[member[None.graphRequests]call[None.add, parameter[member[.req]]]]
return[member[.req]]
end[}]
END[}] | Keyword[private] operator[<] identifier[T] operator[>] identifier[GraphRequest] operator[<] identifier[T] operator[>] identifier[graph] operator[SEP] identifier[String] identifier[object] , identifier[JavaType] identifier[type] , identifier[Param] operator[...] identifier[params] operator[SEP] {
Keyword[this] operator[SEP] identifier[checkForBatchExecution] operator[SEP] operator[SEP] operator[SEP] identifier[GraphRequest] operator[<] identifier[T] operator[>] identifier[req] operator[=] Keyword[new] identifier[GraphRequest] operator[<] identifier[T] operator[>] operator[SEP] identifier[object] , identifier[params] , Keyword[this] operator[SEP] identifier[mapper] , Keyword[this] operator[SEP] operator[<] identifier[T] operator[>] identifier[createMappingChain] operator[SEP] identifier[type] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[graphRequests] operator[SEP] identifier[add] operator[SEP] identifier[req] operator[SEP] operator[SEP] Keyword[return] identifier[req] operator[SEP]
}
|
@UiHandler("m_addButton")
void addButtonClick(ClickEvent e) {
if (null != m_newDate.getValue()) {
m_dateList.addDate(m_newDate.getValue());
m_newDate.setValue(null);
if (handleChange()) {
m_controller.setDates(m_dateList.getDates());
}
}
} | class class_name[name] begin[{]
method[addButtonClick, return_type[void], modifier[default], parameter[e]] begin[{]
if[binary_operation[literal[null], !=, call[m_newDate.getValue, parameter[]]]] begin[{]
call[m_dateList.addDate, parameter[call[m_newDate.getValue, parameter[]]]]
call[m_newDate.setValue, parameter[literal[null]]]
if[call[.handleChange, parameter[]]] begin[{]
call[m_controller.setDates, parameter[call[m_dateList.getDates, parameter[]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[UiHandler] operator[SEP] literal[String] operator[SEP] Keyword[void] identifier[addButtonClick] operator[SEP] identifier[ClickEvent] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] Other[null] operator[!=] identifier[m_newDate] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] {
identifier[m_dateList] operator[SEP] identifier[addDate] operator[SEP] identifier[m_newDate] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[m_newDate] operator[SEP] identifier[setValue] operator[SEP] Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[handleChange] operator[SEP] operator[SEP] operator[SEP] {
identifier[m_controller] operator[SEP] identifier[setDates] operator[SEP] identifier[m_dateList] operator[SEP] identifier[getDates] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.