code
stringlengths 63
466k
| code_sememe
stringlengths 141
3.79M
| token_type
stringlengths 274
1.23M
|
|---|---|---|
public static MethodNode findMethod(ClassNode clazz, String name)
{
for (MethodNode method : clazz.methods)
{
if (method.name.equals(name))
{
return method;
}
}
return null;
}
|
class class_name[name] begin[{]
method[findMethod, return_type[type[MethodNode]], modifier[public static], parameter[clazz, name]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=method.name, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=method, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=methods, postfix_operators=[], prefix_operators=[], qualifier=clazz, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=method)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MethodNode, sub_type=None))), label=None)
return[literal[null]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[MethodNode] identifier[findMethod] operator[SEP] identifier[ClassNode] identifier[clazz] , identifier[String] identifier[name] operator[SEP] {
Keyword[for] operator[SEP] identifier[MethodNode] identifier[method] operator[:] identifier[clazz] operator[SEP] identifier[methods] operator[SEP] {
Keyword[if] operator[SEP] identifier[method] operator[SEP] identifier[name] operator[SEP] identifier[equals] operator[SEP] identifier[name] operator[SEP] operator[SEP] {
Keyword[return] identifier[method] operator[SEP]
}
}
Keyword[return] Other[null] operator[SEP]
}
|
protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception {
sc_stats[] resources = new sc_stats[1];
sc_response result = (sc_response) service.get_payload_formatter().string_to_resource(sc_response.class, response);
if(result.errorcode != 0) {
if (result.errorcode == 444) {
service.clear_session();
}
if(result.severity != null)
{
if (result.severity.equals("ERROR"))
throw new nitro_exception(result.message,result.errorcode);
}
else
{
throw new nitro_exception(result.message,result.errorcode);
}
}
resources[0] = result.sc;
return resources;
}
|
class class_name[name] begin[{]
method[get_nitro_response, return_type[type[base_resource]], modifier[protected], parameter[service, response]] begin[{]
local_variable[type[sc_stats], resources]
local_variable[type[sc_response], result]
if[binary_operation[member[result.errorcode], !=, literal[0]]] begin[{]
if[binary_operation[member[result.errorcode], ==, literal[444]]] begin[{]
call[service.clear_session, parameter[]]
else begin[{]
None
end[}]
if[binary_operation[member[result.severity], !=, literal[null]]] begin[{]
if[call[result.severity.equals, parameter[literal["ERROR"]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[]), MemberReference(member=errorcode, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=nitro_exception, sub_type=None)), label=None)
else begin[{]
None
end[}]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[]), MemberReference(member=errorcode, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=nitro_exception, sub_type=None)), label=None)
end[}]
else begin[{]
None
end[}]
assign[member[.resources], member[result.sc]]
return[member[.resources]]
end[}]
END[}]
|
Keyword[protected] identifier[base_resource] operator[SEP] operator[SEP] identifier[get_nitro_response] operator[SEP] identifier[nitro_service] identifier[service] , identifier[String] identifier[response] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[sc_stats] operator[SEP] operator[SEP] identifier[resources] operator[=] Keyword[new] identifier[sc_stats] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[sc_response] identifier[result] operator[=] operator[SEP] identifier[sc_response] operator[SEP] identifier[service] operator[SEP] identifier[get_payload_formatter] operator[SEP] operator[SEP] operator[SEP] identifier[string_to_resource] operator[SEP] identifier[sc_response] operator[SEP] Keyword[class] , identifier[response] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[SEP] identifier[errorcode] operator[!=] Other[0] operator[SEP] {
Keyword[if] operator[SEP] identifier[result] operator[SEP] identifier[errorcode] operator[==] Other[444] operator[SEP] {
identifier[service] operator[SEP] identifier[clear_session] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[result] operator[SEP] identifier[severity] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[result] operator[SEP] identifier[severity] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[nitro_exception] operator[SEP] identifier[result] operator[SEP] identifier[message] , identifier[result] operator[SEP] identifier[errorcode] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[nitro_exception] operator[SEP] identifier[result] operator[SEP] identifier[message] , identifier[result] operator[SEP] identifier[errorcode] operator[SEP] operator[SEP]
}
}
identifier[resources] operator[SEP] Other[0] operator[SEP] operator[=] identifier[result] operator[SEP] identifier[sc] operator[SEP] Keyword[return] identifier[resources] operator[SEP]
}
|
public void marshall(RegisterInstanceRequest registerInstanceRequest, ProtocolMarshaller protocolMarshaller) {
if (registerInstanceRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(registerInstanceRequest.getServiceId(), SERVICEID_BINDING);
protocolMarshaller.marshall(registerInstanceRequest.getInstanceId(), INSTANCEID_BINDING);
protocolMarshaller.marshall(registerInstanceRequest.getCreatorRequestId(), CREATORREQUESTID_BINDING);
protocolMarshaller.marshall(registerInstanceRequest.getAttributes(), ATTRIBUTES_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[registerInstanceRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.registerInstanceRequest], ==, 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=getServiceId, postfix_operators=[], prefix_operators=[], qualifier=registerInstanceRequest, selectors=[], type_arguments=None), MemberReference(member=SERVICEID_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=getInstanceId, postfix_operators=[], prefix_operators=[], qualifier=registerInstanceRequest, selectors=[], type_arguments=None), MemberReference(member=INSTANCEID_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=getCreatorRequestId, postfix_operators=[], prefix_operators=[], qualifier=registerInstanceRequest, selectors=[], type_arguments=None), MemberReference(member=CREATORREQUESTID_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=getAttributes, postfix_operators=[], prefix_operators=[], qualifier=registerInstanceRequest, selectors=[], type_arguments=None), MemberReference(member=ATTRIBUTES_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[RegisterInstanceRequest] identifier[registerInstanceRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[registerInstanceRequest] 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[registerInstanceRequest] operator[SEP] identifier[getServiceId] operator[SEP] operator[SEP] , identifier[SERVICEID_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[registerInstanceRequest] operator[SEP] identifier[getInstanceId] operator[SEP] operator[SEP] , identifier[INSTANCEID_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[registerInstanceRequest] operator[SEP] identifier[getCreatorRequestId] operator[SEP] operator[SEP] , identifier[CREATORREQUESTID_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[registerInstanceRequest] operator[SEP] identifier[getAttributes] operator[SEP] operator[SEP] , identifier[ATTRIBUTES_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public static InboundMessageContext header(String name, Object value) {
return getRequest().header(name, value);
}
|
class class_name[name] begin[{]
method[header, return_type[type[InboundMessageContext]], modifier[public static], parameter[name, value]] begin[{]
return[call[.getRequest, parameter[]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[InboundMessageContext] identifier[header] operator[SEP] identifier[String] identifier[name] , identifier[Object] identifier[value] operator[SEP] {
Keyword[return] identifier[getRequest] operator[SEP] operator[SEP] operator[SEP] identifier[header] operator[SEP] identifier[name] , identifier[value] operator[SEP] operator[SEP]
}
|
private boolean isMinimalQuery(QueryPlanningInfo info) {
return info.projectionAfterOrderBy == null && info.globalLetClause == null && info.perRecordLetClause == null
&& info.whereClause == null && info.flattenedWhereClause == null && info.groupBy == null && info.orderBy == null
&& info.unwind == null && info.skip == null;
}
|
class class_name[name] begin[{]
method[isMinimalQuery, return_type[type[boolean]], modifier[private], parameter[info]] begin[{]
return[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[member[info.projectionAfterOrderBy], ==, literal[null]], &&, binary_operation[member[info.globalLetClause], ==, literal[null]]], &&, binary_operation[member[info.perRecordLetClause], ==, literal[null]]], &&, binary_operation[member[info.whereClause], ==, literal[null]]], &&, binary_operation[member[info.flattenedWhereClause], ==, literal[null]]], &&, binary_operation[member[info.groupBy], ==, literal[null]]], &&, binary_operation[member[info.orderBy], ==, literal[null]]], &&, binary_operation[member[info.unwind], ==, literal[null]]], &&, binary_operation[member[info.skip], ==, literal[null]]]]
end[}]
END[}]
|
Keyword[private] Keyword[boolean] identifier[isMinimalQuery] operator[SEP] identifier[QueryPlanningInfo] identifier[info] operator[SEP] {
Keyword[return] identifier[info] operator[SEP] identifier[projectionAfterOrderBy] operator[==] Other[null] operator[&&] identifier[info] operator[SEP] identifier[globalLetClause] operator[==] Other[null] operator[&&] identifier[info] operator[SEP] identifier[perRecordLetClause] operator[==] Other[null] operator[&&] identifier[info] operator[SEP] identifier[whereClause] operator[==] Other[null] operator[&&] identifier[info] operator[SEP] identifier[flattenedWhereClause] operator[==] Other[null] operator[&&] identifier[info] operator[SEP] identifier[groupBy] operator[==] Other[null] operator[&&] identifier[info] operator[SEP] identifier[orderBy] operator[==] Other[null] operator[&&] identifier[info] operator[SEP] identifier[unwind] operator[==] Other[null] operator[&&] identifier[info] operator[SEP] identifier[skip] operator[==] Other[null] operator[SEP]
}
|
public static CommandResult execCommand(List<String> commands, boolean isRoot, boolean isNeedResultMsg) {
return execCommand(commands == null ? null : commands.toArray(new String[]{}), isRoot, isNeedResultMsg);
}
|
class class_name[name] begin[{]
method[execCommand, return_type[type[CommandResult]], modifier[public static], parameter[commands, isRoot, isNeedResultMsg]] begin[{]
return[call[.execCommand, parameter[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=commands, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))], member=toArray, postfix_operators=[], prefix_operators=[], qualifier=commands, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), member[.isRoot], member[.isNeedResultMsg]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[CommandResult] identifier[execCommand] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[commands] , Keyword[boolean] identifier[isRoot] , Keyword[boolean] identifier[isNeedResultMsg] operator[SEP] {
Keyword[return] identifier[execCommand] operator[SEP] identifier[commands] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[commands] operator[SEP] identifier[toArray] operator[SEP] Keyword[new] identifier[String] operator[SEP] operator[SEP] {
} operator[SEP] , identifier[isRoot] , identifier[isNeedResultMsg] operator[SEP] operator[SEP]
}
|
public XMLElement parse(String name, InputStream in) throws SlickXMLException {
try {
if (factory == null) {
factory = DocumentBuilderFactory.newInstance();
}
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse(in);
return new XMLElement(doc.getDocumentElement());
} catch (Exception e) {
throw new SlickXMLException("Failed to parse document: "+name, e);
}
}
|
class class_name[name] begin[{]
method[parse, return_type[type[XMLElement]], modifier[public], parameter[name, in]] begin[{]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=factory, 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=factory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=newInstance, postfix_operators=[], prefix_operators=[], qualifier=DocumentBuilderFactory, selectors=[], type_arguments=None)), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=newDocumentBuilder, postfix_operators=[], prefix_operators=[], qualifier=factory, selectors=[], type_arguments=None), name=builder)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DocumentBuilder, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parse, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), name=doc)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Document, sub_type=None)), ReturnStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getDocumentElement, postfix_operators=[], prefix_operators=[], qualifier=doc, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=XMLElement, sub_type=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to parse document: "), operandr=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SlickXMLException, 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] identifier[XMLElement] identifier[parse] operator[SEP] identifier[String] identifier[name] , identifier[InputStream] identifier[in] operator[SEP] Keyword[throws] identifier[SlickXMLException] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[factory] operator[==] Other[null] operator[SEP] {
identifier[factory] operator[=] identifier[DocumentBuilderFactory] operator[SEP] identifier[newInstance] operator[SEP] operator[SEP] operator[SEP]
}
identifier[DocumentBuilder] identifier[builder] operator[=] identifier[factory] operator[SEP] identifier[newDocumentBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[Document] identifier[doc] operator[=] identifier[builder] operator[SEP] identifier[parse] operator[SEP] identifier[in] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[XMLElement] operator[SEP] identifier[doc] operator[SEP] identifier[getDocumentElement] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SlickXMLException] operator[SEP] literal[String] operator[+] identifier[name] , identifier[e] operator[SEP] operator[SEP]
}
}
|
@XmlElementDecl(namespace = "http://schema.intuit.com/finance/v3", name = "TimeActivity", substitutionHeadNamespace = "http://schema.intuit.com/finance/v3", substitutionHeadName = "IntuitObject")
public JAXBElement<TimeActivity> createTimeActivity(TimeActivity value) {
return new JAXBElement<TimeActivity>(_TimeActivity_QNAME, TimeActivity.class, null, value);
}
|
class class_name[name] begin[{]
method[createTimeActivity, return_type[type[JAXBElement]], modifier[public], parameter[value]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=_TimeActivity_QNAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TimeActivity, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=TimeActivity, sub_type=None))], dimensions=None, name=JAXBElement, sub_type=None))]
end[}]
END[}]
|
annotation[@] identifier[XmlElementDecl] operator[SEP] identifier[namespace] operator[=] literal[String] , identifier[name] operator[=] literal[String] , identifier[substitutionHeadNamespace] operator[=] literal[String] , identifier[substitutionHeadName] operator[=] literal[String] operator[SEP] Keyword[public] identifier[JAXBElement] operator[<] identifier[TimeActivity] operator[>] identifier[createTimeActivity] operator[SEP] identifier[TimeActivity] identifier[value] operator[SEP] {
Keyword[return] Keyword[new] identifier[JAXBElement] operator[<] identifier[TimeActivity] operator[>] operator[SEP] identifier[_TimeActivity_QNAME] , identifier[TimeActivity] operator[SEP] Keyword[class] , Other[null] , identifier[value] operator[SEP] operator[SEP]
}
|
public Surface clear (float red, float green, float blue, float alpha) {
batch.gl.glClearColor(red, green, blue, alpha);
batch.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
return this;
}
|
class class_name[name] begin[{]
method[clear, return_type[type[Surface]], modifier[public], parameter[red, green, blue, alpha]] begin[{]
call[batch.gl.glClearColor, parameter[member[.red], member[.green], member[.blue], member[.alpha]]]
call[batch.gl.glClear, parameter[member[GL20.GL_COLOR_BUFFER_BIT]]]
return[THIS[]]
end[}]
END[}]
|
Keyword[public] identifier[Surface] identifier[clear] operator[SEP] Keyword[float] identifier[red] , Keyword[float] identifier[green] , Keyword[float] identifier[blue] , Keyword[float] identifier[alpha] operator[SEP] {
identifier[batch] operator[SEP] identifier[gl] operator[SEP] identifier[glClearColor] operator[SEP] identifier[red] , identifier[green] , identifier[blue] , identifier[alpha] operator[SEP] operator[SEP] identifier[batch] operator[SEP] identifier[gl] operator[SEP] identifier[glClear] operator[SEP] identifier[GL20] operator[SEP] identifier[GL_COLOR_BUFFER_BIT] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public Path withFile(final String file) {
final Path result = new Path(this);
result.setFile(file);
return result;
}
|
class class_name[name] begin[{]
method[withFile, return_type[type[Path]], modifier[public], parameter[file]] begin[{]
local_variable[type[Path], result]
call[result.setFile, parameter[member[.file]]]
return[member[.result]]
end[}]
END[}]
|
Keyword[public] identifier[Path] identifier[withFile] operator[SEP] Keyword[final] identifier[String] identifier[file] operator[SEP] {
Keyword[final] identifier[Path] identifier[result] operator[=] Keyword[new] identifier[Path] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[setFile] operator[SEP] identifier[file] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
private static MimeBodyPart createBodyPart(byte[] data, String type, String filename) throws MessagingException {
final MimeBodyPart attachmentPart = new MimeBodyPart();
attachmentPart.setFileName(filename);
ByteArrayDataSource source = new ByteArrayDataSource(data, type);
attachmentPart.setDataHandler(new DataHandler(source));
attachmentPart.setHeader("Content-ID", createContentID(filename));
attachmentPart.setDisposition(MimeBodyPart.INLINE);
return attachmentPart;
}
|
class class_name[name] begin[{]
method[createBodyPart, return_type[type[MimeBodyPart]], modifier[private static], parameter[data, type, filename]] begin[{]
local_variable[type[MimeBodyPart], attachmentPart]
call[attachmentPart.setFileName, parameter[member[.filename]]]
local_variable[type[ByteArrayDataSource], source]
call[attachmentPart.setDataHandler, parameter[ClassCreator(arguments=[MemberReference(member=source, 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=DataHandler, sub_type=None))]]
call[attachmentPart.setHeader, parameter[literal["Content-ID"], call[.createContentID, parameter[member[.filename]]]]]
call[attachmentPart.setDisposition, parameter[member[MimeBodyPart.INLINE]]]
return[member[.attachmentPart]]
end[}]
END[}]
|
Keyword[private] Keyword[static] identifier[MimeBodyPart] identifier[createBodyPart] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[data] , identifier[String] identifier[type] , identifier[String] identifier[filename] operator[SEP] Keyword[throws] identifier[MessagingException] {
Keyword[final] identifier[MimeBodyPart] identifier[attachmentPart] operator[=] Keyword[new] identifier[MimeBodyPart] operator[SEP] operator[SEP] operator[SEP] identifier[attachmentPart] operator[SEP] identifier[setFileName] operator[SEP] identifier[filename] operator[SEP] operator[SEP] identifier[ByteArrayDataSource] identifier[source] operator[=] Keyword[new] identifier[ByteArrayDataSource] operator[SEP] identifier[data] , identifier[type] operator[SEP] operator[SEP] identifier[attachmentPart] operator[SEP] identifier[setDataHandler] operator[SEP] Keyword[new] identifier[DataHandler] operator[SEP] identifier[source] operator[SEP] operator[SEP] operator[SEP] identifier[attachmentPart] operator[SEP] identifier[setHeader] operator[SEP] literal[String] , identifier[createContentID] operator[SEP] identifier[filename] operator[SEP] operator[SEP] operator[SEP] identifier[attachmentPart] operator[SEP] identifier[setDisposition] operator[SEP] identifier[MimeBodyPart] operator[SEP] identifier[INLINE] operator[SEP] operator[SEP] Keyword[return] identifier[attachmentPart] operator[SEP]
}
|
public void marshall(TagResourceRequest tagResourceRequest, ProtocolMarshaller protocolMarshaller) {
if (tagResourceRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(tagResourceRequest.getKeyId(), KEYID_BINDING);
protocolMarshaller.marshall(tagResourceRequest.getTags(), TAGS_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[tagResourceRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.tagResourceRequest], ==, 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=getKeyId, postfix_operators=[], prefix_operators=[], qualifier=tagResourceRequest, selectors=[], type_arguments=None), MemberReference(member=KEYID_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=getTags, postfix_operators=[], prefix_operators=[], qualifier=tagResourceRequest, selectors=[], type_arguments=None), MemberReference(member=TAGS_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[TagResourceRequest] identifier[tagResourceRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[tagResourceRequest] 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[tagResourceRequest] operator[SEP] identifier[getKeyId] operator[SEP] operator[SEP] , identifier[KEYID_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[tagResourceRequest] operator[SEP] identifier[getTags] operator[SEP] operator[SEP] , identifier[TAGS_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public static void saveMD5File(File dataFile, MD5Hash digest)
throws IOException {
File md5File = getDigestFileForFile(dataFile);
String digestString = StringUtils.byteToHexString(
digest.getDigest());
String md5Line = digestString + " *" + dataFile.getName() + "\n";
AtomicFileOutputStream afos = new AtomicFileOutputStream(md5File);
afos.write(md5Line.getBytes());
afos.close();
LOG.info("Saved MD5 " + digest + " to " + md5File);
}
|
class class_name[name] begin[{]
method[saveMD5File, return_type[void], modifier[public static], parameter[dataFile, digest]] begin[{]
local_variable[type[File], md5File]
local_variable[type[String], digestString]
local_variable[type[String], md5Line]
local_variable[type[AtomicFileOutputStream], afos]
call[afos.write, parameter[call[md5Line.getBytes, parameter[]]]]
call[afos.close, parameter[]]
call[LOG.info, parameter[binary_operation[binary_operation[binary_operation[literal["Saved MD5 "], +, member[.digest]], +, literal[" to "]], +, member[.md5File]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[saveMD5File] operator[SEP] identifier[File] identifier[dataFile] , identifier[MD5Hash] identifier[digest] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[File] identifier[md5File] operator[=] identifier[getDigestFileForFile] operator[SEP] identifier[dataFile] operator[SEP] operator[SEP] identifier[String] identifier[digestString] operator[=] identifier[StringUtils] operator[SEP] identifier[byteToHexString] operator[SEP] identifier[digest] operator[SEP] identifier[getDigest] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[md5Line] operator[=] identifier[digestString] operator[+] literal[String] operator[+] identifier[dataFile] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] identifier[AtomicFileOutputStream] identifier[afos] operator[=] Keyword[new] identifier[AtomicFileOutputStream] operator[SEP] identifier[md5File] operator[SEP] operator[SEP] identifier[afos] operator[SEP] identifier[write] operator[SEP] identifier[md5Line] operator[SEP] identifier[getBytes] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[afos] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[digest] operator[+] literal[String] operator[+] identifier[md5File] operator[SEP] operator[SEP]
}
|
public static void configureDB(JobConf job, String driverClass, String dbUrl
, String userName, String passwd) {
job.set(DRIVER_CLASS_PROPERTY, driverClass);
job.set(URL_PROPERTY, dbUrl);
if(userName != null)
job.set(USERNAME_PROPERTY, userName);
if(passwd != null)
job.set(PASSWORD_PROPERTY, passwd);
}
|
class class_name[name] begin[{]
method[configureDB, return_type[void], modifier[public static], parameter[job, driverClass, dbUrl, userName, passwd]] begin[{]
call[job.set, parameter[member[.DRIVER_CLASS_PROPERTY], member[.driverClass]]]
call[job.set, parameter[member[.URL_PROPERTY], member[.dbUrl]]]
if[binary_operation[member[.userName], !=, literal[null]]] begin[{]
call[job.set, parameter[member[.USERNAME_PROPERTY], member[.userName]]]
else begin[{]
None
end[}]
if[binary_operation[member[.passwd], !=, literal[null]]] begin[{]
call[job.set, parameter[member[.PASSWORD_PROPERTY], member[.passwd]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[configureDB] operator[SEP] identifier[JobConf] identifier[job] , identifier[String] identifier[driverClass] , identifier[String] identifier[dbUrl] , identifier[String] identifier[userName] , identifier[String] identifier[passwd] operator[SEP] {
identifier[job] operator[SEP] identifier[set] operator[SEP] identifier[DRIVER_CLASS_PROPERTY] , identifier[driverClass] operator[SEP] operator[SEP] identifier[job] operator[SEP] identifier[set] operator[SEP] identifier[URL_PROPERTY] , identifier[dbUrl] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[userName] operator[!=] Other[null] operator[SEP] identifier[job] operator[SEP] identifier[set] operator[SEP] identifier[USERNAME_PROPERTY] , identifier[userName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[passwd] operator[!=] Other[null] operator[SEP] identifier[job] operator[SEP] identifier[set] operator[SEP] identifier[PASSWORD_PROPERTY] , identifier[passwd] operator[SEP] operator[SEP]
}
|
public boolean needsGui() {
BeanContextChild bcc = getPeer();
if (bcc != this && bcc instanceof Visibility) {
return ((Visibility) bcc).needsGui();
}
// check children
for (Object o : _children.keySet()) {
if (o instanceof Visibility) {
if (((Visibility) o).needsGui()) {
return true;
}
}
}
return false;
}
|
class class_name[name] begin[{]
method[needsGui, return_type[type[boolean]], modifier[public], parameter[]] begin[{]
local_variable[type[BeanContextChild], bcc]
if[binary_operation[binary_operation[member[.bcc], !=, THIS[]], &&, binary_operation[member[.bcc], instanceof, type[Visibility]]]] begin[{]
return[Cast(expression=MemberReference(member=bcc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Visibility, sub_type=None))]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=Visibility, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=Cast(expression=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Visibility, sub_type=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=keySet, postfix_operators=[], prefix_operators=[], qualifier=_children, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=o)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))), label=None)
return[literal[false]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[needsGui] operator[SEP] operator[SEP] {
identifier[BeanContextChild] identifier[bcc] operator[=] identifier[getPeer] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bcc] operator[!=] Keyword[this] operator[&&] identifier[bcc] Keyword[instanceof] identifier[Visibility] operator[SEP] {
Keyword[return] operator[SEP] operator[SEP] identifier[Visibility] operator[SEP] identifier[bcc] operator[SEP] operator[SEP] identifier[needsGui] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[Object] identifier[o] operator[:] identifier[_children] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[o] Keyword[instanceof] identifier[Visibility] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] operator[SEP] identifier[Visibility] operator[SEP] identifier[o] operator[SEP] operator[SEP] identifier[needsGui] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public Properties getOptionProperties(String opt)
{
Properties props = new Properties();
for (Option option : options)
{
if (opt.equals(option.getOpt()) || opt.equals(option.getLongOpt()))
{
List<String> values = option.getValuesList();
if (values.size() >= 2)
{
// use the first 2 arguments as the key/value pair
props.put(values.get(0), values.get(1));
}
else if (values.size() == 1)
{
// no explicit value, handle it as a boolean
props.put(values.get(0), "true");
}
}
}
return props;
}
|
class class_name[name] begin[{]
method[getOptionProperties, return_type[type[Properties]], modifier[public], parameter[opt]] begin[{]
local_variable[type[Properties], props]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getOpt, postfix_operators=[], prefix_operators=[], qualifier=option, selectors=[], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=[], qualifier=opt, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getLongOpt, postfix_operators=[], prefix_operators=[], qualifier=option, selectors=[], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=[], qualifier=opt, selectors=[], type_arguments=None), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getValuesList, postfix_operators=[], prefix_operators=[], qualifier=option, selectors=[], type_arguments=None), name=values)], 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=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=values, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=>=), else_statement=IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=values, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), 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=0)], member=get, postfix_operators=[], prefix_operators=[], qualifier=values, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="true")], member=put, postfix_operators=[], prefix_operators=[], qualifier=props, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=get, postfix_operators=[], prefix_operators=[], qualifier=values, selectors=[], type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=get, postfix_operators=[], prefix_operators=[], qualifier=values, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=props, selectors=[], type_arguments=None), label=None)]))]))]), control=EnhancedForControl(iterable=MemberReference(member=options, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=option)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Option, sub_type=None))), label=None)
return[member[.props]]
end[}]
END[}]
|
Keyword[public] identifier[Properties] identifier[getOptionProperties] operator[SEP] identifier[String] identifier[opt] operator[SEP] {
identifier[Properties] identifier[props] operator[=] Keyword[new] identifier[Properties] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Option] identifier[option] operator[:] identifier[options] operator[SEP] {
Keyword[if] operator[SEP] identifier[opt] operator[SEP] identifier[equals] operator[SEP] identifier[option] operator[SEP] identifier[getOpt] operator[SEP] operator[SEP] operator[SEP] operator[||] identifier[opt] operator[SEP] identifier[equals] operator[SEP] identifier[option] operator[SEP] identifier[getLongOpt] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[String] operator[>] identifier[values] operator[=] identifier[option] operator[SEP] identifier[getValuesList] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[values] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>=] Other[2] operator[SEP] {
identifier[props] operator[SEP] identifier[put] operator[SEP] identifier[values] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] , identifier[values] operator[SEP] identifier[get] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[values] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[1] operator[SEP] {
identifier[props] operator[SEP] identifier[put] operator[SEP] identifier[values] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] , literal[String] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[props] operator[SEP]
}
|
public static appfwprofile get(nitro_service service, String name) throws Exception{
appfwprofile obj = new appfwprofile();
obj.set_name(name);
appfwprofile response = (appfwprofile) obj.get_resource(service);
return response;
}
|
class class_name[name] begin[{]
method[get, return_type[type[appfwprofile]], modifier[public static], parameter[service, name]] begin[{]
local_variable[type[appfwprofile], obj]
call[obj.set_name, parameter[member[.name]]]
local_variable[type[appfwprofile], response]
return[member[.response]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[appfwprofile] identifier[get] operator[SEP] identifier[nitro_service] identifier[service] , identifier[String] identifier[name] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[appfwprofile] identifier[obj] operator[=] Keyword[new] identifier[appfwprofile] operator[SEP] operator[SEP] operator[SEP] identifier[obj] operator[SEP] identifier[set_name] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[appfwprofile] identifier[response] operator[=] operator[SEP] identifier[appfwprofile] operator[SEP] identifier[obj] operator[SEP] identifier[get_resource] operator[SEP] identifier[service] operator[SEP] operator[SEP] Keyword[return] identifier[response] operator[SEP]
}
|
@Override
public CreateNamedQueryResult createNamedQuery(CreateNamedQueryRequest request) {
request = beforeClientExecution(request);
return executeCreateNamedQuery(request);
}
|
class class_name[name] begin[{]
method[createNamedQuery, return_type[type[CreateNamedQueryResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeCreateNamedQuery, parameter[member[.request]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[CreateNamedQueryResult] identifier[createNamedQuery] operator[SEP] identifier[CreateNamedQueryRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeCreateNamedQuery] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
private static String escapeDoubleQuotes(String s, int beginIndex, int endIndex) {
if (s == null || s.length() == 0 || s.indexOf('"') == -1) {
return s;
}
StringBuilder b = new StringBuilder();
for (int i = beginIndex; i < endIndex; i++) {
char c = s.charAt(i);
if (c == '\\' ) {
b.append(c);
//ignore the character after an escape, just append it
if (++i>=endIndex) throw UndertowMessages.MESSAGES.invalidEscapeCharacter();
b.append(s.charAt(i));
} else if (c == '"')
b.append('\\').append('"');
else
b.append(c);
}
return b.toString();
}
|
class class_name[name] begin[{]
method[escapeDoubleQuotes, return_type[type[String]], modifier[private static], parameter[s, beginIndex, endIndex]] begin[{]
if[binary_operation[binary_operation[binary_operation[member[.s], ==, literal[null]], ||, binary_operation[call[s.length, parameter[]], ==, literal[0]]], ||, binary_operation[call[s.indexOf, parameter[literal['"']]], ==, literal[1]]]] begin[{]
return[member[.s]]
else begin[{]
None
end[}]
local_variable[type[StringBuilder], b]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None), name=c)], modifiers=set(), type=BasicType(dimensions=[], name=char)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\\'), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='"'), operator===), else_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=b, selectors=[], type_arguments=None), label=None), label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\\')], member=append, postfix_operators=[], prefix_operators=[], qualifier=b, selectors=[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)], type_arguments=None), label=None)), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=b, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[]), operandr=MemberReference(member=endIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>=), else_statement=None, label=None, then_statement=ThrowStatement(expression=MethodInvocation(arguments=[], member=invalidEscapeCharacter, postfix_operators=[], prefix_operators=[], qualifier=UndertowMessages.MESSAGES, selectors=[], type_arguments=None), label=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=b, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=endIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=beginIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[call[b.toString, parameter[]]]
end[}]
END[}]
|
Keyword[private] Keyword[static] identifier[String] identifier[escapeDoubleQuotes] operator[SEP] identifier[String] identifier[s] , Keyword[int] identifier[beginIndex] , Keyword[int] identifier[endIndex] operator[SEP] {
Keyword[if] operator[SEP] identifier[s] operator[==] Other[null] operator[||] identifier[s] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[||] identifier[s] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[==] operator[-] Other[1] operator[SEP] {
Keyword[return] identifier[s] operator[SEP]
}
identifier[StringBuilder] identifier[b] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[beginIndex] operator[SEP] identifier[i] operator[<] identifier[endIndex] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[char] identifier[c] operator[=] identifier[s] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[c] operator[==] literal[String] operator[SEP] {
identifier[b] operator[SEP] identifier[append] operator[SEP] identifier[c] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[++] identifier[i] operator[>=] identifier[endIndex] operator[SEP] Keyword[throw] identifier[UndertowMessages] operator[SEP] identifier[MESSAGES] operator[SEP] identifier[invalidEscapeCharacter] operator[SEP] operator[SEP] operator[SEP] identifier[b] operator[SEP] identifier[append] operator[SEP] identifier[s] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[c] operator[==] literal[String] operator[SEP] identifier[b] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[else] identifier[b] operator[SEP] identifier[append] operator[SEP] identifier[c] operator[SEP] operator[SEP]
}
Keyword[return] identifier[b] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void setDecimal(int ordinal, Decimal value, int precision) {
assertIndexIsValid(ordinal);
if (precision <= Decimal.MAX_LONG_DIGITS()) {
// compact format
if (value == null) {
setNullAt(ordinal);
} else {
setLong(ordinal, value.toUnscaledLong());
}
} else {
// fixed length
long cursor = getLong(ordinal) >>> 32;
assert cursor > 0 : "invalid cursor " + cursor;
// zero-out the bytes
Platform.putLong(baseObject, baseOffset + cursor, 0L);
Platform.putLong(baseObject, baseOffset + cursor + 8, 0L);
if (value == null) {
setNullAt(ordinal);
// keep the offset for future update
Platform.putLong(baseObject, getFieldOffset(ordinal), cursor << 32);
} else {
final BigInteger integer = value.toJavaBigDecimal().unscaledValue();
byte[] bytes = integer.toByteArray();
assert(bytes.length <= 16);
// Write the bytes to the variable length portion.
Platform.copyMemory(
bytes, Platform.BYTE_ARRAY_OFFSET, baseObject, baseOffset + cursor, bytes.length);
setLong(ordinal, (cursor << 32) | ((long) bytes.length));
}
}
}
|
class class_name[name] begin[{]
method[setDecimal, return_type[void], modifier[public], parameter[ordinal, value, precision]] begin[{]
call[.assertIndexIsValid, parameter[member[.ordinal]]]
if[binary_operation[member[.precision], <=, call[Decimal.MAX_LONG_DIGITS, parameter[]]]] begin[{]
if[binary_operation[member[.value], ==, literal[null]]] begin[{]
call[.setNullAt, parameter[member[.ordinal]]]
else begin[{]
call[.setLong, parameter[member[.ordinal], call[value.toUnscaledLong, parameter[]]]]
end[}]
else begin[{]
local_variable[type[long], cursor]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=cursor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), label=None, value=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="invalid cursor "), operandr=MemberReference(member=cursor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+))
call[Platform.putLong, parameter[member[.baseObject], binary_operation[member[.baseOffset], +, member[.cursor]], literal[0L]]]
call[Platform.putLong, parameter[member[.baseObject], binary_operation[binary_operation[member[.baseOffset], +, member[.cursor]], +, literal[8]], literal[0L]]]
if[binary_operation[member[.value], ==, literal[null]]] begin[{]
call[.setNullAt, parameter[member[.ordinal]]]
call[Platform.putLong, parameter[member[.baseObject], call[.getFieldOffset, parameter[member[.ordinal]]], binary_operation[member[.cursor], <<, literal[32]]]]
else begin[{]
local_variable[type[BigInteger], integer]
local_variable[type[byte], bytes]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=bytes, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=16), operator=<=), label=None, value=None)
call[Platform.copyMemory, parameter[member[.bytes], member[Platform.BYTE_ARRAY_OFFSET], member[.baseObject], binary_operation[member[.baseOffset], +, member[.cursor]], member[bytes.length]]]
call[.setLong, parameter[member[.ordinal], binary_operation[binary_operation[member[.cursor], <<, literal[32]], |, Cast(expression=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=bytes, selectors=[]), type=BasicType(dimensions=[], name=long))]]]
end[}]
end[}]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[setDecimal] operator[SEP] Keyword[int] identifier[ordinal] , identifier[Decimal] identifier[value] , Keyword[int] identifier[precision] operator[SEP] {
identifier[assertIndexIsValid] operator[SEP] identifier[ordinal] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[precision] operator[<=] identifier[Decimal] operator[SEP] identifier[MAX_LONG_DIGITS] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[value] operator[==] Other[null] operator[SEP] {
identifier[setNullAt] operator[SEP] identifier[ordinal] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[setLong] operator[SEP] identifier[ordinal] , identifier[value] operator[SEP] identifier[toUnscaledLong] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[long] identifier[cursor] operator[=] identifier[getLong] operator[SEP] identifier[ordinal] operator[SEP] operator[>] operator[>] operator[>] Other[32] operator[SEP] Keyword[assert] identifier[cursor] operator[>] Other[0] operator[:] literal[String] operator[+] identifier[cursor] operator[SEP] identifier[Platform] operator[SEP] identifier[putLong] operator[SEP] identifier[baseObject] , identifier[baseOffset] operator[+] identifier[cursor] , Other[0L] operator[SEP] operator[SEP] identifier[Platform] operator[SEP] identifier[putLong] operator[SEP] identifier[baseObject] , identifier[baseOffset] operator[+] identifier[cursor] operator[+] Other[8] , Other[0L] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[==] Other[null] operator[SEP] {
identifier[setNullAt] operator[SEP] identifier[ordinal] operator[SEP] operator[SEP] identifier[Platform] operator[SEP] identifier[putLong] operator[SEP] identifier[baseObject] , identifier[getFieldOffset] operator[SEP] identifier[ordinal] operator[SEP] , identifier[cursor] operator[<<] Other[32] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[final] identifier[BigInteger] identifier[integer] operator[=] identifier[value] operator[SEP] identifier[toJavaBigDecimal] operator[SEP] operator[SEP] operator[SEP] identifier[unscaledValue] operator[SEP] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[bytes] operator[=] identifier[integer] operator[SEP] identifier[toByteArray] operator[SEP] operator[SEP] operator[SEP] Keyword[assert] operator[SEP] identifier[bytes] operator[SEP] identifier[length] operator[<=] Other[16] operator[SEP] operator[SEP] identifier[Platform] operator[SEP] identifier[copyMemory] operator[SEP] identifier[bytes] , identifier[Platform] operator[SEP] identifier[BYTE_ARRAY_OFFSET] , identifier[baseObject] , identifier[baseOffset] operator[+] identifier[cursor] , identifier[bytes] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[setLong] operator[SEP] identifier[ordinal] , operator[SEP] identifier[cursor] operator[<<] Other[32] operator[SEP] operator[|] operator[SEP] operator[SEP] Keyword[long] operator[SEP] identifier[bytes] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
public static int computeCapacity(double percentage, String mapName) {
return computeCapacity(Runtime.getRuntime().maxMemory(), percentage, mapName);
}
|
class class_name[name] begin[{]
method[computeCapacity, return_type[type[int]], modifier[public static], parameter[percentage, mapName]] begin[{]
return[call[.computeCapacity, parameter[call[Runtime.getRuntime, parameter[]], member[.percentage], member[.mapName]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[int] identifier[computeCapacity] operator[SEP] Keyword[double] identifier[percentage] , identifier[String] identifier[mapName] operator[SEP] {
Keyword[return] identifier[computeCapacity] operator[SEP] identifier[Runtime] operator[SEP] identifier[getRuntime] operator[SEP] operator[SEP] operator[SEP] identifier[maxMemory] operator[SEP] operator[SEP] , identifier[percentage] , identifier[mapName] operator[SEP] operator[SEP]
}
|
public static BasicStroke toStroke(final String style) {
BasicStroke result = null;
if (style != null) {
float lineWidth = STROKE_DEFAULT_LINE_WIDTH;
float[] dash = { STROKE_DEFAULT_DASH_WIDTH };
float[] dot = { lineWidth };
if (style.equalsIgnoreCase(STYLE_LINE)) {
result = new BasicStroke(lineWidth);
} else if (style.equalsIgnoreCase(STYLE_DASH)) {
result = new BasicStroke(lineWidth, BasicStroke.CAP_BUTT,
BasicStroke.JOIN_MITER,
STROKE_MITER_LIMIT_STYLE_DASH, dash,
STROKE_DEFAULT_DASHPHASE);
} else if (style.equalsIgnoreCase(STYLE_DOT)) {
result = new BasicStroke(lineWidth, BasicStroke.CAP_BUTT,
BasicStroke.JOIN_MITER,
STROKE_MITER_LIMIT_STYLE_DOT, dot,
STROKE_DEFAULT_DASHPHASE);
}
}
return result;
}
|
class class_name[name] begin[{]
method[toStroke, return_type[type[BasicStroke]], modifier[public static], parameter[style]] begin[{]
local_variable[type[BasicStroke], result]
if[binary_operation[member[.style], !=, literal[null]]] begin[{]
local_variable[type[float], lineWidth]
local_variable[type[float], dash]
local_variable[type[float], dot]
if[call[style.equalsIgnoreCase, parameter[member[.STYLE_LINE]]]] begin[{]
assign[member[.result], ClassCreator(arguments=[MemberReference(member=lineWidth, 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=BasicStroke, sub_type=None))]
else begin[{]
if[call[style.equalsIgnoreCase, parameter[member[.STYLE_DASH]]]] begin[{]
assign[member[.result], ClassCreator(arguments=[MemberReference(member=lineWidth, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=CAP_BUTT, postfix_operators=[], prefix_operators=[], qualifier=BasicStroke, selectors=[]), MemberReference(member=JOIN_MITER, postfix_operators=[], prefix_operators=[], qualifier=BasicStroke, selectors=[]), MemberReference(member=STROKE_MITER_LIMIT_STYLE_DASH, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dash, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=STROKE_DEFAULT_DASHPHASE, 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=BasicStroke, sub_type=None))]
else begin[{]
if[call[style.equalsIgnoreCase, parameter[member[.STYLE_DOT]]]] begin[{]
assign[member[.result], ClassCreator(arguments=[MemberReference(member=lineWidth, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=CAP_BUTT, postfix_operators=[], prefix_operators=[], qualifier=BasicStroke, selectors=[]), MemberReference(member=JOIN_MITER, postfix_operators=[], prefix_operators=[], qualifier=BasicStroke, selectors=[]), MemberReference(member=STROKE_MITER_LIMIT_STYLE_DOT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dot, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=STROKE_DEFAULT_DASHPHASE, 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=BasicStroke, sub_type=None))]
else begin[{]
None
end[}]
end[}]
end[}]
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[BasicStroke] identifier[toStroke] operator[SEP] Keyword[final] identifier[String] identifier[style] operator[SEP] {
identifier[BasicStroke] identifier[result] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[style] operator[!=] Other[null] operator[SEP] {
Keyword[float] identifier[lineWidth] operator[=] identifier[STROKE_DEFAULT_LINE_WIDTH] operator[SEP] Keyword[float] operator[SEP] operator[SEP] identifier[dash] operator[=] {
identifier[STROKE_DEFAULT_DASH_WIDTH]
} operator[SEP] Keyword[float] operator[SEP] operator[SEP] identifier[dot] operator[=] {
identifier[lineWidth]
} operator[SEP] Keyword[if] operator[SEP] identifier[style] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[STYLE_LINE] operator[SEP] operator[SEP] {
identifier[result] operator[=] Keyword[new] identifier[BasicStroke] operator[SEP] identifier[lineWidth] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[style] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[STYLE_DASH] operator[SEP] operator[SEP] {
identifier[result] operator[=] Keyword[new] identifier[BasicStroke] operator[SEP] identifier[lineWidth] , identifier[BasicStroke] operator[SEP] identifier[CAP_BUTT] , identifier[BasicStroke] operator[SEP] identifier[JOIN_MITER] , identifier[STROKE_MITER_LIMIT_STYLE_DASH] , identifier[dash] , identifier[STROKE_DEFAULT_DASHPHASE] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[style] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[STYLE_DOT] operator[SEP] operator[SEP] {
identifier[result] operator[=] Keyword[new] identifier[BasicStroke] operator[SEP] identifier[lineWidth] , identifier[BasicStroke] operator[SEP] identifier[CAP_BUTT] , identifier[BasicStroke] operator[SEP] identifier[JOIN_MITER] , identifier[STROKE_MITER_LIMIT_STYLE_DOT] , identifier[dot] , identifier[STROKE_DEFAULT_DASHPHASE] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[result] operator[SEP]
}
|
private ZipFile createZipFile(List<Path.Entry<?>> files) throws IOException {
// The set of known paths
HashSet<Path.ID> paths = new HashSet<>();
// The zip file we're creating
ZipFile zf = new ZipFile();
// Add each file to zip file
for (int i = 0; i != files.size(); ++i) {
Path.Entry<?> file = files.get(i);
// Extract path
addPaths(file.id().parent(),paths,zf);
// Construct filename for given entry
String filename = file.id().toString() + "." + file.contentType().getSuffix();
// Extract bytes representing entry
byte[] contents = readFileContents(file);
zf.add(new ZipEntry(filename), contents);
}
//
return zf;
}
|
class class_name[name] begin[{]
method[createZipFile, return_type[type[ZipFile]], modifier[private], parameter[files]] begin[{]
local_variable[type[HashSet], paths]
local_variable[type[ZipFile], zf]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=files, selectors=[], type_arguments=None), name=file)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Path, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=None, name=Entry, sub_type=None))), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=id, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[MethodInvocation(arguments=[], member=parent, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MemberReference(member=paths, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=zf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addPaths, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=id, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="."), operator=+), operandr=MethodInvocation(arguments=[], member=contentType, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[MethodInvocation(arguments=[], member=getSuffix, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=+), name=filename)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=file, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readFileContents, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=contents)], modifiers=set(), type=BasicType(dimensions=[None], name=byte)), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=filename, 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=ZipEntry, sub_type=None)), MemberReference(member=contents, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=zf, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=files, selectors=[], type_arguments=None), operator=!=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)
return[member[.zf]]
end[}]
END[}]
|
Keyword[private] identifier[ZipFile] identifier[createZipFile] operator[SEP] identifier[List] operator[<] identifier[Path] operator[SEP] identifier[Entry] operator[<] operator[?] operator[>] operator[>] identifier[files] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[HashSet] operator[<] identifier[Path] operator[SEP] identifier[ID] operator[>] identifier[paths] operator[=] Keyword[new] identifier[HashSet] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[ZipFile] identifier[zf] operator[=] Keyword[new] identifier[ZipFile] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[!=] identifier[files] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[++] identifier[i] operator[SEP] {
identifier[Path] operator[SEP] identifier[Entry] operator[<] operator[?] operator[>] identifier[file] operator[=] identifier[files] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[addPaths] operator[SEP] identifier[file] operator[SEP] identifier[id] operator[SEP] operator[SEP] operator[SEP] identifier[parent] operator[SEP] operator[SEP] , identifier[paths] , identifier[zf] operator[SEP] operator[SEP] identifier[String] identifier[filename] operator[=] identifier[file] operator[SEP] identifier[id] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[file] operator[SEP] identifier[contentType] operator[SEP] operator[SEP] operator[SEP] identifier[getSuffix] operator[SEP] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[contents] operator[=] identifier[readFileContents] operator[SEP] identifier[file] operator[SEP] operator[SEP] identifier[zf] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[ZipEntry] operator[SEP] identifier[filename] operator[SEP] , identifier[contents] operator[SEP] operator[SEP]
}
Keyword[return] identifier[zf] operator[SEP]
}
|
public void setFailed(java.util.Collection<BatchResultErrorEntry> failed) {
if (failed == null) {
this.failed = null;
return;
}
this.failed = new com.amazonaws.internal.SdkInternalList<BatchResultErrorEntry>(failed);
}
|
class class_name[name] begin[{]
method[setFailed, return_type[void], modifier[public], parameter[failed]] begin[{]
if[binary_operation[member[.failed], ==, literal[null]]] begin[{]
assign[THIS[member[None.failed]], literal[null]]
return[None]
else begin[{]
None
end[}]
assign[THIS[member[None.failed]], ClassCreator(arguments=[MemberReference(member=failed, 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=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=BatchResultErrorEntry, sub_type=None))], dimensions=None, name=SdkInternalList, sub_type=None)))))]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setFailed] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Collection] operator[<] identifier[BatchResultErrorEntry] operator[>] identifier[failed] operator[SEP] {
Keyword[if] operator[SEP] identifier[failed] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[failed] operator[=] Other[null] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[this] operator[SEP] identifier[failed] operator[=] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[BatchResultErrorEntry] operator[>] operator[SEP] identifier[failed] operator[SEP] operator[SEP]
}
|
public boolean updateLastIndexed(String geoPackage, String tableName, long lastIndexed) {
return updateLastIndexed(getGeoPackageId(geoPackage), tableName, lastIndexed);
}
|
class class_name[name] begin[{]
method[updateLastIndexed, return_type[type[boolean]], modifier[public], parameter[geoPackage, tableName, lastIndexed]] begin[{]
return[call[.updateLastIndexed, parameter[call[.getGeoPackageId, parameter[member[.geoPackage]]], member[.tableName], member[.lastIndexed]]]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[updateLastIndexed] operator[SEP] identifier[String] identifier[geoPackage] , identifier[String] identifier[tableName] , Keyword[long] identifier[lastIndexed] operator[SEP] {
Keyword[return] identifier[updateLastIndexed] operator[SEP] identifier[getGeoPackageId] operator[SEP] identifier[geoPackage] operator[SEP] , identifier[tableName] , identifier[lastIndexed] operator[SEP] operator[SEP]
}
|
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public void defaultHeaders_serverHandler(Blackhole bh) {
serverHandler(bh, new DefaultHttp2Headers(true, 9));
}
|
class class_name[name] begin[{]
method[defaultHeaders_serverHandler, return_type[void], modifier[public], parameter[bh]] begin[{]
call[.serverHandler, parameter[member[.bh], ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=9)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DefaultHttp2Headers, sub_type=None))]]
end[}]
END[}]
|
annotation[@] identifier[Benchmark] annotation[@] identifier[BenchmarkMode] operator[SEP] identifier[Mode] operator[SEP] identifier[AverageTime] operator[SEP] annotation[@] identifier[OutputTimeUnit] operator[SEP] identifier[TimeUnit] operator[SEP] identifier[NANOSECONDS] operator[SEP] Keyword[public] Keyword[void] identifier[defaultHeaders_serverHandler] operator[SEP] identifier[Blackhole] identifier[bh] operator[SEP] {
identifier[serverHandler] operator[SEP] identifier[bh] , Keyword[new] identifier[DefaultHttp2Headers] operator[SEP] literal[boolean] , Other[9] operator[SEP] operator[SEP] operator[SEP]
}
|
protected static boolean compareAttributes(Part left, Part right) {
if (left == right) {
return true;
} else if (left == Part.ANY) {
return true;
}
return false;
}
|
class class_name[name] begin[{]
method[compareAttributes, return_type[type[boolean]], modifier[static protected], parameter[left, right]] begin[{]
if[binary_operation[member[.left], ==, member[.right]]] begin[{]
return[literal[true]]
else begin[{]
if[binary_operation[member[.left], ==, member[Part.ANY]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
end[}]
return[literal[false]]
end[}]
END[}]
|
Keyword[protected] Keyword[static] Keyword[boolean] identifier[compareAttributes] operator[SEP] identifier[Part] identifier[left] , identifier[Part] identifier[right] operator[SEP] {
Keyword[if] operator[SEP] identifier[left] operator[==] identifier[right] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[left] operator[==] identifier[Part] operator[SEP] identifier[ANY] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
private static int findPairBracketPosition(final String str, final int startPos) {
int bracketNum = 0;
for (int i = startPos; i < str.length(); i++)
{
char current = str.charAt(i);
if (current == TieConstants.EL_START_BRACKET)
{
bracketNum++;
} else if (current == TieConstants.EL_END )
{
bracketNum--;
if (bracketNum <=0 ) {
return i;
}
}
}
return -1;
}
|
class class_name[name] begin[{]
method[findPairBracketPosition, return_type[type[int]], modifier[private static], parameter[str, startPos]] begin[{]
local_variable[type[int], bracketNum]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=str, selectors=[], type_arguments=None), name=current)], modifiers=set(), type=BasicType(dimensions=[], name=char)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=current, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=EL_START_BRACKET, postfix_operators=[], prefix_operators=[], qualifier=TieConstants, selectors=[]), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=current, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=EL_END, postfix_operators=[], prefix_operators=[], qualifier=TieConstants, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=bracketNum, postfix_operators=['--'], prefix_operators=[], qualifier=, selectors=[]), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=bracketNum, 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=[ReturnStatement(expression=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=bracketNum, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=str, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=startPos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[literal[1]]
end[}]
END[}]
|
Keyword[private] Keyword[static] Keyword[int] identifier[findPairBracketPosition] operator[SEP] Keyword[final] identifier[String] identifier[str] , Keyword[final] Keyword[int] identifier[startPos] operator[SEP] {
Keyword[int] identifier[bracketNum] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[startPos] operator[SEP] identifier[i] operator[<] identifier[str] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[char] identifier[current] operator[=] identifier[str] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[current] operator[==] identifier[TieConstants] operator[SEP] identifier[EL_START_BRACKET] operator[SEP] {
identifier[bracketNum] operator[++] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[current] operator[==] identifier[TieConstants] operator[SEP] identifier[EL_END] operator[SEP] {
identifier[bracketNum] operator[--] operator[SEP] Keyword[if] operator[SEP] identifier[bracketNum] operator[<=] Other[0] operator[SEP] {
Keyword[return] identifier[i] operator[SEP]
}
}
}
Keyword[return] operator[-] Other[1] operator[SEP]
}
|
@Override
public GetHostedZoneResult getHostedZone(GetHostedZoneRequest request) {
request = beforeClientExecution(request);
return executeGetHostedZone(request);
}
|
class class_name[name] begin[{]
method[getHostedZone, return_type[type[GetHostedZoneResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeGetHostedZone, parameter[member[.request]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[GetHostedZoneResult] identifier[getHostedZone] operator[SEP] identifier[GetHostedZoneRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeGetHostedZone] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
public static List<Method> getPublicMethods(Class<?> clazz, String... excludeMethodNames) {
return getPublicMethods(clazz, excludeMethodNames);
}
|
class class_name[name] begin[{]
method[getPublicMethods, return_type[type[List]], modifier[public static], parameter[clazz, excludeMethodNames]] begin[{]
return[call[.getPublicMethods, parameter[member[.clazz], member[.excludeMethodNames]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[List] operator[<] identifier[Method] operator[>] identifier[getPublicMethods] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[clazz] , identifier[String] operator[...] identifier[excludeMethodNames] operator[SEP] {
Keyword[return] identifier[getPublicMethods] operator[SEP] identifier[clazz] , identifier[excludeMethodNames] operator[SEP] operator[SEP]
}
|
public JavadocLink javadocMethodLink(String memberName, Type... types) {
return new JavadocLink("%s#%s(%s)",
getQualifiedName(),
memberName,
(Excerpt) code -> {
String separator = "";
for (Type type : types) {
code.add("%s%s", separator, type.getQualifiedName());
separator = ", ";
}
});
}
|
class class_name[name] begin[{]
method[javadocMethodLink, return_type[type[JavadocLink]], modifier[public], parameter[memberName, types]] begin[{]
return[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="%s#%s(%s)"), MethodInvocation(arguments=[], member=getQualifiedName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=memberName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), LambdaExpression(body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), name=separator)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="%s%s"), MemberReference(member=separator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getQualifiedName, postfix_operators=[], prefix_operators=[], qualifier=type, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=code, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=separator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", ")), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=types, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=type)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Type, sub_type=None))), label=None)], parameters=[Cast(expression=MemberReference(member=code, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Excerpt, sub_type=None))])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JavadocLink, sub_type=None))]
end[}]
END[}]
|
Keyword[public] identifier[JavadocLink] identifier[javadocMethodLink] operator[SEP] identifier[String] identifier[memberName] , identifier[Type] operator[...] identifier[types] operator[SEP] {
Keyword[return] Keyword[new] identifier[JavadocLink] operator[SEP] literal[String] , identifier[getQualifiedName] operator[SEP] operator[SEP] , identifier[memberName] , operator[SEP] identifier[Excerpt] operator[SEP] identifier[code] operator[->] {
identifier[String] identifier[separator] operator[=] literal[String] operator[SEP] Keyword[for] operator[SEP] identifier[Type] identifier[type] operator[:] identifier[types] operator[SEP] {
identifier[code] operator[SEP] identifier[add] operator[SEP] literal[String] , identifier[separator] , identifier[type] operator[SEP] identifier[getQualifiedName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[separator] operator[=] literal[String] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
public final void startServer(){
logger.info("Starting Ebeans Module.");
// /////////////////////////////////////////////////////////////////////
// Setup basic parameters
// /////////////////////////////////////////////////////////////////////
boolean ebeanDdlGenerate = ninjaProperties.getBooleanWithDefault(
EBEAN_DDL_GENERATE, false);
boolean ebeanDdlRun = ninjaProperties.getBooleanWithDefault(
EBEAN_DDL_RUN, false);
String ebeanDdlInitSql = ninjaProperties.get(EBEAN_DDL_INIT_SQL);
String ebeanDdlSeedSql = ninjaProperties.get(EBEAN_DDL_SEED_SQL);
String ebeanDatasourceName = ninjaProperties.getWithDefault(
EBEAN_DATASOURCE_NAME, "default");
String ebeanDatasourceUserName = ninjaProperties.getWithDefault(
EBEAN_DATASOURCE_USERNAME, "test");
String ebeanDatasourcePassword = ninjaProperties.getWithDefault(
EBEAN_DATASOURCE_PASSWORD, "test");
String ebeanDatasourceDatabaseUrl = ninjaProperties.getWithDefault(
EBEAN_DATASOURCE_DATABASE_URL,
"jdbc:h2:mem:tests;DB_CLOSE_DELAY=-1");
String ebeanDatasourceDatabaseDriver = ninjaProperties.getWithDefault(
EBEAN_DATASOURCE_DATABASE_DRIVER, "org.h2.Driver");
int ebeanDatasourceMinConnections = ninjaProperties
.getIntegerWithDefault(EBEAN_DATASOURCE_MIN_CONNECTIONS, 1);
int ebeanDatasourceMaxConnections = ninjaProperties
.getIntegerWithDefault(EBEAN_DATASOURCE_MAX_CONNECTIONS, 25);
String ebeanDatasourceHeartbeatSql = ninjaProperties.getWithDefault(
EBEAN_DATASOURCE_HEARTBEAT_SQL, "select 1");
ServerConfig serverConfig = new ServerConfig();
serverConfig.setName(ebeanDatasourceName);
serverConfig.loadFromProperties();
// Define DataSource parameters
DataSourceConfig dataSourceConfig = new DataSourceConfig();
dataSourceConfig.setDriver(ebeanDatasourceDatabaseDriver);
dataSourceConfig.setUsername(ebeanDatasourceUserName);
dataSourceConfig.setPassword(ebeanDatasourcePassword);
dataSourceConfig.setUrl(ebeanDatasourceDatabaseUrl);
dataSourceConfig.setMinConnections(ebeanDatasourceMinConnections);
dataSourceConfig.setMaxConnections(ebeanDatasourceMaxConnections);
dataSourceConfig.setHeartbeatSql(ebeanDatasourceHeartbeatSql);
serverConfig.setDataSourceConfig(dataSourceConfig);
// set DDL options...
serverConfig.setDdlGenerate(ebeanDdlGenerate);
serverConfig.setDdlRun(ebeanDdlRun);
serverConfig.setDdlInitSql(ebeanDdlInitSql);
serverConfig.setDdlSeedSql(ebeanDdlSeedSql);
serverConfig.setDefaultServer(true);
serverConfig.setRegister(true);
// split models configuration into classes & packages
Set<String> packageNames = new LinkedHashSet<>();
Set<Class<?>> entityClasses = new LinkedHashSet<>();
// models always added by default
packageNames.add("models");
// add manually listed classes from the property
String[] manuallyListedModels = ninjaProperties.getStringArray(EBEAN_MODELS);
if (manuallyListedModels != null) {
for (String model: manuallyListedModels) {
if (model.endsWith(".*")) {
// strip off .* at end
String packageName = model.substring(0, model.length() - 2);
packageNames.add(packageName);
} else {
try {
entityClasses.add(Class.forName(model));
} catch (ClassNotFoundException e) {
throw new RuntimeException(
"Configuration error. Class listed/discovered via " + EBEAN_MODELS + " not found: " + model);
}
}
}
}
// if any packages were specified the reflections library MUST be available
if (!packageNames.isEmpty()) {
for (String packageName : packageNames) {
Set<String> packageClasses
= ReflectionsHelper.findAllClassesInPackage(packageName);
logger.info("Searched and found " + packageClasses.size() + " classes in package " + packageName);
for (String packageClass : packageClasses) {
try {
entityClasses.add(Class.forName(packageClass));
} catch (ClassNotFoundException e) {
// should be impossible since Reflections just found 'em
throw new RuntimeException("Something fishy happenend. Unable to find class " + packageClass);
}
}
}
}
for (Class<?> entityClass : entityClasses) {
serverConfig.addClass(entityClass);
}
// create the EbeanServer instance
ebeanServer = createEbeanServer(serverConfig);
// Activate the Ebean shutdown manager (disconnects from db, shuts down all threads and so on)
ShutdownManager.touch();
}
|
class class_name[name] begin[{]
method[startServer, return_type[void], modifier[final public], parameter[]] begin[{]
call[logger.info, parameter[literal["Starting Ebeans Module."]]]
local_variable[type[boolean], ebeanDdlGenerate]
local_variable[type[boolean], ebeanDdlRun]
local_variable[type[String], ebeanDdlInitSql]
local_variable[type[String], ebeanDdlSeedSql]
local_variable[type[String], ebeanDatasourceName]
local_variable[type[String], ebeanDatasourceUserName]
local_variable[type[String], ebeanDatasourcePassword]
local_variable[type[String], ebeanDatasourceDatabaseUrl]
local_variable[type[String], ebeanDatasourceDatabaseDriver]
local_variable[type[int], ebeanDatasourceMinConnections]
local_variable[type[int], ebeanDatasourceMaxConnections]
local_variable[type[String], ebeanDatasourceHeartbeatSql]
local_variable[type[ServerConfig], serverConfig]
call[serverConfig.setName, parameter[member[.ebeanDatasourceName]]]
call[serverConfig.loadFromProperties, parameter[]]
local_variable[type[DataSourceConfig], dataSourceConfig]
call[dataSourceConfig.setDriver, parameter[member[.ebeanDatasourceDatabaseDriver]]]
call[dataSourceConfig.setUsername, parameter[member[.ebeanDatasourceUserName]]]
call[dataSourceConfig.setPassword, parameter[member[.ebeanDatasourcePassword]]]
call[dataSourceConfig.setUrl, parameter[member[.ebeanDatasourceDatabaseUrl]]]
call[dataSourceConfig.setMinConnections, parameter[member[.ebeanDatasourceMinConnections]]]
call[dataSourceConfig.setMaxConnections, parameter[member[.ebeanDatasourceMaxConnections]]]
call[dataSourceConfig.setHeartbeatSql, parameter[member[.ebeanDatasourceHeartbeatSql]]]
call[serverConfig.setDataSourceConfig, parameter[member[.dataSourceConfig]]]
call[serverConfig.setDdlGenerate, parameter[member[.ebeanDdlGenerate]]]
call[serverConfig.setDdlRun, parameter[member[.ebeanDdlRun]]]
call[serverConfig.setDdlInitSql, parameter[member[.ebeanDdlInitSql]]]
call[serverConfig.setDdlSeedSql, parameter[member[.ebeanDdlSeedSql]]]
call[serverConfig.setDefaultServer, parameter[literal[true]]]
call[serverConfig.setRegister, parameter[literal[true]]]
local_variable[type[Set], packageNames]
local_variable[type[Set], entityClasses]
call[packageNames.add, parameter[literal["models"]]]
local_variable[type[String], manuallyListedModels]
if[binary_operation[member[.manuallyListedModels], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".*")], member=endsWith, postfix_operators=[], prefix_operators=[], qualifier=model, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=model, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Class, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=entityClasses, 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="Configuration error. Class listed/discovered via "), operandr=MemberReference(member=EBEAN_MODELS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" not found: "), operator=+), operandr=MemberReference(member=model, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ClassNotFoundException']))], finally_block=None, label=None, resources=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), BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=model, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=-)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=model, selectors=[], type_arguments=None), name=packageName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=packageName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=packageNames, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=manuallyListedModels, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=model)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
else begin[{]
None
end[}]
if[call[packageNames.isEmpty, parameter[]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=packageName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=findAllClassesInPackage, postfix_operators=[], prefix_operators=[], qualifier=ReflectionsHelper, selectors=[], type_arguments=None), name=packageClasses)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=Set, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Searched and found "), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=packageClasses, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" classes in package "), operator=+), operandr=MemberReference(member=packageName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=info, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=packageClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Class, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=entityClasses, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Something fishy happenend. Unable to find class "), operandr=MemberReference(member=packageClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ClassNotFoundException']))], finally_block=None, label=None, resources=None)]), control=EnhancedForControl(iterable=MemberReference(member=packageClasses, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=packageClass)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=packageNames, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=packageName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=entityClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addClass, postfix_operators=[], prefix_operators=[], qualifier=serverConfig, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=entityClasses, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entityClass)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Class, sub_type=None))), label=None)
assign[member[.ebeanServer], call[.createEbeanServer, parameter[member[.serverConfig]]]]
call[ShutdownManager.touch, parameter[]]
end[}]
END[}]
|
Keyword[public] Keyword[final] Keyword[void] identifier[startServer] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[boolean] identifier[ebeanDdlGenerate] operator[=] identifier[ninjaProperties] operator[SEP] identifier[getBooleanWithDefault] operator[SEP] identifier[EBEAN_DDL_GENERATE] , literal[boolean] operator[SEP] operator[SEP] Keyword[boolean] identifier[ebeanDdlRun] operator[=] identifier[ninjaProperties] operator[SEP] identifier[getBooleanWithDefault] operator[SEP] identifier[EBEAN_DDL_RUN] , literal[boolean] operator[SEP] operator[SEP] identifier[String] identifier[ebeanDdlInitSql] operator[=] identifier[ninjaProperties] operator[SEP] identifier[get] operator[SEP] identifier[EBEAN_DDL_INIT_SQL] operator[SEP] operator[SEP] identifier[String] identifier[ebeanDdlSeedSql] operator[=] identifier[ninjaProperties] operator[SEP] identifier[get] operator[SEP] identifier[EBEAN_DDL_SEED_SQL] operator[SEP] operator[SEP] identifier[String] identifier[ebeanDatasourceName] operator[=] identifier[ninjaProperties] operator[SEP] identifier[getWithDefault] operator[SEP] identifier[EBEAN_DATASOURCE_NAME] , literal[String] operator[SEP] operator[SEP] identifier[String] identifier[ebeanDatasourceUserName] operator[=] identifier[ninjaProperties] operator[SEP] identifier[getWithDefault] operator[SEP] identifier[EBEAN_DATASOURCE_USERNAME] , literal[String] operator[SEP] operator[SEP] identifier[String] identifier[ebeanDatasourcePassword] operator[=] identifier[ninjaProperties] operator[SEP] identifier[getWithDefault] operator[SEP] identifier[EBEAN_DATASOURCE_PASSWORD] , literal[String] operator[SEP] operator[SEP] identifier[String] identifier[ebeanDatasourceDatabaseUrl] operator[=] identifier[ninjaProperties] operator[SEP] identifier[getWithDefault] operator[SEP] identifier[EBEAN_DATASOURCE_DATABASE_URL] , literal[String] operator[SEP] operator[SEP] identifier[String] identifier[ebeanDatasourceDatabaseDriver] operator[=] identifier[ninjaProperties] operator[SEP] identifier[getWithDefault] operator[SEP] identifier[EBEAN_DATASOURCE_DATABASE_DRIVER] , literal[String] operator[SEP] operator[SEP] Keyword[int] identifier[ebeanDatasourceMinConnections] operator[=] identifier[ninjaProperties] operator[SEP] identifier[getIntegerWithDefault] operator[SEP] identifier[EBEAN_DATASOURCE_MIN_CONNECTIONS] , Other[1] operator[SEP] operator[SEP] Keyword[int] identifier[ebeanDatasourceMaxConnections] operator[=] identifier[ninjaProperties] operator[SEP] identifier[getIntegerWithDefault] operator[SEP] identifier[EBEAN_DATASOURCE_MAX_CONNECTIONS] , Other[25] operator[SEP] operator[SEP] identifier[String] identifier[ebeanDatasourceHeartbeatSql] operator[=] identifier[ninjaProperties] operator[SEP] identifier[getWithDefault] operator[SEP] identifier[EBEAN_DATASOURCE_HEARTBEAT_SQL] , literal[String] operator[SEP] operator[SEP] identifier[ServerConfig] identifier[serverConfig] operator[=] Keyword[new] identifier[ServerConfig] operator[SEP] operator[SEP] operator[SEP] identifier[serverConfig] operator[SEP] identifier[setName] operator[SEP] identifier[ebeanDatasourceName] operator[SEP] operator[SEP] identifier[serverConfig] operator[SEP] identifier[loadFromProperties] operator[SEP] operator[SEP] operator[SEP] identifier[DataSourceConfig] identifier[dataSourceConfig] operator[=] Keyword[new] identifier[DataSourceConfig] operator[SEP] operator[SEP] operator[SEP] identifier[dataSourceConfig] operator[SEP] identifier[setDriver] operator[SEP] identifier[ebeanDatasourceDatabaseDriver] operator[SEP] operator[SEP] identifier[dataSourceConfig] operator[SEP] identifier[setUsername] operator[SEP] identifier[ebeanDatasourceUserName] operator[SEP] operator[SEP] identifier[dataSourceConfig] operator[SEP] identifier[setPassword] operator[SEP] identifier[ebeanDatasourcePassword] operator[SEP] operator[SEP] identifier[dataSourceConfig] operator[SEP] identifier[setUrl] operator[SEP] identifier[ebeanDatasourceDatabaseUrl] operator[SEP] operator[SEP] identifier[dataSourceConfig] operator[SEP] identifier[setMinConnections] operator[SEP] identifier[ebeanDatasourceMinConnections] operator[SEP] operator[SEP] identifier[dataSourceConfig] operator[SEP] identifier[setMaxConnections] operator[SEP] identifier[ebeanDatasourceMaxConnections] operator[SEP] operator[SEP] identifier[dataSourceConfig] operator[SEP] identifier[setHeartbeatSql] operator[SEP] identifier[ebeanDatasourceHeartbeatSql] operator[SEP] operator[SEP] identifier[serverConfig] operator[SEP] identifier[setDataSourceConfig] operator[SEP] identifier[dataSourceConfig] operator[SEP] operator[SEP] identifier[serverConfig] operator[SEP] identifier[setDdlGenerate] operator[SEP] identifier[ebeanDdlGenerate] operator[SEP] operator[SEP] identifier[serverConfig] operator[SEP] identifier[setDdlRun] operator[SEP] identifier[ebeanDdlRun] operator[SEP] operator[SEP] identifier[serverConfig] operator[SEP] identifier[setDdlInitSql] operator[SEP] identifier[ebeanDdlInitSql] operator[SEP] operator[SEP] identifier[serverConfig] operator[SEP] identifier[setDdlSeedSql] operator[SEP] identifier[ebeanDdlSeedSql] operator[SEP] operator[SEP] identifier[serverConfig] operator[SEP] identifier[setDefaultServer] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[serverConfig] operator[SEP] identifier[setRegister] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[Set] operator[<] identifier[String] operator[>] identifier[packageNames] operator[=] Keyword[new] identifier[LinkedHashSet] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Set] operator[<] identifier[Class] operator[<] operator[?] operator[>] operator[>] identifier[entityClasses] operator[=] Keyword[new] identifier[LinkedHashSet] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[packageNames] operator[SEP] identifier[add] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[manuallyListedModels] operator[=] identifier[ninjaProperties] operator[SEP] identifier[getStringArray] operator[SEP] identifier[EBEAN_MODELS] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[manuallyListedModels] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[String] identifier[model] operator[:] identifier[manuallyListedModels] operator[SEP] {
Keyword[if] operator[SEP] identifier[model] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[String] identifier[packageName] operator[=] identifier[model] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[model] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[2] operator[SEP] operator[SEP] identifier[packageNames] operator[SEP] identifier[add] operator[SEP] identifier[packageName] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[try] {
identifier[entityClasses] operator[SEP] identifier[add] operator[SEP] identifier[Class] operator[SEP] identifier[forName] operator[SEP] identifier[model] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ClassNotFoundException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[+] identifier[EBEAN_MODELS] operator[+] literal[String] operator[+] identifier[model] operator[SEP] operator[SEP]
}
}
}
}
Keyword[if] operator[SEP] operator[!] identifier[packageNames] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[String] identifier[packageName] operator[:] identifier[packageNames] operator[SEP] {
identifier[Set] operator[<] identifier[String] operator[>] identifier[packageClasses] operator[=] identifier[ReflectionsHelper] operator[SEP] identifier[findAllClassesInPackage] operator[SEP] identifier[packageName] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[packageClasses] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[packageName] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[packageClass] operator[:] identifier[packageClasses] operator[SEP] {
Keyword[try] {
identifier[entityClasses] operator[SEP] identifier[add] operator[SEP] identifier[Class] operator[SEP] identifier[forName] operator[SEP] identifier[packageClass] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ClassNotFoundException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[+] identifier[packageClass] operator[SEP] operator[SEP]
}
}
}
}
Keyword[for] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[entityClass] operator[:] identifier[entityClasses] operator[SEP] {
identifier[serverConfig] operator[SEP] identifier[addClass] operator[SEP] identifier[entityClass] operator[SEP] operator[SEP]
}
identifier[ebeanServer] operator[=] identifier[createEbeanServer] operator[SEP] identifier[serverConfig] operator[SEP] operator[SEP] identifier[ShutdownManager] operator[SEP] identifier[touch] operator[SEP] operator[SEP] operator[SEP]
}
|
public static cmppolicy_csvserver_binding[] get(nitro_service service, String name) throws Exception{
cmppolicy_csvserver_binding obj = new cmppolicy_csvserver_binding();
obj.set_name(name);
cmppolicy_csvserver_binding response[] = (cmppolicy_csvserver_binding[]) obj.get_resources(service);
return response;
}
|
class class_name[name] begin[{]
method[get, return_type[type[cmppolicy_csvserver_binding]], modifier[public static], parameter[service, name]] begin[{]
local_variable[type[cmppolicy_csvserver_binding], obj]
call[obj.set_name, parameter[member[.name]]]
local_variable[type[cmppolicy_csvserver_binding], response]
return[member[.response]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[cmppolicy_csvserver_binding] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[nitro_service] identifier[service] , identifier[String] identifier[name] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[cmppolicy_csvserver_binding] identifier[obj] operator[=] Keyword[new] identifier[cmppolicy_csvserver_binding] operator[SEP] operator[SEP] operator[SEP] identifier[obj] operator[SEP] identifier[set_name] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[cmppolicy_csvserver_binding] identifier[response] operator[SEP] operator[SEP] operator[=] operator[SEP] identifier[cmppolicy_csvserver_binding] operator[SEP] operator[SEP] operator[SEP] identifier[obj] operator[SEP] identifier[get_resources] operator[SEP] identifier[service] operator[SEP] operator[SEP] Keyword[return] identifier[response] operator[SEP]
}
|
@Override
public Set<String> getFileExtension(String fileTypeExtension) throws OSException {
fileTypeExtension = sanitizeFileExtension(fileTypeExtension);
if (!LinuxMIMEDatabase.instance().getExtensionMimeMap().containsKey(fileTypeExtension)) {
throw new OSException("File type extension \"" + fileTypeExtension + "\" is not registered.");
}
Set<String> apps = new HashSet<>();
Set<String> allMimeTypes = LinuxMIMEDatabase.instance().getExtensionMimeMap().get(fileTypeExtension);
Map<String, Set<String>> mimeApplications = LinuxMIMEDatabase.instance().getMimeApps();
for (String mimeType : allMimeTypes) {
if (mimeApplications.containsKey(mimeType) && mimeApplications.get(mimeType) != null) {
apps.addAll(mimeApplications.get(mimeType));
}
}
return apps;
}
|
class class_name[name] begin[{]
method[getFileExtension, return_type[type[Set]], modifier[public], parameter[fileTypeExtension]] begin[{]
assign[member[.fileTypeExtension], call[.sanitizeFileExtension, parameter[member[.fileTypeExtension]]]]
if[call[LinuxMIMEDatabase.instance, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="File type extension \""), operandr=MemberReference(member=fileTypeExtension, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\" is not registered."), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=OSException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[Set], apps]
local_variable[type[Set], allMimeTypes]
local_variable[type[Map], mimeApplications]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=mimeType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=containsKey, postfix_operators=[], prefix_operators=[], qualifier=mimeApplications, selectors=[], type_arguments=None), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=mimeType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=mimeApplications, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=mimeType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=mimeApplications, selectors=[], type_arguments=None)], member=addAll, postfix_operators=[], prefix_operators=[], qualifier=apps, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=allMimeTypes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=mimeType)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[member[.apps]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[Set] operator[<] identifier[String] operator[>] identifier[getFileExtension] operator[SEP] identifier[String] identifier[fileTypeExtension] operator[SEP] Keyword[throws] identifier[OSException] {
identifier[fileTypeExtension] operator[=] identifier[sanitizeFileExtension] operator[SEP] identifier[fileTypeExtension] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[LinuxMIMEDatabase] operator[SEP] identifier[instance] operator[SEP] operator[SEP] operator[SEP] identifier[getExtensionMimeMap] operator[SEP] operator[SEP] operator[SEP] identifier[containsKey] operator[SEP] identifier[fileTypeExtension] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[OSException] operator[SEP] literal[String] operator[+] identifier[fileTypeExtension] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[Set] operator[<] identifier[String] operator[>] identifier[apps] operator[=] Keyword[new] identifier[HashSet] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Set] operator[<] identifier[String] operator[>] identifier[allMimeTypes] operator[=] identifier[LinuxMIMEDatabase] operator[SEP] identifier[instance] operator[SEP] operator[SEP] operator[SEP] identifier[getExtensionMimeMap] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[fileTypeExtension] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Set] operator[<] identifier[String] operator[>] operator[>] identifier[mimeApplications] operator[=] identifier[LinuxMIMEDatabase] operator[SEP] identifier[instance] operator[SEP] operator[SEP] operator[SEP] identifier[getMimeApps] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[mimeType] operator[:] identifier[allMimeTypes] operator[SEP] {
Keyword[if] operator[SEP] identifier[mimeApplications] operator[SEP] identifier[containsKey] operator[SEP] identifier[mimeType] operator[SEP] operator[&&] identifier[mimeApplications] operator[SEP] identifier[get] operator[SEP] identifier[mimeType] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[apps] operator[SEP] identifier[addAll] operator[SEP] identifier[mimeApplications] operator[SEP] identifier[get] operator[SEP] identifier[mimeType] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[apps] operator[SEP]
}
|
public final void mGREATER() throws RecognitionException {
try {
int _type = GREATER;
int _channel = DEFAULT_TOKEN_CHANNEL;
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:226:5: ( '>' )
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:226:7: '>'
{
match('>'); if (state.failed) return;
}
state.type = _type;
state.channel = _channel;
}
finally {
// do for sure before leaving
}
}
|
class class_name[name] begin[{]
method[mGREATER, return_type[void], modifier[final public], parameter[]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=GREATER, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=_type)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=DEFAULT_TOKEN_CHANNEL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=_channel)], modifiers=set(), type=BasicType(dimensions=[], name=int)), BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='>')], member=match, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), else_statement=None, label=None, then_statement=ReturnStatement(expression=None, label=None))]), StatementExpression(expression=Assignment(expressionl=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), type==, value=MemberReference(member=_type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=channel, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), type==, value=MemberReference(member=_channel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)], catches=None, finally_block=[], label=None, resources=None)
end[}]
END[}]
|
Keyword[public] Keyword[final] Keyword[void] identifier[mGREATER] operator[SEP] operator[SEP] Keyword[throws] identifier[RecognitionException] {
Keyword[try] {
Keyword[int] identifier[_type] operator[=] identifier[GREATER] operator[SEP] Keyword[int] identifier[_channel] operator[=] identifier[DEFAULT_TOKEN_CHANNEL] operator[SEP] {
identifier[match] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[failed] operator[SEP] Keyword[return] operator[SEP]
}
identifier[state] operator[SEP] identifier[type] operator[=] identifier[_type] operator[SEP] identifier[state] operator[SEP] identifier[channel] operator[=] identifier[_channel] operator[SEP]
}
Keyword[finally] {
}
}
|
public ScreenComponent setupDefaultView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, Map<String, Object> properties)
{
ScreenComponent screenField = null;
if (converter.getMaxLength() <= ScreenConstants.MAX_SINGLE_LINE_CHARS)
screenField = createScreenComponent(ScreenModel.EDIT_TEXT, itsLocation, targetScreen, converter, iDisplayFieldDesc, properties);
else
{
if (targetScreen instanceof GridScreenParent)
screenField = createScreenComponent(ScreenModel.EDIT_TEXT, itsLocation, targetScreen, converter, iDisplayFieldDesc, properties);
else
screenField = createScreenComponent(ScreenModel.TE_VIEW, itsLocation, targetScreen, this, iDisplayFieldDesc, properties);
}
return screenField;
}
|
class class_name[name] begin[{]
method[setupDefaultView, return_type[type[ScreenComponent]], modifier[public], parameter[itsLocation, targetScreen, converter, iDisplayFieldDesc, properties]] begin[{]
local_variable[type[ScreenComponent], screenField]
if[binary_operation[call[converter.getMaxLength, parameter[]], <=, member[ScreenConstants.MAX_SINGLE_LINE_CHARS]]] begin[{]
assign[member[.screenField], call[.createScreenComponent, parameter[member[ScreenModel.EDIT_TEXT], member[.itsLocation], member[.targetScreen], member[.converter], member[.iDisplayFieldDesc], member[.properties]]]]
else begin[{]
if[binary_operation[member[.targetScreen], instanceof, type[GridScreenParent]]] begin[{]
assign[member[.screenField], call[.createScreenComponent, parameter[member[ScreenModel.EDIT_TEXT], member[.itsLocation], member[.targetScreen], member[.converter], member[.iDisplayFieldDesc], member[.properties]]]]
else begin[{]
assign[member[.screenField], call[.createScreenComponent, parameter[member[ScreenModel.TE_VIEW], member[.itsLocation], member[.targetScreen], THIS[], member[.iDisplayFieldDesc], member[.properties]]]]
end[}]
end[}]
return[member[.screenField]]
end[}]
END[}]
|
Keyword[public] identifier[ScreenComponent] identifier[setupDefaultView] operator[SEP] identifier[ScreenLoc] identifier[itsLocation] , identifier[ComponentParent] identifier[targetScreen] , identifier[Convert] identifier[converter] , Keyword[int] identifier[iDisplayFieldDesc] , identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[properties] operator[SEP] {
identifier[ScreenComponent] identifier[screenField] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[converter] operator[SEP] identifier[getMaxLength] operator[SEP] operator[SEP] operator[<=] identifier[ScreenConstants] operator[SEP] identifier[MAX_SINGLE_LINE_CHARS] operator[SEP] identifier[screenField] operator[=] identifier[createScreenComponent] operator[SEP] identifier[ScreenModel] operator[SEP] identifier[EDIT_TEXT] , identifier[itsLocation] , identifier[targetScreen] , identifier[converter] , identifier[iDisplayFieldDesc] , identifier[properties] operator[SEP] operator[SEP] Keyword[else] {
Keyword[if] operator[SEP] identifier[targetScreen] Keyword[instanceof] identifier[GridScreenParent] operator[SEP] identifier[screenField] operator[=] identifier[createScreenComponent] operator[SEP] identifier[ScreenModel] operator[SEP] identifier[EDIT_TEXT] , identifier[itsLocation] , identifier[targetScreen] , identifier[converter] , identifier[iDisplayFieldDesc] , identifier[properties] operator[SEP] operator[SEP] Keyword[else] identifier[screenField] operator[=] identifier[createScreenComponent] operator[SEP] identifier[ScreenModel] operator[SEP] identifier[TE_VIEW] , identifier[itsLocation] , identifier[targetScreen] , Keyword[this] , identifier[iDisplayFieldDesc] , identifier[properties] operator[SEP] operator[SEP]
}
Keyword[return] identifier[screenField] operator[SEP]
}
|
public IfcPileConstructionEnum createIfcPileConstructionEnumFromString(EDataType eDataType, String initialValue) {
IfcPileConstructionEnum result = IfcPileConstructionEnum.get(initialValue);
if (result == null)
throw new IllegalArgumentException(
"The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
return result;
}
|
class class_name[name] begin[{]
method[createIfcPileConstructionEnumFromString, return_type[type[IfcPileConstructionEnum]], modifier[public], parameter[eDataType, initialValue]] begin[{]
local_variable[type[IfcPileConstructionEnum], result]
if[binary_operation[member[.result], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The value '"), operandr=MemberReference(member=initialValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' is not a valid enumerator of '"), operator=+), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=eDataType, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="'"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}]
|
Keyword[public] identifier[IfcPileConstructionEnum] identifier[createIfcPileConstructionEnumFromString] operator[SEP] identifier[EDataType] identifier[eDataType] , identifier[String] identifier[initialValue] operator[SEP] {
identifier[IfcPileConstructionEnum] identifier[result] operator[=] identifier[IfcPileConstructionEnum] operator[SEP] identifier[get] operator[SEP] identifier[initialValue] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[initialValue] operator[+] literal[String] operator[+] identifier[eDataType] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
ProtectionDomain getProtectionDomainForProxy(ProtectionDomain domain) {
if (domain.getCodeSource() == null) {
// no codesource to cache on
return create(domain);
}
ProtectionDomain proxyProtectionDomain = proxyProtectionDomains.get(domain.getCodeSource());
if (proxyProtectionDomain == null) {
// as this is not atomic create() may be called multiple times for the same domain
// we ignore that
proxyProtectionDomain = create(domain);
ProtectionDomain existing = proxyProtectionDomains.putIfAbsent(domain.getCodeSource(), proxyProtectionDomain);
if (existing != null) {
proxyProtectionDomain = existing;
}
}
return proxyProtectionDomain;
}
|
class class_name[name] begin[{]
method[getProtectionDomainForProxy, return_type[type[ProtectionDomain]], modifier[default], parameter[domain]] begin[{]
if[binary_operation[call[domain.getCodeSource, parameter[]], ==, literal[null]]] begin[{]
return[call[.create, parameter[member[.domain]]]]
else begin[{]
None
end[}]
local_variable[type[ProtectionDomain], proxyProtectionDomain]
if[binary_operation[member[.proxyProtectionDomain], ==, literal[null]]] begin[{]
assign[member[.proxyProtectionDomain], call[.create, parameter[member[.domain]]]]
local_variable[type[ProtectionDomain], existing]
if[binary_operation[member[.existing], !=, literal[null]]] begin[{]
assign[member[.proxyProtectionDomain], member[.existing]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[member[.proxyProtectionDomain]]
end[}]
END[}]
|
identifier[ProtectionDomain] identifier[getProtectionDomainForProxy] operator[SEP] identifier[ProtectionDomain] identifier[domain] operator[SEP] {
Keyword[if] operator[SEP] identifier[domain] operator[SEP] identifier[getCodeSource] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[create] operator[SEP] identifier[domain] operator[SEP] operator[SEP]
}
identifier[ProtectionDomain] identifier[proxyProtectionDomain] operator[=] identifier[proxyProtectionDomains] operator[SEP] identifier[get] operator[SEP] identifier[domain] operator[SEP] identifier[getCodeSource] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[proxyProtectionDomain] operator[==] Other[null] operator[SEP] {
identifier[proxyProtectionDomain] operator[=] identifier[create] operator[SEP] identifier[domain] operator[SEP] operator[SEP] identifier[ProtectionDomain] identifier[existing] operator[=] identifier[proxyProtectionDomains] operator[SEP] identifier[putIfAbsent] operator[SEP] identifier[domain] operator[SEP] identifier[getCodeSource] operator[SEP] operator[SEP] , identifier[proxyProtectionDomain] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[existing] operator[!=] Other[null] operator[SEP] {
identifier[proxyProtectionDomain] operator[=] identifier[existing] operator[SEP]
}
}
Keyword[return] identifier[proxyProtectionDomain] operator[SEP]
}
|
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case AfplibPackage.STO__IORNTION:
return IORNTION_EDEFAULT == null ? iorntion != null : !IORNTION_EDEFAULT.equals(iorntion);
case AfplibPackage.STO__BORNTION:
return BORNTION_EDEFAULT == null ? borntion != null : !BORNTION_EDEFAULT.equals(borntion);
}
return super.eIsSet(featureID);
}
|
class class_name[name] begin[{]
method[eIsSet, return_type[type[boolean]], modifier[public], parameter[featureID]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=STO__IORNTION, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[ReturnStatement(expression=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=IORNTION_EDEFAULT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[MemberReference(member=iorntion, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=['!'], qualifier=IORNTION_EDEFAULT, selectors=[], type_arguments=None), if_true=BinaryOperation(operandl=MemberReference(member=iorntion, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=)), label=None)]), SwitchStatementCase(case=[MemberReference(member=STO__BORNTION, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[ReturnStatement(expression=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=BORNTION_EDEFAULT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[MemberReference(member=borntion, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=['!'], qualifier=BORNTION_EDEFAULT, selectors=[], type_arguments=None), if_true=BinaryOperation(operandl=MemberReference(member=borntion, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=)), label=None)])], expression=MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
return[SuperMethodInvocation(arguments=[MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=eIsSet, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[eIsSet] operator[SEP] Keyword[int] identifier[featureID] operator[SEP] {
Keyword[switch] operator[SEP] identifier[featureID] operator[SEP] {
Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[STO__IORNTION] operator[:] Keyword[return] identifier[IORNTION_EDEFAULT] operator[==] Other[null] operator[?] identifier[iorntion] operator[!=] Other[null] operator[:] operator[!] identifier[IORNTION_EDEFAULT] operator[SEP] identifier[equals] operator[SEP] identifier[iorntion] operator[SEP] operator[SEP] Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[STO__BORNTION] operator[:] Keyword[return] identifier[BORNTION_EDEFAULT] operator[==] Other[null] operator[?] identifier[borntion] operator[!=] Other[null] operator[:] operator[!] identifier[BORNTION_EDEFAULT] operator[SEP] identifier[equals] operator[SEP] identifier[borntion] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[super] operator[SEP] identifier[eIsSet] operator[SEP] identifier[featureID] operator[SEP] operator[SEP]
}
|
public static String joinNamespace(final List<String> namespace) {
for (final String element : namespace) {
checkArgument(!element.startsWith(DELIM),
"Namespace element may not begin with a period: " + element);
checkArgument(!element.endsWith(DELIM),
"Namespace element may not end with a period: " + element);
}
return JOINER.join(namespace);
}
|
class class_name[name] begin[{]
method[joinNamespace, return_type[type[String]], modifier[public static], parameter[namespace]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=DELIM, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=startsWith, postfix_operators=[], prefix_operators=['!'], qualifier=element, selectors=[], type_arguments=None), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Namespace element may not begin with a period: "), operandr=MemberReference(member=element, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=checkArgument, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=DELIM, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=endsWith, postfix_operators=[], prefix_operators=['!'], qualifier=element, selectors=[], type_arguments=None), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Namespace element may not end with a period: "), operandr=MemberReference(member=element, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=checkArgument, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=namespace, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=element)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[call[JOINER.join, parameter[member[.namespace]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[joinNamespace] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[String] operator[>] identifier[namespace] operator[SEP] {
Keyword[for] operator[SEP] Keyword[final] identifier[String] identifier[element] operator[:] identifier[namespace] operator[SEP] {
identifier[checkArgument] operator[SEP] operator[!] identifier[element] operator[SEP] identifier[startsWith] operator[SEP] identifier[DELIM] operator[SEP] , literal[String] operator[+] identifier[element] operator[SEP] operator[SEP] identifier[checkArgument] operator[SEP] operator[!] identifier[element] operator[SEP] identifier[endsWith] operator[SEP] identifier[DELIM] operator[SEP] , literal[String] operator[+] identifier[element] operator[SEP] operator[SEP]
}
Keyword[return] identifier[JOINER] operator[SEP] identifier[join] operator[SEP] identifier[namespace] operator[SEP] operator[SEP]
}
|
public boolean recordDefineType(JSTypeExpression type) {
if (type != null &&
!currentInfo.isConstant() &&
!currentInfo.isDefine() &&
recordType(type)) {
currentInfo.setDefine(true);
populated = true;
return true;
} else {
return false;
}
}
|
class class_name[name] begin[{]
method[recordDefineType, return_type[type[boolean]], modifier[public], parameter[type]] begin[{]
if[binary_operation[binary_operation[binary_operation[binary_operation[member[.type], !=, literal[null]], &&, call[currentInfo.isConstant, parameter[]]], &&, call[currentInfo.isDefine, parameter[]]], &&, call[.recordType, parameter[member[.type]]]]] begin[{]
call[currentInfo.setDefine, parameter[literal[true]]]
assign[member[.populated], literal[true]]
return[literal[true]]
else begin[{]
return[literal[false]]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[recordDefineType] operator[SEP] identifier[JSTypeExpression] identifier[type] operator[SEP] {
Keyword[if] operator[SEP] identifier[type] operator[!=] Other[null] operator[&&] operator[!] identifier[currentInfo] operator[SEP] identifier[isConstant] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[currentInfo] operator[SEP] identifier[isDefine] operator[SEP] operator[SEP] operator[&&] identifier[recordType] operator[SEP] identifier[type] operator[SEP] operator[SEP] {
identifier[currentInfo] operator[SEP] identifier[setDefine] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[populated] operator[=] literal[boolean] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] {
Keyword[return] literal[boolean] operator[SEP]
}
}
|
public void setContentAction(Action.OnActionListener listener) {
setContentAction(listener, null, null, null, null);
}
|
class class_name[name] begin[{]
method[setContentAction, return_type[void], modifier[public], parameter[listener]] begin[{]
call[.setContentAction, parameter[member[.listener], literal[null], literal[null], literal[null], literal[null]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setContentAction] operator[SEP] identifier[Action] operator[SEP] identifier[OnActionListener] identifier[listener] operator[SEP] {
identifier[setContentAction] operator[SEP] identifier[listener] , Other[null] , Other[null] , Other[null] , Other[null] operator[SEP] operator[SEP]
}
|
public static NumberData negative(SoyValue node) {
if (node instanceof IntegerData) {
return IntegerData.forValue(-node.longValue());
} else {
return FloatData.forValue(-node.floatValue());
}
}
|
class class_name[name] begin[{]
method[negative, return_type[type[NumberData]], modifier[public static], parameter[node]] begin[{]
if[binary_operation[member[.node], instanceof, type[IntegerData]]] begin[{]
return[call[IntegerData.forValue, parameter[call[node.longValue, parameter[]]]]]
else begin[{]
return[call[FloatData.forValue, parameter[call[node.floatValue, parameter[]]]]]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[NumberData] identifier[negative] operator[SEP] identifier[SoyValue] identifier[node] operator[SEP] {
Keyword[if] operator[SEP] identifier[node] Keyword[instanceof] identifier[IntegerData] operator[SEP] {
Keyword[return] identifier[IntegerData] operator[SEP] identifier[forValue] operator[SEP] operator[-] identifier[node] operator[SEP] identifier[longValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[FloatData] operator[SEP] identifier[forValue] operator[SEP] operator[-] identifier[node] operator[SEP] identifier[floatValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static LineString fromLngLats(@NonNull List<Point> points) {
return new LineString(TYPE, null, points);
}
|
class class_name[name] begin[{]
method[fromLngLats, return_type[type[LineString]], modifier[public static], parameter[points]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=TYPE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=points, 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=LineString, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[LineString] identifier[fromLngLats] operator[SEP] annotation[@] identifier[NonNull] identifier[List] operator[<] identifier[Point] operator[>] identifier[points] operator[SEP] {
Keyword[return] Keyword[new] identifier[LineString] operator[SEP] identifier[TYPE] , Other[null] , identifier[points] operator[SEP] operator[SEP]
}
|
public void delete_attribute_property(String attname, String propname) throws DevFailed {
database.delete_device_attribute_property(deviceName, attname, propname);
}
|
class class_name[name] begin[{]
method[delete_attribute_property, return_type[void], modifier[public], parameter[attname, propname]] begin[{]
call[database.delete_device_attribute_property, parameter[member[.deviceName], member[.attname], member[.propname]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[delete_attribute_property] operator[SEP] identifier[String] identifier[attname] , identifier[String] identifier[propname] operator[SEP] Keyword[throws] identifier[DevFailed] {
identifier[database] operator[SEP] identifier[delete_device_attribute_property] operator[SEP] identifier[deviceName] , identifier[attname] , identifier[propname] operator[SEP] operator[SEP]
}
|
static Method findPrivateMethod(Class<?> cl, String methodName,
Class<?>[] param) {
try {
Method method = cl.getDeclaredMethod(methodName, param);
if (Modifier.isPrivate(method.getModifiers()) && method.getReturnType() == void.class) {
method.setAccessible(true);
return method;
}
} catch (NoSuchMethodException nsm) {
// Ignored
}
return null;
}
|
class class_name[name] begin[{]
method[findPrivateMethod, return_type[type[Method]], modifier[static], parameter[cl, methodName, param]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=methodName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=param, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getDeclaredMethod, postfix_operators=[], prefix_operators=[], qualifier=cl, selectors=[], type_arguments=None), name=method)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Method, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getModifiers, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[], type_arguments=None)], member=isPrivate, postfix_operators=[], prefix_operators=[], qualifier=Modifier, selectors=[], type_arguments=None), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getReturnType, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[], type_arguments=None), operandr=VoidClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=None), operator===), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=setAccessible, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MemberReference(member=method, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=nsm, types=['NoSuchMethodException']))], finally_block=None, label=None, resources=None)
return[literal[null]]
end[}]
END[}]
|
Keyword[static] identifier[Method] identifier[findPrivateMethod] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[cl] , identifier[String] identifier[methodName] , identifier[Class] operator[<] operator[?] operator[>] operator[SEP] operator[SEP] identifier[param] operator[SEP] {
Keyword[try] {
identifier[Method] identifier[method] operator[=] identifier[cl] operator[SEP] identifier[getDeclaredMethod] operator[SEP] identifier[methodName] , identifier[param] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Modifier] operator[SEP] identifier[isPrivate] operator[SEP] identifier[method] operator[SEP] identifier[getModifiers] operator[SEP] operator[SEP] operator[SEP] operator[&&] identifier[method] operator[SEP] identifier[getReturnType] operator[SEP] operator[SEP] operator[==] Keyword[void] operator[SEP] Keyword[class] operator[SEP] {
identifier[method] operator[SEP] identifier[setAccessible] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[return] identifier[method] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[NoSuchMethodException] identifier[nsm] operator[SEP] {
}
Keyword[return] Other[null] operator[SEP]
}
|
public static <T> List<T> toposort(final Set<T> inputSet, T root, final Deps<T> deps, boolean isFullCut) {
// Check that inputs set is a valid set of leaves for the given output module.
checkAreDescendentsOf(inputSet, root, deps);
if (isFullCut) {
checkIsFullCut(inputSet, root, deps);
}
Deps<T> cutoffDeps = getCutoffDeps(inputSet, deps);
return Toposort.toposort(root, cutoffDeps);
}
|
class class_name[name] begin[{]
method[toposort, return_type[type[List]], modifier[public static], parameter[inputSet, root, deps, isFullCut]] begin[{]
call[.checkAreDescendentsOf, parameter[member[.inputSet], member[.root], member[.deps]]]
if[member[.isFullCut]] begin[{]
call[.checkIsFullCut, parameter[member[.inputSet], member[.root], member[.deps]]]
else begin[{]
None
end[}]
local_variable[type[Deps], cutoffDeps]
return[call[Toposort.toposort, parameter[member[.root], member[.cutoffDeps]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[List] operator[<] identifier[T] operator[>] identifier[toposort] operator[SEP] Keyword[final] identifier[Set] operator[<] identifier[T] operator[>] identifier[inputSet] , identifier[T] identifier[root] , Keyword[final] identifier[Deps] operator[<] identifier[T] operator[>] identifier[deps] , Keyword[boolean] identifier[isFullCut] operator[SEP] {
identifier[checkAreDescendentsOf] operator[SEP] identifier[inputSet] , identifier[root] , identifier[deps] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isFullCut] operator[SEP] {
identifier[checkIsFullCut] operator[SEP] identifier[inputSet] , identifier[root] , identifier[deps] operator[SEP] operator[SEP]
}
identifier[Deps] operator[<] identifier[T] operator[>] identifier[cutoffDeps] operator[=] identifier[getCutoffDeps] operator[SEP] identifier[inputSet] , identifier[deps] operator[SEP] operator[SEP] Keyword[return] identifier[Toposort] operator[SEP] identifier[toposort] operator[SEP] identifier[root] , identifier[cutoffDeps] operator[SEP] operator[SEP]
}
|
public List<ResourceRefType<MessageDrivenBeanType<T>>> getAllResourceRef()
{
List<ResourceRefType<MessageDrivenBeanType<T>>> list = new ArrayList<ResourceRefType<MessageDrivenBeanType<T>>>();
List<Node> nodeList = childNode.get("resource-ref");
for(Node node: nodeList)
{
ResourceRefType<MessageDrivenBeanType<T>> type = new ResourceRefTypeImpl<MessageDrivenBeanType<T>>(this, "resource-ref", childNode, node);
list.add(type);
}
return list;
}
|
class class_name[name] begin[{]
method[getAllResourceRef, return_type[type[List]], modifier[public], parameter[]] begin[{]
local_variable[type[List], list]
local_variable[type[List], nodeList]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="resource-ref"), MemberReference(member=childNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=MessageDrivenBeanType, sub_type=None))], dimensions=None, name=ResourceRefTypeImpl, sub_type=None)), name=type)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=MessageDrivenBeanType, sub_type=None))], dimensions=[], name=ResourceRefType, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=list, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=nodeList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=node)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Node, sub_type=None))), label=None)
return[member[.list]]
end[}]
END[}]
|
Keyword[public] identifier[List] operator[<] identifier[ResourceRefType] operator[<] identifier[MessageDrivenBeanType] operator[<] identifier[T] operator[>] operator[>] operator[>] identifier[getAllResourceRef] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[ResourceRefType] operator[<] identifier[MessageDrivenBeanType] operator[<] identifier[T] operator[>] operator[>] operator[>] identifier[list] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[ResourceRefType] operator[<] identifier[MessageDrivenBeanType] operator[<] identifier[T] operator[>] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Node] operator[>] identifier[nodeList] operator[=] identifier[childNode] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Node] identifier[node] operator[:] identifier[nodeList] operator[SEP] {
identifier[ResourceRefType] operator[<] identifier[MessageDrivenBeanType] operator[<] identifier[T] operator[>] operator[>] identifier[type] operator[=] Keyword[new] identifier[ResourceRefTypeImpl] operator[<] identifier[MessageDrivenBeanType] operator[<] identifier[T] operator[>] operator[>] operator[SEP] Keyword[this] , literal[String] , identifier[childNode] , identifier[node] operator[SEP] operator[SEP] identifier[list] operator[SEP] identifier[add] operator[SEP] identifier[type] operator[SEP] operator[SEP]
}
Keyword[return] identifier[list] operator[SEP]
}
|
public String getNumericName(int i )
{
if(i < getNumNumericalVars() && i >= 0)
return numericalVariableNames.getOrDefault(i, "Numeric Feature " + i);
else
throw new IndexOutOfBoundsException("Can not acces variable for invalid index " + i );
}
|
class class_name[name] begin[{]
method[getNumericName, return_type[type[String]], modifier[public], parameter[i]] begin[{]
if[binary_operation[binary_operation[member[.i], <, call[.getNumNumericalVars, parameter[]]], &&, binary_operation[member[.i], >=, literal[0]]]] begin[{]
return[call[numericalVariableNames.getOrDefault, parameter[member[.i], binary_operation[literal["Numeric Feature "], +, member[.i]]]]]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Can not acces variable for invalid index "), operandr=MemberReference(member=i, 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=IndexOutOfBoundsException, sub_type=None)), label=None)
end[}]
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[getNumericName] operator[SEP] Keyword[int] identifier[i] operator[SEP] {
Keyword[if] operator[SEP] identifier[i] operator[<] identifier[getNumNumericalVars] operator[SEP] operator[SEP] operator[&&] identifier[i] operator[>=] Other[0] operator[SEP] Keyword[return] identifier[numericalVariableNames] operator[SEP] identifier[getOrDefault] operator[SEP] identifier[i] , literal[String] operator[+] identifier[i] operator[SEP] operator[SEP] Keyword[else] Keyword[throw] Keyword[new] identifier[IndexOutOfBoundsException] operator[SEP] literal[String] operator[+] identifier[i] operator[SEP] operator[SEP]
}
|
public Vector<Object> runReference(Vector<Object> referenceParams, String locale)
{
return serviceDelegator.runReference(referenceParams, locale);
}
|
class class_name[name] begin[{]
method[runReference, return_type[type[Vector]], modifier[public], parameter[referenceParams, locale]] begin[{]
return[call[serviceDelegator.runReference, parameter[member[.referenceParams], member[.locale]]]]
end[}]
END[}]
|
Keyword[public] identifier[Vector] operator[<] identifier[Object] operator[>] identifier[runReference] operator[SEP] identifier[Vector] operator[<] identifier[Object] operator[>] identifier[referenceParams] , identifier[String] identifier[locale] operator[SEP] {
Keyword[return] identifier[serviceDelegator] operator[SEP] identifier[runReference] operator[SEP] identifier[referenceParams] , identifier[locale] operator[SEP] operator[SEP]
}
|
@SuppressWarnings("deprecation")
public Date toDate() {
int dom = getDayOfMonth();
Date date = new Date(getYear() - 1900, getMonthOfYear() - 1, dom,
getHourOfDay(), getMinuteOfHour(), getSecondOfMinute());
date.setTime(date.getTime() + getMillisOfSecond());
return correctDstTransition(date, TimeZone.getDefault());
}
|
class class_name[name] begin[{]
method[toDate, return_type[type[Date]], modifier[public], parameter[]] begin[{]
local_variable[type[int], dom]
local_variable[type[Date], date]
call[date.setTime, parameter[binary_operation[call[date.getTime, parameter[]], +, call[.getMillisOfSecond, parameter[]]]]]
return[call[.correctDstTransition, parameter[member[.date], call[TimeZone.getDefault, parameter[]]]]]
end[}]
END[}]
|
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] identifier[Date] identifier[toDate] operator[SEP] operator[SEP] {
Keyword[int] identifier[dom] operator[=] identifier[getDayOfMonth] operator[SEP] operator[SEP] operator[SEP] identifier[Date] identifier[date] operator[=] Keyword[new] identifier[Date] operator[SEP] identifier[getYear] operator[SEP] operator[SEP] operator[-] Other[1900] , identifier[getMonthOfYear] operator[SEP] operator[SEP] operator[-] Other[1] , identifier[dom] , identifier[getHourOfDay] operator[SEP] operator[SEP] , identifier[getMinuteOfHour] operator[SEP] operator[SEP] , identifier[getSecondOfMinute] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[date] operator[SEP] identifier[setTime] operator[SEP] identifier[date] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] operator[+] identifier[getMillisOfSecond] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[correctDstTransition] operator[SEP] identifier[date] , identifier[TimeZone] operator[SEP] identifier[getDefault] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Benchmark
@BenchmarkMode(Mode.Throughput)
public void discard(final LifeCycle lifeCycle) {
lifeCycle.logger.log(java.util.logging.Level.CONFIG, "Hello {}!", MAGIC_NUMBER);
}
|
class class_name[name] begin[{]
method[discard, return_type[void], modifier[public], parameter[lifeCycle]] begin[{]
call[lifeCycle.logger.log, parameter[member[java.util.logging.Level.CONFIG], literal["Hello {}!"], member[.MAGIC_NUMBER]]]
end[}]
END[}]
|
annotation[@] identifier[Benchmark] annotation[@] identifier[BenchmarkMode] operator[SEP] identifier[Mode] operator[SEP] identifier[Throughput] operator[SEP] Keyword[public] Keyword[void] identifier[discard] operator[SEP] Keyword[final] identifier[LifeCycle] identifier[lifeCycle] operator[SEP] {
identifier[lifeCycle] operator[SEP] identifier[logger] operator[SEP] identifier[log] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[logging] operator[SEP] identifier[Level] operator[SEP] identifier[CONFIG] , literal[String] , identifier[MAGIC_NUMBER] operator[SEP] operator[SEP]
}
|
@Override
public <B> IdentityT<M, B> flatMap(Function<? super A, ? extends Monad<B, MonadT<M, Identity<?>, ?>>> f) {
return identityT(mia.flatMap(identityA -> f.apply(identityA.runIdentity()).<IdentityT<M, B>>coerce().run()));
}
|
class class_name[name] begin[{]
method[flatMap, return_type[type[IdentityT]], modifier[public], parameter[f]] begin[{]
return[call[.identityT, parameter[call[mia.flatMap, parameter[LambdaExpression(body=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=runIdentity, postfix_operators=[], prefix_operators=[], qualifier=identityA, selectors=[], type_arguments=None)], member=apply, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[MethodInvocation(arguments=[], member=coerce, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=M, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=B, sub_type=None))], dimensions=[], name=IdentityT, sub_type=None))]), MethodInvocation(arguments=[], member=run, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), parameters=[MemberReference(member=identityA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] operator[<] identifier[B] operator[>] identifier[IdentityT] operator[<] identifier[M] , identifier[B] operator[>] identifier[flatMap] operator[SEP] identifier[Function] operator[<] operator[?] Keyword[super] identifier[A] , operator[?] Keyword[extends] identifier[Monad] operator[<] identifier[B] , identifier[MonadT] operator[<] identifier[M] , identifier[Identity] operator[<] operator[?] operator[>] , operator[?] operator[>] operator[>] operator[>] identifier[f] operator[SEP] {
Keyword[return] identifier[identityT] operator[SEP] identifier[mia] operator[SEP] identifier[flatMap] operator[SEP] identifier[identityA] operator[->] identifier[f] operator[SEP] identifier[apply] operator[SEP] identifier[identityA] operator[SEP] identifier[runIdentity] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[<] identifier[IdentityT] operator[<] identifier[M] , identifier[B] operator[>] operator[>] identifier[coerce] operator[SEP] operator[SEP] operator[SEP] identifier[run] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public boolean execute() {
try {
coroutine.run(continuation);
continuation.successExecutionCycle();
} catch (Exception e) {
continuation.failedExecutionCycle();
throw new CoroutineException("Exception thrown during execution", e);
}
// if mode was not set to SAVING after return, it means the method finished executing
if (continuation.getMode() != Continuation.MODE_SAVING) {
continuation.reset(); // clear methodstates + set to normal
return false;
} else {
continuation.setMode(Continuation.MODE_LOADING); // set to loading for next invokation
return true;
}
}
|
class class_name[name] begin[{]
method[execute, return_type[type[boolean]], modifier[public], parameter[]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=continuation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=run, postfix_operators=[], prefix_operators=[], qualifier=coroutine, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=successExecutionCycle, postfix_operators=[], prefix_operators=[], qualifier=continuation, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=failedExecutionCycle, postfix_operators=[], prefix_operators=[], qualifier=continuation, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Exception thrown during execution"), 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=CoroutineException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
if[binary_operation[call[continuation.getMode, parameter[]], !=, member[Continuation.MODE_SAVING]]] begin[{]
call[continuation.reset, parameter[]]
return[literal[false]]
else begin[{]
call[continuation.setMode, parameter[member[Continuation.MODE_LOADING]]]
return[literal[true]]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[execute] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[coroutine] operator[SEP] identifier[run] operator[SEP] identifier[continuation] operator[SEP] operator[SEP] identifier[continuation] operator[SEP] identifier[successExecutionCycle] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[continuation] operator[SEP] identifier[failedExecutionCycle] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[CoroutineException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[continuation] operator[SEP] identifier[getMode] operator[SEP] operator[SEP] operator[!=] identifier[Continuation] operator[SEP] identifier[MODE_SAVING] operator[SEP] {
identifier[continuation] operator[SEP] identifier[reset] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] {
identifier[continuation] operator[SEP] identifier[setMode] operator[SEP] identifier[Continuation] operator[SEP] identifier[MODE_LOADING] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
}
|
public final <U3> Tuple3<T1, T2, U3> map3(Function<? super T3, ? extends U3> function) {
return Tuple.tuple(v1, v2, function.apply(v3));
}
|
class class_name[name] begin[{]
method[map3, return_type[type[Tuple3]], modifier[final public], parameter[function]] begin[{]
return[call[Tuple.tuple, parameter[member[.v1], member[.v2], call[function.apply, parameter[member[.v3]]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[final] operator[<] identifier[U3] operator[>] identifier[Tuple3] operator[<] identifier[T1] , identifier[T2] , identifier[U3] operator[>] identifier[map3] operator[SEP] identifier[Function] operator[<] operator[?] Keyword[super] identifier[T3] , operator[?] Keyword[extends] identifier[U3] operator[>] identifier[function] operator[SEP] {
Keyword[return] identifier[Tuple] operator[SEP] identifier[tuple] operator[SEP] identifier[v1] , identifier[v2] , identifier[function] operator[SEP] identifier[apply] operator[SEP] identifier[v3] operator[SEP] operator[SEP] operator[SEP]
}
|
public static String orderRefundQuery(boolean isSandbox, Map<String, String> params) {
if (isSandbox)
return doPost(REFUNDQUERY_SANDBOXNEW_URL, params);
return doPost(REFUNDQUERY_URL, params);
}
|
class class_name[name] begin[{]
method[orderRefundQuery, return_type[type[String]], modifier[public static], parameter[isSandbox, params]] begin[{]
if[member[.isSandbox]] begin[{]
return[call[.doPost, parameter[member[.REFUNDQUERY_SANDBOXNEW_URL], member[.params]]]]
else begin[{]
None
end[}]
return[call[.doPost, parameter[member[.REFUNDQUERY_URL], member[.params]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[orderRefundQuery] operator[SEP] Keyword[boolean] identifier[isSandbox] , identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[params] operator[SEP] {
Keyword[if] operator[SEP] identifier[isSandbox] operator[SEP] Keyword[return] identifier[doPost] operator[SEP] identifier[REFUNDQUERY_SANDBOXNEW_URL] , identifier[params] operator[SEP] operator[SEP] Keyword[return] identifier[doPost] operator[SEP] identifier[REFUNDQUERY_URL] , identifier[params] operator[SEP] operator[SEP]
}
|
public final void push(String s)
{
if ((m_firstFree + 1) >= m_mapSize)
{
m_mapSize += m_blocksize;
String newMap[] = new String[m_mapSize];
System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1);
m_map = newMap;
}
m_map[m_firstFree] = s;
m_firstFree++;
}
|
class class_name[name] begin[{]
method[push, return_type[void], modifier[final public], parameter[s]] begin[{]
if[binary_operation[binary_operation[member[.m_firstFree], +, literal[1]], >=, member[.m_mapSize]]] begin[{]
assign[member[.m_mapSize], member[.m_blocksize]]
local_variable[type[String], newMap]
call[System.arraycopy, parameter[member[.m_map], literal[0], member[.newMap], literal[0], binary_operation[member[.m_firstFree], +, literal[1]]]]
assign[member[.m_map], member[.newMap]]
else begin[{]
None
end[}]
assign[member[.m_map], member[.s]]
member[.m_firstFree]
end[}]
END[}]
|
Keyword[public] Keyword[final] Keyword[void] identifier[push] operator[SEP] identifier[String] identifier[s] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[m_firstFree] operator[+] Other[1] operator[SEP] operator[>=] identifier[m_mapSize] operator[SEP] {
identifier[m_mapSize] operator[+=] identifier[m_blocksize] operator[SEP] identifier[String] identifier[newMap] operator[SEP] operator[SEP] operator[=] Keyword[new] identifier[String] operator[SEP] identifier[m_mapSize] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[m_map] , Other[0] , identifier[newMap] , Other[0] , identifier[m_firstFree] operator[+] Other[1] operator[SEP] operator[SEP] identifier[m_map] operator[=] identifier[newMap] operator[SEP]
}
identifier[m_map] operator[SEP] identifier[m_firstFree] operator[SEP] operator[=] identifier[s] operator[SEP] identifier[m_firstFree] operator[++] operator[SEP]
}
|
public static BeanId create(final String instanceId, final String schemaName) {
if (instanceId == null || "".equals(instanceId)) {
throw CFG107_MISSING_ID();
}
return new BeanId(instanceId, schemaName);
}
|
class class_name[name] begin[{]
method[create, return_type[type[BeanId]], modifier[public static], parameter[instanceId, schemaName]] begin[{]
if[binary_operation[binary_operation[member[.instanceId], ==, literal[null]], ||, literal[""]]] begin[{]
ThrowStatement(expression=MethodInvocation(arguments=[], member=CFG107_MISSING_ID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MemberReference(member=instanceId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=schemaName, 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=BeanId, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[BeanId] identifier[create] operator[SEP] Keyword[final] identifier[String] identifier[instanceId] , Keyword[final] identifier[String] identifier[schemaName] operator[SEP] {
Keyword[if] operator[SEP] identifier[instanceId] operator[==] Other[null] operator[||] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[instanceId] operator[SEP] operator[SEP] {
Keyword[throw] identifier[CFG107_MISSING_ID] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[BeanId] operator[SEP] identifier[instanceId] , identifier[schemaName] operator[SEP] operator[SEP]
}
|
@Override
public boolean verify(byte[] data, Key key) throws AuditSigningException {
if (signature != null) {
try {
signature.initVerify((PublicKey) key);
signature.update(data);
if (tc.isEntryEnabled())
Tr.exit(tc, "verify");
return signature.verify(sigBytes);
} catch (Exception ex) {
throw new AuditSigningException(ex);
}
} else {
String msg = "Signature is null. Cannot verify data.";
throw new AuditSigningException(msg);
}
}
|
class class_name[name] begin[{]
method[verify, return_type[type[boolean]], modifier[public], parameter[data, key]] begin[{]
if[binary_operation[member[.signature], !=, literal[null]]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=PublicKey, sub_type=None))], member=initVerify, postfix_operators=[], prefix_operators=[], qualifier=signature, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=update, postfix_operators=[], prefix_operators=[], qualifier=signature, selectors=[], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=isEntryEnabled, postfix_operators=[], prefix_operators=[], qualifier=tc, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="verify")], member=exit, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None), label=None)), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=sigBytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=verify, postfix_operators=[], prefix_operators=[], qualifier=signature, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[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=AuditSigningException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Exception']))], finally_block=None, label=None, resources=None)
else begin[{]
local_variable[type[String], msg]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=msg, 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=AuditSigningException, sub_type=None)), label=None)
end[}]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[verify] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[data] , identifier[Key] identifier[key] operator[SEP] Keyword[throws] identifier[AuditSigningException] {
Keyword[if] operator[SEP] identifier[signature] operator[!=] Other[null] operator[SEP] {
Keyword[try] {
identifier[signature] operator[SEP] identifier[initVerify] operator[SEP] operator[SEP] identifier[PublicKey] operator[SEP] identifier[key] operator[SEP] operator[SEP] identifier[signature] operator[SEP] identifier[update] operator[SEP] identifier[data] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[signature] operator[SEP] identifier[verify] operator[SEP] identifier[sigBytes] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ex] operator[SEP] {
Keyword[throw] Keyword[new] identifier[AuditSigningException] operator[SEP] identifier[ex] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[String] identifier[msg] operator[=] literal[String] operator[SEP] Keyword[throw] Keyword[new] identifier[AuditSigningException] operator[SEP] identifier[msg] operator[SEP] operator[SEP]
}
}
|
private E unlinkFirst(Node<E> f) {
// assert f == first && f != null;
final E element = f.item;
final Node<E> next = f.next;
f.item = null;
f.next = null; // help GC
first = next;
if (next == null)
last = null;
else
next.prev = null;
size--;
modCount++;
return element;
}
|
class class_name[name] begin[{]
method[unlinkFirst, return_type[type[E]], modifier[private], parameter[f]] begin[{]
local_variable[type[E], element]
local_variable[type[Node], next]
assign[member[f.item], literal[null]]
assign[member[f.next], literal[null]]
assign[member[.first], member[.next]]
if[binary_operation[member[.next], ==, literal[null]]] begin[{]
assign[member[.last], literal[null]]
else begin[{]
assign[member[next.prev], literal[null]]
end[}]
member[.size]
member[.modCount]
return[member[.element]]
end[}]
END[}]
|
Keyword[private] identifier[E] identifier[unlinkFirst] operator[SEP] identifier[Node] operator[<] identifier[E] operator[>] identifier[f] operator[SEP] {
Keyword[final] identifier[E] identifier[element] operator[=] identifier[f] operator[SEP] identifier[item] operator[SEP] Keyword[final] identifier[Node] operator[<] identifier[E] operator[>] identifier[next] operator[=] identifier[f] operator[SEP] identifier[next] operator[SEP] identifier[f] operator[SEP] identifier[item] operator[=] Other[null] operator[SEP] identifier[f] operator[SEP] identifier[next] operator[=] Other[null] operator[SEP] identifier[first] operator[=] identifier[next] operator[SEP] Keyword[if] operator[SEP] identifier[next] operator[==] Other[null] operator[SEP] identifier[last] operator[=] Other[null] operator[SEP] Keyword[else] identifier[next] operator[SEP] identifier[prev] operator[=] Other[null] operator[SEP] identifier[size] operator[--] operator[SEP] identifier[modCount] operator[++] operator[SEP] Keyword[return] identifier[element] operator[SEP]
}
|
public static int getContentLength(HttpMessage message, int defaultValue) {
return (int) Math.min(Integer.MAX_VALUE, getContentLength(message, (long) defaultValue));
}
|
class class_name[name] begin[{]
method[getContentLength, return_type[type[int]], modifier[public static], parameter[message, defaultValue]] begin[{]
return[Cast(expression=MethodInvocation(arguments=[MemberReference(member=MAX_VALUE, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[]), MethodInvocation(arguments=[MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Cast(expression=MemberReference(member=defaultValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=long))], member=getContentLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=min, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=int))]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[int] identifier[getContentLength] operator[SEP] identifier[HttpMessage] identifier[message] , Keyword[int] identifier[defaultValue] operator[SEP] {
Keyword[return] operator[SEP] Keyword[int] operator[SEP] identifier[Math] operator[SEP] identifier[min] operator[SEP] identifier[Integer] operator[SEP] identifier[MAX_VALUE] , identifier[getContentLength] operator[SEP] identifier[message] , operator[SEP] Keyword[long] operator[SEP] identifier[defaultValue] operator[SEP] operator[SEP] operator[SEP]
}
|
protected <N extends Page & Externalizable> PageFile<N> makePageFile(Class<N> cls) {
@SuppressWarnings("unchecked")
final PageFileFactory<N> castFactory = (PageFileFactory<N>) pageFileFactory;
return castFactory.newPageFile(cls);
}
|
class class_name[name] begin[{]
method[makePageFile, return_type[type[PageFile]], modifier[protected], parameter[cls]] begin[{]
local_variable[type[PageFileFactory], castFactory]
return[call[castFactory.newPageFile, parameter[member[.cls]]]]
end[}]
END[}]
|
Keyword[protected] operator[<] identifier[N] Keyword[extends] identifier[Page] operator[&] identifier[Externalizable] operator[>] identifier[PageFile] operator[<] identifier[N] operator[>] identifier[makePageFile] operator[SEP] identifier[Class] operator[<] identifier[N] operator[>] identifier[cls] operator[SEP] {
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[final] identifier[PageFileFactory] operator[<] identifier[N] operator[>] identifier[castFactory] operator[=] operator[SEP] identifier[PageFileFactory] operator[<] identifier[N] operator[>] operator[SEP] identifier[pageFileFactory] operator[SEP] Keyword[return] identifier[castFactory] operator[SEP] identifier[newPageFile] operator[SEP] identifier[cls] operator[SEP] operator[SEP]
}
|
public String get(Property<String> property) throws ConfigurationException {
return tryGet(property, s -> s);
}
|
class class_name[name] begin[{]
method[get, return_type[type[String]], modifier[public], parameter[property]] begin[{]
return[call[.tryGet, parameter[member[.property], LambdaExpression(body=MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), parameters=[MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]]
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[get] operator[SEP] identifier[Property] operator[<] identifier[String] operator[>] identifier[property] operator[SEP] Keyword[throws] identifier[ConfigurationException] {
Keyword[return] identifier[tryGet] operator[SEP] identifier[property] , identifier[s] operator[->] identifier[s] operator[SEP] operator[SEP]
}
|
public Coordinate[] getCoordinates() {
if (isEmpty()) {
return null;
}
Coordinate[] coordinates = new Coordinate[getNumPoints()];
int count = 0;
for (LineString lineString : lineStrings) {
for (int j = 0; j < lineString.getNumPoints(); j++) {
coordinates[count++] = lineString.getCoordinateN(j);
}
}
return coordinates;
}
|
class class_name[name] begin[{]
method[getCoordinates, return_type[type[Coordinate]], modifier[public], parameter[]] begin[{]
if[call[.isEmpty, parameter[]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[Coordinate], coordinates]
local_variable[type[int], count]
ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=coordinates, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=count, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getCoordinateN, postfix_operators=[], prefix_operators=[], qualifier=lineString, selectors=[], type_arguments=None)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getNumPoints, postfix_operators=[], prefix_operators=[], qualifier=lineString, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=j, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=lineStrings, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=lineString)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=LineString, sub_type=None))), label=None)
return[member[.coordinates]]
end[}]
END[}]
|
Keyword[public] identifier[Coordinate] operator[SEP] operator[SEP] identifier[getCoordinates] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[Coordinate] operator[SEP] operator[SEP] identifier[coordinates] operator[=] Keyword[new] identifier[Coordinate] operator[SEP] identifier[getNumPoints] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[count] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[LineString] identifier[lineString] operator[:] identifier[lineStrings] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] Other[0] operator[SEP] identifier[j] operator[<] identifier[lineString] operator[SEP] identifier[getNumPoints] operator[SEP] operator[SEP] operator[SEP] identifier[j] operator[++] operator[SEP] {
identifier[coordinates] operator[SEP] identifier[count] operator[++] operator[SEP] operator[=] identifier[lineString] operator[SEP] identifier[getCoordinateN] operator[SEP] identifier[j] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[coordinates] operator[SEP]
}
|
public Observable<UserInner> createOrUpdateAsync(String resourceGroupName, String labAccountName, String labName, String userName, UserInner user) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, labAccountName, labName, userName, user).map(new Func1<ServiceResponse<UserInner>, UserInner>() {
@Override
public UserInner call(ServiceResponse<UserInner> response) {
return response.body();
}
});
}
|
class class_name[name] begin[{]
method[createOrUpdateAsync, return_type[type[Observable]], modifier[public], parameter[resourceGroupName, labAccountName, labName, userName, user]] begin[{]
return[call[.createOrUpdateWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.labAccountName], member[.labName], member[.userName], member[.user]]]]
end[}]
END[}]
|
Keyword[public] identifier[Observable] operator[<] identifier[UserInner] operator[>] identifier[createOrUpdateAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[labAccountName] , identifier[String] identifier[labName] , identifier[String] identifier[userName] , identifier[UserInner] identifier[user] operator[SEP] {
Keyword[return] identifier[createOrUpdateWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[labAccountName] , identifier[labName] , identifier[userName] , identifier[user] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[ServiceResponse] operator[<] identifier[UserInner] operator[>] , identifier[UserInner] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[UserInner] identifier[call] operator[SEP] identifier[ServiceResponse] operator[<] identifier[UserInner] operator[>] identifier[response] operator[SEP] {
Keyword[return] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
private static void addFileFunction(CtClass clazz, String property)
throws NotFoundException, CannotCompileException {
String wrapperName = property + "wrapper";
String funcName = "set";
funcName = funcName + Character.toUpperCase(wrapperName.charAt(0));
funcName = funcName + wrapperName.substring(1);
String setterName = "set";
setterName = setterName + Character.toUpperCase(property.charAt(0));
setterName = setterName + property.substring(1);
CtClass[] params = generateClassField(FileWrapper.class);
CtMethod newFunc = new CtMethod(CtClass.voidType, funcName, params, clazz);
newFunc.setBody("{ " + setterName + "($1.returnFile());\n }");
clazz.addMethod(newFunc);
}
|
class class_name[name] begin[{]
method[addFileFunction, return_type[void], modifier[private static], parameter[clazz, property]] begin[{]
local_variable[type[String], wrapperName]
local_variable[type[String], funcName]
assign[member[.funcName], binary_operation[member[.funcName], +, call[Character.toUpperCase, parameter[call[wrapperName.charAt, parameter[literal[0]]]]]]]
assign[member[.funcName], binary_operation[member[.funcName], +, call[wrapperName.substring, parameter[literal[1]]]]]
local_variable[type[String], setterName]
assign[member[.setterName], binary_operation[member[.setterName], +, call[Character.toUpperCase, parameter[call[property.charAt, parameter[literal[0]]]]]]]
assign[member[.setterName], binary_operation[member[.setterName], +, call[property.substring, parameter[literal[1]]]]]
local_variable[type[CtClass], params]
local_variable[type[CtMethod], newFunc]
call[newFunc.setBody, parameter[binary_operation[binary_operation[literal["{ "], +, member[.setterName]], +, literal["($1.returnFile());\n }"]]]]
call[clazz.addMethod, parameter[member[.newFunc]]]
end[}]
END[}]
|
Keyword[private] Keyword[static] Keyword[void] identifier[addFileFunction] operator[SEP] identifier[CtClass] identifier[clazz] , identifier[String] identifier[property] operator[SEP] Keyword[throws] identifier[NotFoundException] , identifier[CannotCompileException] {
identifier[String] identifier[wrapperName] operator[=] identifier[property] operator[+] literal[String] operator[SEP] identifier[String] identifier[funcName] operator[=] literal[String] operator[SEP] identifier[funcName] operator[=] identifier[funcName] operator[+] identifier[Character] operator[SEP] identifier[toUpperCase] operator[SEP] identifier[wrapperName] operator[SEP] identifier[charAt] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] identifier[funcName] operator[=] identifier[funcName] operator[+] identifier[wrapperName] operator[SEP] identifier[substring] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[String] identifier[setterName] operator[=] literal[String] operator[SEP] identifier[setterName] operator[=] identifier[setterName] operator[+] identifier[Character] operator[SEP] identifier[toUpperCase] operator[SEP] identifier[property] operator[SEP] identifier[charAt] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] identifier[setterName] operator[=] identifier[setterName] operator[+] identifier[property] operator[SEP] identifier[substring] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[CtClass] operator[SEP] operator[SEP] identifier[params] operator[=] identifier[generateClassField] operator[SEP] identifier[FileWrapper] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[CtMethod] identifier[newFunc] operator[=] Keyword[new] identifier[CtMethod] operator[SEP] identifier[CtClass] operator[SEP] identifier[voidType] , identifier[funcName] , identifier[params] , identifier[clazz] operator[SEP] operator[SEP] identifier[newFunc] operator[SEP] identifier[setBody] operator[SEP] literal[String] operator[+] identifier[setterName] operator[+] literal[String] operator[SEP] operator[SEP] identifier[clazz] operator[SEP] identifier[addMethod] operator[SEP] identifier[newFunc] operator[SEP] operator[SEP]
}
|
public double[] getMoneynessAsOffsets() {
DoubleStream moneyness = getGridNodesPerMoneyness().keySet().stream().mapToDouble(Integer::doubleValue);
if(quotingConvention == QuotingConvention.PAYERVOLATILITYLOGNORMAL) {
moneyness = moneyness.map(new DoubleUnaryOperator() {
@Override
public double applyAsDouble(double x) {
return x * 0.01;
}
});
} else if(quotingConvention == QuotingConvention.RECEIVERPRICE) {
moneyness = moneyness.map(new DoubleUnaryOperator() {
@Override
public double applyAsDouble(double x) {
return - x * 0.0001;
}
});
} else {
moneyness = moneyness.map(new DoubleUnaryOperator() {
@Override
public double applyAsDouble(double x) {
return x * 0.0001;
}
});
}
return moneyness.toArray();
}
|
class class_name[name] begin[{]
method[getMoneynessAsOffsets, return_type[type[double]], modifier[public], parameter[]] begin[{]
local_variable[type[DoubleStream], moneyness]
if[binary_operation[member[.quotingConvention], ==, member[QuotingConvention.PAYERVOLATILITYLOGNORMAL]]] begin[{]
assign[member[.moneyness], call[moneyness.map, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0.01), operator=*), label=None)], documentation=None, modifiers={'public'}, name=applyAsDouble, parameters=[FormalParameter(annotations=[], modifiers=set(), name=x, type=BasicType(dimensions=[], name=double), varargs=False)], return_type=BasicType(dimensions=[], name=double), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DoubleUnaryOperator, sub_type=None))]]]
else begin[{]
if[binary_operation[member[.quotingConvention], ==, member[QuotingConvention.RECEIVERPRICE]]] begin[{]
assign[member[.moneyness], call[moneyness.map, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=['-'], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0.0001), operator=*), label=None)], documentation=None, modifiers={'public'}, name=applyAsDouble, parameters=[FormalParameter(annotations=[], modifiers=set(), name=x, type=BasicType(dimensions=[], name=double), varargs=False)], return_type=BasicType(dimensions=[], name=double), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DoubleUnaryOperator, sub_type=None))]]]
else begin[{]
assign[member[.moneyness], call[moneyness.map, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0.0001), operator=*), label=None)], documentation=None, modifiers={'public'}, name=applyAsDouble, parameters=[FormalParameter(annotations=[], modifiers=set(), name=x, type=BasicType(dimensions=[], name=double), varargs=False)], return_type=BasicType(dimensions=[], name=double), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DoubleUnaryOperator, sub_type=None))]]]
end[}]
end[}]
return[call[moneyness.toArray, parameter[]]]
end[}]
END[}]
|
Keyword[public] Keyword[double] operator[SEP] operator[SEP] identifier[getMoneynessAsOffsets] operator[SEP] operator[SEP] {
identifier[DoubleStream] identifier[moneyness] operator[=] identifier[getGridNodesPerMoneyness] operator[SEP] operator[SEP] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[mapToDouble] operator[SEP] identifier[Integer] operator[::] identifier[doubleValue] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[quotingConvention] operator[==] identifier[QuotingConvention] operator[SEP] identifier[PAYERVOLATILITYLOGNORMAL] operator[SEP] {
identifier[moneyness] operator[=] identifier[moneyness] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[DoubleUnaryOperator] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[double] identifier[applyAsDouble] operator[SEP] Keyword[double] identifier[x] operator[SEP] {
Keyword[return] identifier[x] operator[*] literal[Float] operator[SEP]
}
} operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[quotingConvention] operator[==] identifier[QuotingConvention] operator[SEP] identifier[RECEIVERPRICE] operator[SEP] {
identifier[moneyness] operator[=] identifier[moneyness] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[DoubleUnaryOperator] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[double] identifier[applyAsDouble] operator[SEP] Keyword[double] identifier[x] operator[SEP] {
Keyword[return] operator[-] identifier[x] operator[*] literal[Float] operator[SEP]
}
} operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[moneyness] operator[=] identifier[moneyness] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[DoubleUnaryOperator] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[double] identifier[applyAsDouble] operator[SEP] Keyword[double] identifier[x] operator[SEP] {
Keyword[return] identifier[x] operator[*] literal[Float] operator[SEP]
}
} operator[SEP] operator[SEP]
}
Keyword[return] identifier[moneyness] operator[SEP] identifier[toArray] operator[SEP] operator[SEP] operator[SEP]
}
|
public Criteria subsetof(Collection<?> c) {
notNull(c, "collection can not be null");
this.criteriaType = RelationalOperator.SUBSETOF;
this.right = new ValueListNode(c);
return this;
}
|
class class_name[name] begin[{]
method[subsetof, return_type[type[Criteria]], modifier[public], parameter[c]] begin[{]
call[.notNull, parameter[member[.c], literal["collection can not be null"]]]
assign[THIS[member[None.criteriaType]], member[RelationalOperator.SUBSETOF]]
assign[THIS[member[None.right]], ClassCreator(arguments=[MemberReference(member=c, 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=ValueListNode, sub_type=None))]
return[THIS[]]
end[}]
END[}]
|
Keyword[public] identifier[Criteria] identifier[subsetof] operator[SEP] identifier[Collection] operator[<] operator[?] operator[>] identifier[c] operator[SEP] {
identifier[notNull] operator[SEP] identifier[c] , literal[String] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[criteriaType] operator[=] identifier[RelationalOperator] operator[SEP] identifier[SUBSETOF] operator[SEP] Keyword[this] operator[SEP] identifier[right] operator[=] Keyword[new] identifier[ValueListNode] operator[SEP] identifier[c] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public ServiceFuture<List<HubVirtualNetworkConnectionInner>> listAsync(final String resourceGroupName, final String virtualHubName, final ListOperationCallback<HubVirtualNetworkConnectionInner> serviceCallback) {
return AzureServiceFuture.fromPageResponse(
listSinglePageAsync(resourceGroupName, virtualHubName),
new Func1<String, Observable<ServiceResponse<Page<HubVirtualNetworkConnectionInner>>>>() {
@Override
public Observable<ServiceResponse<Page<HubVirtualNetworkConnectionInner>>> call(String nextPageLink) {
return listNextSinglePageAsync(nextPageLink);
}
},
serviceCallback);
}
|
class class_name[name] begin[{]
method[listAsync, return_type[type[ServiceFuture]], modifier[public], parameter[resourceGroupName, virtualHubName, serviceCallback]] begin[{]
return[call[AzureServiceFuture.fromPageResponse, parameter[call[.listSinglePageAsync, parameter[member[.resourceGroupName], member[.virtualHubName]]], 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=listNextSinglePageAsync, 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=HubVirtualNetworkConnectionInner, 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=HubVirtualNetworkConnectionInner, 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[HubVirtualNetworkConnectionInner] operator[>] operator[>] identifier[listAsync] operator[SEP] Keyword[final] identifier[String] identifier[resourceGroupName] , Keyword[final] identifier[String] identifier[virtualHubName] , Keyword[final] identifier[ListOperationCallback] operator[<] identifier[HubVirtualNetworkConnectionInner] operator[>] identifier[serviceCallback] operator[SEP] {
Keyword[return] identifier[AzureServiceFuture] operator[SEP] identifier[fromPageResponse] operator[SEP] identifier[listSinglePageAsync] operator[SEP] identifier[resourceGroupName] , identifier[virtualHubName] operator[SEP] , Keyword[new] identifier[Func1] operator[<] identifier[String] , identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[HubVirtualNetworkConnectionInner] operator[>] operator[>] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[HubVirtualNetworkConnectionInner] operator[>] operator[>] operator[>] identifier[call] operator[SEP] identifier[String] identifier[nextPageLink] operator[SEP] {
Keyword[return] identifier[listNextSinglePageAsync] operator[SEP] identifier[nextPageLink] operator[SEP] operator[SEP]
}
} , identifier[serviceCallback] operator[SEP] operator[SEP]
}
|
public OutputStream asOutputStream() {
OutputStream out = new OutputStream() {
@Override
public final void write(int b) {
sendData(new byte[] { (byte) b });
}
@Override
public final void write(byte[] b) {
write(b, 0, b.length);
}
@Override
public final void write(byte[] b, int off, int len) {
byte[] copy = new byte[len];
System.arraycopy(b, 0, copy, 0, len);
sendData(copy);
}
@Override
public final void flush() {
// Do nothing
}
@Override
public final void close() {
sendClose();
}
};
// Bufferless/direct output
if (packetSize < 2) {
return out;
}
// Buffered output
return new BufferedOutputStream(out, packetSize);
}
|
class class_name[name] begin[{]
method[asOutputStream, return_type[type[OutputStream]], modifier[public], parameter[]] begin[{]
local_variable[type[OutputStream], out]
if[binary_operation[member[.packetSize], <, literal[2]]] begin[{]
return[member[.out]]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=packetSize, 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=BufferedOutputStream, sub_type=None))]
end[}]
END[}]
|
Keyword[public] identifier[OutputStream] identifier[asOutputStream] operator[SEP] operator[SEP] {
identifier[OutputStream] identifier[out] operator[=] Keyword[new] identifier[OutputStream] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[final] Keyword[void] identifier[write] operator[SEP] Keyword[int] identifier[b] operator[SEP] {
identifier[sendData] operator[SEP] Keyword[new] Keyword[byte] operator[SEP] operator[SEP] {
operator[SEP] Keyword[byte] operator[SEP] identifier[b]
} operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[final] Keyword[void] identifier[write] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[b] operator[SEP] {
identifier[write] operator[SEP] identifier[b] , Other[0] , identifier[b] operator[SEP] identifier[length] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[final] Keyword[void] identifier[write] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[b] , Keyword[int] identifier[off] , Keyword[int] identifier[len] operator[SEP] {
Keyword[byte] operator[SEP] operator[SEP] identifier[copy] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[len] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[b] , Other[0] , identifier[copy] , Other[0] , identifier[len] operator[SEP] operator[SEP] identifier[sendData] operator[SEP] identifier[copy] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[final] Keyword[void] identifier[flush] operator[SEP] operator[SEP] {
} annotation[@] identifier[Override] Keyword[public] Keyword[final] Keyword[void] identifier[close] operator[SEP] operator[SEP] {
identifier[sendClose] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] Keyword[if] operator[SEP] identifier[packetSize] operator[<] Other[2] operator[SEP] {
Keyword[return] identifier[out] operator[SEP]
}
Keyword[return] Keyword[new] identifier[BufferedOutputStream] operator[SEP] identifier[out] , identifier[packetSize] operator[SEP] operator[SEP]
}
|
private List<Segment> getCompactableSegments(SegmentManager manager) {
List<Segment> segments = new ArrayList<>(manager.segments().size());
Iterator<Segment> iterator = manager.segments().iterator();
Segment segment = iterator.next();
while (iterator.hasNext()) {
Segment nextSegment = iterator.next();
// Segments that have already been compacted are eligible for compaction. For uncompacted segments, the segment must be full, consist
// of entries less than the minorIndex, and a later segment with at least one committed entry must exist in the log. This ensures that
// a non-empty entry always remains at the end of the log.
if (segment.isCompacted() || (segment.isFull() && segment.lastIndex() < compactor.minorIndex() && nextSegment.firstIndex() <= manager.commitIndex() && !nextSegment.isEmpty())) {
segments.add(segment);
} else {
break;
}
segment = nextSegment;
}
return segments;
}
|
class class_name[name] begin[{]
method[getCompactableSegments, return_type[type[List]], modifier[private], parameter[manager]] begin[{]
local_variable[type[List], segments]
local_variable[type[Iterator], iterator]
local_variable[type[Segment], segment]
while[call[iterator.hasNext, parameter[]]] begin[{]
local_variable[type[Segment], nextSegment]
if[binary_operation[call[segment.isCompacted, parameter[]], ||, binary_operation[binary_operation[binary_operation[call[segment.isFull, parameter[]], &&, binary_operation[call[segment.lastIndex, parameter[]], <, call[compactor.minorIndex, parameter[]]]], &&, binary_operation[call[nextSegment.firstIndex, parameter[]], <=, call[manager.commitIndex, parameter[]]]], &&, call[nextSegment.isEmpty, parameter[]]]]] begin[{]
call[segments.add, parameter[member[.segment]]]
else begin[{]
BreakStatement(goto=None, label=None)
end[}]
assign[member[.segment], member[.nextSegment]]
end[}]
return[member[.segments]]
end[}]
END[}]
|
Keyword[private] identifier[List] operator[<] identifier[Segment] operator[>] identifier[getCompactableSegments] operator[SEP] identifier[SegmentManager] identifier[manager] operator[SEP] {
identifier[List] operator[<] identifier[Segment] operator[>] identifier[segments] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] identifier[manager] operator[SEP] identifier[segments] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Iterator] operator[<] identifier[Segment] operator[>] identifier[iterator] operator[=] identifier[manager] operator[SEP] identifier[segments] operator[SEP] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[Segment] identifier[segment] operator[=] identifier[iterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[iterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[Segment] identifier[nextSegment] operator[=] identifier[iterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[segment] operator[SEP] identifier[isCompacted] operator[SEP] operator[SEP] operator[||] operator[SEP] identifier[segment] operator[SEP] identifier[isFull] operator[SEP] operator[SEP] operator[&&] identifier[segment] operator[SEP] identifier[lastIndex] operator[SEP] operator[SEP] operator[<] identifier[compactor] operator[SEP] identifier[minorIndex] operator[SEP] operator[SEP] operator[&&] identifier[nextSegment] operator[SEP] identifier[firstIndex] operator[SEP] operator[SEP] operator[<=] identifier[manager] operator[SEP] identifier[commitIndex] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[nextSegment] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[segments] operator[SEP] identifier[add] operator[SEP] identifier[segment] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[break] operator[SEP]
}
identifier[segment] operator[=] identifier[nextSegment] operator[SEP]
}
Keyword[return] identifier[segments] operator[SEP]
}
|
public synchronized boolean markFailed(int id) {
boolean isSuccessful = false;
SQLiteDatabase db = null;
Cursor cursor = null;
try {
db = getWritableDatabase();
// Get number of times this record has already failed to process.
cursor = db.query(ShareRequestTable.NAME, new String[]{ShareRequestTable.COLUMN_FAILS},
WHERE_CLAUSE_BY_ID, new String[]{String.valueOf(id)}, null, null, null);
if (cursor != null && cursor.moveToFirst()) {
int fails = cursor.getInt(cursor.getColumnIndex(ShareRequestTable.COLUMN_FAILS));
// Reset state back to pending and increment fails.
ContentValues values = new ContentValues();
values.put(ShareRequestTable.COLUMN_STATE, ShareRequest.STATE_PENDING);
values.put(ShareRequestTable.COLUMN_FAILS, fails + 1);
isSuccessful = db.update(ShareRequestTable.NAME, values, WHERE_CLAUSE_BY_ID,
new String[]{String.valueOf(id)}) > 0;
sLogger.log(WingsDbHelper.class, "markFailed", "isSuccessful=" + isSuccessful + " id=" + id);
}
} catch (SQLException e) {
// Do nothing.
} finally {
if (cursor != null) {
cursor.close();
}
db.close();
}
return isSuccessful;
}
|
class class_name[name] begin[{]
method[markFailed, return_type[type[boolean]], modifier[synchronized public], parameter[id]] begin[{]
local_variable[type[boolean], isSuccessful]
local_variable[type[SQLiteDatabase], db]
local_variable[type[Cursor], cursor]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=db, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getWritableDatabase, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=cursor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=NAME, postfix_operators=[], prefix_operators=[], qualifier=ShareRequestTable, selectors=[]), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=COLUMN_FAILS, postfix_operators=[], prefix_operators=[], qualifier=ShareRequestTable, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None)), MemberReference(member=WHERE_CLAUSE_BY_ID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MethodInvocation(arguments=[MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=query, postfix_operators=[], prefix_operators=[], qualifier=db, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=cursor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[], member=moveToFirst, postfix_operators=[], prefix_operators=[], qualifier=cursor, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=COLUMN_FAILS, postfix_operators=[], prefix_operators=[], qualifier=ShareRequestTable, selectors=[])], member=getColumnIndex, postfix_operators=[], prefix_operators=[], qualifier=cursor, selectors=[], type_arguments=None)], member=getInt, postfix_operators=[], prefix_operators=[], qualifier=cursor, selectors=[], type_arguments=None), name=fails)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ContentValues, sub_type=None)), name=values)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ContentValues, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=COLUMN_STATE, postfix_operators=[], prefix_operators=[], qualifier=ShareRequestTable, selectors=[]), MemberReference(member=STATE_PENDING, postfix_operators=[], prefix_operators=[], qualifier=ShareRequest, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=values, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=COLUMN_FAILS, postfix_operators=[], prefix_operators=[], qualifier=ShareRequestTable, selectors=[]), BinaryOperation(operandl=MemberReference(member=fails, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)], member=put, postfix_operators=[], prefix_operators=[], qualifier=values, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=isSuccessful, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=NAME, postfix_operators=[], prefix_operators=[], qualifier=ShareRequestTable, selectors=[]), MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=WHERE_CLAUSE_BY_ID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MethodInvocation(arguments=[MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))], member=update, postfix_operators=[], prefix_operators=[], qualifier=db, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>)), label=None), StatementExpression(expression=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=WingsDbHelper, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="markFailed"), BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="isSuccessful="), operandr=MemberReference(member=isSuccessful, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" id="), operator=+), operandr=MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=log, postfix_operators=[], prefix_operators=[], qualifier=sLogger, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SQLException']))], finally_block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=cursor, 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=close, postfix_operators=[], prefix_operators=[], qualifier=cursor, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=db, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
return[member[.isSuccessful]]
end[}]
END[}]
|
Keyword[public] Keyword[synchronized] Keyword[boolean] identifier[markFailed] operator[SEP] Keyword[int] identifier[id] operator[SEP] {
Keyword[boolean] identifier[isSuccessful] operator[=] literal[boolean] operator[SEP] identifier[SQLiteDatabase] identifier[db] operator[=] Other[null] operator[SEP] identifier[Cursor] identifier[cursor] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[db] operator[=] identifier[getWritableDatabase] operator[SEP] operator[SEP] operator[SEP] identifier[cursor] operator[=] identifier[db] operator[SEP] identifier[query] operator[SEP] identifier[ShareRequestTable] operator[SEP] identifier[NAME] , Keyword[new] identifier[String] operator[SEP] operator[SEP] {
identifier[ShareRequestTable] operator[SEP] identifier[COLUMN_FAILS]
} , identifier[WHERE_CLAUSE_BY_ID] , Keyword[new] identifier[String] operator[SEP] operator[SEP] {
identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[id] operator[SEP]
} , Other[null] , Other[null] , Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cursor] operator[!=] Other[null] operator[&&] identifier[cursor] operator[SEP] identifier[moveToFirst] operator[SEP] operator[SEP] operator[SEP] {
Keyword[int] identifier[fails] operator[=] identifier[cursor] operator[SEP] identifier[getInt] operator[SEP] identifier[cursor] operator[SEP] identifier[getColumnIndex] operator[SEP] identifier[ShareRequestTable] operator[SEP] identifier[COLUMN_FAILS] operator[SEP] operator[SEP] operator[SEP] identifier[ContentValues] identifier[values] operator[=] Keyword[new] identifier[ContentValues] operator[SEP] operator[SEP] operator[SEP] identifier[values] operator[SEP] identifier[put] operator[SEP] identifier[ShareRequestTable] operator[SEP] identifier[COLUMN_STATE] , identifier[ShareRequest] operator[SEP] identifier[STATE_PENDING] operator[SEP] operator[SEP] identifier[values] operator[SEP] identifier[put] operator[SEP] identifier[ShareRequestTable] operator[SEP] identifier[COLUMN_FAILS] , identifier[fails] operator[+] Other[1] operator[SEP] operator[SEP] identifier[isSuccessful] operator[=] identifier[db] operator[SEP] identifier[update] operator[SEP] identifier[ShareRequestTable] operator[SEP] identifier[NAME] , identifier[values] , identifier[WHERE_CLAUSE_BY_ID] , Keyword[new] identifier[String] operator[SEP] operator[SEP] {
identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[id] operator[SEP]
} operator[SEP] operator[>] Other[0] operator[SEP] identifier[sLogger] operator[SEP] identifier[log] operator[SEP] identifier[WingsDbHelper] operator[SEP] Keyword[class] , literal[String] , literal[String] operator[+] identifier[isSuccessful] operator[+] literal[String] operator[+] identifier[id] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[SQLException] identifier[e] operator[SEP] {
}
Keyword[finally] {
Keyword[if] operator[SEP] identifier[cursor] operator[!=] Other[null] operator[SEP] {
identifier[cursor] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
identifier[db] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[isSuccessful] operator[SEP]
}
|
public Interval getInterval(String aName, int aLength) {
Interval interval = intervalsByName.get(aName);
if (interval == null)
interval = createInterval(aName, aLength);
return interval;
}
|
class class_name[name] begin[{]
method[getInterval, return_type[type[Interval]], modifier[public], parameter[aName, aLength]] begin[{]
local_variable[type[Interval], interval]
if[binary_operation[member[.interval], ==, literal[null]]] begin[{]
assign[member[.interval], call[.createInterval, parameter[member[.aName], member[.aLength]]]]
else begin[{]
None
end[}]
return[member[.interval]]
end[}]
END[}]
|
Keyword[public] identifier[Interval] identifier[getInterval] operator[SEP] identifier[String] identifier[aName] , Keyword[int] identifier[aLength] operator[SEP] {
identifier[Interval] identifier[interval] operator[=] identifier[intervalsByName] operator[SEP] identifier[get] operator[SEP] identifier[aName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[interval] operator[==] Other[null] operator[SEP] identifier[interval] operator[=] identifier[createInterval] operator[SEP] identifier[aName] , identifier[aLength] operator[SEP] operator[SEP] Keyword[return] identifier[interval] operator[SEP]
}
|
private static boolean annotationEquals(
Class<? extends Annotation> type, Map<String, Object> members, Object other)
throws Exception {
if (!type.isInstance(other)) {
return false;
}
for (Method method : type.getDeclaredMethods()) {
String name = method.getName();
if (!Arrays.deepEquals(
new Object[] {method.invoke(other)}, new Object[] {members.get(name)})) {
return false;
}
}
return true;
}
|
class class_name[name] begin[{]
method[annotationEquals, return_type[type[boolean]], modifier[private static], parameter[type, members, other]] begin[{]
if[call[type.isInstance, parameter[member[.other]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[], type_arguments=None), name=name)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MethodInvocation(arguments=[MemberReference(member=other, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=invoke, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[], type_arguments=None)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None)), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=members, selectors=[], type_arguments=None)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))], member=deepEquals, postfix_operators=[], prefix_operators=['!'], qualifier=Arrays, 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=false), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getDeclaredMethods, postfix_operators=[], prefix_operators=[], qualifier=type, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=method)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Method, sub_type=None))), label=None)
return[literal[true]]
end[}]
END[}]
|
Keyword[private] Keyword[static] Keyword[boolean] identifier[annotationEquals] operator[SEP] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[Annotation] operator[>] identifier[type] , identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[members] , identifier[Object] identifier[other] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[if] operator[SEP] operator[!] identifier[type] operator[SEP] identifier[isInstance] operator[SEP] identifier[other] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[for] operator[SEP] identifier[Method] identifier[method] operator[:] identifier[type] operator[SEP] identifier[getDeclaredMethods] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[name] operator[=] identifier[method] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[Arrays] operator[SEP] identifier[deepEquals] operator[SEP] Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[method] operator[SEP] identifier[invoke] operator[SEP] identifier[other] operator[SEP]
} , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[members] operator[SEP] identifier[get] operator[SEP] identifier[name] operator[SEP]
} operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public void actionUnlockUser() throws Exception {
CmsUUID userId = new CmsUUID(m_paramUserId);
CmsObject cms = getCms();
CmsUser user = cms.readUser(userId);
OpenCms.getLoginManager().unlockUser(getCms(), user);
actionCloseDialog();
}
|
class class_name[name] begin[{]
method[actionUnlockUser, return_type[void], modifier[public], parameter[]] begin[{]
local_variable[type[CmsUUID], userId]
local_variable[type[CmsObject], cms]
local_variable[type[CmsUser], user]
call[OpenCms.getLoginManager, parameter[]]
call[.actionCloseDialog, parameter[]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[actionUnlockUser] operator[SEP] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[CmsUUID] identifier[userId] operator[=] Keyword[new] identifier[CmsUUID] operator[SEP] identifier[m_paramUserId] operator[SEP] operator[SEP] identifier[CmsObject] identifier[cms] operator[=] identifier[getCms] operator[SEP] operator[SEP] operator[SEP] identifier[CmsUser] identifier[user] operator[=] identifier[cms] operator[SEP] identifier[readUser] operator[SEP] identifier[userId] operator[SEP] operator[SEP] identifier[OpenCms] operator[SEP] identifier[getLoginManager] operator[SEP] operator[SEP] operator[SEP] identifier[unlockUser] operator[SEP] identifier[getCms] operator[SEP] operator[SEP] , identifier[user] operator[SEP] operator[SEP] identifier[actionCloseDialog] operator[SEP] operator[SEP] operator[SEP]
}
|
public static void createAnalysisContext(Project project, List<ClassDescriptor> appClassList,
@CheckForNull String sourceInfoFileName) throws IOException {
AnalysisContext analysisContext = new AnalysisContext(project);
// Make this the current analysis context
AnalysisContext.setCurrentAnalysisContext(analysisContext);
// Make the AnalysisCache the backing store for
// the BCEL Repository
analysisContext.clearRepository();
// If needed, load SourceInfoMap
if (sourceInfoFileName != null) {
SourceInfoMap sourceInfoMap = analysisContext.getSourceInfoMap();
sourceInfoMap.read(new FileInputStream(sourceInfoFileName));
}
}
|
class class_name[name] begin[{]
method[createAnalysisContext, return_type[void], modifier[public static], parameter[project, appClassList, sourceInfoFileName]] begin[{]
local_variable[type[AnalysisContext], analysisContext]
call[AnalysisContext.setCurrentAnalysisContext, parameter[member[.analysisContext]]]
call[analysisContext.clearRepository, parameter[]]
if[binary_operation[member[.sourceInfoFileName], !=, literal[null]]] begin[{]
local_variable[type[SourceInfoMap], sourceInfoMap]
call[sourceInfoMap.read, parameter[ClassCreator(arguments=[MemberReference(member=sourceInfoFileName, 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=FileInputStream, sub_type=None))]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[createAnalysisContext] operator[SEP] identifier[Project] identifier[project] , identifier[List] operator[<] identifier[ClassDescriptor] operator[>] identifier[appClassList] , annotation[@] identifier[CheckForNull] identifier[String] identifier[sourceInfoFileName] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[AnalysisContext] identifier[analysisContext] operator[=] Keyword[new] identifier[AnalysisContext] operator[SEP] identifier[project] operator[SEP] operator[SEP] identifier[AnalysisContext] operator[SEP] identifier[setCurrentAnalysisContext] operator[SEP] identifier[analysisContext] operator[SEP] operator[SEP] identifier[analysisContext] operator[SEP] identifier[clearRepository] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[sourceInfoFileName] operator[!=] Other[null] operator[SEP] {
identifier[SourceInfoMap] identifier[sourceInfoMap] operator[=] identifier[analysisContext] operator[SEP] identifier[getSourceInfoMap] operator[SEP] operator[SEP] operator[SEP] identifier[sourceInfoMap] operator[SEP] identifier[read] operator[SEP] Keyword[new] identifier[FileInputStream] operator[SEP] identifier[sourceInfoFileName] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public void autoGenerateStyleMapFile(AnalysisEngineMetaData aMetaData,
File aStyleMapFile) throws IOException {
String xmlStr = autoGenerateStyleMap(aMetaData);
FileWriter out = null;
try {
out = new FileWriter(aStyleMapFile);
out.write(xmlStr);
} finally {
if (out != null)
out.close();
}
}
|
class class_name[name] begin[{]
method[autoGenerateStyleMapFile, return_type[void], modifier[public], parameter[aMetaData, aStyleMapFile]] begin[{]
local_variable[type[String], xmlStr]
local_variable[type[FileWriter], out]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=aStyleMapFile, 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=FileWriter, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=xmlStr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=write, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None))], label=None, resources=None)
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[autoGenerateStyleMapFile] operator[SEP] identifier[AnalysisEngineMetaData] identifier[aMetaData] , identifier[File] identifier[aStyleMapFile] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[String] identifier[xmlStr] operator[=] identifier[autoGenerateStyleMap] operator[SEP] identifier[aMetaData] operator[SEP] operator[SEP] identifier[FileWriter] identifier[out] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[out] operator[=] Keyword[new] identifier[FileWriter] operator[SEP] identifier[aStyleMapFile] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[write] operator[SEP] identifier[xmlStr] operator[SEP] operator[SEP]
}
Keyword[finally] {
Keyword[if] operator[SEP] identifier[out] operator[!=] Other[null] operator[SEP] identifier[out] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
}
|
protected int getValueForInput(FacesContext context, UIInput component, String itemValue, Map<String, Object> valueArray,
Converter converter) {
try {
int retInt = 0;
if (itemValue == null || valueArray == null) {
return retInt;
}
if (valueArray.containsKey(itemValue)) {
retInt = Integer.parseInt((String) valueArray.get(itemValue));
return retInt % 3;
}
else {
return retInt;
}
}
catch (final NumberFormatException ex) {
throw new FacesException("State of '" + component.getClientId() + "' must be an integer representation");
}
}
|
class class_name[name] begin[{]
method[getValueForInput, return_type[type[int]], modifier[protected], parameter[context, component, itemValue, valueArray, converter]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=retInt)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=itemValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operandr=BinaryOperation(operandl=MemberReference(member=valueArray, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=retInt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)])), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=itemValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=containsKey, postfix_operators=[], prefix_operators=[], qualifier=valueArray, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=retInt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=retInt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Cast(expression=MethodInvocation(arguments=[MemberReference(member=itemValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=valueArray, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], member=parseInt, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None)), label=None), ReturnStatement(expression=BinaryOperation(operandl=MemberReference(member=retInt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3), operator=%), label=None)]))], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="State of '"), operandr=MethodInvocation(arguments=[], member=getClientId, postfix_operators=[], prefix_operators=[], qualifier=component, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' must be an integer representation"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FacesException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['NumberFormatException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[protected] Keyword[int] identifier[getValueForInput] operator[SEP] identifier[FacesContext] identifier[context] , identifier[UIInput] identifier[component] , identifier[String] identifier[itemValue] , identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[valueArray] , identifier[Converter] identifier[converter] operator[SEP] {
Keyword[try] {
Keyword[int] identifier[retInt] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[itemValue] operator[==] Other[null] operator[||] identifier[valueArray] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[retInt] operator[SEP]
}
Keyword[if] operator[SEP] identifier[valueArray] operator[SEP] identifier[containsKey] operator[SEP] identifier[itemValue] operator[SEP] operator[SEP] {
identifier[retInt] operator[=] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] operator[SEP] identifier[String] operator[SEP] identifier[valueArray] operator[SEP] identifier[get] operator[SEP] identifier[itemValue] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[retInt] operator[%] Other[3] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[retInt] operator[SEP]
}
}
Keyword[catch] operator[SEP] Keyword[final] identifier[NumberFormatException] identifier[ex] operator[SEP] {
Keyword[throw] Keyword[new] identifier[FacesException] operator[SEP] literal[String] operator[+] identifier[component] operator[SEP] identifier[getClientId] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
|
public boolean isEOFRecord(byte[] record) {
for (int i = 0, sz = this.getRecordSize(); i < sz; ++i) {
if (record[i] != 0) {
return false;
}
}
return true;
}
|
class class_name[name] begin[{]
method[isEOFRecord, return_type[type[boolean]], modifier[public], parameter[record]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=record, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=sz, 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), VariableDeclarator(dimensions=[], initializer=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getRecordSize, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), name=sz)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)
return[literal[true]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[isEOFRecord] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[record] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] , identifier[sz] operator[=] Keyword[this] operator[SEP] identifier[getRecordSize] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[<] identifier[sz] operator[SEP] operator[++] identifier[i] operator[SEP] {
Keyword[if] operator[SEP] identifier[record] operator[SEP] identifier[i] operator[SEP] operator[!=] Other[0] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
private static Object newInstance(String className,
ClassLoader classLoader)
throws SOAPException
{
try {
Class spiClass;
if (classLoader == null) {
spiClass = Class.forName(className);
} else {
spiClass = classLoader.loadClass(className);
}
return spiClass.newInstance();
} catch (ClassNotFoundException x) {
throw new SOAPException(
"Provider " + className + " not found", x);
} catch (Exception x) {
throw new SOAPException(
"Provider " + className + " could not be instantiated: " + x,
x);
}
}
|
class class_name[name] begin[{]
method[newInstance, return_type[type[Object]], modifier[private static], parameter[className, classLoader]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=spiClass)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Class, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=classLoader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=spiClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=className, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=loadClass, postfix_operators=[], prefix_operators=[], qualifier=classLoader, selectors=[], type_arguments=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=spiClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=className, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Class, selectors=[], type_arguments=None)), label=None)])), ReturnStatement(expression=MethodInvocation(arguments=[], member=newInstance, postfix_operators=[], prefix_operators=[], qualifier=spiClass, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Provider "), operandr=MemberReference(member=className, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" not found"), operator=+), MemberReference(member=x, 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=SOAPException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=x, types=['ClassNotFoundException'])), CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Provider "), operandr=MemberReference(member=className, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" could not be instantiated: "), operator=+), operandr=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=x, 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=SOAPException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=x, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[private] Keyword[static] identifier[Object] identifier[newInstance] operator[SEP] identifier[String] identifier[className] , identifier[ClassLoader] identifier[classLoader] operator[SEP] Keyword[throws] identifier[SOAPException] {
Keyword[try] {
identifier[Class] identifier[spiClass] operator[SEP] Keyword[if] operator[SEP] identifier[classLoader] operator[==] Other[null] operator[SEP] {
identifier[spiClass] operator[=] identifier[Class] operator[SEP] identifier[forName] operator[SEP] identifier[className] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[spiClass] operator[=] identifier[classLoader] operator[SEP] identifier[loadClass] operator[SEP] identifier[className] operator[SEP] operator[SEP]
}
Keyword[return] identifier[spiClass] operator[SEP] identifier[newInstance] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ClassNotFoundException] identifier[x] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SOAPException] operator[SEP] literal[String] operator[+] identifier[className] operator[+] literal[String] , identifier[x] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[x] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SOAPException] operator[SEP] literal[String] operator[+] identifier[className] operator[+] literal[String] operator[+] identifier[x] , identifier[x] operator[SEP] operator[SEP]
}
}
|
@SuppressWarnings("unchecked")
public static <T> BeanMap<T> filterRequestFields(T src) {
return (BeanMap<T>) FilteringBeanMap.from(src, parsePathProperties());
}
|
class class_name[name] begin[{]
method[filterRequestFields, return_type[type[BeanMap]], modifier[public static], parameter[src]] begin[{]
return[Cast(expression=MethodInvocation(arguments=[MemberReference(member=src, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=parsePathProperties, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=from, postfix_operators=[], prefix_operators=[], qualifier=FilteringBeanMap, selectors=[], type_arguments=None), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=BeanMap, sub_type=None))]
end[}]
END[}]
|
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[BeanMap] operator[<] identifier[T] operator[>] identifier[filterRequestFields] operator[SEP] identifier[T] identifier[src] operator[SEP] {
Keyword[return] operator[SEP] identifier[BeanMap] operator[<] identifier[T] operator[>] operator[SEP] identifier[FilteringBeanMap] operator[SEP] identifier[from] operator[SEP] identifier[src] , identifier[parsePathProperties] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
boolean isWiredTo(final ExecutionGroupVertex groupVertex) {
final Iterator<ExecutionGroupEdge> it = this.forwardLinks.iterator();
while (it.hasNext()) {
final ExecutionGroupEdge edge = it.next();
if (edge.getTargetVertex() == groupVertex) {
return true;
}
}
return false;
}
|
class class_name[name] begin[{]
method[isWiredTo, return_type[type[boolean]], modifier[default], parameter[groupVertex]] begin[{]
local_variable[type[Iterator], it]
while[call[it.hasNext, parameter[]]] begin[{]
local_variable[type[ExecutionGroupEdge], edge]
if[binary_operation[call[edge.getTargetVertex, parameter[]], ==, member[.groupVertex]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
end[}]
return[literal[false]]
end[}]
END[}]
|
Keyword[boolean] identifier[isWiredTo] operator[SEP] Keyword[final] identifier[ExecutionGroupVertex] identifier[groupVertex] operator[SEP] {
Keyword[final] identifier[Iterator] operator[<] identifier[ExecutionGroupEdge] operator[>] identifier[it] operator[=] Keyword[this] operator[SEP] identifier[forwardLinks] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[it] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[ExecutionGroupEdge] identifier[edge] operator[=] identifier[it] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[edge] operator[SEP] identifier[getTargetVertex] operator[SEP] operator[SEP] operator[==] identifier[groupVertex] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
private static Integer checkQuietly(final String name, final Integer value)
{
Integer val = 50;
try
{
val = Args.withinRange(0, 100, value, name);
}
catch (final IllegalArgumentException e)
{
LOGGER.error(String.format(
"Given argument '%s' must have a value within [%s,%s], but was %s. Default value 50% will be set.",
name, 0, 100, value));
}
return val;
}
|
class class_name[name] begin[{]
method[checkQuietly, return_type[type[Integer]], modifier[private static], parameter[name, value]] begin[{]
local_variable[type[Integer], val]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=val, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=100), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=withinRange, postfix_operators=[], prefix_operators=[], qualifier=Args, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Given argument '%s' must have a value within [%s,%s], but was %s. Default value 50% will be set."), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=100), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], 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=['IllegalArgumentException']))], finally_block=None, label=None, resources=None)
return[member[.val]]
end[}]
END[}]
|
Keyword[private] Keyword[static] identifier[Integer] identifier[checkQuietly] operator[SEP] Keyword[final] identifier[String] identifier[name] , Keyword[final] identifier[Integer] identifier[value] operator[SEP] {
identifier[Integer] identifier[val] operator[=] Other[50] operator[SEP] Keyword[try] {
identifier[val] operator[=] identifier[Args] operator[SEP] identifier[withinRange] operator[SEP] Other[0] , Other[100] , identifier[value] , identifier[name] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[IllegalArgumentException] identifier[e] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[error] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[name] , Other[0] , Other[100] , identifier[value] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[val] operator[SEP]
}
|
public static StyledLayerDescriptor readStyle( File file ) throws IOException {
SLDParser stylereader = new SLDParser(sf, file);
StyledLayerDescriptor sld = stylereader.parseSLD();
return sld;
}
|
class class_name[name] begin[{]
method[readStyle, return_type[type[StyledLayerDescriptor]], modifier[public static], parameter[file]] begin[{]
local_variable[type[SLDParser], stylereader]
local_variable[type[StyledLayerDescriptor], sld]
return[member[.sld]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[StyledLayerDescriptor] identifier[readStyle] operator[SEP] identifier[File] identifier[file] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[SLDParser] identifier[stylereader] operator[=] Keyword[new] identifier[SLDParser] operator[SEP] identifier[sf] , identifier[file] operator[SEP] operator[SEP] identifier[StyledLayerDescriptor] identifier[sld] operator[=] identifier[stylereader] operator[SEP] identifier[parseSLD] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[sld] operator[SEP]
}
|
public List<File> files() throws ParseException, IOException
{
final List<File> files1 = files(new File(startingPath));
logger.trace("wildfile counts: dir({}) files({}) matched({})",
scanDirCount, scanFileCount, files1.size());
return files1;
}
|
class class_name[name] begin[{]
method[files, return_type[type[List]], modifier[public], parameter[]] begin[{]
local_variable[type[List], files1]
call[logger.trace, parameter[literal["wildfile counts: dir({}) files({}) matched({})"], member[.scanDirCount], member[.scanFileCount], call[files1.size, parameter[]]]]
return[member[.files1]]
end[}]
END[}]
|
Keyword[public] identifier[List] operator[<] identifier[File] operator[>] identifier[files] operator[SEP] operator[SEP] Keyword[throws] identifier[ParseException] , identifier[IOException] {
Keyword[final] identifier[List] operator[<] identifier[File] operator[>] identifier[files1] operator[=] identifier[files] operator[SEP] Keyword[new] identifier[File] operator[SEP] identifier[startingPath] operator[SEP] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[trace] operator[SEP] literal[String] , identifier[scanDirCount] , identifier[scanFileCount] , identifier[files1] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[files1] operator[SEP]
}
|
void release(RichByteBufferImpl handler)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "release", handler);
byteBufferWrapperPool.add(handler);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "release");
}
|
class class_name[name] begin[{]
method[release, return_type[void], modifier[default], parameter[handler]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[THIS[], member[.tc], literal["release"], member[.handler]]]
else begin[{]
None
end[}]
call[byteBufferWrapperPool.add, parameter[member[.handler]]]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[THIS[], member[.tc], literal["release"]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[void] identifier[release] operator[SEP] identifier[RichByteBufferImpl] identifier[handler] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] Keyword[this] , identifier[tc] , literal[String] , identifier[handler] operator[SEP] operator[SEP] identifier[byteBufferWrapperPool] operator[SEP] identifier[add] operator[SEP] identifier[handler] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] Keyword[this] , identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
|
public ArrayList<OvhPccStockProfile> location_pccZone_stock_pcc_GET(String pccZone) throws IOException {
String qPath = "/dedicatedCloud/location/{pccZone}/stock/pcc";
StringBuilder sb = path(qPath, pccZone);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t9);
}
|
class class_name[name] begin[{]
method[location_pccZone_stock_pcc_GET, return_type[type[ArrayList]], modifier[public], parameter[pccZone]] begin[{]
local_variable[type[String], qPath]
local_variable[type[StringBuilder], sb]
local_variable[type[String], resp]
return[call[.convertTo, parameter[member[.resp], member[.t9]]]]
end[}]
END[}]
|
Keyword[public] identifier[ArrayList] operator[<] identifier[OvhPccStockProfile] operator[>] identifier[location_pccZone_stock_pcc_GET] operator[SEP] identifier[String] identifier[pccZone] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[String] identifier[qPath] operator[=] literal[String] operator[SEP] identifier[StringBuilder] identifier[sb] operator[=] identifier[path] operator[SEP] identifier[qPath] , identifier[pccZone] operator[SEP] operator[SEP] identifier[String] identifier[resp] operator[=] identifier[exec] operator[SEP] identifier[qPath] , literal[String] , identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP] Keyword[return] identifier[convertTo] operator[SEP] identifier[resp] , identifier[t9] operator[SEP] operator[SEP]
}
|
public synchronized Set<String> getNames() {
if (map == null) {
return Collections.emptySet();
}
return Collections.unmodifiableSet(map.keySet());
}
|
class class_name[name] begin[{]
method[getNames, return_type[type[Set]], modifier[synchronized public], parameter[]] begin[{]
if[binary_operation[member[.map], ==, literal[null]]] begin[{]
return[call[Collections.emptySet, parameter[]]]
else begin[{]
None
end[}]
return[call[Collections.unmodifiableSet, parameter[call[map.keySet, parameter[]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[synchronized] identifier[Set] operator[<] identifier[String] operator[>] identifier[getNames] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[map] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[Collections] operator[SEP] identifier[emptySet] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[Collections] operator[SEP] identifier[unmodifiableSet] operator[SEP] identifier[map] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public JSONWriter object() {
if (this.mode == INIT) {
this.mode = OBJECT;
}
if (this.mode == OBJECT || this.mode == ARRAY) {
this.append("{");
this.push(KEY);
this.comma = false;
return this;
}
throw new JSONException("Misplaced object: expected mode of INIT, OBJECT or ARRAY but was " + this.mode);
}
|
class class_name[name] begin[{]
method[object, return_type[type[JSONWriter]], modifier[public], parameter[]] begin[{]
if[binary_operation[THIS[member[None.mode]], ==, member[.INIT]]] begin[{]
assign[THIS[member[None.mode]], member[.OBJECT]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[THIS[member[None.mode]], ==, member[.OBJECT]], ||, binary_operation[THIS[member[None.mode]], ==, member[.ARRAY]]]] begin[{]
THIS[call[None.append, parameter[literal["{"]]]]
THIS[call[None.push, parameter[member[.KEY]]]]
assign[THIS[member[None.comma]], literal[false]]
return[THIS[]]
else begin[{]
None
end[}]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Misplaced object: expected mode of INIT, OBJECT or ARRAY but was "), operandr=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=mode, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JSONException, sub_type=None)), label=None)
end[}]
END[}]
|
Keyword[public] identifier[JSONWriter] identifier[object] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[mode] operator[==] identifier[INIT] operator[SEP] {
Keyword[this] operator[SEP] identifier[mode] operator[=] identifier[OBJECT] operator[SEP]
}
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[mode] operator[==] identifier[OBJECT] operator[||] Keyword[this] operator[SEP] identifier[mode] operator[==] identifier[ARRAY] operator[SEP] {
Keyword[this] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[push] operator[SEP] identifier[KEY] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[comma] operator[=] literal[boolean] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
Keyword[throw] Keyword[new] identifier[JSONException] operator[SEP] literal[String] operator[+] Keyword[this] operator[SEP] identifier[mode] operator[SEP] operator[SEP]
}
|
protected CrossVMState handleNeighborConcurrent(ReadableJobState me, LocalDateTime activationTime) {
final NeighborConcurrentJobStopper stopper = createNeighborConcurrentJobStopper(me.getNeighborConcurrentGroupList());
return stopper.stopIfNeeds(me, neighbor -> buildNeighborJobStateDisp(me, neighbor, activationTime)).map(result -> {
return asQuitState();
}).orElseGet(() -> {
return asNormalExecution();
});
}
|
class class_name[name] begin[{]
method[handleNeighborConcurrent, return_type[type[CrossVMState]], modifier[protected], parameter[me, activationTime]] begin[{]
local_variable[type[NeighborConcurrentJobStopper], stopper]
return[call[stopper.stopIfNeeds, parameter[member[.me], LambdaExpression(body=MethodInvocation(arguments=[MemberReference(member=me, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=neighbor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=activationTime, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=buildNeighborJobStateDisp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), parameters=[MemberReference(member=neighbor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]]
end[}]
END[}]
|
Keyword[protected] identifier[CrossVMState] identifier[handleNeighborConcurrent] operator[SEP] identifier[ReadableJobState] identifier[me] , identifier[LocalDateTime] identifier[activationTime] operator[SEP] {
Keyword[final] identifier[NeighborConcurrentJobStopper] identifier[stopper] operator[=] identifier[createNeighborConcurrentJobStopper] operator[SEP] identifier[me] operator[SEP] identifier[getNeighborConcurrentGroupList] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[stopper] operator[SEP] identifier[stopIfNeeds] operator[SEP] identifier[me] , identifier[neighbor] operator[->] identifier[buildNeighborJobStateDisp] operator[SEP] identifier[me] , identifier[neighbor] , identifier[activationTime] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[result] operator[->] {
Keyword[return] identifier[asQuitState] operator[SEP] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP] identifier[orElseGet] operator[SEP] operator[SEP] operator[SEP] operator[->] {
Keyword[return] identifier[asNormalExecution] operator[SEP] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP]
}
|
public ListBuildsForProjectResult withIds(String... ids) {
if (this.ids == null) {
setIds(new java.util.ArrayList<String>(ids.length));
}
for (String ele : ids) {
this.ids.add(ele);
}
return this;
}
|
class class_name[name] begin[{]
method[withIds, return_type[type[ListBuildsForProjectResult]], modifier[public], parameter[ids]] begin[{]
if[binary_operation[THIS[member[None.ids]], ==, literal[null]]] begin[{]
call[.setIds, parameter[ClassCreator(arguments=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=ids, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=util, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))))]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=ids, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=ele, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=ids, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=ele)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[THIS[]]
end[}]
END[}]
|
Keyword[public] identifier[ListBuildsForProjectResult] identifier[withIds] operator[SEP] identifier[String] operator[...] identifier[ids] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[ids] operator[==] Other[null] operator[SEP] {
identifier[setIds] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] identifier[ids] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[String] identifier[ele] operator[:] identifier[ids] operator[SEP] {
Keyword[this] operator[SEP] identifier[ids] operator[SEP] identifier[add] operator[SEP] identifier[ele] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public static <A, B> boolean equalsAny(A object, B... objects) {
for (B o : objects) {
if (bothNullOrEqual(o, object)) {
return true;
}
}
return false;
}
|
class class_name[name] begin[{]
method[equalsAny, return_type[type[boolean]], modifier[public static], parameter[object, objects]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=object, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=bothNullOrEqual, postfix_operators=[], prefix_operators=[], qualifier=, 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=MemberReference(member=objects, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=o)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=B, sub_type=None))), label=None)
return[literal[false]]
end[}]
END[}]
|
Keyword[public] Keyword[static] operator[<] identifier[A] , identifier[B] operator[>] Keyword[boolean] identifier[equalsAny] operator[SEP] identifier[A] identifier[object] , identifier[B] operator[...] identifier[objects] operator[SEP] {
Keyword[for] operator[SEP] identifier[B] identifier[o] operator[:] identifier[objects] operator[SEP] {
Keyword[if] operator[SEP] identifier[bothNullOrEqual] operator[SEP] identifier[o] , identifier[object] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public void addOutgoingFor(SDVariable[] variables, DifferentialFunction function) {
String[] varNames = new String[variables.length];
for (int i = 0; i < varNames.length; i++) {
varNames[i] = variables[i].getVarName();
}
addOutgoingFor(varNames, function);
}
|
class class_name[name] begin[{]
method[addOutgoingFor, return_type[void], modifier[public], parameter[variables, function]] begin[{]
local_variable[type[String], varNames]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=varNames, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=variables, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[], member=getVarName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, 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=varNames, 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[.addOutgoingFor, parameter[member[.varNames], member[.function]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[addOutgoingFor] operator[SEP] identifier[SDVariable] operator[SEP] operator[SEP] identifier[variables] , identifier[DifferentialFunction] identifier[function] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] identifier[varNames] operator[=] Keyword[new] identifier[String] operator[SEP] identifier[variables] 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[varNames] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[varNames] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[variables] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[getVarName] operator[SEP] operator[SEP] operator[SEP]
}
identifier[addOutgoingFor] operator[SEP] identifier[varNames] , identifier[function] operator[SEP] operator[SEP]
}
|
public void reacquire() throws IOException {
try {
areaReader.af = new AreaFile(location);
} catch (Throwable e) {
throw new IOException(e);
}
}
|
class class_name[name] begin[{]
method[reacquire, return_type[void], modifier[public], parameter[]] begin[{]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=af, postfix_operators=[], prefix_operators=[], qualifier=areaReader, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=location, 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=AreaFile, sub_type=None))), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Throwable']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[reacquire] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[try] {
identifier[areaReader] operator[SEP] identifier[af] operator[=] Keyword[new] identifier[AreaFile] operator[SEP] identifier[location] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
private void addPostParams(final Request request) {
if (defaultActivitySid != null) {
request.addPostParam("DefaultActivitySid", defaultActivitySid);
}
if (eventCallbackUrl != null) {
request.addPostParam("EventCallbackUrl", eventCallbackUrl.toString());
}
if (eventsFilter != null) {
request.addPostParam("EventsFilter", eventsFilter);
}
if (friendlyName != null) {
request.addPostParam("FriendlyName", friendlyName);
}
if (multiTaskEnabled != null) {
request.addPostParam("MultiTaskEnabled", multiTaskEnabled.toString());
}
if (timeoutActivitySid != null) {
request.addPostParam("TimeoutActivitySid", timeoutActivitySid);
}
if (prioritizeQueueOrder != null) {
request.addPostParam("PrioritizeQueueOrder", prioritizeQueueOrder.toString());
}
}
|
class class_name[name] begin[{]
method[addPostParams, return_type[void], modifier[private], parameter[request]] begin[{]
if[binary_operation[member[.defaultActivitySid], !=, literal[null]]] begin[{]
call[request.addPostParam, parameter[literal["DefaultActivitySid"], member[.defaultActivitySid]]]
else begin[{]
None
end[}]
if[binary_operation[member[.eventCallbackUrl], !=, literal[null]]] begin[{]
call[request.addPostParam, parameter[literal["EventCallbackUrl"], call[eventCallbackUrl.toString, parameter[]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.eventsFilter], !=, literal[null]]] begin[{]
call[request.addPostParam, parameter[literal["EventsFilter"], member[.eventsFilter]]]
else begin[{]
None
end[}]
if[binary_operation[member[.friendlyName], !=, literal[null]]] begin[{]
call[request.addPostParam, parameter[literal["FriendlyName"], member[.friendlyName]]]
else begin[{]
None
end[}]
if[binary_operation[member[.multiTaskEnabled], !=, literal[null]]] begin[{]
call[request.addPostParam, parameter[literal["MultiTaskEnabled"], call[multiTaskEnabled.toString, parameter[]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.timeoutActivitySid], !=, literal[null]]] begin[{]
call[request.addPostParam, parameter[literal["TimeoutActivitySid"], member[.timeoutActivitySid]]]
else begin[{]
None
end[}]
if[binary_operation[member[.prioritizeQueueOrder], !=, literal[null]]] begin[{]
call[request.addPostParam, parameter[literal["PrioritizeQueueOrder"], call[prioritizeQueueOrder.toString, parameter[]]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[addPostParams] operator[SEP] Keyword[final] identifier[Request] identifier[request] operator[SEP] {
Keyword[if] operator[SEP] identifier[defaultActivitySid] operator[!=] Other[null] operator[SEP] {
identifier[request] operator[SEP] identifier[addPostParam] operator[SEP] literal[String] , identifier[defaultActivitySid] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[eventCallbackUrl] operator[!=] Other[null] operator[SEP] {
identifier[request] operator[SEP] identifier[addPostParam] operator[SEP] literal[String] , identifier[eventCallbackUrl] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[eventsFilter] operator[!=] Other[null] operator[SEP] {
identifier[request] operator[SEP] identifier[addPostParam] operator[SEP] literal[String] , identifier[eventsFilter] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[friendlyName] operator[!=] Other[null] operator[SEP] {
identifier[request] operator[SEP] identifier[addPostParam] operator[SEP] literal[String] , identifier[friendlyName] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[multiTaskEnabled] operator[!=] Other[null] operator[SEP] {
identifier[request] operator[SEP] identifier[addPostParam] operator[SEP] literal[String] , identifier[multiTaskEnabled] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[timeoutActivitySid] operator[!=] Other[null] operator[SEP] {
identifier[request] operator[SEP] identifier[addPostParam] operator[SEP] literal[String] , identifier[timeoutActivitySid] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[prioritizeQueueOrder] operator[!=] Other[null] operator[SEP] {
identifier[request] operator[SEP] identifier[addPostParam] operator[SEP] literal[String] , identifier[prioritizeQueueOrder] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public UpdateElasticsearchDomainConfigRequest withLogPublishingOptions(java.util.Map<String, LogPublishingOption> logPublishingOptions) {
setLogPublishingOptions(logPublishingOptions);
return this;
}
|
class class_name[name] begin[{]
method[withLogPublishingOptions, return_type[type[UpdateElasticsearchDomainConfigRequest]], modifier[public], parameter[logPublishingOptions]] begin[{]
call[.setLogPublishingOptions, parameter[member[.logPublishingOptions]]]
return[THIS[]]
end[}]
END[}]
|
Keyword[public] identifier[UpdateElasticsearchDomainConfigRequest] identifier[withLogPublishingOptions] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[LogPublishingOption] operator[>] identifier[logPublishingOptions] operator[SEP] {
identifier[setLogPublishingOptions] operator[SEP] identifier[logPublishingOptions] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
@Deprecated
public UnaryCallSettings.Builder getApiCallSettings(RetrySettings retrySettings) {
return UnaryCallSettings.newUnaryCallSettingsBuilder().setRetrySettings(retrySettings);
}
|
class class_name[name] begin[{]
method[getApiCallSettings, return_type[type[UnaryCallSettings]], modifier[public], parameter[retrySettings]] begin[{]
return[call[UnaryCallSettings.newUnaryCallSettingsBuilder, parameter[]]]
end[}]
END[}]
|
annotation[@] identifier[Deprecated] Keyword[public] identifier[UnaryCallSettings] operator[SEP] identifier[Builder] identifier[getApiCallSettings] operator[SEP] identifier[RetrySettings] identifier[retrySettings] operator[SEP] {
Keyword[return] identifier[UnaryCallSettings] operator[SEP] identifier[newUnaryCallSettingsBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[setRetrySettings] operator[SEP] identifier[retrySettings] operator[SEP] operator[SEP]
}
|
@Nonnull
public static Matcher getMatcher (@Nonnull @RegEx final String sRegEx, @Nonnull final String sValue)
{
ValueEnforcer.notNull (sValue, "Value");
return RegExCache.getPattern (sRegEx).matcher (sValue);
}
|
class class_name[name] begin[{]
method[getMatcher, return_type[type[Matcher]], modifier[public static], parameter[sRegEx, sValue]] begin[{]
call[ValueEnforcer.notNull, parameter[member[.sValue], literal["Value"]]]
return[call[RegExCache.getPattern, parameter[member[.sRegEx]]]]
end[}]
END[}]
|
annotation[@] identifier[Nonnull] Keyword[public] Keyword[static] identifier[Matcher] identifier[getMatcher] operator[SEP] annotation[@] identifier[Nonnull] annotation[@] identifier[RegEx] Keyword[final] identifier[String] identifier[sRegEx] , annotation[@] identifier[Nonnull] Keyword[final] identifier[String] identifier[sValue] operator[SEP] {
identifier[ValueEnforcer] operator[SEP] identifier[notNull] operator[SEP] identifier[sValue] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[RegExCache] operator[SEP] identifier[getPattern] operator[SEP] identifier[sRegEx] operator[SEP] operator[SEP] identifier[matcher] operator[SEP] identifier[sValue] operator[SEP] operator[SEP]
}
|
@Override
public SetVaultAccessPolicyResult setVaultAccessPolicy(SetVaultAccessPolicyRequest request) {
request = beforeClientExecution(request);
return executeSetVaultAccessPolicy(request);
}
|
class class_name[name] begin[{]
method[setVaultAccessPolicy, return_type[type[SetVaultAccessPolicyResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeSetVaultAccessPolicy, parameter[member[.request]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[SetVaultAccessPolicyResult] identifier[setVaultAccessPolicy] operator[SEP] identifier[SetVaultAccessPolicyRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeSetVaultAccessPolicy] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
public Integer getSelectedLastRow() {
final Object result = getStateHelper().eval(PropertyKeys.selectedLastRow);
if (result == null) {
return null;
}
return Integer.valueOf(result.toString());
}
|
class class_name[name] begin[{]
method[getSelectedLastRow, return_type[type[Integer]], modifier[public], parameter[]] begin[{]
local_variable[type[Object], result]
if[binary_operation[member[.result], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
return[call[Integer.valueOf, parameter[call[result.toString, parameter[]]]]]
end[}]
END[}]
|
Keyword[public] identifier[Integer] identifier[getSelectedLastRow] operator[SEP] operator[SEP] {
Keyword[final] identifier[Object] identifier[result] operator[=] identifier[getStateHelper] operator[SEP] operator[SEP] operator[SEP] identifier[eval] operator[SEP] identifier[PropertyKeys] operator[SEP] identifier[selectedLastRow] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[return] identifier[Integer] operator[SEP] identifier[valueOf] operator[SEP] identifier[result] operator[SEP] identifier[toString] 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.