code
stringlengths 63
466k
| code_sememe
stringlengths 141
3.79M
| token_type
stringlengths 274
1.23M
|
|---|---|---|
public static ExtractionFn fromQueryGranularity(final Granularity queryGranularity)
{
if (queryGranularity == null) {
return null;
} else {
return new TimeFormatExtractionFn(null, null, null, queryGranularity, true);
}
}
|
class class_name[name] begin[{]
method[fromQueryGranularity, return_type[type[ExtractionFn]], modifier[public static], parameter[queryGranularity]] begin[{]
if[binary_operation[member[.queryGranularity], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
return[ClassCreator(arguments=[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), MemberReference(member=queryGranularity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TimeFormatExtractionFn, sub_type=None))]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[ExtractionFn] identifier[fromQueryGranularity] operator[SEP] Keyword[final] identifier[Granularity] identifier[queryGranularity] operator[SEP] {
Keyword[if] operator[SEP] identifier[queryGranularity] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[else] {
Keyword[return] Keyword[new] identifier[TimeFormatExtractionFn] operator[SEP] Other[null] , Other[null] , Other[null] , identifier[queryGranularity] , literal[boolean] operator[SEP] operator[SEP]
}
}
|
public static List<SourceInfo> getSourceInfo(String tenantId, List<Trace> items)
throws RetryAttemptException {
List<SourceInfo> sourceInfoList = new ArrayList<SourceInfo>();
int curpos=0;
// This method initialises the deriver with a list of trace fragments
// that will need to be referenced when correlating a consumer with a producer
for (int i = 0; i < items.size(); i++) {
// Need to check for Producer nodes
Trace trace = items.get(i);
StringBuffer nodeId = new StringBuffer(trace.getFragmentId());
for (int j = 0; j < trace.getNodes().size(); j++) {
Node node = trace.getNodes().get(j);
int len = nodeId.length();
initialiseSourceInfo(sourceInfoList, tenantId, trace, nodeId, j,
node);
// Trim the node id for use with next node
nodeId.delete(len, nodeId.length());
}
// Apply origin information to the source info
EndpointRef ep = EndpointUtil.getSourceEndpoint(trace);
for (int j=curpos; j < sourceInfoList.size(); j++) {
SourceInfo si = sourceInfoList.get(j);
si.setEndpoint(ep);
}
curpos = sourceInfoList.size();
}
return sourceInfoList;
}
|
class class_name[name] begin[{]
method[getSourceInfo, return_type[type[List]], modifier[public static], parameter[tenantId, items]] begin[{]
local_variable[type[List], sourceInfoList]
local_variable[type[int], curpos]
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=items, selectors=[], type_arguments=None), name=trace)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Trace, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getFragmentId, postfix_operators=[], prefix_operators=[], qualifier=trace, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StringBuffer, sub_type=None)), name=nodeId)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=StringBuffer, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getNodes, postfix_operators=[], prefix_operators=[], qualifier=trace, selectors=[MethodInvocation(arguments=[MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=node)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Node, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=nodeId, selectors=[], type_arguments=None), name=len)], modifiers=set(), type=BasicType(dimensions=[], name=int)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=sourceInfoList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tenantId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=trace, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=nodeId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=initialiseSourceInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=len, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=nodeId, selectors=[], type_arguments=None)], member=delete, postfix_operators=[], prefix_operators=[], qualifier=nodeId, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getNodes, postfix_operators=[], prefix_operators=[], qualifier=trace, selectors=[MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], 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), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=trace, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getSourceEndpoint, postfix_operators=[], prefix_operators=[], qualifier=EndpointUtil, selectors=[], type_arguments=None), name=ep)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=EndpointRef, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=sourceInfoList, selectors=[], type_arguments=None), name=si)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SourceInfo, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ep, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setEndpoint, postfix_operators=[], prefix_operators=[], qualifier=si, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=sourceInfoList, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=curpos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=j, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=curpos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=sourceInfoList, 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=items, 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[.sourceInfoList]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[List] operator[<] identifier[SourceInfo] operator[>] identifier[getSourceInfo] operator[SEP] identifier[String] identifier[tenantId] , identifier[List] operator[<] identifier[Trace] operator[>] identifier[items] operator[SEP] Keyword[throws] identifier[RetryAttemptException] {
identifier[List] operator[<] identifier[SourceInfo] operator[>] identifier[sourceInfoList] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[SourceInfo] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[curpos] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[items] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[Trace] identifier[trace] operator[=] identifier[items] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[StringBuffer] identifier[nodeId] operator[=] Keyword[new] identifier[StringBuffer] operator[SEP] identifier[trace] operator[SEP] identifier[getFragmentId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] Other[0] operator[SEP] identifier[j] operator[<] identifier[trace] operator[SEP] identifier[getNodes] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[j] operator[++] operator[SEP] {
identifier[Node] identifier[node] operator[=] identifier[trace] operator[SEP] identifier[getNodes] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[j] operator[SEP] operator[SEP] Keyword[int] identifier[len] operator[=] identifier[nodeId] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[initialiseSourceInfo] operator[SEP] identifier[sourceInfoList] , identifier[tenantId] , identifier[trace] , identifier[nodeId] , identifier[j] , identifier[node] operator[SEP] operator[SEP] identifier[nodeId] operator[SEP] identifier[delete] operator[SEP] identifier[len] , identifier[nodeId] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[EndpointRef] identifier[ep] operator[=] identifier[EndpointUtil] operator[SEP] identifier[getSourceEndpoint] operator[SEP] identifier[trace] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] identifier[curpos] operator[SEP] identifier[j] operator[<] identifier[sourceInfoList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[j] operator[++] operator[SEP] {
identifier[SourceInfo] identifier[si] operator[=] identifier[sourceInfoList] operator[SEP] identifier[get] operator[SEP] identifier[j] operator[SEP] operator[SEP] identifier[si] operator[SEP] identifier[setEndpoint] operator[SEP] identifier[ep] operator[SEP] operator[SEP]
}
identifier[curpos] operator[=] identifier[sourceInfoList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[sourceInfoList] operator[SEP]
}
|
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
String url = this.getURL(req);
LOGGER.debug("Started processing request : {}", url);
List<String> resourcesToMerge = findResourcesToMerge(req.getContextPath(), url);
String extensionOrPath = detectExtension(url);//in case of non js/css files it null
if (extensionOrPath.isEmpty()) {
extensionOrPath = resourcesToMerge.get(0);//non grouped i.e. non css/js file, we refer it's path in that case
}
//If not modified, return 304 and stop
ResourceStatus status = JSCSSMergeServlet.isNotModified(this.getServletContext(), req, resourcesToMerge, this.turnOffETag);
if (status.isNotModified()) {
LOGGER.trace("Resources Not Modified. Sending 304.");
String ETag = !this.turnOffETag ? status.getActualETag() : null;
JSCSSMergeServlet.sendNotModified(resp, extensionOrPath, ETag, this.expiresMinutes, this.cacheControl, this.overrideExistingHeaders);
return;
}
//Add appropriate headers
this.addAppropriateResponseHeaders(extensionOrPath, resourcesToMerge, status.getActualETag(), resp);
OutputStream outputStream = resp.getOutputStream();
String contextPathForCss = customContextPathForCSSUrls != null ?
customContextPathForCSSUrls : req.getContextPath();
ProcessedResult processedResult = this.processResources(contextPathForCss, outputStream, resourcesToMerge);
int resourcesNotFound = processedResult.getNumberOfMissingResources();
if (resourcesNotFound > 0 && resourcesNotFound == resourcesToMerge.size()) { //all resources not found
resp.sendError(HttpServletResponse.SC_NOT_FOUND);
LOGGER.warn("All resources are not found. Sending 404.");
return;
}
if (outputStream != null) {
try {
resp.setStatus(HttpServletResponse.SC_OK);
outputStream.close();
} catch (Exception e) {
// ignore
}
}
resp.setHeader("Content-Length", String.valueOf(processedResult.contentLength));
LOGGER.debug("Finished processing Request : {}", url);
}
|
class class_name[name] begin[{]
method[doGet, return_type[void], modifier[protected], parameter[req, resp]] begin[{]
local_variable[type[String], url]
call[LOGGER.debug, parameter[literal["Started processing request : {}"], member[.url]]]
local_variable[type[List], resourcesToMerge]
local_variable[type[String], extensionOrPath]
if[call[extensionOrPath.isEmpty, parameter[]]] begin[{]
assign[member[.extensionOrPath], call[resourcesToMerge.get, parameter[literal[0]]]]
else begin[{]
None
end[}]
local_variable[type[ResourceStatus], status]
if[call[status.isNotModified, parameter[]]] begin[{]
call[LOGGER.trace, parameter[literal["Resources Not Modified. Sending 304."]]]
local_variable[type[String], ETag]
call[JSCSSMergeServlet.sendNotModified, parameter[member[.resp], member[.extensionOrPath], member[.ETag], THIS[member[None.expiresMinutes]], THIS[member[None.cacheControl]], THIS[member[None.overrideExistingHeaders]]]]
return[None]
else begin[{]
None
end[}]
THIS[call[None.addAppropriateResponseHeaders, parameter[member[.extensionOrPath], member[.resourcesToMerge], call[status.getActualETag, parameter[]], member[.resp]]]]
local_variable[type[OutputStream], outputStream]
local_variable[type[String], contextPathForCss]
local_variable[type[ProcessedResult], processedResult]
local_variable[type[int], resourcesNotFound]
if[binary_operation[binary_operation[member[.resourcesNotFound], >, literal[0]], &&, binary_operation[member[.resourcesNotFound], ==, call[resourcesToMerge.size, parameter[]]]]] begin[{]
call[resp.sendError, parameter[member[HttpServletResponse.SC_NOT_FOUND]]]
call[LOGGER.warn, parameter[literal["All resources are not found. Sending 404."]]]
return[None]
else begin[{]
None
end[}]
if[binary_operation[member[.outputStream], !=, literal[null]]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=SC_OK, postfix_operators=[], prefix_operators=[], qualifier=HttpServletResponse, selectors=[])], member=setStatus, postfix_operators=[], prefix_operators=[], qualifier=resp, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=outputStream, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
call[resp.setHeader, parameter[literal["Content-Length"], call[String.valueOf, parameter[member[processedResult.contentLength]]]]]
call[LOGGER.debug, parameter[literal["Finished processing Request : {}"], member[.url]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[doGet] operator[SEP] identifier[HttpServletRequest] identifier[req] , identifier[HttpServletResponse] identifier[resp] operator[SEP] Keyword[throws] identifier[ServletException] , identifier[IOException] {
identifier[String] identifier[url] operator[=] Keyword[this] operator[SEP] identifier[getURL] operator[SEP] identifier[req] operator[SEP] operator[SEP] identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[url] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[resourcesToMerge] operator[=] identifier[findResourcesToMerge] operator[SEP] identifier[req] operator[SEP] identifier[getContextPath] operator[SEP] operator[SEP] , identifier[url] operator[SEP] operator[SEP] identifier[String] identifier[extensionOrPath] operator[=] identifier[detectExtension] operator[SEP] identifier[url] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[extensionOrPath] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[extensionOrPath] operator[=] identifier[resourcesToMerge] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
identifier[ResourceStatus] identifier[status] operator[=] identifier[JSCSSMergeServlet] operator[SEP] identifier[isNotModified] operator[SEP] Keyword[this] operator[SEP] identifier[getServletContext] operator[SEP] operator[SEP] , identifier[req] , identifier[resourcesToMerge] , Keyword[this] operator[SEP] identifier[turnOffETag] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[status] operator[SEP] identifier[isNotModified] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[trace] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] identifier[ETag] operator[=] operator[!] Keyword[this] operator[SEP] identifier[turnOffETag] operator[?] identifier[status] operator[SEP] identifier[getActualETag] operator[SEP] operator[SEP] operator[:] Other[null] operator[SEP] identifier[JSCSSMergeServlet] operator[SEP] identifier[sendNotModified] operator[SEP] identifier[resp] , identifier[extensionOrPath] , identifier[ETag] , Keyword[this] operator[SEP] identifier[expiresMinutes] , Keyword[this] operator[SEP] identifier[cacheControl] , Keyword[this] operator[SEP] identifier[overrideExistingHeaders] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[this] operator[SEP] identifier[addAppropriateResponseHeaders] operator[SEP] identifier[extensionOrPath] , identifier[resourcesToMerge] , identifier[status] operator[SEP] identifier[getActualETag] operator[SEP] operator[SEP] , identifier[resp] operator[SEP] operator[SEP] identifier[OutputStream] identifier[outputStream] operator[=] identifier[resp] operator[SEP] identifier[getOutputStream] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[contextPathForCss] operator[=] identifier[customContextPathForCSSUrls] operator[!=] Other[null] operator[?] identifier[customContextPathForCSSUrls] operator[:] identifier[req] operator[SEP] identifier[getContextPath] operator[SEP] operator[SEP] operator[SEP] identifier[ProcessedResult] identifier[processedResult] operator[=] Keyword[this] operator[SEP] identifier[processResources] operator[SEP] identifier[contextPathForCss] , identifier[outputStream] , identifier[resourcesToMerge] operator[SEP] operator[SEP] Keyword[int] identifier[resourcesNotFound] operator[=] identifier[processedResult] operator[SEP] identifier[getNumberOfMissingResources] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[resourcesNotFound] operator[>] Other[0] operator[&&] identifier[resourcesNotFound] operator[==] identifier[resourcesToMerge] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] {
identifier[resp] operator[SEP] identifier[sendError] operator[SEP] identifier[HttpServletResponse] operator[SEP] identifier[SC_NOT_FOUND] operator[SEP] operator[SEP] identifier[LOGGER] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[outputStream] operator[!=] Other[null] operator[SEP] {
Keyword[try] {
identifier[resp] operator[SEP] identifier[setStatus] operator[SEP] identifier[HttpServletResponse] operator[SEP] identifier[SC_OK] operator[SEP] operator[SEP] identifier[outputStream] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
}
}
identifier[resp] operator[SEP] identifier[setHeader] operator[SEP] literal[String] , identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[processedResult] operator[SEP] identifier[contentLength] operator[SEP] operator[SEP] operator[SEP] identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[url] operator[SEP] operator[SEP]
}
|
public ServiceFuture<List<KeyItem>> getKeyVersionsNextAsync(final String nextPageLink, final ServiceFuture<List<KeyItem>> serviceFuture, final ListOperationCallback<KeyItem> serviceCallback) {
return AzureServiceFuture.fromPageResponse(
getKeyVersionsNextSinglePageAsync(nextPageLink),
new Func1<String, Observable<ServiceResponse<Page<KeyItem>>>>() {
@Override
public Observable<ServiceResponse<Page<KeyItem>>> call(String nextPageLink) {
return getKeyVersionsNextSinglePageAsync(nextPageLink);
}
},
serviceCallback);
}
|
class class_name[name] begin[{]
method[getKeyVersionsNextAsync, return_type[type[ServiceFuture]], modifier[public], parameter[nextPageLink, serviceFuture, serviceCallback]] begin[{]
return[call[AzureServiceFuture.fromPageResponse, parameter[call[.getKeyVersionsNextSinglePageAsync, parameter[member[.nextPageLink]]], 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=getKeyVersionsNextSinglePageAsync, 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=KeyItem, 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=KeyItem, 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[KeyItem] operator[>] operator[>] identifier[getKeyVersionsNextAsync] operator[SEP] Keyword[final] identifier[String] identifier[nextPageLink] , Keyword[final] identifier[ServiceFuture] operator[<] identifier[List] operator[<] identifier[KeyItem] operator[>] operator[>] identifier[serviceFuture] , Keyword[final] identifier[ListOperationCallback] operator[<] identifier[KeyItem] operator[>] identifier[serviceCallback] operator[SEP] {
Keyword[return] identifier[AzureServiceFuture] operator[SEP] identifier[fromPageResponse] operator[SEP] identifier[getKeyVersionsNextSinglePageAsync] operator[SEP] identifier[nextPageLink] operator[SEP] , Keyword[new] identifier[Func1] operator[<] identifier[String] , identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[KeyItem] operator[>] operator[>] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[KeyItem] operator[>] operator[>] operator[>] identifier[call] operator[SEP] identifier[String] identifier[nextPageLink] operator[SEP] {
Keyword[return] identifier[getKeyVersionsNextSinglePageAsync] operator[SEP] identifier[nextPageLink] operator[SEP] operator[SEP]
}
} , identifier[serviceCallback] operator[SEP] operator[SEP]
}
|
@Override
public String getDateLiteral(final String isoDate) {
if (isDateOnly(isoDate) || isTimeOnly(isoDate)) {
return "'" + isoDate + "'";
} else if (isDateTime(isoDate)) {
return "'" + isoDate.replace('T', ' ') + "'";
} else {
return "BAD_DATE_FORMAT:" + isoDate;
}
}
|
class class_name[name] begin[{]
method[getDateLiteral, return_type[type[String]], modifier[public], parameter[isoDate]] begin[{]
if[binary_operation[call[.isDateOnly, parameter[member[.isoDate]]], ||, call[.isTimeOnly, parameter[member[.isoDate]]]]] begin[{]
return[binary_operation[binary_operation[literal["'"], +, member[.isoDate]], +, literal["'"]]]
else begin[{]
if[call[.isDateTime, parameter[member[.isoDate]]]] begin[{]
return[binary_operation[binary_operation[literal["'"], +, call[isoDate.replace, parameter[literal['T'], literal[' ']]]], +, literal["'"]]]
else begin[{]
return[binary_operation[literal["BAD_DATE_FORMAT:"], +, member[.isoDate]]]
end[}]
end[}]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[getDateLiteral] operator[SEP] Keyword[final] identifier[String] identifier[isoDate] operator[SEP] {
Keyword[if] operator[SEP] identifier[isDateOnly] operator[SEP] identifier[isoDate] operator[SEP] operator[||] identifier[isTimeOnly] operator[SEP] identifier[isoDate] operator[SEP] operator[SEP] {
Keyword[return] literal[String] operator[+] identifier[isoDate] operator[+] literal[String] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[isDateTime] operator[SEP] identifier[isoDate] operator[SEP] operator[SEP] {
Keyword[return] literal[String] operator[+] identifier[isoDate] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[+] literal[String] operator[SEP]
}
Keyword[else] {
Keyword[return] literal[String] operator[+] identifier[isoDate] operator[SEP]
}
}
|
private Jedis getAndSetConnection()
{
Jedis conn = factory.getConnection();
this.connection = conn;
// If resource is not null means a transaction in progress.
if (settings != null)
{
for (String key : settings.keySet())
{
conn.configSet(key, settings.get(key).toString());
}
}
return conn;
}
|
class class_name[name] begin[{]
method[getAndSetConnection, return_type[type[Jedis]], modifier[private], parameter[]] begin[{]
local_variable[type[Jedis], conn]
assign[THIS[member[None.connection]], member[.conn]]
if[binary_operation[member[.settings], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=settings, selectors=[MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=configSet, postfix_operators=[], prefix_operators=[], qualifier=conn, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=settings, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=key)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
else begin[{]
None
end[}]
return[member[.conn]]
end[}]
END[}]
|
Keyword[private] identifier[Jedis] identifier[getAndSetConnection] operator[SEP] operator[SEP] {
identifier[Jedis] identifier[conn] operator[=] identifier[factory] operator[SEP] identifier[getConnection] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[connection] operator[=] identifier[conn] operator[SEP] Keyword[if] operator[SEP] identifier[settings] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[String] identifier[key] operator[:] identifier[settings] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[conn] operator[SEP] identifier[configSet] operator[SEP] identifier[key] , identifier[settings] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[conn] operator[SEP]
}
|
private void enlarge() {
int oldCapacity = keys.length;
if (oldCapacity == LinearProbing.MAXIMUM_CAPACITY)
throw new IllegalArgumentException(
"Map cannot grow beyond capacity: "
+ LinearProbing.MAXIMUM_CAPACITY);
K oldKeys[] = keys;
V oldValues[] = values;
int newCapacity = oldCapacity << 1;
@SuppressWarnings("unchecked")
K newKeys[] = (K[]) new Object[newCapacity];
@SuppressWarnings("unchecked")
V newValues[] = (V[]) new Object[newCapacity];
for (int i = 0; i < oldCapacity; i++) {
K key = oldKeys[i];
if (key != null)
putKeyValue(newKeys, newValues, key, oldValues[i]);
}
this.keys = newKeys;
this.values = newValues;
}
|
class class_name[name] begin[{]
method[enlarge, return_type[void], modifier[private], parameter[]] begin[{]
local_variable[type[int], oldCapacity]
if[binary_operation[member[.oldCapacity], ==, member[LinearProbing.MAXIMUM_CAPACITY]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Map cannot grow beyond capacity: "), operandr=MemberReference(member=MAXIMUM_CAPACITY, postfix_operators=[], prefix_operators=[], qualifier=LinearProbing, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[K], oldKeys]
local_variable[type[V], oldValues]
local_variable[type[int], newCapacity]
local_variable[type[K], newKeys]
local_variable[type[V], newValues]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=oldKeys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=key)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=K, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=newKeys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newValues, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=oldValues, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=putKeyValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=oldCapacity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
assign[THIS[member[None.keys]], member[.newKeys]]
assign[THIS[member[None.values]], member[.newValues]]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[enlarge] operator[SEP] operator[SEP] {
Keyword[int] identifier[oldCapacity] operator[=] identifier[keys] operator[SEP] identifier[length] operator[SEP] Keyword[if] operator[SEP] identifier[oldCapacity] operator[==] identifier[LinearProbing] operator[SEP] identifier[MAXIMUM_CAPACITY] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[LinearProbing] operator[SEP] identifier[MAXIMUM_CAPACITY] operator[SEP] operator[SEP] identifier[K] identifier[oldKeys] operator[SEP] operator[SEP] operator[=] identifier[keys] operator[SEP] identifier[V] identifier[oldValues] operator[SEP] operator[SEP] operator[=] identifier[values] operator[SEP] Keyword[int] identifier[newCapacity] operator[=] identifier[oldCapacity] operator[<<] Other[1] operator[SEP] annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] identifier[K] identifier[newKeys] operator[SEP] operator[SEP] operator[=] operator[SEP] identifier[K] operator[SEP] operator[SEP] operator[SEP] Keyword[new] identifier[Object] operator[SEP] identifier[newCapacity] operator[SEP] operator[SEP] annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] identifier[V] identifier[newValues] operator[SEP] operator[SEP] operator[=] operator[SEP] identifier[V] operator[SEP] operator[SEP] operator[SEP] Keyword[new] identifier[Object] operator[SEP] identifier[newCapacity] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[oldCapacity] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[K] identifier[key] operator[=] identifier[oldKeys] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[key] operator[!=] Other[null] operator[SEP] identifier[putKeyValue] operator[SEP] identifier[newKeys] , identifier[newValues] , identifier[key] , identifier[oldValues] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[keys] operator[=] identifier[newKeys] operator[SEP] Keyword[this] operator[SEP] identifier[values] operator[=] identifier[newValues] operator[SEP]
}
|
public static PylonStream fromString(String str) {
if (str == null || str.isEmpty()) {
throw new IllegalArgumentException("Cannot create a stream from an empty or null string");
}
PylonStream stream = new PylonStream();
stream.hash = str;
return stream;
}
|
class class_name[name] begin[{]
method[fromString, return_type[type[PylonStream]], modifier[public static], parameter[str]] begin[{]
if[binary_operation[binary_operation[member[.str], ==, literal[null]], ||, call[str.isEmpty, parameter[]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot create a stream from an empty or null string")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[PylonStream], stream]
assign[member[stream.hash], member[.str]]
return[member[.stream]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[PylonStream] identifier[fromString] operator[SEP] identifier[String] identifier[str] operator[SEP] {
Keyword[if] operator[SEP] identifier[str] operator[==] Other[null] operator[||] identifier[str] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[PylonStream] identifier[stream] operator[=] Keyword[new] identifier[PylonStream] operator[SEP] operator[SEP] operator[SEP] identifier[stream] operator[SEP] identifier[hash] operator[=] identifier[str] operator[SEP] Keyword[return] identifier[stream] operator[SEP]
}
|
public Cookie[] getCookieObjects() {
Cookie[] result = request.getCookies();
return result != null ? result : new Cookie[0];
}
|
class class_name[name] begin[{]
method[getCookieObjects, return_type[type[Cookie]], modifier[public], parameter[]] begin[{]
local_variable[type[Cookie], result]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=ArrayCreator(dimensions=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Cookie, sub_type=None)), if_true=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]
end[}]
END[}]
|
Keyword[public] identifier[Cookie] operator[SEP] operator[SEP] identifier[getCookieObjects] operator[SEP] operator[SEP] {
identifier[Cookie] operator[SEP] operator[SEP] identifier[result] operator[=] identifier[request] operator[SEP] identifier[getCookies] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[!=] Other[null] operator[?] identifier[result] operator[:] Keyword[new] identifier[Cookie] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
|
public static LicenseProvider createInstance(ZipFile zipFile, String laPrefix) {
JarFile jar = null;
try {
jar = getJarFile(zipFile);
} catch (IOException e) {
}
if (jar == null) {
return null;
}
return ContentLicenseProvider.createInstance(new Content.JarContent(jar), laPrefix);
}
|
class class_name[name] begin[{]
method[createInstance, return_type[type[LicenseProvider]], modifier[public static], parameter[zipFile, laPrefix]] begin[{]
local_variable[type[JarFile], jar]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=jar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=zipFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getJarFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
if[binary_operation[member[.jar], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
return[call[ContentLicenseProvider.createInstance, parameter[ClassCreator(arguments=[MemberReference(member=jar, 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=Content, sub_type=ReferenceType(arguments=None, dimensions=None, name=JarContent, sub_type=None))), member[.laPrefix]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[LicenseProvider] identifier[createInstance] operator[SEP] identifier[ZipFile] identifier[zipFile] , identifier[String] identifier[laPrefix] operator[SEP] {
identifier[JarFile] identifier[jar] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[jar] operator[=] identifier[getJarFile] operator[SEP] identifier[zipFile] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
}
Keyword[if] operator[SEP] identifier[jar] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[return] identifier[ContentLicenseProvider] operator[SEP] identifier[createInstance] operator[SEP] Keyword[new] identifier[Content] operator[SEP] identifier[JarContent] operator[SEP] identifier[jar] operator[SEP] , identifier[laPrefix] operator[SEP] operator[SEP]
}
|
@Override
public SwapEnvironmentCNAMEsResult swapEnvironmentCNAMEs(SwapEnvironmentCNAMEsRequest request) {
request = beforeClientExecution(request);
return executeSwapEnvironmentCNAMEs(request);
}
|
class class_name[name] begin[{]
method[swapEnvironmentCNAMEs, return_type[type[SwapEnvironmentCNAMEsResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeSwapEnvironmentCNAMEs, parameter[member[.request]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[SwapEnvironmentCNAMEsResult] identifier[swapEnvironmentCNAMEs] operator[SEP] identifier[SwapEnvironmentCNAMEsRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeSwapEnvironmentCNAMEs] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
protected void deleteEntryFiles() throws IOException {
File[] files = getDirectory().listFiles();
if(files == null) return;
String prefix = getEntryLogPrefix();
String suffix = getEntryLogSuffix();
for (File file : files) {
String fileName = file.getName();
if (fileName.startsWith(prefix) && fileName.endsWith(suffix)) {
if (file.delete()) {
_log.info("file " + file.getAbsolutePath() + " deleted");
} else {
_log.warn("file " + file.getAbsolutePath() + " not deleted");
}
}
}
}
|
class class_name[name] begin[{]
method[deleteEntryFiles, return_type[void], modifier[protected], parameter[]] begin[{]
local_variable[type[File], files]
if[binary_operation[member[.files], ==, literal[null]]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[String], prefix]
local_variable[type[String], suffix]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[], type_arguments=None), name=fileName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=prefix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=fileName, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=suffix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=endsWith, postfix_operators=[], prefix_operators=[], qualifier=fileName, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=delete, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="file "), operandr=MethodInvocation(arguments=[], member=getAbsolutePath, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" not deleted"), operator=+)], member=warn, postfix_operators=[], prefix_operators=[], qualifier=_log, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="file "), operandr=MethodInvocation(arguments=[], member=getAbsolutePath, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" deleted"), operator=+)], member=info, postfix_operators=[], prefix_operators=[], qualifier=_log, selectors=[], type_arguments=None), label=None)]))]))]), control=EnhancedForControl(iterable=MemberReference(member=files, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=file)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None))), label=None)
end[}]
END[}]
|
Keyword[protected] Keyword[void] identifier[deleteEntryFiles] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[File] operator[SEP] operator[SEP] identifier[files] operator[=] identifier[getDirectory] operator[SEP] operator[SEP] operator[SEP] identifier[listFiles] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[files] operator[==] Other[null] operator[SEP] Keyword[return] operator[SEP] identifier[String] identifier[prefix] operator[=] identifier[getEntryLogPrefix] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[suffix] operator[=] identifier[getEntryLogSuffix] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[File] identifier[file] operator[:] identifier[files] operator[SEP] {
identifier[String] identifier[fileName] operator[=] identifier[file] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[fileName] operator[SEP] identifier[startsWith] operator[SEP] identifier[prefix] operator[SEP] operator[&&] identifier[fileName] operator[SEP] identifier[endsWith] operator[SEP] identifier[suffix] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[file] operator[SEP] identifier[delete] operator[SEP] operator[SEP] operator[SEP] {
identifier[_log] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[file] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[_log] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] identifier[file] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
}
}
|
public void fixupVariables(java.util.Vector vars, int globalsSize)
{
super.fixupVariables(vars, globalsSize);
if(null != m_arg2)
m_arg2.fixupVariables(vars, globalsSize);
}
|
class class_name[name] begin[{]
method[fixupVariables, return_type[void], modifier[public], parameter[vars, globalsSize]] begin[{]
SuperMethodInvocation(arguments=[MemberReference(member=vars, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=globalsSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=fixupVariables, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
if[binary_operation[literal[null], !=, member[.m_arg2]]] begin[{]
call[m_arg2.fixupVariables, parameter[member[.vars], member[.globalsSize]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[fixupVariables] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Vector] identifier[vars] , Keyword[int] identifier[globalsSize] operator[SEP] {
Keyword[super] operator[SEP] identifier[fixupVariables] operator[SEP] identifier[vars] , identifier[globalsSize] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[!=] identifier[m_arg2] operator[SEP] identifier[m_arg2] operator[SEP] identifier[fixupVariables] operator[SEP] identifier[vars] , identifier[globalsSize] operator[SEP] operator[SEP]
}
|
public boolean importStylesheetList(String listNr, List listIn) {
RtfList rtfList = new RtfList(this.rtfDoc, listIn);
rtfList.setRtfDocument(this.rtfDoc);
// TODO HGS - Finish implementation of import
//this.importStylesheetListMapping.put(listNr, Integer.toString(this.rtfDoc.getDocumentHeader().getRtfParagraphStyle(styleName)(rtfList)));
return true;
}
|
class class_name[name] begin[{]
method[importStylesheetList, return_type[type[boolean]], modifier[public], parameter[listNr, listIn]] begin[{]
local_variable[type[RtfList], rtfList]
call[rtfList.setRtfDocument, parameter[THIS[member[None.rtfDoc]]]]
return[literal[true]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[importStylesheetList] operator[SEP] identifier[String] identifier[listNr] , identifier[List] identifier[listIn] operator[SEP] {
identifier[RtfList] identifier[rtfList] operator[=] Keyword[new] identifier[RtfList] operator[SEP] Keyword[this] operator[SEP] identifier[rtfDoc] , identifier[listIn] operator[SEP] operator[SEP] identifier[rtfList] operator[SEP] identifier[setRtfDocument] operator[SEP] Keyword[this] operator[SEP] identifier[rtfDoc] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
|
public static Intent getCameraCaptureIntent(Context ctx, String authority){
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
try {
// Get the app's local file storage
mCurrentCaptureUri = createAccessibleTempFile(ctx, authority);
grantPermissions(ctx, mCurrentCaptureUri);
intent.putExtra(MediaStore.EXTRA_OUTPUT, mCurrentCaptureUri);
} catch (IOException e) {
e.printStackTrace();
}
return intent;
}
|
class class_name[name] begin[{]
method[getCameraCaptureIntent, return_type[type[Intent]], modifier[public static], parameter[ctx, authority]] begin[{]
local_variable[type[Intent], intent]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=mCurrentCaptureUri, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=ctx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=authority, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createAccessibleTempFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ctx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=mCurrentCaptureUri, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=grantPermissions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=EXTRA_OUTPUT, postfix_operators=[], prefix_operators=[], qualifier=MediaStore, selectors=[]), MemberReference(member=mCurrentCaptureUri, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=putExtra, postfix_operators=[], prefix_operators=[], qualifier=intent, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
return[member[.intent]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Intent] identifier[getCameraCaptureIntent] operator[SEP] identifier[Context] identifier[ctx] , identifier[String] identifier[authority] operator[SEP] {
identifier[Intent] identifier[intent] operator[=] Keyword[new] identifier[Intent] operator[SEP] identifier[MediaStore] operator[SEP] identifier[ACTION_IMAGE_CAPTURE] operator[SEP] operator[SEP] Keyword[try] {
identifier[mCurrentCaptureUri] operator[=] identifier[createAccessibleTempFile] operator[SEP] identifier[ctx] , identifier[authority] operator[SEP] operator[SEP] identifier[grantPermissions] operator[SEP] identifier[ctx] , identifier[mCurrentCaptureUri] operator[SEP] operator[SEP] identifier[intent] operator[SEP] identifier[putExtra] operator[SEP] identifier[MediaStore] operator[SEP] identifier[EXTRA_OUTPUT] , identifier[mCurrentCaptureUri] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[intent] operator[SEP]
}
|
public void pad(int width) throws JSONException {
try {
this.bitwriter.pad(width);
} catch (Throwable e) {
throw new JSONException(e);
}
}
|
class class_name[name] begin[{]
method[pad, return_type[void], modifier[public], parameter[width]] begin[{]
TryStatement(block=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=bitwriter, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=width, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=pad, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=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=JSONException, 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[pad] operator[SEP] Keyword[int] identifier[width] operator[SEP] Keyword[throws] identifier[JSONException] {
Keyword[try] {
Keyword[this] operator[SEP] identifier[bitwriter] operator[SEP] identifier[pad] operator[SEP] identifier[width] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[JSONException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
@Handler(priority = -10000)
public void onStop(Stop event) throws InterruptedException {
synchronized (this) {
if (runner == null) {
return;
}
// It just might happen that the wakeup() occurs between the
// check for running and the select() in the thread's run loop,
// but we -- obviously -- cannot put the select() in a
// synchronized(this).
while (runner.isAlive()) {
runner.interrupt(); // *Should* be sufficient, but...
selector.wakeup(); // Make sure
runner.join(10);
}
runner = null;
}
}
|
class class_name[name] begin[{]
method[onStop, return_type[void], modifier[public], parameter[event]] begin[{]
SYNCHRONIZED[THIS[]] BEGIN[{]
if[binary_operation[member[.runner], ==, literal[null]]] begin[{]
return[None]
else begin[{]
None
end[}]
while[call[runner.isAlive, parameter[]]] begin[{]
call[runner.interrupt, parameter[]]
call[selector.wakeup, parameter[]]
call[runner.join, parameter[literal[10]]]
end[}]
assign[member[.runner], literal[null]]
END[}]
end[}]
END[}]
|
annotation[@] identifier[Handler] operator[SEP] identifier[priority] operator[=] operator[-] Other[10000] operator[SEP] Keyword[public] Keyword[void] identifier[onStop] operator[SEP] identifier[Stop] identifier[event] operator[SEP] Keyword[throws] identifier[InterruptedException] {
Keyword[synchronized] operator[SEP] Keyword[this] operator[SEP] {
Keyword[if] operator[SEP] identifier[runner] operator[==] Other[null] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[while] operator[SEP] identifier[runner] operator[SEP] identifier[isAlive] operator[SEP] operator[SEP] operator[SEP] {
identifier[runner] operator[SEP] identifier[interrupt] operator[SEP] operator[SEP] operator[SEP] identifier[selector] operator[SEP] identifier[wakeup] operator[SEP] operator[SEP] operator[SEP] identifier[runner] operator[SEP] identifier[join] operator[SEP] Other[10] operator[SEP] operator[SEP]
}
identifier[runner] operator[=] Other[null] operator[SEP]
}
}
|
public void openDrawer() {
if (drawerLayout != null && sliderLayout != null) {
if (drawerGravity != 0) {
drawerLayout.openDrawer(drawerGravity);
} else {
drawerLayout.openDrawer(sliderLayout);
}
}
}
|
class class_name[name] begin[{]
method[openDrawer, return_type[void], modifier[public], parameter[]] begin[{]
if[binary_operation[binary_operation[member[.drawerLayout], !=, literal[null]], &&, binary_operation[member[.sliderLayout], !=, literal[null]]]] begin[{]
if[binary_operation[member[.drawerGravity], !=, literal[0]]] begin[{]
call[drawerLayout.openDrawer, parameter[member[.drawerGravity]]]
else begin[{]
call[drawerLayout.openDrawer, parameter[member[.sliderLayout]]]
end[}]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[openDrawer] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[drawerLayout] operator[!=] Other[null] operator[&&] identifier[sliderLayout] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[drawerGravity] operator[!=] Other[0] operator[SEP] {
identifier[drawerLayout] operator[SEP] identifier[openDrawer] operator[SEP] identifier[drawerGravity] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[drawerLayout] operator[SEP] identifier[openDrawer] operator[SEP] identifier[sliderLayout] operator[SEP] operator[SEP]
}
}
}
|
public static List<HBaseConsumerState> create(SortedMap<byte[], byte[]> stateMap) {
List<HBaseConsumerState> states = new ArrayList<HBaseConsumerState>(stateMap.size());
for (Map.Entry<byte[], byte[]> entry : stateMap.entrySet()) {
// Intentionally using HBase Bytes.
long groupId = Bytes.toLong(entry.getKey());
int instanceId = Bytes.toInt(entry.getKey(), LONG_BYTES);
states.add(new HBaseConsumerState(entry.getValue(), groupId, instanceId));
}
return states;
}
|
class class_name[name] begin[{]
method[create, return_type[type[List]], modifier[public static], parameter[stateMap]] begin[{]
local_variable[type[List], states]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None)], member=toLong, postfix_operators=[], prefix_operators=[], qualifier=Bytes, selectors=[], type_arguments=None), name=groupId)], modifiers=set(), type=BasicType(dimensions=[], name=long)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), MemberReference(member=LONG_BYTES, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toInt, postfix_operators=[], prefix_operators=[], qualifier=Bytes, selectors=[], type_arguments=None), name=instanceId)], modifiers=set(), type=BasicType(dimensions=[], name=int)), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), MemberReference(member=groupId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=instanceId, 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=HBaseConsumerState, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=states, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=stateMap, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=BasicType(dimensions=[None], name=byte)), TypeArgument(pattern_type=None, type=BasicType(dimensions=[None], name=byte))], dimensions=None, name=Entry, sub_type=None)))), label=None)
return[member[.states]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[List] operator[<] identifier[HBaseConsumerState] operator[>] identifier[create] operator[SEP] identifier[SortedMap] operator[<] Keyword[byte] operator[SEP] operator[SEP] , Keyword[byte] operator[SEP] operator[SEP] operator[>] identifier[stateMap] operator[SEP] {
identifier[List] operator[<] identifier[HBaseConsumerState] operator[>] identifier[states] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[HBaseConsumerState] operator[>] operator[SEP] identifier[stateMap] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] Keyword[byte] operator[SEP] operator[SEP] , Keyword[byte] operator[SEP] operator[SEP] operator[>] identifier[entry] operator[:] identifier[stateMap] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[long] identifier[groupId] operator[=] identifier[Bytes] operator[SEP] identifier[toLong] operator[SEP] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[instanceId] operator[=] identifier[Bytes] operator[SEP] identifier[toInt] operator[SEP] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[LONG_BYTES] operator[SEP] operator[SEP] identifier[states] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[HBaseConsumerState] operator[SEP] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] , identifier[groupId] , identifier[instanceId] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[states] operator[SEP]
}
|
private KeyPersonCompensationDataType getCompensation(
KeyPersonDto keyPerson, int budgetPeriod) {
KeyPersonCompensationDataType keyPersonCompensation = KeyPersonCompensationDataType.Factory
.newInstance();
ScaleTwoDecimal baseSalaryByPeriod;
if (keyPerson != null) {
if (keyPerson.getAcademicMonths() != null) {
keyPersonCompensation.setAcademicMonths(keyPerson
.getAcademicMonths().bigDecimalValue());
}
if (keyPerson.getCalendarMonths() != null) {
keyPersonCompensation.setCalendarMonths(keyPerson
.getCalendarMonths().bigDecimalValue());
}
if (keyPerson.getFringe() != null) {
keyPersonCompensation.setFringeBenefits(keyPerson.getFringe()
.bigDecimalValue());
}
if (keyPerson.getSummerMonths() != null) {
keyPersonCompensation.setSummerMonths(keyPerson
.getSummerMonths().bigDecimalValue());
}
if (keyPerson.getRequestedSalary() != null) {
keyPersonCompensation.setRequestedSalary(keyPerson
.getRequestedSalary().bigDecimalValue());
}
if (keyPerson.getFundsRequested() != null) {
keyPersonCompensation.setFundsRequested(keyPerson
.getFundsRequested().bigDecimalValue());
}
if (pdDoc.getDevelopmentProposal().getBudgets() != null) {
baseSalaryByPeriod = s2sBudgetCalculatorService.getBaseSalaryByPeriod(pdDoc.getDevelopmentProposal().getBudgets().get(0)
.getBudgetId(), budgetPeriod, keyPerson);
if (baseSalaryByPeriod != null && baseSalaryByPeriod.isGreaterThan(ScaleTwoDecimal.ZERO)) {
keyPersonCompensation.setBaseSalary(baseSalaryByPeriod.bigDecimalValue());
}
else {
if (keyPerson.getBaseSalary() != null) {
keyPersonCompensation.setBaseSalary(keyPerson.getBaseSalary().bigDecimalValue());
}
}
}
else {
if (keyPerson.getBaseSalary() != null) {
keyPersonCompensation.setBaseSalary(keyPerson.getBaseSalary().bigDecimalValue());
}
}
}
return keyPersonCompensation;
}
|
class class_name[name] begin[{]
method[getCompensation, return_type[type[KeyPersonCompensationDataType]], modifier[private], parameter[keyPerson, budgetPeriod]] begin[{]
local_variable[type[KeyPersonCompensationDataType], keyPersonCompensation]
local_variable[type[ScaleTwoDecimal], baseSalaryByPeriod]
if[binary_operation[member[.keyPerson], !=, literal[null]]] begin[{]
if[binary_operation[call[keyPerson.getAcademicMonths, parameter[]], !=, literal[null]]] begin[{]
call[keyPersonCompensation.setAcademicMonths, parameter[call[keyPerson.getAcademicMonths, parameter[]]]]
else begin[{]
None
end[}]
if[binary_operation[call[keyPerson.getCalendarMonths, parameter[]], !=, literal[null]]] begin[{]
call[keyPersonCompensation.setCalendarMonths, parameter[call[keyPerson.getCalendarMonths, parameter[]]]]
else begin[{]
None
end[}]
if[binary_operation[call[keyPerson.getFringe, parameter[]], !=, literal[null]]] begin[{]
call[keyPersonCompensation.setFringeBenefits, parameter[call[keyPerson.getFringe, parameter[]]]]
else begin[{]
None
end[}]
if[binary_operation[call[keyPerson.getSummerMonths, parameter[]], !=, literal[null]]] begin[{]
call[keyPersonCompensation.setSummerMonths, parameter[call[keyPerson.getSummerMonths, parameter[]]]]
else begin[{]
None
end[}]
if[binary_operation[call[keyPerson.getRequestedSalary, parameter[]], !=, literal[null]]] begin[{]
call[keyPersonCompensation.setRequestedSalary, parameter[call[keyPerson.getRequestedSalary, parameter[]]]]
else begin[{]
None
end[}]
if[binary_operation[call[keyPerson.getFundsRequested, parameter[]], !=, literal[null]]] begin[{]
call[keyPersonCompensation.setFundsRequested, parameter[call[keyPerson.getFundsRequested, parameter[]]]]
else begin[{]
None
end[}]
if[binary_operation[call[pdDoc.getDevelopmentProposal, parameter[]], !=, literal[null]]] begin[{]
assign[member[.baseSalaryByPeriod], call[s2sBudgetCalculatorService.getBaseSalaryByPeriod, parameter[call[pdDoc.getDevelopmentProposal, parameter[]], member[.budgetPeriod], member[.keyPerson]]]]
if[binary_operation[binary_operation[member[.baseSalaryByPeriod], !=, literal[null]], &&, call[baseSalaryByPeriod.isGreaterThan, parameter[member[ScaleTwoDecimal.ZERO]]]]] begin[{]
call[keyPersonCompensation.setBaseSalary, parameter[call[baseSalaryByPeriod.bigDecimalValue, parameter[]]]]
else begin[{]
if[binary_operation[call[keyPerson.getBaseSalary, parameter[]], !=, literal[null]]] begin[{]
call[keyPersonCompensation.setBaseSalary, parameter[call[keyPerson.getBaseSalary, parameter[]]]]
else begin[{]
None
end[}]
end[}]
else begin[{]
if[binary_operation[call[keyPerson.getBaseSalary, parameter[]], !=, literal[null]]] begin[{]
call[keyPersonCompensation.setBaseSalary, parameter[call[keyPerson.getBaseSalary, parameter[]]]]
else begin[{]
None
end[}]
end[}]
else begin[{]
None
end[}]
return[member[.keyPersonCompensation]]
end[}]
END[}]
|
Keyword[private] identifier[KeyPersonCompensationDataType] identifier[getCompensation] operator[SEP] identifier[KeyPersonDto] identifier[keyPerson] , Keyword[int] identifier[budgetPeriod] operator[SEP] {
identifier[KeyPersonCompensationDataType] identifier[keyPersonCompensation] operator[=] identifier[KeyPersonCompensationDataType] operator[SEP] identifier[Factory] operator[SEP] identifier[newInstance] operator[SEP] operator[SEP] operator[SEP] identifier[ScaleTwoDecimal] identifier[baseSalaryByPeriod] operator[SEP] Keyword[if] operator[SEP] identifier[keyPerson] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[keyPerson] operator[SEP] identifier[getAcademicMonths] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[keyPersonCompensation] operator[SEP] identifier[setAcademicMonths] operator[SEP] identifier[keyPerson] operator[SEP] identifier[getAcademicMonths] operator[SEP] operator[SEP] operator[SEP] identifier[bigDecimalValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[keyPerson] operator[SEP] identifier[getCalendarMonths] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[keyPersonCompensation] operator[SEP] identifier[setCalendarMonths] operator[SEP] identifier[keyPerson] operator[SEP] identifier[getCalendarMonths] operator[SEP] operator[SEP] operator[SEP] identifier[bigDecimalValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[keyPerson] operator[SEP] identifier[getFringe] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[keyPersonCompensation] operator[SEP] identifier[setFringeBenefits] operator[SEP] identifier[keyPerson] operator[SEP] identifier[getFringe] operator[SEP] operator[SEP] operator[SEP] identifier[bigDecimalValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[keyPerson] operator[SEP] identifier[getSummerMonths] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[keyPersonCompensation] operator[SEP] identifier[setSummerMonths] operator[SEP] identifier[keyPerson] operator[SEP] identifier[getSummerMonths] operator[SEP] operator[SEP] operator[SEP] identifier[bigDecimalValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[keyPerson] operator[SEP] identifier[getRequestedSalary] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[keyPersonCompensation] operator[SEP] identifier[setRequestedSalary] operator[SEP] identifier[keyPerson] operator[SEP] identifier[getRequestedSalary] operator[SEP] operator[SEP] operator[SEP] identifier[bigDecimalValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[keyPerson] operator[SEP] identifier[getFundsRequested] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[keyPersonCompensation] operator[SEP] identifier[setFundsRequested] operator[SEP] identifier[keyPerson] operator[SEP] identifier[getFundsRequested] operator[SEP] operator[SEP] operator[SEP] identifier[bigDecimalValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[pdDoc] operator[SEP] identifier[getDevelopmentProposal] operator[SEP] operator[SEP] operator[SEP] identifier[getBudgets] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[baseSalaryByPeriod] operator[=] identifier[s2sBudgetCalculatorService] operator[SEP] identifier[getBaseSalaryByPeriod] operator[SEP] identifier[pdDoc] operator[SEP] identifier[getDevelopmentProposal] operator[SEP] operator[SEP] operator[SEP] identifier[getBudgets] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[getBudgetId] operator[SEP] operator[SEP] , identifier[budgetPeriod] , identifier[keyPerson] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[baseSalaryByPeriod] operator[!=] Other[null] operator[&&] identifier[baseSalaryByPeriod] operator[SEP] identifier[isGreaterThan] operator[SEP] identifier[ScaleTwoDecimal] operator[SEP] identifier[ZERO] operator[SEP] operator[SEP] {
identifier[keyPersonCompensation] operator[SEP] identifier[setBaseSalary] operator[SEP] identifier[baseSalaryByPeriod] operator[SEP] identifier[bigDecimalValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[keyPerson] operator[SEP] identifier[getBaseSalary] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[keyPersonCompensation] operator[SEP] identifier[setBaseSalary] operator[SEP] identifier[keyPerson] operator[SEP] identifier[getBaseSalary] operator[SEP] operator[SEP] operator[SEP] identifier[bigDecimalValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[keyPerson] operator[SEP] identifier[getBaseSalary] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[keyPersonCompensation] operator[SEP] identifier[setBaseSalary] operator[SEP] identifier[keyPerson] operator[SEP] identifier[getBaseSalary] operator[SEP] operator[SEP] operator[SEP] identifier[bigDecimalValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[keyPersonCompensation] operator[SEP]
}
|
public Currency addCurrency(String name, String plural, String minor, String minorPlural, String sign, boolean save) {
return addCurrency(name, plural, minor, minorPlural, sign, save, false);
}
|
class class_name[name] begin[{]
method[addCurrency, return_type[type[Currency]], modifier[public], parameter[name, plural, minor, minorPlural, sign, save]] begin[{]
return[call[.addCurrency, parameter[member[.name], member[.plural], member[.minor], member[.minorPlural], member[.sign], member[.save], literal[false]]]]
end[}]
END[}]
|
Keyword[public] identifier[Currency] identifier[addCurrency] operator[SEP] identifier[String] identifier[name] , identifier[String] identifier[plural] , identifier[String] identifier[minor] , identifier[String] identifier[minorPlural] , identifier[String] identifier[sign] , Keyword[boolean] identifier[save] operator[SEP] {
Keyword[return] identifier[addCurrency] operator[SEP] identifier[name] , identifier[plural] , identifier[minor] , identifier[minorPlural] , identifier[sign] , identifier[save] , literal[boolean] operator[SEP] operator[SEP]
}
|
public ListAccess<User> findUsersByQuery(Query query, UserStatus status) throws Exception
{
return query.isEmpty() ? new SimpleJCRUserListAccess(service, status) : new UserByQueryJCRUserListAccess(
service, query, status);
}
|
class class_name[name] begin[{]
method[findUsersByQuery, return_type[type[ListAccess]], modifier[public], parameter[query, status]] begin[{]
return[TernaryExpression(condition=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=[], qualifier=query, selectors=[], type_arguments=None), if_false=ClassCreator(arguments=[MemberReference(member=service, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=query, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=status, 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=UserByQueryJCRUserListAccess, sub_type=None)), if_true=ClassCreator(arguments=[MemberReference(member=service, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=status, 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=SimpleJCRUserListAccess, sub_type=None)))]
end[}]
END[}]
|
Keyword[public] identifier[ListAccess] operator[<] identifier[User] operator[>] identifier[findUsersByQuery] operator[SEP] identifier[Query] identifier[query] , identifier[UserStatus] identifier[status] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[return] identifier[query] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[?] Keyword[new] identifier[SimpleJCRUserListAccess] operator[SEP] identifier[service] , identifier[status] operator[SEP] operator[:] Keyword[new] identifier[UserByQueryJCRUserListAccess] operator[SEP] identifier[service] , identifier[query] , identifier[status] operator[SEP] operator[SEP]
}
|
public static void fastinverseDelta(int[] data) {
int sz0 = data.length / 4 * 4;
int i = 1;
if (sz0 >= 4) {
int a = data[0];
for (; i < sz0 - 4; i += 4) {
a = data[i] += a;
a = data[i + 1] += a;
a = data[i + 2] += a;
a = data[i + 3] += a;
}
}
for (; i != data.length; ++i) {
data[i] += data[i - 1];
}
}
|
class class_name[name] begin[{]
method[fastinverseDelta, return_type[void], modifier[public static], parameter[data]] begin[{]
local_variable[type[int], sz0]
local_variable[type[int], i]
if[binary_operation[member[.sz0], >=, literal[4]]] begin[{]
local_variable[type[int], a]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Assignment(expressionl=MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type=+=, value=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Assignment(expressionl=MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+))]), type=+=, value=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Assignment(expressionl=MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=+))]), type=+=, value=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Assignment(expressionl=MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3), operator=+))]), type=+=, value=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=sz0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4), operator=-), operator=<), init=None, update=[Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4))]), label=None)
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type=+=, value=MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-))])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[]), operator=!=), init=None, update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[fastinverseDelta] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[data] operator[SEP] {
Keyword[int] identifier[sz0] operator[=] identifier[data] operator[SEP] identifier[length] operator[/] Other[4] operator[*] Other[4] operator[SEP] Keyword[int] identifier[i] operator[=] Other[1] operator[SEP] Keyword[if] operator[SEP] identifier[sz0] operator[>=] Other[4] operator[SEP] {
Keyword[int] identifier[a] operator[=] identifier[data] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[for] operator[SEP] operator[SEP] identifier[i] operator[<] identifier[sz0] operator[-] Other[4] operator[SEP] identifier[i] operator[+=] Other[4] operator[SEP] {
identifier[a] operator[=] identifier[data] operator[SEP] identifier[i] operator[SEP] operator[+=] identifier[a] operator[SEP] identifier[a] operator[=] identifier[data] operator[SEP] identifier[i] operator[+] Other[1] operator[SEP] operator[+=] identifier[a] operator[SEP] identifier[a] operator[=] identifier[data] operator[SEP] identifier[i] operator[+] Other[2] operator[SEP] operator[+=] identifier[a] operator[SEP] identifier[a] operator[=] identifier[data] operator[SEP] identifier[i] operator[+] Other[3] operator[SEP] operator[+=] identifier[a] operator[SEP]
}
}
Keyword[for] operator[SEP] operator[SEP] identifier[i] operator[!=] identifier[data] operator[SEP] identifier[length] operator[SEP] operator[++] identifier[i] operator[SEP] {
identifier[data] operator[SEP] identifier[i] operator[SEP] operator[+=] identifier[data] operator[SEP] identifier[i] operator[-] Other[1] operator[SEP] operator[SEP]
}
}
|
public Statistics doCell( Example cell ) throws Exception
{
Statistics stats = new Statistics();
Call call = new Call( send );
call.will(Annotate.exception( cell )).when(ResultIs.exception());
call.will(Compile.statistics(stats)).when(ResultIs.exception());
call.execute( cell.getContent() );
return stats;
}
|
class class_name[name] begin[{]
method[doCell, return_type[type[Statistics]], modifier[public], parameter[cell]] begin[{]
local_variable[type[Statistics], stats]
local_variable[type[Call], call]
call[call.will, parameter[call[Annotate.exception, parameter[member[.cell]]]]]
call[call.will, parameter[call[Compile.statistics, parameter[member[.stats]]]]]
call[call.execute, parameter[call[cell.getContent, parameter[]]]]
return[member[.stats]]
end[}]
END[}]
|
Keyword[public] identifier[Statistics] identifier[doCell] operator[SEP] identifier[Example] identifier[cell] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[Statistics] identifier[stats] operator[=] Keyword[new] identifier[Statistics] operator[SEP] operator[SEP] operator[SEP] identifier[Call] identifier[call] operator[=] Keyword[new] identifier[Call] operator[SEP] identifier[send] operator[SEP] operator[SEP] identifier[call] operator[SEP] identifier[will] operator[SEP] identifier[Annotate] operator[SEP] identifier[exception] operator[SEP] identifier[cell] operator[SEP] operator[SEP] operator[SEP] identifier[when] operator[SEP] identifier[ResultIs] operator[SEP] identifier[exception] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[call] operator[SEP] identifier[will] operator[SEP] identifier[Compile] operator[SEP] identifier[statistics] operator[SEP] identifier[stats] operator[SEP] operator[SEP] operator[SEP] identifier[when] operator[SEP] identifier[ResultIs] operator[SEP] identifier[exception] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[call] operator[SEP] identifier[execute] operator[SEP] identifier[cell] operator[SEP] identifier[getContent] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[stats] operator[SEP]
}
|
public Properties producerConfig() {
Properties props = new Properties();
props.put("bootstrap.servers", connectionString());
props.put("acks", "all");
props.put("batch.size", "100");
props.put("client.id", "kafka-junit");
props.put("request.timeout.ms", "5000");
props.put("max.in.flight.requests.per.connection", "1");
props.put(ProducerConfig.RETRIES_CONFIG, Integer.MAX_VALUE);
props.put(ProducerConfig.LINGER_MS_CONFIG, 0);
return props;
}
|
class class_name[name] begin[{]
method[producerConfig, return_type[type[Properties]], modifier[public], parameter[]] begin[{]
local_variable[type[Properties], props]
call[props.put, parameter[literal["bootstrap.servers"], call[.connectionString, parameter[]]]]
call[props.put, parameter[literal["acks"], literal["all"]]]
call[props.put, parameter[literal["batch.size"], literal["100"]]]
call[props.put, parameter[literal["client.id"], literal["kafka-junit"]]]
call[props.put, parameter[literal["request.timeout.ms"], literal["5000"]]]
call[props.put, parameter[literal["max.in.flight.requests.per.connection"], literal["1"]]]
call[props.put, parameter[member[ProducerConfig.RETRIES_CONFIG], member[Integer.MAX_VALUE]]]
call[props.put, parameter[member[ProducerConfig.LINGER_MS_CONFIG], literal[0]]]
return[member[.props]]
end[}]
END[}]
|
Keyword[public] identifier[Properties] identifier[producerConfig] operator[SEP] operator[SEP] {
identifier[Properties] identifier[props] operator[=] Keyword[new] identifier[Properties] operator[SEP] operator[SEP] operator[SEP] identifier[props] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[connectionString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[props] operator[SEP] identifier[put] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[props] operator[SEP] identifier[put] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[props] operator[SEP] identifier[put] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[props] operator[SEP] identifier[put] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[props] operator[SEP] identifier[put] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[props] operator[SEP] identifier[put] operator[SEP] identifier[ProducerConfig] operator[SEP] identifier[RETRIES_CONFIG] , identifier[Integer] operator[SEP] identifier[MAX_VALUE] operator[SEP] operator[SEP] identifier[props] operator[SEP] identifier[put] operator[SEP] identifier[ProducerConfig] operator[SEP] identifier[LINGER_MS_CONFIG] , Other[0] operator[SEP] operator[SEP] Keyword[return] identifier[props] operator[SEP]
}
|
private static RelatedTablesCoreExtension getRelatedTableExtension(
GeoPackageCore geoPackage) {
return new RelatedTablesCoreExtension(geoPackage) {
@Override
public String getPrimaryKeyColumnName(String tableName) {
return null;
}
};
}
|
class class_name[name] begin[{]
method[getRelatedTableExtension, return_type[type[RelatedTablesCoreExtension]], modifier[private static], parameter[geoPackage]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=geoPackage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)], documentation=None, modifiers={'public'}, name=getPrimaryKeyColumnName, parameters=[FormalParameter(annotations=[], modifiers=set(), name=tableName, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RelatedTablesCoreExtension, sub_type=None))]
end[}]
END[}]
|
Keyword[private] Keyword[static] identifier[RelatedTablesCoreExtension] identifier[getRelatedTableExtension] operator[SEP] identifier[GeoPackageCore] identifier[geoPackage] operator[SEP] {
Keyword[return] Keyword[new] identifier[RelatedTablesCoreExtension] operator[SEP] identifier[geoPackage] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[getPrimaryKeyColumnName] operator[SEP] identifier[String] identifier[tableName] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
} operator[SEP]
}
|
public ConciseSet convert(int... a)
{
ConciseSet res = empty();
if (a != null) {
a = Arrays.copyOf(a, a.length);
Arrays.sort(a);
for (int i : a) {
if (res.last != i) {
res.add(i);
}
}
}
return res;
}
|
class class_name[name] begin[{]
method[convert, return_type[type[ConciseSet]], modifier[public], parameter[a]] begin[{]
local_variable[type[ConciseSet], res]
if[binary_operation[member[.a], !=, literal[null]]] begin[{]
assign[member[.a], call[Arrays.copyOf, parameter[member[.a], member[a.length]]]]
call[Arrays.sort, parameter[member[.a]]]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=last, postfix_operators=[], prefix_operators=[], qualifier=res, selectors=[]), operandr=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=res, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int))), label=None)
else begin[{]
None
end[}]
return[member[.res]]
end[}]
END[}]
|
Keyword[public] identifier[ConciseSet] identifier[convert] operator[SEP] Keyword[int] operator[...] identifier[a] operator[SEP] {
identifier[ConciseSet] identifier[res] operator[=] identifier[empty] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[a] operator[!=] Other[null] operator[SEP] {
identifier[a] operator[=] identifier[Arrays] operator[SEP] identifier[copyOf] operator[SEP] identifier[a] , identifier[a] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[Arrays] operator[SEP] identifier[sort] operator[SEP] identifier[a] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[:] identifier[a] operator[SEP] {
Keyword[if] operator[SEP] identifier[res] operator[SEP] identifier[last] operator[!=] identifier[i] operator[SEP] {
identifier[res] operator[SEP] identifier[add] operator[SEP] identifier[i] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[res] operator[SEP]
}
|
public static List<LasCell> getLasCells( ASpatialDb db, Envelope envelope, Geometry exactGeometry, boolean doPosition,
boolean doIntensity, boolean doReturns, boolean doTime, boolean doColor, int limitTo ) throws Exception {
List<LasCell> lasCells = new ArrayList<>();
String sql = "SELECT " + COLUMN_GEOM + "," + COLUMN_ID + "," + COLUMN_SOURCE_ID + "," + COLUMN_POINTS_COUNT;
if (doPosition)
sql += "," + COLUMN_AVG_ELEV + "," + //
COLUMN_MIN_ELEV + "," + //
COLUMN_MAX_ELEV + "," + //
COLUMN_POSITION_BLOB;//
if (doIntensity)
sql += "," + COLUMN_AVG_INTENSITY + "," + //
COLUMN_MIN_INTENSITY + "," + //
COLUMN_MAX_INTENSITY + "," + //
COLUMN_INTENS_CLASS_BLOB;//
if (doReturns)
sql += "," + COLUMN_RETURNS_BLOB;
if (doTime)
sql += "," + COLUMN_MIN_GPSTIME + "," + //
COLUMN_MAX_GPSTIME + "," + //
COLUMN_GPSTIME_BLOB;
if (doColor)
sql += "," + COLUMN_COLORS_BLOB;
sql += " FROM " + TABLENAME;
if (exactGeometry != null) {
sql += " WHERE " + db.getSpatialindexGeometryWherePiece(TABLENAME, null, exactGeometry);
} else if (envelope != null) {
double x1 = envelope.getMinX();
double y1 = envelope.getMinY();
double x2 = envelope.getMaxX();
double y2 = envelope.getMaxY();
sql += " WHERE " + db.getSpatialindexBBoxWherePiece(TABLENAME, null, x1, y1, x2, y2);
}
if (limitTo > 0) {
sql += " LIMIT " + limitTo;
}
String _sql = sql;
IGeometryParser gp = db.getType().getGeometryParser();
return db.execOnConnection(conn -> {
try (IHMStatement stmt = conn.createStatement(); IHMResultSet rs = stmt.executeQuery(_sql)) {
while( rs.next() ) {
LasCell lasCell = resultSetToCell(db, gp, doPosition, doIntensity, doReturns, doTime, doColor, rs);
lasCells.add(lasCell);
}
return lasCells;
}
});
}
|
class class_name[name] begin[{]
method[getLasCells, return_type[type[List]], modifier[public static], parameter[db, envelope, exactGeometry, doPosition, doIntensity, doReturns, doTime, doColor, limitTo]] begin[{]
local_variable[type[List], lasCells]
local_variable[type[String], sql]
if[member[.doPosition]] begin[{]
assign[member[.sql], binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[literal[","], +, member[.COLUMN_AVG_ELEV]], +, literal[","]], +, member[.COLUMN_MIN_ELEV]], +, literal[","]], +, member[.COLUMN_MAX_ELEV]], +, literal[","]], +, member[.COLUMN_POSITION_BLOB]]]
else begin[{]
None
end[}]
if[member[.doIntensity]] begin[{]
assign[member[.sql], binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[literal[","], +, member[.COLUMN_AVG_INTENSITY]], +, literal[","]], +, member[.COLUMN_MIN_INTENSITY]], +, literal[","]], +, member[.COLUMN_MAX_INTENSITY]], +, literal[","]], +, member[.COLUMN_INTENS_CLASS_BLOB]]]
else begin[{]
None
end[}]
if[member[.doReturns]] begin[{]
assign[member[.sql], binary_operation[literal[","], +, member[.COLUMN_RETURNS_BLOB]]]
else begin[{]
None
end[}]
if[member[.doTime]] begin[{]
assign[member[.sql], binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[literal[","], +, member[.COLUMN_MIN_GPSTIME]], +, literal[","]], +, member[.COLUMN_MAX_GPSTIME]], +, literal[","]], +, member[.COLUMN_GPSTIME_BLOB]]]
else begin[{]
None
end[}]
if[member[.doColor]] begin[{]
assign[member[.sql], binary_operation[literal[","], +, member[.COLUMN_COLORS_BLOB]]]
else begin[{]
None
end[}]
assign[member[.sql], binary_operation[literal[" FROM "], +, member[.TABLENAME]]]
if[binary_operation[member[.exactGeometry], !=, literal[null]]] begin[{]
assign[member[.sql], binary_operation[literal[" WHERE "], +, call[db.getSpatialindexGeometryWherePiece, parameter[member[.TABLENAME], literal[null], member[.exactGeometry]]]]]
else begin[{]
if[binary_operation[member[.envelope], !=, literal[null]]] begin[{]
local_variable[type[double], x1]
local_variable[type[double], y1]
local_variable[type[double], x2]
local_variable[type[double], y2]
assign[member[.sql], binary_operation[literal[" WHERE "], +, call[db.getSpatialindexBBoxWherePiece, parameter[member[.TABLENAME], literal[null], member[.x1], member[.y1], member[.x2], member[.y2]]]]]
else begin[{]
None
end[}]
end[}]
if[binary_operation[member[.limitTo], >, literal[0]]] begin[{]
assign[member[.sql], binary_operation[literal[" LIMIT "], +, member[.limitTo]]]
else begin[{]
None
end[}]
local_variable[type[String], _sql]
local_variable[type[IGeometryParser], gp]
return[call[db.execOnConnection, parameter[LambdaExpression(body=[TryStatement(block=[WhileStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=db, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=gp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=doPosition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=doIntensity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=doReturns, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=doTime, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=doColor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=rs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=resultSetToCell, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=lasCell)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=LasCell, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=lasCell, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=lasCells, selectors=[], type_arguments=None), label=None)]), condition=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=rs, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MemberReference(member=lasCells, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=None, finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=stmt, type=ReferenceType(arguments=None, dimensions=[], name=IHMStatement, sub_type=None), value=MethodInvocation(arguments=[], member=createStatement, postfix_operators=[], prefix_operators=[], qualifier=conn, selectors=[], type_arguments=None)), TryResource(annotations=[], modifiers=set(), name=rs, type=ReferenceType(arguments=None, dimensions=[], name=IHMResultSet, sub_type=None), value=MethodInvocation(arguments=[MemberReference(member=_sql, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=executeQuery, postfix_operators=[], prefix_operators=[], qualifier=stmt, selectors=[], type_arguments=None))])], parameters=[MemberReference(member=conn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[List] operator[<] identifier[LasCell] operator[>] identifier[getLasCells] operator[SEP] identifier[ASpatialDb] identifier[db] , identifier[Envelope] identifier[envelope] , identifier[Geometry] identifier[exactGeometry] , Keyword[boolean] identifier[doPosition] , Keyword[boolean] identifier[doIntensity] , Keyword[boolean] identifier[doReturns] , Keyword[boolean] identifier[doTime] , Keyword[boolean] identifier[doColor] , Keyword[int] identifier[limitTo] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[List] operator[<] identifier[LasCell] operator[>] identifier[lasCells] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[sql] operator[=] literal[String] operator[+] identifier[COLUMN_GEOM] operator[+] literal[String] operator[+] identifier[COLUMN_ID] operator[+] literal[String] operator[+] identifier[COLUMN_SOURCE_ID] operator[+] literal[String] operator[+] identifier[COLUMN_POINTS_COUNT] operator[SEP] Keyword[if] operator[SEP] identifier[doPosition] operator[SEP] identifier[sql] operator[+=] literal[String] operator[+] identifier[COLUMN_AVG_ELEV] operator[+] literal[String] operator[+] identifier[COLUMN_MIN_ELEV] operator[+] literal[String] operator[+] identifier[COLUMN_MAX_ELEV] operator[+] literal[String] operator[+] identifier[COLUMN_POSITION_BLOB] operator[SEP] Keyword[if] operator[SEP] identifier[doIntensity] operator[SEP] identifier[sql] operator[+=] literal[String] operator[+] identifier[COLUMN_AVG_INTENSITY] operator[+] literal[String] operator[+] identifier[COLUMN_MIN_INTENSITY] operator[+] literal[String] operator[+] identifier[COLUMN_MAX_INTENSITY] operator[+] literal[String] operator[+] identifier[COLUMN_INTENS_CLASS_BLOB] operator[SEP] Keyword[if] operator[SEP] identifier[doReturns] operator[SEP] identifier[sql] operator[+=] literal[String] operator[+] identifier[COLUMN_RETURNS_BLOB] operator[SEP] Keyword[if] operator[SEP] identifier[doTime] operator[SEP] identifier[sql] operator[+=] literal[String] operator[+] identifier[COLUMN_MIN_GPSTIME] operator[+] literal[String] operator[+] identifier[COLUMN_MAX_GPSTIME] operator[+] literal[String] operator[+] identifier[COLUMN_GPSTIME_BLOB] operator[SEP] Keyword[if] operator[SEP] identifier[doColor] operator[SEP] identifier[sql] operator[+=] literal[String] operator[+] identifier[COLUMN_COLORS_BLOB] operator[SEP] identifier[sql] operator[+=] literal[String] operator[+] identifier[TABLENAME] operator[SEP] Keyword[if] operator[SEP] identifier[exactGeometry] operator[!=] Other[null] operator[SEP] {
identifier[sql] operator[+=] literal[String] operator[+] identifier[db] operator[SEP] identifier[getSpatialindexGeometryWherePiece] operator[SEP] identifier[TABLENAME] , Other[null] , identifier[exactGeometry] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[envelope] operator[!=] Other[null] operator[SEP] {
Keyword[double] identifier[x1] operator[=] identifier[envelope] operator[SEP] identifier[getMinX] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[y1] operator[=] identifier[envelope] operator[SEP] identifier[getMinY] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[x2] operator[=] identifier[envelope] operator[SEP] identifier[getMaxX] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[y2] operator[=] identifier[envelope] operator[SEP] identifier[getMaxY] operator[SEP] operator[SEP] operator[SEP] identifier[sql] operator[+=] literal[String] operator[+] identifier[db] operator[SEP] identifier[getSpatialindexBBoxWherePiece] operator[SEP] identifier[TABLENAME] , Other[null] , identifier[x1] , identifier[y1] , identifier[x2] , identifier[y2] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[limitTo] operator[>] Other[0] operator[SEP] {
identifier[sql] operator[+=] literal[String] operator[+] identifier[limitTo] operator[SEP]
}
identifier[String] identifier[_sql] operator[=] identifier[sql] operator[SEP] identifier[IGeometryParser] identifier[gp] operator[=] identifier[db] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] identifier[getGeometryParser] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[db] operator[SEP] identifier[execOnConnection] operator[SEP] identifier[conn] operator[->] {
Keyword[try] operator[SEP] identifier[IHMStatement] identifier[stmt] operator[=] identifier[conn] operator[SEP] identifier[createStatement] operator[SEP] operator[SEP] operator[SEP] identifier[IHMResultSet] identifier[rs] operator[=] identifier[stmt] operator[SEP] identifier[executeQuery] operator[SEP] identifier[_sql] operator[SEP] operator[SEP] {
Keyword[while] operator[SEP] identifier[rs] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] {
identifier[LasCell] identifier[lasCell] operator[=] identifier[resultSetToCell] operator[SEP] identifier[db] , identifier[gp] , identifier[doPosition] , identifier[doIntensity] , identifier[doReturns] , identifier[doTime] , identifier[doColor] , identifier[rs] operator[SEP] operator[SEP] identifier[lasCells] operator[SEP] identifier[add] operator[SEP] identifier[lasCell] operator[SEP] operator[SEP]
}
Keyword[return] identifier[lasCells] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
@SuppressWarnings("unchecked")
public CliValueContainer getOrCreate(CliParameterContainer parameterContainer) {
CliValueContainer result = this.map.get(parameterContainer);
if (result == null) {
PojoPropertyAccessorOneArg setter = parameterContainer.getSetter();
Class<?> propertyClass = setter.getPropertyClass();
if (propertyClass.isArray()) {
result = new CliValueContainerArray(parameterContainer, this.cliState, this.dependencies, this.logger);
} else if (Collection.class.isAssignableFrom(propertyClass)) {
Class<? extends Collection<?>> collectionClass = (Class<? extends Collection<?>>) propertyClass;
Collection<Object> collection = this.dependencies.getCollectionFactoryManager()
.getCollectionFactory(collectionClass).create();
result = new CliValueContainerCollection(parameterContainer, this.cliState, this.dependencies, this.logger,
collection);
} else if (Map.class.isAssignableFrom(propertyClass)) {
Class<? extends Map<?, ?>> mapClass = (Class<? extends Map<?, ?>>) propertyClass;
Map<Object, Object> mapValue = this.dependencies.getCollectionFactoryManager().getMapFactory(mapClass)
.create();
result = new CliValueContainerMap(parameterContainer, this.cliState, this.dependencies, this.logger,
mapValue);
} else {
result = new CliValueContainerObject(parameterContainer, this.cliState, this.dependencies, this.logger);
}
this.map.put(parameterContainer, result);
}
return result;
}
|
class class_name[name] begin[{]
method[getOrCreate, return_type[type[CliValueContainer]], modifier[public], parameter[parameterContainer]] begin[{]
local_variable[type[CliValueContainer], result]
if[binary_operation[member[.result], ==, literal[null]]] begin[{]
local_variable[type[PojoPropertyAccessorOneArg], setter]
local_variable[type[Class], propertyClass]
if[call[propertyClass.isArray, parameter[]]] begin[{]
assign[member[.result], ClassCreator(arguments=[MemberReference(member=parameterContainer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=cliState, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=dependencies, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=logger, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CliValueContainerArray, sub_type=None))]
else begin[{]
if[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=propertyClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isAssignableFrom, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Collection, sub_type=None))] begin[{]
local_variable[type[Class], collectionClass]
local_variable[type[Collection], collection]
assign[member[.result], ClassCreator(arguments=[MemberReference(member=parameterContainer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=cliState, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=dependencies, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=logger, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), MemberReference(member=collection, 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=CliValueContainerCollection, sub_type=None))]
else begin[{]
if[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=propertyClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isAssignableFrom, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Map, sub_type=None))] begin[{]
local_variable[type[Class], mapClass]
local_variable[type[Map], mapValue]
assign[member[.result], ClassCreator(arguments=[MemberReference(member=parameterContainer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=cliState, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=dependencies, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=logger, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), MemberReference(member=mapValue, 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=CliValueContainerMap, sub_type=None))]
else begin[{]
assign[member[.result], ClassCreator(arguments=[MemberReference(member=parameterContainer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=cliState, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=dependencies, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=logger, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CliValueContainerObject, sub_type=None))]
end[}]
end[}]
end[}]
THIS[member[None.map]call[None.put, parameter[member[.parameterContainer], member[.result]]]]
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}]
|
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] identifier[CliValueContainer] identifier[getOrCreate] operator[SEP] identifier[CliParameterContainer] identifier[parameterContainer] operator[SEP] {
identifier[CliValueContainer] identifier[result] operator[=] Keyword[this] operator[SEP] identifier[map] operator[SEP] identifier[get] operator[SEP] identifier[parameterContainer] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[==] Other[null] operator[SEP] {
identifier[PojoPropertyAccessorOneArg] identifier[setter] operator[=] identifier[parameterContainer] operator[SEP] identifier[getSetter] operator[SEP] operator[SEP] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[propertyClass] operator[=] identifier[setter] operator[SEP] identifier[getPropertyClass] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[propertyClass] operator[SEP] identifier[isArray] operator[SEP] operator[SEP] operator[SEP] {
identifier[result] operator[=] Keyword[new] identifier[CliValueContainerArray] operator[SEP] identifier[parameterContainer] , Keyword[this] operator[SEP] identifier[cliState] , Keyword[this] operator[SEP] identifier[dependencies] , Keyword[this] operator[SEP] identifier[logger] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[Collection] operator[SEP] Keyword[class] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[propertyClass] operator[SEP] operator[SEP] {
identifier[Class] operator[<] operator[?] Keyword[extends] identifier[Collection] operator[<] operator[?] operator[>] operator[>] identifier[collectionClass] operator[=] operator[SEP] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[Collection] operator[<] operator[?] operator[>] operator[>] operator[SEP] identifier[propertyClass] operator[SEP] identifier[Collection] operator[<] identifier[Object] operator[>] identifier[collection] operator[=] Keyword[this] operator[SEP] identifier[dependencies] operator[SEP] identifier[getCollectionFactoryManager] operator[SEP] operator[SEP] operator[SEP] identifier[getCollectionFactory] operator[SEP] identifier[collectionClass] operator[SEP] operator[SEP] identifier[create] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[=] Keyword[new] identifier[CliValueContainerCollection] operator[SEP] identifier[parameterContainer] , Keyword[this] operator[SEP] identifier[cliState] , Keyword[this] operator[SEP] identifier[dependencies] , Keyword[this] operator[SEP] identifier[logger] , identifier[collection] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[Map] operator[SEP] Keyword[class] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[propertyClass] operator[SEP] operator[SEP] {
identifier[Class] operator[<] operator[?] Keyword[extends] identifier[Map] operator[<] operator[?] , operator[?] operator[>] operator[>] identifier[mapClass] operator[=] operator[SEP] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[Map] operator[<] operator[?] , operator[?] operator[>] operator[>] operator[SEP] identifier[propertyClass] operator[SEP] identifier[Map] operator[<] identifier[Object] , identifier[Object] operator[>] identifier[mapValue] operator[=] Keyword[this] operator[SEP] identifier[dependencies] operator[SEP] identifier[getCollectionFactoryManager] operator[SEP] operator[SEP] operator[SEP] identifier[getMapFactory] operator[SEP] identifier[mapClass] operator[SEP] operator[SEP] identifier[create] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[=] Keyword[new] identifier[CliValueContainerMap] operator[SEP] identifier[parameterContainer] , Keyword[this] operator[SEP] identifier[cliState] , Keyword[this] operator[SEP] identifier[dependencies] , Keyword[this] operator[SEP] identifier[logger] , identifier[mapValue] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[result] operator[=] Keyword[new] identifier[CliValueContainerObject] operator[SEP] identifier[parameterContainer] , Keyword[this] operator[SEP] identifier[cliState] , Keyword[this] operator[SEP] identifier[dependencies] , Keyword[this] operator[SEP] identifier[logger] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[map] operator[SEP] identifier[put] operator[SEP] identifier[parameterContainer] , identifier[result] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public static StringConsumers buildConsumer(Properties props, final String topic,//
final String groupId,//
final IMessageListener<String> listener,//
final int threads
) {
if (props == null || props.isEmpty()) {
props = new Properties();
}
props.put("groupid", groupId);
return new StringConsumers(props, topic, threads, listener);
}
|
class class_name[name] begin[{]
method[buildConsumer, return_type[type[StringConsumers]], modifier[public static], parameter[props, topic, groupId, listener, threads]] begin[{]
if[binary_operation[binary_operation[member[.props], ==, literal[null]], ||, call[props.isEmpty, parameter[]]]] begin[{]
assign[member[.props], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Properties, sub_type=None))]
else begin[{]
None
end[}]
call[props.put, parameter[literal["groupid"], member[.groupId]]]
return[ClassCreator(arguments=[MemberReference(member=props, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=topic, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=threads, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=listener, 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=StringConsumers, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[StringConsumers] identifier[buildConsumer] operator[SEP] identifier[Properties] identifier[props] , Keyword[final] identifier[String] identifier[topic] , Keyword[final] identifier[String] identifier[groupId] , Keyword[final] identifier[IMessageListener] operator[<] identifier[String] operator[>] identifier[listener] , Keyword[final] Keyword[int] identifier[threads] operator[SEP] {
Keyword[if] operator[SEP] identifier[props] operator[==] Other[null] operator[||] identifier[props] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[props] operator[=] Keyword[new] identifier[Properties] operator[SEP] operator[SEP] operator[SEP]
}
identifier[props] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[groupId] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[StringConsumers] operator[SEP] identifier[props] , identifier[topic] , identifier[threads] , identifier[listener] operator[SEP] operator[SEP]
}
|
public void tableSwitch(final int[] keys,
final TableSwitchGenerator generator, final boolean useTable) {
for (int i = 1; i < keys.length; ++i) {
if (keys[i] < keys[i - 1]) {
throw new IllegalArgumentException(
"keys must be sorted ascending");
}
}
Label def = newLabel();
Label end = newLabel();
if (keys.length > 0) {
int len = keys.length;
int min = keys[0];
int max = keys[len - 1];
int range = max - min + 1;
if (useTable) {
Label[] labels = new Label[range];
Arrays.fill(labels, def);
for (int i = 0; i < len; ++i) {
labels[keys[i] - min] = newLabel();
}
mv.visitTableSwitchInsn(min, max, def, labels);
for (int i = 0; i < range; ++i) {
Label label = labels[i];
if (label != def) {
mark(label);
generator.generateCase(i + min, end);
}
}
} else {
Label[] labels = new Label[len];
for (int i = 0; i < len; ++i) {
labels[i] = newLabel();
}
mv.visitLookupSwitchInsn(def, keys, labels);
for (int i = 0; i < len; ++i) {
mark(labels[i]);
generator.generateCase(keys[i], end);
}
}
}
mark(def);
generator.generateDefault();
mark(end);
}
|
class class_name[name] begin[{]
method[tableSwitch, return_type[void], modifier[public], parameter[keys, generator, useTable]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=keys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=keys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-))]), operator=<), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="keys must be sorted ascending")], 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)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=keys, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)
local_variable[type[Label], def]
local_variable[type[Label], end]
if[binary_operation[member[keys.length], >, literal[0]]] begin[{]
local_variable[type[int], len]
local_variable[type[int], min]
local_variable[type[int], max]
local_variable[type[int], range]
if[member[.useTable]] begin[{]
local_variable[type[Label], labels]
call[Arrays.fill, parameter[member[.labels], member[.def]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=labels, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=keys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=min, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-))]), type==, value=MethodInvocation(arguments=[], member=newLabel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=len, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)
call[mv.visitTableSwitchInsn, parameter[member[.min], member[.max], member[.def], member[.labels]]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=labels, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=label)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Label, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=label, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=def, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=label, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=mark, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=min, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=end, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=generateCase, postfix_operators=[], prefix_operators=[], qualifier=generator, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=range, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)
else begin[{]
local_variable[type[Label], labels]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=labels, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[], member=newLabel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=len, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)
call[mv.visitLookupSwitchInsn, parameter[member[.def], member[.keys], member[.labels]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=labels, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=mark, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=keys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MemberReference(member=end, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=generateCase, postfix_operators=[], prefix_operators=[], qualifier=generator, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=len, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)
end[}]
else begin[{]
None
end[}]
call[.mark, parameter[member[.def]]]
call[generator.generateDefault, parameter[]]
call[.mark, parameter[member[.end]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[tableSwitch] operator[SEP] Keyword[final] Keyword[int] operator[SEP] operator[SEP] identifier[keys] , Keyword[final] identifier[TableSwitchGenerator] identifier[generator] , Keyword[final] Keyword[boolean] identifier[useTable] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[1] operator[SEP] identifier[i] operator[<] identifier[keys] operator[SEP] identifier[length] operator[SEP] operator[++] identifier[i] operator[SEP] {
Keyword[if] operator[SEP] identifier[keys] operator[SEP] identifier[i] operator[SEP] operator[<] identifier[keys] operator[SEP] identifier[i] operator[-] Other[1] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
identifier[Label] identifier[def] operator[=] identifier[newLabel] operator[SEP] operator[SEP] operator[SEP] identifier[Label] identifier[end] operator[=] identifier[newLabel] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[keys] operator[SEP] identifier[length] operator[>] Other[0] operator[SEP] {
Keyword[int] identifier[len] operator[=] identifier[keys] operator[SEP] identifier[length] operator[SEP] Keyword[int] identifier[min] operator[=] identifier[keys] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[int] identifier[max] operator[=] identifier[keys] operator[SEP] identifier[len] operator[-] Other[1] operator[SEP] operator[SEP] Keyword[int] identifier[range] operator[=] identifier[max] operator[-] identifier[min] operator[+] Other[1] operator[SEP] Keyword[if] operator[SEP] identifier[useTable] operator[SEP] {
identifier[Label] operator[SEP] operator[SEP] identifier[labels] operator[=] Keyword[new] identifier[Label] operator[SEP] identifier[range] operator[SEP] operator[SEP] identifier[Arrays] operator[SEP] identifier[fill] operator[SEP] identifier[labels] , identifier[def] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[len] operator[SEP] operator[++] identifier[i] operator[SEP] {
identifier[labels] operator[SEP] identifier[keys] operator[SEP] identifier[i] operator[SEP] operator[-] identifier[min] operator[SEP] operator[=] identifier[newLabel] operator[SEP] operator[SEP] operator[SEP]
}
identifier[mv] operator[SEP] identifier[visitTableSwitchInsn] operator[SEP] identifier[min] , identifier[max] , identifier[def] , identifier[labels] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[range] operator[SEP] operator[++] identifier[i] operator[SEP] {
identifier[Label] identifier[label] operator[=] identifier[labels] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[label] operator[!=] identifier[def] operator[SEP] {
identifier[mark] operator[SEP] identifier[label] operator[SEP] operator[SEP] identifier[generator] operator[SEP] identifier[generateCase] operator[SEP] identifier[i] operator[+] identifier[min] , identifier[end] operator[SEP] operator[SEP]
}
}
}
Keyword[else] {
identifier[Label] operator[SEP] operator[SEP] identifier[labels] operator[=] Keyword[new] identifier[Label] operator[SEP] identifier[len] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[len] operator[SEP] operator[++] identifier[i] operator[SEP] {
identifier[labels] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[newLabel] operator[SEP] operator[SEP] operator[SEP]
}
identifier[mv] operator[SEP] identifier[visitLookupSwitchInsn] operator[SEP] identifier[def] , identifier[keys] , identifier[labels] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[len] operator[SEP] operator[++] identifier[i] operator[SEP] {
identifier[mark] operator[SEP] identifier[labels] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] identifier[generator] operator[SEP] identifier[generateCase] operator[SEP] identifier[keys] operator[SEP] identifier[i] operator[SEP] , identifier[end] operator[SEP] operator[SEP]
}
}
}
identifier[mark] operator[SEP] identifier[def] operator[SEP] operator[SEP] identifier[generator] operator[SEP] identifier[generateDefault] operator[SEP] operator[SEP] operator[SEP] identifier[mark] operator[SEP] identifier[end] operator[SEP] operator[SEP]
}
|
@Override
public List<Metric> transform(QueryContext context, List<Metric> metrics) {
if (metrics == null) {
throw new MissingDataException("The metrics list cannot be null or empty while performing arithmetic transformations.");
}
if (metrics.isEmpty()) {
return metrics;
}
Metric result = new Metric(getResultScopeName(), RESULT_METRIC_NAME);
Map<Long, Double> resultDatapoints = new HashMap<>();
Iterator<Entry<Long, Double>> it = metrics.get(0).getDatapoints().entrySet().iterator();
while (it.hasNext()) {
Entry<Long, Double> entry = it.next();
List<Double> operands = null;
try {
operands = getOperands(entry.getKey(), metrics);
} catch (MissingDataException mde) {
continue;
}
resultDatapoints.put(entry.getKey(), performOperation(operands));
}
result.setDatapoints(resultDatapoints);
MetricDistiller.setCommonAttributes(metrics, result);
List<Metric> resultMetrics = new ArrayList<>();
Collections.addAll(resultMetrics, result);
return resultMetrics;
}
|
class class_name[name] begin[{]
method[transform, return_type[type[List]], modifier[public], parameter[context, metrics]] begin[{]
if[binary_operation[member[.metrics], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The metrics list cannot be null or empty while performing arithmetic transformations.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MissingDataException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[call[metrics.isEmpty, parameter[]]] begin[{]
return[member[.metrics]]
else begin[{]
None
end[}]
local_variable[type[Metric], result]
local_variable[type[Map], resultDatapoints]
local_variable[type[Iterator], it]
while[call[it.hasNext, parameter[]]] begin[{]
local_variable[type[Entry], entry]
local_variable[type[List], operands]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=operands, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), MemberReference(member=metrics, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getOperands, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ContinueStatement(goto=None, label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=mde, types=['MissingDataException']))], finally_block=None, label=None, resources=None)
call[resultDatapoints.put, parameter[call[entry.getKey, parameter[]], call[.performOperation, parameter[member[.operands]]]]]
end[}]
call[result.setDatapoints, parameter[member[.resultDatapoints]]]
call[MetricDistiller.setCommonAttributes, parameter[member[.metrics], member[.result]]]
local_variable[type[List], resultMetrics]
call[Collections.addAll, parameter[member[.resultMetrics], member[.result]]]
return[member[.resultMetrics]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[List] operator[<] identifier[Metric] operator[>] identifier[transform] operator[SEP] identifier[QueryContext] identifier[context] , identifier[List] operator[<] identifier[Metric] operator[>] identifier[metrics] operator[SEP] {
Keyword[if] operator[SEP] identifier[metrics] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[MissingDataException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[metrics] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[metrics] operator[SEP]
}
identifier[Metric] identifier[result] operator[=] Keyword[new] identifier[Metric] operator[SEP] identifier[getResultScopeName] operator[SEP] operator[SEP] , identifier[RESULT_METRIC_NAME] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[Long] , identifier[Double] operator[>] identifier[resultDatapoints] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Iterator] operator[<] identifier[Entry] operator[<] identifier[Long] , identifier[Double] operator[>] operator[>] identifier[it] operator[=] identifier[metrics] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[getDatapoints] operator[SEP] operator[SEP] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] 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] {
identifier[Entry] operator[<] identifier[Long] , identifier[Double] operator[>] identifier[entry] operator[=] identifier[it] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Double] operator[>] identifier[operands] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[operands] operator[=] identifier[getOperands] operator[SEP] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[metrics] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[MissingDataException] identifier[mde] operator[SEP] {
Keyword[continue] operator[SEP]
}
identifier[resultDatapoints] operator[SEP] identifier[put] operator[SEP] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[performOperation] operator[SEP] identifier[operands] operator[SEP] operator[SEP] operator[SEP]
}
identifier[result] operator[SEP] identifier[setDatapoints] operator[SEP] identifier[resultDatapoints] operator[SEP] operator[SEP] identifier[MetricDistiller] operator[SEP] identifier[setCommonAttributes] operator[SEP] identifier[metrics] , identifier[result] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Metric] operator[>] identifier[resultMetrics] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Collections] operator[SEP] identifier[addAll] operator[SEP] identifier[resultMetrics] , identifier[result] operator[SEP] operator[SEP] Keyword[return] identifier[resultMetrics] operator[SEP]
}
|
@Override
public List<DefinedUnit> getDefinedForms(String code) throws UcumException {
assert checkStringParam(code) : paramError("getDefinedForms", "code", "must not be null or empty");
List<DefinedUnit> result = new ArrayList<DefinedUnit>();
BaseUnit base = model.getBaseUnit(code);
if (base != null) {
for (DefinedUnit unit : model.getDefinedUnits()) {
if (!unit.isSpecial() && code.equals(getCanonicalUnits(unit.getCode())))
result.add(unit);
}
}
return result;
}
|
class class_name[name] begin[{]
method[getDefinedForms, return_type[type[List]], modifier[public], parameter[code]] begin[{]
AssertStatement(condition=MethodInvocation(arguments=[MemberReference(member=code, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkStringParam, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="getDefinedForms"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="code"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="must not be null or empty")], member=paramError, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None))
local_variable[type[List], result]
local_variable[type[BaseUnit], base]
if[binary_operation[member[.base], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isSpecial, postfix_operators=[], prefix_operators=['!'], qualifier=unit, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getCode, postfix_operators=[], prefix_operators=[], qualifier=unit, selectors=[], type_arguments=None)], member=getCanonicalUnits, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=[], qualifier=code, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=unit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getDefinedUnits, postfix_operators=[], prefix_operators=[], qualifier=model, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=unit)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DefinedUnit, sub_type=None))), label=None)
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[List] operator[<] identifier[DefinedUnit] operator[>] identifier[getDefinedForms] operator[SEP] identifier[String] identifier[code] operator[SEP] Keyword[throws] identifier[UcumException] {
Keyword[assert] identifier[checkStringParam] operator[SEP] identifier[code] operator[SEP] operator[:] identifier[paramError] operator[SEP] literal[String] , literal[String] , literal[String] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[DefinedUnit] operator[>] identifier[result] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[DefinedUnit] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[BaseUnit] identifier[base] operator[=] identifier[model] operator[SEP] identifier[getBaseUnit] operator[SEP] identifier[code] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[base] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[DefinedUnit] identifier[unit] operator[:] identifier[model] operator[SEP] identifier[getDefinedUnits] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[unit] operator[SEP] identifier[isSpecial] operator[SEP] operator[SEP] operator[&&] identifier[code] operator[SEP] identifier[equals] operator[SEP] identifier[getCanonicalUnits] operator[SEP] identifier[unit] operator[SEP] identifier[getCode] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[add] operator[SEP] identifier[unit] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[result] operator[SEP]
}
|
private boolean checkFailover() throws InterruptedException {
boolean isPrimary = isPrimaryServiceCached();
if (!isPrimary && isPrimaryService()) {
this.servicePair.setPrimaryOfferService(this);
return true;
}
return false;
}
|
class class_name[name] begin[{]
method[checkFailover, return_type[type[boolean]], modifier[private], parameter[]] begin[{]
local_variable[type[boolean], isPrimary]
if[binary_operation[member[.isPrimary], &&, call[.isPrimaryService, parameter[]]]] begin[{]
THIS[member[None.servicePair]call[None.setPrimaryOfferService, parameter[THIS[]]]]
return[literal[true]]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}]
|
Keyword[private] Keyword[boolean] identifier[checkFailover] operator[SEP] operator[SEP] Keyword[throws] identifier[InterruptedException] {
Keyword[boolean] identifier[isPrimary] operator[=] identifier[isPrimaryServiceCached] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[isPrimary] operator[&&] identifier[isPrimaryService] operator[SEP] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[servicePair] operator[SEP] identifier[setPrimaryOfferService] operator[SEP] Keyword[this] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public static void checkIntInRange(int index, int start, int end) {
if (index < start) {
throw new IndexOutOfBoundsException(ExceptionMessageMap.getMessage("000006") + " { index=["
+ index + "], start=[" + start + "], end=[" + end + "] }");
}
if (index >= end) {
throw new IndexOutOfBoundsException(ExceptionMessageMap.getMessage("000006") + " { index=["
+ index + "], start=[" + start + "], end=[" + end + "] }");
}
}
|
class class_name[name] begin[{]
method[checkIntInRange, return_type[void], modifier[public static], parameter[index, start, end]] begin[{]
if[binary_operation[member[.index], <, member[.start]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="000006")], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=ExceptionMessageMap, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" { index=["), operator=+), operandr=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="], start=["), operator=+), operandr=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="], end=["), operator=+), operandr=MemberReference(member=end, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="] }"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IndexOutOfBoundsException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.index], >=, member[.end]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="000006")], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=ExceptionMessageMap, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" { index=["), operator=+), operandr=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="], start=["), operator=+), operandr=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="], end=["), operator=+), operandr=MemberReference(member=end, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="] }"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IndexOutOfBoundsException, sub_type=None)), label=None)
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[checkIntInRange] operator[SEP] Keyword[int] identifier[index] , Keyword[int] identifier[start] , Keyword[int] identifier[end] operator[SEP] {
Keyword[if] operator[SEP] identifier[index] operator[<] identifier[start] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IndexOutOfBoundsException] operator[SEP] identifier[ExceptionMessageMap] operator[SEP] identifier[getMessage] operator[SEP] literal[String] operator[SEP] operator[+] literal[String] operator[+] identifier[index] operator[+] literal[String] operator[+] identifier[start] operator[+] literal[String] operator[+] identifier[end] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[index] operator[>=] identifier[end] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IndexOutOfBoundsException] operator[SEP] identifier[ExceptionMessageMap] operator[SEP] identifier[getMessage] operator[SEP] literal[String] operator[SEP] operator[+] literal[String] operator[+] identifier[index] operator[+] literal[String] operator[+] identifier[start] operator[+] literal[String] operator[+] identifier[end] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
|
public ServiceFuture<ExpressRouteCircuitConnectionInner> beginCreateOrUpdateAsync(String resourceGroupName, String circuitName, String peeringName, String connectionName, ExpressRouteCircuitConnectionInner expressRouteCircuitConnectionParameters, final ServiceCallback<ExpressRouteCircuitConnectionInner> serviceCallback) {
return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, circuitName, peeringName, connectionName, expressRouteCircuitConnectionParameters), serviceCallback);
}
|
class class_name[name] begin[{]
method[beginCreateOrUpdateAsync, return_type[type[ServiceFuture]], modifier[public], parameter[resourceGroupName, circuitName, peeringName, connectionName, expressRouteCircuitConnectionParameters, serviceCallback]] begin[{]
return[call[ServiceFuture.fromResponse, parameter[call[.beginCreateOrUpdateWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.circuitName], member[.peeringName], member[.connectionName], member[.expressRouteCircuitConnectionParameters]]], member[.serviceCallback]]]]
end[}]
END[}]
|
Keyword[public] identifier[ServiceFuture] operator[<] identifier[ExpressRouteCircuitConnectionInner] operator[>] identifier[beginCreateOrUpdateAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[circuitName] , identifier[String] identifier[peeringName] , identifier[String] identifier[connectionName] , identifier[ExpressRouteCircuitConnectionInner] identifier[expressRouteCircuitConnectionParameters] , Keyword[final] identifier[ServiceCallback] operator[<] identifier[ExpressRouteCircuitConnectionInner] operator[>] identifier[serviceCallback] operator[SEP] {
Keyword[return] identifier[ServiceFuture] operator[SEP] identifier[fromResponse] operator[SEP] identifier[beginCreateOrUpdateWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[circuitName] , identifier[peeringName] , identifier[connectionName] , identifier[expressRouteCircuitConnectionParameters] operator[SEP] , identifier[serviceCallback] operator[SEP] operator[SEP]
}
|
static public String normalize(String path) {
if (path == null || path.length() == 0) return ROOT;
if (path.charAt(0) != PATH_SEPARATOR) {
throw new IllegalArgumentException(
"Network Location path does not start with "
+PATH_SEPARATOR_STR+ ": "+path);
}
int len = path.length();
if (path.charAt(len-1) == PATH_SEPARATOR) {
return path.substring(0, len-1);
}
return path;
}
|
class class_name[name] begin[{]
method[normalize, return_type[type[String]], modifier[public static], parameter[path]] begin[{]
if[binary_operation[binary_operation[member[.path], ==, literal[null]], ||, binary_operation[call[path.length, parameter[]], ==, literal[0]]]] begin[{]
return[member[.ROOT]]
else begin[{]
None
end[}]
if[binary_operation[call[path.charAt, parameter[literal[0]]], !=, member[.PATH_SEPARATOR]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Network Location path does not start with "), operandr=MemberReference(member=PATH_SEPARATOR_STR, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=": "), operator=+), operandr=MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[int], len]
if[binary_operation[call[path.charAt, parameter[binary_operation[member[.len], -, literal[1]]]], ==, member[.PATH_SEPARATOR]]] begin[{]
return[call[path.substring, parameter[literal[0], binary_operation[member[.len], -, literal[1]]]]]
else begin[{]
None
end[}]
return[member[.path]]
end[}]
END[}]
|
Keyword[static] Keyword[public] identifier[String] identifier[normalize] operator[SEP] identifier[String] identifier[path] operator[SEP] {
Keyword[if] operator[SEP] identifier[path] operator[==] Other[null] operator[||] identifier[path] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] Keyword[return] identifier[ROOT] operator[SEP] Keyword[if] operator[SEP] identifier[path] operator[SEP] identifier[charAt] operator[SEP] Other[0] operator[SEP] operator[!=] identifier[PATH_SEPARATOR] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[PATH_SEPARATOR_STR] operator[+] literal[String] operator[+] identifier[path] operator[SEP] operator[SEP]
}
Keyword[int] identifier[len] operator[=] identifier[path] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[path] operator[SEP] identifier[charAt] operator[SEP] identifier[len] operator[-] Other[1] operator[SEP] operator[==] identifier[PATH_SEPARATOR] operator[SEP] {
Keyword[return] identifier[path] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[len] operator[-] Other[1] operator[SEP] operator[SEP]
}
Keyword[return] identifier[path] operator[SEP]
}
|
public void setTemporaryDirectory(File dir) throws IOException {
if (dir != null) {
if (!dir.exists() || !dir.isDirectory())
if (!dir.mkdirs())
throw new IOException("Unable to create temporary directory: " + dir.getAbsolutePath());
}
tempDir = dir;
}
|
class class_name[name] begin[{]
method[setTemporaryDirectory, return_type[void], modifier[public], parameter[dir]] begin[{]
if[binary_operation[member[.dir], !=, literal[null]]] begin[{]
if[binary_operation[call[dir.exists, parameter[]], ||, call[dir.isDirectory, parameter[]]]] begin[{]
if[call[dir.mkdirs, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to create temporary directory: "), operandr=MethodInvocation(arguments=[], member=getAbsolutePath, postfix_operators=[], prefix_operators=[], qualifier=dir, selectors=[], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None)
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
assign[member[.tempDir], member[.dir]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setTemporaryDirectory] operator[SEP] identifier[File] identifier[dir] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[dir] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[dir] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[||] operator[!] identifier[dir] operator[SEP] identifier[isDirectory] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[dir] operator[SEP] identifier[mkdirs] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[+] identifier[dir] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[tempDir] operator[=] identifier[dir] operator[SEP]
}
|
public JServiceMethod[] methods() {
List<CServiceMethod> methods = new ArrayList<>(service.getMethodsIncludingExtended());
CServiceMethod[] ma = methods.toArray(new CServiceMethod[methods.size()]);
JServiceMethod[] ret = new JServiceMethod[ma.length];
for (int i = 0; i < methods.size(); ++i) {
ret[i] = new JServiceMethod(service, ma[i], helper);
}
return ret;
}
|
class class_name[name] begin[{]
method[methods, return_type[type[JServiceMethod]], modifier[public], parameter[]] begin[{]
local_variable[type[List], methods]
local_variable[type[CServiceMethod], ma]
local_variable[type[JServiceMethod], ret]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=ret, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=ClassCreator(arguments=[MemberReference(member=service, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ma, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MemberReference(member=helper, 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=JServiceMethod, sub_type=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=methods, 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[.ret]]
end[}]
END[}]
|
Keyword[public] identifier[JServiceMethod] operator[SEP] operator[SEP] identifier[methods] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[CServiceMethod] operator[>] identifier[methods] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] identifier[service] operator[SEP] identifier[getMethodsIncludingExtended] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[CServiceMethod] operator[SEP] operator[SEP] identifier[ma] operator[=] identifier[methods] operator[SEP] identifier[toArray] operator[SEP] Keyword[new] identifier[CServiceMethod] operator[SEP] identifier[methods] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[JServiceMethod] operator[SEP] operator[SEP] identifier[ret] operator[=] Keyword[new] identifier[JServiceMethod] operator[SEP] identifier[ma] 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[methods] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[++] identifier[i] operator[SEP] {
identifier[ret] operator[SEP] identifier[i] operator[SEP] operator[=] Keyword[new] identifier[JServiceMethod] operator[SEP] identifier[service] , identifier[ma] operator[SEP] identifier[i] operator[SEP] , identifier[helper] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ret] operator[SEP]
}
|
public static String password(int length) {
StringBuilder result = new StringBuilder();
byte[] values = byteArray(length);
// We use a modulus of an increasing index rather than of the byte values
// to avoid certain characters coming up more often.
int index = 0;
for (int i = 0; i < length; i++) {
index += (values[i] & 0xff);
index = index % passwordCharacters.length();
result.append(passwordCharacters.charAt(index));
}
return result.toString();
}
|
class class_name[name] begin[{]
method[password, return_type[type[String]], modifier[public static], parameter[length]] begin[{]
local_variable[type[StringBuilder], result]
local_variable[type[byte], values]
local_variable[type[int], index]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=BinaryOperation(operandl=MemberReference(member=values, 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=0xff), operator=&)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=passwordCharacters, selectors=[], type_arguments=None), operator=%)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=passwordCharacters, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[call[result.toString, parameter[]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[password] operator[SEP] Keyword[int] identifier[length] operator[SEP] {
identifier[StringBuilder] identifier[result] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[values] operator[=] identifier[byteArray] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[int] identifier[index] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[index] operator[+=] operator[SEP] identifier[values] operator[SEP] identifier[i] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[SEP] identifier[index] operator[=] identifier[index] operator[%] identifier[passwordCharacters] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[append] operator[SEP] identifier[passwordCharacters] operator[SEP] identifier[charAt] operator[SEP] identifier[index] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
private void finishTask(TaskControllerContext context,
TaskCommands command) throws IOException{
if(context.task == null) {
LOG.info("Context task null not killing the JVM");
return;
}
ShellCommandExecutor shExec = buildTaskControllerExecutor(
command, context.env.conf.getUser(),
buildKillTaskCommandArgs(context), context.env.workDir,
context.env.env);
try {
shExec.execute();
} catch (Exception e) {
LOG.warn("Output from task-contoller is : " + shExec.getOutput());
throw new IOException(e);
}
}
|
class class_name[name] begin[{]
method[finishTask, return_type[void], modifier[private], parameter[context, command]] begin[{]
if[binary_operation[member[context.task], ==, literal[null]]] begin[{]
call[LOG.info, parameter[literal["Context task null not killing the JVM"]]]
return[None]
else begin[{]
None
end[}]
local_variable[type[ShellCommandExecutor], shExec]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=execute, postfix_operators=[], prefix_operators=[], qualifier=shExec, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Output from task-contoller is : "), operandr=MethodInvocation(arguments=[], member=getOutput, postfix_operators=[], prefix_operators=[], qualifier=shExec, selectors=[], type_arguments=None), operator=+)], member=warn, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), 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=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[finishTask] operator[SEP] identifier[TaskControllerContext] identifier[context] , identifier[TaskCommands] identifier[command] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[context] operator[SEP] identifier[task] operator[==] Other[null] operator[SEP] {
identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
identifier[ShellCommandExecutor] identifier[shExec] operator[=] identifier[buildTaskControllerExecutor] operator[SEP] identifier[command] , identifier[context] operator[SEP] identifier[env] operator[SEP] identifier[conf] operator[SEP] identifier[getUser] operator[SEP] operator[SEP] , identifier[buildKillTaskCommandArgs] operator[SEP] identifier[context] operator[SEP] , identifier[context] operator[SEP] identifier[env] operator[SEP] identifier[workDir] , identifier[context] operator[SEP] identifier[env] operator[SEP] identifier[env] operator[SEP] operator[SEP] Keyword[try] {
identifier[shExec] operator[SEP] identifier[execute] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[LOG] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] identifier[shExec] operator[SEP] identifier[getOutput] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
public final void mapExpressionList() throws RecognitionException {
try {
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:570:5: ( mapEntry ( COMMA mapEntry )* )
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:570:7: mapEntry ( COMMA mapEntry )*
{
pushFollow(FOLLOW_mapEntry_in_mapExpressionList3151);
mapEntry();
state._fsp--;
if (state.failed) return;
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:570:16: ( COMMA mapEntry )*
loop62:
while (true) {
int alt62=2;
int LA62_0 = input.LA(1);
if ( (LA62_0==COMMA) ) {
alt62=1;
}
switch (alt62) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:570:17: COMMA mapEntry
{
match(input,COMMA,FOLLOW_COMMA_in_mapExpressionList3154); if (state.failed) return;
pushFollow(FOLLOW_mapEntry_in_mapExpressionList3156);
mapEntry();
state._fsp--;
if (state.failed) return;
}
break;
default :
break loop62;
}
}
}
}
catch (RecognitionException re) {
throw re;
}
finally {
// do for sure before leaving
}
}
|
class class_name[name] begin[{]
method[mapExpressionList, return_type[void], modifier[final public], parameter[]] begin[{]
TryStatement(block=[BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=FOLLOW_mapEntry_in_mapExpressionList3151, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=pushFollow, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=mapEntry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MemberReference(member=_fsp, postfix_operators=['--'], prefix_operators=[], qualifier=state, selectors=[]), label=None), IfStatement(condition=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), else_statement=None, label=None, then_statement=ReturnStatement(expression=None, label=None)), WhileStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), name=alt62)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=LA, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), name=LA62_0)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=LA62_0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=COMMA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=alt62, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)), label=None)])), SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], statements=[BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=COMMA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=FOLLOW_COMMA_in_mapExpressionList3154, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], 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=MethodInvocation(arguments=[MemberReference(member=FOLLOW_mapEntry_in_mapExpressionList3156, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=pushFollow, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=mapEntry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MemberReference(member=_fsp, postfix_operators=['--'], prefix_operators=[], qualifier=state, selectors=[]), label=None), IfStatement(condition=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), else_statement=None, label=None, then_statement=ReturnStatement(expression=None, label=None))]), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[BreakStatement(goto=loop62, label=None)])], expression=MemberReference(member=alt62, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), condition=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=loop62)])], catches=[CatchClause(block=[ThrowStatement(expression=MemberReference(member=re, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=re, types=['RecognitionException']))], finally_block=[], label=None, resources=None)
end[}]
END[}]
|
Keyword[public] Keyword[final] Keyword[void] identifier[mapExpressionList] operator[SEP] operator[SEP] Keyword[throws] identifier[RecognitionException] {
Keyword[try] {
{
identifier[pushFollow] operator[SEP] identifier[FOLLOW_mapEntry_in_mapExpressionList3151] operator[SEP] operator[SEP] identifier[mapEntry] operator[SEP] operator[SEP] operator[SEP] identifier[state] operator[SEP] identifier[_fsp] operator[--] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[failed] operator[SEP] Keyword[return] operator[SEP] identifier[loop62] operator[:] Keyword[while] operator[SEP] literal[boolean] operator[SEP] {
Keyword[int] identifier[alt62] operator[=] Other[2] operator[SEP] Keyword[int] identifier[LA62_0] operator[=] identifier[input] operator[SEP] identifier[LA] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[LA62_0] operator[==] identifier[COMMA] operator[SEP] operator[SEP] {
identifier[alt62] operator[=] Other[1] operator[SEP]
}
Keyword[switch] operator[SEP] identifier[alt62] operator[SEP] {
Keyword[case] Other[1] operator[:] {
identifier[match] operator[SEP] identifier[input] , identifier[COMMA] , identifier[FOLLOW_COMMA_in_mapExpressionList3154] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[failed] operator[SEP] Keyword[return] operator[SEP] identifier[pushFollow] operator[SEP] identifier[FOLLOW_mapEntry_in_mapExpressionList3156] operator[SEP] operator[SEP] identifier[mapEntry] operator[SEP] operator[SEP] operator[SEP] identifier[state] operator[SEP] identifier[_fsp] operator[--] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[failed] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[break] identifier[loop62] operator[SEP]
}
}
}
}
Keyword[catch] operator[SEP] identifier[RecognitionException] identifier[re] operator[SEP] {
Keyword[throw] identifier[re] operator[SEP]
}
Keyword[finally] {
}
}
|
public EntryStream<K, V> peekKeys(Consumer<? super K> keyAction) {
return peek(e -> keyAction.accept(e.getKey()));
}
|
class class_name[name] begin[{]
method[peekKeys, return_type[type[EntryStream]], modifier[public], parameter[keyAction]] begin[{]
return[call[.peek, parameter[LambdaExpression(body=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], member=accept, postfix_operators=[], prefix_operators=[], qualifier=keyAction, selectors=[], type_arguments=None), parameters=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]]
end[}]
END[}]
|
Keyword[public] identifier[EntryStream] operator[<] identifier[K] , identifier[V] operator[>] identifier[peekKeys] operator[SEP] identifier[Consumer] operator[<] operator[?] Keyword[super] identifier[K] operator[>] identifier[keyAction] operator[SEP] {
Keyword[return] identifier[peek] operator[SEP] identifier[e] operator[->] identifier[keyAction] operator[SEP] identifier[accept] operator[SEP] identifier[e] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
void addArrayList(Node firstInList) {
boolean lastWasEmpty = false;
for (Node n = firstInList; n != null; n = n.getNext()) {
if (n != firstInList) {
cc.listSeparator();
}
addExpr(n, 1, Context.OTHER);
lastWasEmpty = n.isEmpty();
}
if (lastWasEmpty) {
cc.listSeparator();
}
}
|
class class_name[name] begin[{]
method[addArrayList, return_type[void], modifier[default], parameter[firstInList]] begin[{]
local_variable[type[boolean], lastWasEmpty]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=firstInList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=listSeparator, postfix_operators=[], prefix_operators=[], qualifier=cc, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), MemberReference(member=OTHER, postfix_operators=[], prefix_operators=[], qualifier=Context, selectors=[])], member=addExpr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=lastWasEmpty, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=[], qualifier=n, selectors=[], type_arguments=None)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=firstInList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=n)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Node, sub_type=None)), update=[Assignment(expressionl=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getNext, postfix_operators=[], prefix_operators=[], qualifier=n, selectors=[], type_arguments=None))]), label=None)
if[member[.lastWasEmpty]] begin[{]
call[cc.listSeparator, parameter[]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[void] identifier[addArrayList] operator[SEP] identifier[Node] identifier[firstInList] operator[SEP] {
Keyword[boolean] identifier[lastWasEmpty] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] identifier[Node] identifier[n] operator[=] identifier[firstInList] operator[SEP] identifier[n] operator[!=] Other[null] operator[SEP] identifier[n] operator[=] identifier[n] operator[SEP] identifier[getNext] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[n] operator[!=] identifier[firstInList] operator[SEP] {
identifier[cc] operator[SEP] identifier[listSeparator] operator[SEP] operator[SEP] operator[SEP]
}
identifier[addExpr] operator[SEP] identifier[n] , Other[1] , identifier[Context] operator[SEP] identifier[OTHER] operator[SEP] operator[SEP] identifier[lastWasEmpty] operator[=] identifier[n] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[lastWasEmpty] operator[SEP] {
identifier[cc] operator[SEP] identifier[listSeparator] operator[SEP] operator[SEP] operator[SEP]
}
}
|
private void writeBufferChain(BufferChainOutputStream bufferChain, boolean compressed) {
ByteBuffer header = ByteBuffer.wrap(headerScratch);
header.put(compressed ? COMPRESSED : UNCOMPRESSED);
int messageLength = bufferChain.readableBytes();
header.putInt(messageLength);
WritableBuffer writeableHeader = bufferAllocator.allocate(HEADER_LENGTH);
writeableHeader.write(headerScratch, 0, header.position());
if (messageLength == 0) {
// the payload had 0 length so make the header the current buffer.
buffer = writeableHeader;
return;
}
// Note that we are always delivering a small message to the transport here which
// may incur transport framing overhead as it may be sent separately to the contents
// of the GRPC frame.
// The final message may not be completely written because we do not flush the last buffer.
// Do not report the last message as sent.
sink.deliverFrame(writeableHeader, false, false, messagesBuffered - 1);
messagesBuffered = 1;
// Commit all except the last buffer to the sink
List<WritableBuffer> bufferList = bufferChain.bufferList;
for (int i = 0; i < bufferList.size() - 1; i++) {
sink.deliverFrame(bufferList.get(i), false, false, 0);
}
// Assign the current buffer to the last in the chain so it can be used
// for future writes or written with end-of-stream=true on close.
buffer = bufferList.get(bufferList.size() - 1);
currentMessageWireSize = messageLength;
}
|
class class_name[name] begin[{]
method[writeBufferChain, return_type[void], modifier[private], parameter[bufferChain, compressed]] begin[{]
local_variable[type[ByteBuffer], header]
call[header.put, parameter[TernaryExpression(condition=MemberReference(member=compressed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=MemberReference(member=UNCOMPRESSED, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=COMPRESSED, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]]
local_variable[type[int], messageLength]
call[header.putInt, parameter[member[.messageLength]]]
local_variable[type[WritableBuffer], writeableHeader]
call[writeableHeader.write, parameter[member[.headerScratch], literal[0], call[header.position, parameter[]]]]
if[binary_operation[member[.messageLength], ==, literal[0]]] begin[{]
assign[member[.buffer], member[.writeableHeader]]
return[None]
else begin[{]
None
end[}]
call[sink.deliverFrame, parameter[member[.writeableHeader], literal[false], literal[false], binary_operation[member[.messagesBuffered], -, literal[1]]]]
assign[member[.messagesBuffered], literal[1]]
local_variable[type[List], bufferList]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=bufferList, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=deliverFrame, postfix_operators=[], prefix_operators=[], qualifier=sink, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=bufferList, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
assign[member[.buffer], call[bufferList.get, parameter[binary_operation[call[bufferList.size, parameter[]], -, literal[1]]]]]
assign[member[.currentMessageWireSize], member[.messageLength]]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[writeBufferChain] operator[SEP] identifier[BufferChainOutputStream] identifier[bufferChain] , Keyword[boolean] identifier[compressed] operator[SEP] {
identifier[ByteBuffer] identifier[header] operator[=] identifier[ByteBuffer] operator[SEP] identifier[wrap] operator[SEP] identifier[headerScratch] operator[SEP] operator[SEP] identifier[header] operator[SEP] identifier[put] operator[SEP] identifier[compressed] operator[?] identifier[COMPRESSED] operator[:] identifier[UNCOMPRESSED] operator[SEP] operator[SEP] Keyword[int] identifier[messageLength] operator[=] identifier[bufferChain] operator[SEP] identifier[readableBytes] operator[SEP] operator[SEP] operator[SEP] identifier[header] operator[SEP] identifier[putInt] operator[SEP] identifier[messageLength] operator[SEP] operator[SEP] identifier[WritableBuffer] identifier[writeableHeader] operator[=] identifier[bufferAllocator] operator[SEP] identifier[allocate] operator[SEP] identifier[HEADER_LENGTH] operator[SEP] operator[SEP] identifier[writeableHeader] operator[SEP] identifier[write] operator[SEP] identifier[headerScratch] , Other[0] , identifier[header] operator[SEP] identifier[position] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[messageLength] operator[==] Other[0] operator[SEP] {
identifier[buffer] operator[=] identifier[writeableHeader] operator[SEP] Keyword[return] operator[SEP]
}
identifier[sink] operator[SEP] identifier[deliverFrame] operator[SEP] identifier[writeableHeader] , literal[boolean] , literal[boolean] , identifier[messagesBuffered] operator[-] Other[1] operator[SEP] operator[SEP] identifier[messagesBuffered] operator[=] Other[1] operator[SEP] identifier[List] operator[<] identifier[WritableBuffer] operator[>] identifier[bufferList] operator[=] identifier[bufferChain] operator[SEP] identifier[bufferList] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[bufferList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[sink] operator[SEP] identifier[deliverFrame] operator[SEP] identifier[bufferList] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] , literal[boolean] , literal[boolean] , Other[0] operator[SEP] operator[SEP]
}
identifier[buffer] operator[=] identifier[bufferList] operator[SEP] identifier[get] operator[SEP] identifier[bufferList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] identifier[currentMessageWireSize] operator[=] identifier[messageLength] operator[SEP]
}
|
public AsImpl getAs(int dpc, int opc, short si) {
for (FastList.Node<DPCNode> n = dpcList.head(), end = dpcList.tail(); (n = n.getNext()) != end;) {
DPCNode dpcNode = n.getValue();
if (dpcNode.dpc == dpc) {
return dpcNode.getAs(opc, si);
}
}
return null;
}
|
class class_name[name] begin[{]
method[getAs, return_type[type[AsImpl]], modifier[public], parameter[dpc, opc, si]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=n, selectors=[], type_arguments=None), name=dpcNode)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DPCNode, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=dpc, postfix_operators=[], prefix_operators=[], qualifier=dpcNode, selectors=[]), operandr=MemberReference(member=dpc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=opc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=si, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getAs, postfix_operators=[], prefix_operators=[], qualifier=dpcNode, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=Assignment(expressionl=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getNext, postfix_operators=[], prefix_operators=[], qualifier=n, selectors=[], type_arguments=None)), operandr=MemberReference(member=end, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=head, postfix_operators=[], prefix_operators=[], qualifier=dpcList, selectors=[], type_arguments=None), name=n), VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=tail, postfix_operators=[], prefix_operators=[], qualifier=dpcList, selectors=[], type_arguments=None), name=end)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FastList, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=DPCNode, sub_type=None))], dimensions=None, name=Node, sub_type=None))), update=None), label=None)
return[literal[null]]
end[}]
END[}]
|
Keyword[public] identifier[AsImpl] identifier[getAs] operator[SEP] Keyword[int] identifier[dpc] , Keyword[int] identifier[opc] , Keyword[short] identifier[si] operator[SEP] {
Keyword[for] operator[SEP] identifier[FastList] operator[SEP] identifier[Node] operator[<] identifier[DPCNode] operator[>] identifier[n] operator[=] identifier[dpcList] operator[SEP] identifier[head] operator[SEP] operator[SEP] , identifier[end] operator[=] identifier[dpcList] operator[SEP] identifier[tail] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[n] operator[=] identifier[n] operator[SEP] identifier[getNext] operator[SEP] operator[SEP] operator[SEP] operator[!=] identifier[end] operator[SEP] operator[SEP] {
identifier[DPCNode] identifier[dpcNode] operator[=] identifier[n] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dpcNode] operator[SEP] identifier[dpc] operator[==] identifier[dpc] operator[SEP] {
Keyword[return] identifier[dpcNode] operator[SEP] identifier[getAs] operator[SEP] identifier[opc] , identifier[si] operator[SEP] operator[SEP]
}
}
Keyword[return] Other[null] operator[SEP]
}
|
public Observable<ServiceResponse<SignalRKeysInner>> beginRegenerateKeyWithServiceResponseAsync(String resourceGroupName, String resourceName) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (resourceName == null) {
throw new IllegalArgumentException("Parameter resourceName is required and cannot be null.");
}
final KeyType keyType = null;
RegenerateKeyParameters parameters = new RegenerateKeyParameters();
parameters.withKeyType(null);
return service.beginRegenerateKey(this.client.subscriptionId(), resourceGroupName, resourceName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<SignalRKeysInner>>>() {
@Override
public Observable<ServiceResponse<SignalRKeysInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<SignalRKeysInner> clientResponse = beginRegenerateKeyDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
|
class class_name[name] begin[{]
method[beginRegenerateKeyWithServiceResponseAsync, return_type[type[Observable]], modifier[public], parameter[resourceGroupName, resourceName]] begin[{]
if[binary_operation[THIS[member[None.client]call[None.subscriptionId, parameter[]]], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter this.client.subscriptionId() is required and cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.resourceGroupName], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter resourceGroupName is required and cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.resourceName], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter resourceName is required and cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[KeyType], keyType]
local_variable[type[RegenerateKeyParameters], parameters]
call[parameters.withKeyType, parameter[literal[null]]]
return[call[service.beginRegenerateKey, parameter[THIS[member[None.client]call[None.subscriptionId, parameter[]]], member[.resourceGroupName], member[.resourceName], THIS[member[None.client]call[None.apiVersion, parameter[]]], THIS[member[None.client]call[None.acceptLanguage, parameter[]]], member[.parameters], THIS[member[None.client]call[None.userAgent, parameter[]]]]]]
end[}]
END[}]
|
Keyword[public] identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[SignalRKeysInner] operator[>] operator[>] identifier[beginRegenerateKeyWithServiceResponseAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[resourceName] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[subscriptionId] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[resourceGroupName] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[resourceName] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[final] identifier[KeyType] identifier[keyType] operator[=] Other[null] operator[SEP] identifier[RegenerateKeyParameters] identifier[parameters] operator[=] Keyword[new] identifier[RegenerateKeyParameters] operator[SEP] operator[SEP] operator[SEP] identifier[parameters] operator[SEP] identifier[withKeyType] operator[SEP] Other[null] operator[SEP] operator[SEP] Keyword[return] identifier[service] operator[SEP] identifier[beginRegenerateKey] operator[SEP] Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[subscriptionId] operator[SEP] operator[SEP] , identifier[resourceGroupName] , identifier[resourceName] , Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[apiVersion] operator[SEP] operator[SEP] , Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[acceptLanguage] operator[SEP] operator[SEP] , identifier[parameters] , Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[userAgent] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[flatMap] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[Response] operator[<] identifier[ResponseBody] operator[>] , identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[SignalRKeysInner] operator[>] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[SignalRKeysInner] operator[>] operator[>] identifier[call] operator[SEP] identifier[Response] operator[<] identifier[ResponseBody] operator[>] identifier[response] operator[SEP] {
Keyword[try] {
identifier[ServiceResponse] operator[<] identifier[SignalRKeysInner] operator[>] identifier[clientResponse] operator[=] identifier[beginRegenerateKeyDelegate] operator[SEP] identifier[response] operator[SEP] operator[SEP] Keyword[return] identifier[Observable] operator[SEP] identifier[just] operator[SEP] identifier[clientResponse] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
Keyword[return] identifier[Observable] operator[SEP] identifier[error] operator[SEP] identifier[t] operator[SEP] operator[SEP]
}
}
} operator[SEP] operator[SEP]
}
|
public static Camera createPerspective(float fieldOfView, int windowWidth, int windowHeight, float near, float far) {
return new Camera(Matrix4f.createPerspective(fieldOfView, (float) windowWidth / windowHeight, near, far));
}
|
class class_name[name] begin[{]
method[createPerspective, return_type[type[Camera]], modifier[public static], parameter[fieldOfView, windowWidth, windowHeight, near, far]] begin[{]
return[ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=fieldOfView, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=Cast(expression=MemberReference(member=windowWidth, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=float)), operandr=MemberReference(member=windowHeight, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=/), MemberReference(member=near, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=far, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createPerspective, postfix_operators=[], prefix_operators=[], qualifier=Matrix4f, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Camera, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Camera] identifier[createPerspective] operator[SEP] Keyword[float] identifier[fieldOfView] , Keyword[int] identifier[windowWidth] , Keyword[int] identifier[windowHeight] , Keyword[float] identifier[near] , Keyword[float] identifier[far] operator[SEP] {
Keyword[return] Keyword[new] identifier[Camera] operator[SEP] identifier[Matrix4f] operator[SEP] identifier[createPerspective] operator[SEP] identifier[fieldOfView] , operator[SEP] Keyword[float] operator[SEP] identifier[windowWidth] operator[/] identifier[windowHeight] , identifier[near] , identifier[far] operator[SEP] operator[SEP] operator[SEP]
}
|
public static final Color getColorForValue(double val) {
// Color positions
double[] pos = new double[] { 0.0, 0.6, 0.8, 1.0 };
// Colors at these positions
Color[] cols = new Color[] { new Color(0.0f, 0.0f, 0.0f, 0.6f), new Color(0.0f, 0.0f, 1.0f, 0.8f), new Color(1.0f, 0.0f, 0.0f, 0.9f), new Color(1.0f, 1.0f, 0.0f, 1.0f) };
assert (pos.length == cols.length);
if(val < pos[0]) {
val = pos[0];
}
// Linear interpolation:
for(int i = 1; i < pos.length; i++) {
if(val <= pos[i]) {
Color prev = cols[i - 1];
Color next = cols[i];
final double mix = (val - pos[i - 1]) / (pos[i] - pos[i - 1]);
final int r = (int) ((1 - mix) * prev.getRed() + mix * next.getRed());
final int g = (int) ((1 - mix) * prev.getGreen() + mix * next.getGreen());
final int b = (int) ((1 - mix) * prev.getBlue() + mix * next.getBlue());
final int a = (int) ((1 - mix) * prev.getAlpha() + mix * next.getAlpha());
Color col = new Color(r, g, b, a);
return col;
}
}
return cols[cols.length - 1];
}
|
class class_name[name] begin[{]
method[getColorForValue, return_type[type[Color]], modifier[final public static], parameter[val]] begin[{]
local_variable[type[double], pos]
local_variable[type[Color], cols]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=pos, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=cols, selectors=[]), operator===), label=None, value=None)
if[binary_operation[member[.val], <, member[.pos]]] begin[{]
assign[member[.val], member[.pos]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=val, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=<=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=cols, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-))]), name=prev)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Color, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=cols, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=next)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Color, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=val, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-))]), operator=-), operandr=BinaryOperation(operandl=MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-))]), operator=-), operator=/), name=mix)], modifiers={'final'}, type=BasicType(dimensions=[], name=double)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operandr=MemberReference(member=mix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), operandr=MethodInvocation(arguments=[], member=getRed, postfix_operators=[], prefix_operators=[], qualifier=prev, selectors=[], type_arguments=None), operator=*), operandr=BinaryOperation(operandl=MemberReference(member=mix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getRed, postfix_operators=[], prefix_operators=[], qualifier=next, selectors=[], type_arguments=None), operator=*), operator=+), type=BasicType(dimensions=[], name=int)), name=r)], modifiers={'final'}, type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operandr=MemberReference(member=mix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), operandr=MethodInvocation(arguments=[], member=getGreen, postfix_operators=[], prefix_operators=[], qualifier=prev, selectors=[], type_arguments=None), operator=*), operandr=BinaryOperation(operandl=MemberReference(member=mix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getGreen, postfix_operators=[], prefix_operators=[], qualifier=next, selectors=[], type_arguments=None), operator=*), operator=+), type=BasicType(dimensions=[], name=int)), name=g)], modifiers={'final'}, type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operandr=MemberReference(member=mix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), operandr=MethodInvocation(arguments=[], member=getBlue, postfix_operators=[], prefix_operators=[], qualifier=prev, selectors=[], type_arguments=None), operator=*), operandr=BinaryOperation(operandl=MemberReference(member=mix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getBlue, postfix_operators=[], prefix_operators=[], qualifier=next, selectors=[], type_arguments=None), operator=*), operator=+), type=BasicType(dimensions=[], name=int)), name=b)], modifiers={'final'}, type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operandr=MemberReference(member=mix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), operandr=MethodInvocation(arguments=[], member=getAlpha, postfix_operators=[], prefix_operators=[], qualifier=prev, selectors=[], type_arguments=None), operator=*), operandr=BinaryOperation(operandl=MemberReference(member=mix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getAlpha, postfix_operators=[], prefix_operators=[], qualifier=next, selectors=[], type_arguments=None), operator=*), operator=+), type=BasicType(dimensions=[], name=int)), name=a)], modifiers={'final'}, type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=g, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=a, 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=Color, sub_type=None)), name=col)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Color, sub_type=None)), ReturnStatement(expression=MemberReference(member=col, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=pos, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.cols]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[final] identifier[Color] identifier[getColorForValue] operator[SEP] Keyword[double] identifier[val] operator[SEP] {
Keyword[double] operator[SEP] operator[SEP] identifier[pos] operator[=] Keyword[new] Keyword[double] operator[SEP] operator[SEP] {
literal[Float] , literal[Float] , literal[Float] , literal[Float]
} operator[SEP] identifier[Color] operator[SEP] operator[SEP] identifier[cols] operator[=] Keyword[new] identifier[Color] operator[SEP] operator[SEP] {
Keyword[new] identifier[Color] operator[SEP] literal[Float] , literal[Float] , literal[Float] , literal[Float] operator[SEP] , Keyword[new] identifier[Color] operator[SEP] literal[Float] , literal[Float] , literal[Float] , literal[Float] operator[SEP] , Keyword[new] identifier[Color] operator[SEP] literal[Float] , literal[Float] , literal[Float] , literal[Float] operator[SEP] , Keyword[new] identifier[Color] operator[SEP] literal[Float] , literal[Float] , literal[Float] , literal[Float] operator[SEP]
} operator[SEP] Keyword[assert] operator[SEP] identifier[pos] operator[SEP] identifier[length] operator[==] identifier[cols] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[val] operator[<] identifier[pos] operator[SEP] Other[0] operator[SEP] operator[SEP] {
identifier[val] operator[=] identifier[pos] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[1] operator[SEP] identifier[i] operator[<] identifier[pos] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[val] operator[<=] identifier[pos] operator[SEP] identifier[i] operator[SEP] operator[SEP] {
identifier[Color] identifier[prev] operator[=] identifier[cols] operator[SEP] identifier[i] operator[-] Other[1] operator[SEP] operator[SEP] identifier[Color] identifier[next] operator[=] identifier[cols] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[final] Keyword[double] identifier[mix] operator[=] operator[SEP] identifier[val] operator[-] identifier[pos] operator[SEP] identifier[i] operator[-] Other[1] operator[SEP] operator[SEP] operator[/] operator[SEP] identifier[pos] operator[SEP] identifier[i] operator[SEP] operator[-] identifier[pos] operator[SEP] identifier[i] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[r] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] operator[SEP] Other[1] operator[-] identifier[mix] operator[SEP] operator[*] identifier[prev] operator[SEP] identifier[getRed] operator[SEP] operator[SEP] operator[+] identifier[mix] operator[*] identifier[next] operator[SEP] identifier[getRed] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[g] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] operator[SEP] Other[1] operator[-] identifier[mix] operator[SEP] operator[*] identifier[prev] operator[SEP] identifier[getGreen] operator[SEP] operator[SEP] operator[+] identifier[mix] operator[*] identifier[next] operator[SEP] identifier[getGreen] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[b] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] operator[SEP] Other[1] operator[-] identifier[mix] operator[SEP] operator[*] identifier[prev] operator[SEP] identifier[getBlue] operator[SEP] operator[SEP] operator[+] identifier[mix] operator[*] identifier[next] operator[SEP] identifier[getBlue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[a] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] operator[SEP] Other[1] operator[-] identifier[mix] operator[SEP] operator[*] identifier[prev] operator[SEP] identifier[getAlpha] operator[SEP] operator[SEP] operator[+] identifier[mix] operator[*] identifier[next] operator[SEP] identifier[getAlpha] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Color] identifier[col] operator[=] Keyword[new] identifier[Color] operator[SEP] identifier[r] , identifier[g] , identifier[b] , identifier[a] operator[SEP] operator[SEP] Keyword[return] identifier[col] operator[SEP]
}
}
Keyword[return] identifier[cols] operator[SEP] identifier[cols] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] operator[SEP]
}
|
public BoxSharedLink getSharedLink() {
return mBodyMap.containsKey(BoxItem.FIELD_SHARED_LINK) ?
((BoxSharedLink) mBodyMap.get(BoxItem.FIELD_SHARED_LINK)) :
null;
}
|
class class_name[name] begin[{]
method[getSharedLink, return_type[type[BoxSharedLink]], modifier[public], parameter[]] begin[{]
return[TernaryExpression(condition=MethodInvocation(arguments=[MemberReference(member=FIELD_SHARED_LINK, postfix_operators=[], prefix_operators=[], qualifier=BoxItem, selectors=[])], member=containsKey, postfix_operators=[], prefix_operators=[], qualifier=mBodyMap, selectors=[], type_arguments=None), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), if_true=Cast(expression=MethodInvocation(arguments=[MemberReference(member=FIELD_SHARED_LINK, postfix_operators=[], prefix_operators=[], qualifier=BoxItem, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=mBodyMap, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=BoxSharedLink, sub_type=None)))]
end[}]
END[}]
|
Keyword[public] identifier[BoxSharedLink] identifier[getSharedLink] operator[SEP] operator[SEP] {
Keyword[return] identifier[mBodyMap] operator[SEP] identifier[containsKey] operator[SEP] identifier[BoxItem] operator[SEP] identifier[FIELD_SHARED_LINK] operator[SEP] operator[?] operator[SEP] operator[SEP] identifier[BoxSharedLink] operator[SEP] identifier[mBodyMap] operator[SEP] identifier[get] operator[SEP] identifier[BoxItem] operator[SEP] identifier[FIELD_SHARED_LINK] operator[SEP] operator[SEP] operator[:] Other[null] operator[SEP]
}
|
public QrCodeEncoder addAutomatic(String message) {
// very simple coding algorithm. Doesn't try to compress by using multiple formats
if(containsKanji(message)) {
// split into kanji and non-kanji segments
int start = 0;
boolean kanji = isKanji(message.charAt(0));
for (int i = 0; i < message.length(); i++) {
if( isKanji(message.charAt(i))) {
if( !kanji ) {
addAutomatic(message.substring(start,i));
start = i;
kanji = true;
}
} else {
if( kanji ) {
addKanji(message.substring(start,i));
start = i;
kanji = false;
}
}
}
if( kanji ) {
addKanji(message.substring(start,message.length()));
} else {
addAutomatic(message.substring(start,message.length()));
}
return this;
} else if( containsByte(message)) {
return addBytes(message);
} else if( containsAlphaNumeric(message)) {
return addAlphanumeric(message);
} else {
return addNumeric(message);
}
}
|
class class_name[name] begin[{]
method[addAutomatic, return_type[type[QrCodeEncoder]], modifier[public], parameter[message]] begin[{]
if[call[.containsKanji, parameter[member[.message]]]] begin[{]
local_variable[type[int], start]
local_variable[type[boolean], kanji]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=message, selectors=[], type_arguments=None)], member=isKanji, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[IfStatement(condition=MemberReference(member=kanji, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=substring, postfix_operators=[], prefix_operators=[], qualifier=message, selectors=[], type_arguments=None)], member=addKanji, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=kanji, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)]))]), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MemberReference(member=kanji, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=substring, postfix_operators=[], prefix_operators=[], qualifier=message, selectors=[], type_arguments=None)], member=addAutomatic, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=kanji, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), 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=message, 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)
if[member[.kanji]] begin[{]
call[.addKanji, parameter[call[message.substring, parameter[member[.start], call[message.length, parameter[]]]]]]
else begin[{]
call[.addAutomatic, parameter[call[message.substring, parameter[member[.start], call[message.length, parameter[]]]]]]
end[}]
return[THIS[]]
else begin[{]
if[call[.containsByte, parameter[member[.message]]]] begin[{]
return[call[.addBytes, parameter[member[.message]]]]
else begin[{]
if[call[.containsAlphaNumeric, parameter[member[.message]]]] begin[{]
return[call[.addAlphanumeric, parameter[member[.message]]]]
else begin[{]
return[call[.addNumeric, parameter[member[.message]]]]
end[}]
end[}]
end[}]
end[}]
END[}]
|
Keyword[public] identifier[QrCodeEncoder] identifier[addAutomatic] operator[SEP] identifier[String] identifier[message] operator[SEP] {
Keyword[if] operator[SEP] identifier[containsKanji] operator[SEP] identifier[message] operator[SEP] operator[SEP] {
Keyword[int] identifier[start] operator[=] Other[0] operator[SEP] Keyword[boolean] identifier[kanji] operator[=] identifier[isKanji] operator[SEP] identifier[message] operator[SEP] identifier[charAt] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[message] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[isKanji] operator[SEP] identifier[message] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[kanji] operator[SEP] {
identifier[addAutomatic] operator[SEP] identifier[message] operator[SEP] identifier[substring] operator[SEP] identifier[start] , identifier[i] operator[SEP] operator[SEP] operator[SEP] identifier[start] operator[=] identifier[i] operator[SEP] identifier[kanji] operator[=] literal[boolean] operator[SEP]
}
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[kanji] operator[SEP] {
identifier[addKanji] operator[SEP] identifier[message] operator[SEP] identifier[substring] operator[SEP] identifier[start] , identifier[i] operator[SEP] operator[SEP] operator[SEP] identifier[start] operator[=] identifier[i] operator[SEP] identifier[kanji] operator[=] literal[boolean] operator[SEP]
}
}
}
Keyword[if] operator[SEP] identifier[kanji] operator[SEP] {
identifier[addKanji] operator[SEP] identifier[message] operator[SEP] identifier[substring] operator[SEP] identifier[start] , identifier[message] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[addAutomatic] operator[SEP] identifier[message] operator[SEP] identifier[substring] operator[SEP] identifier[start] , identifier[message] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[containsByte] operator[SEP] identifier[message] operator[SEP] operator[SEP] {
Keyword[return] identifier[addBytes] operator[SEP] identifier[message] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[containsAlphaNumeric] operator[SEP] identifier[message] operator[SEP] operator[SEP] {
Keyword[return] identifier[addAlphanumeric] operator[SEP] identifier[message] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[addNumeric] operator[SEP] identifier[message] operator[SEP] operator[SEP]
}
}
|
private static boolean checkIfCollectionExists(CloudSolrClient server, String collection) throws KeeperException, InterruptedException {
ZkStateReader zkStateReader = server.getZkStateReader();
zkStateReader.updateClusterState(true);
ClusterState clusterState = zkStateReader.getClusterState();
return clusterState.getCollectionOrNull(collection) != null;
}
|
class class_name[name] begin[{]
method[checkIfCollectionExists, return_type[type[boolean]], modifier[private static], parameter[server, collection]] begin[{]
local_variable[type[ZkStateReader], zkStateReader]
call[zkStateReader.updateClusterState, parameter[literal[true]]]
local_variable[type[ClusterState], clusterState]
return[binary_operation[call[clusterState.getCollectionOrNull, parameter[member[.collection]]], !=, literal[null]]]
end[}]
END[}]
|
Keyword[private] Keyword[static] Keyword[boolean] identifier[checkIfCollectionExists] operator[SEP] identifier[CloudSolrClient] identifier[server] , identifier[String] identifier[collection] operator[SEP] Keyword[throws] identifier[KeeperException] , identifier[InterruptedException] {
identifier[ZkStateReader] identifier[zkStateReader] operator[=] identifier[server] operator[SEP] identifier[getZkStateReader] operator[SEP] operator[SEP] operator[SEP] identifier[zkStateReader] operator[SEP] identifier[updateClusterState] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[ClusterState] identifier[clusterState] operator[=] identifier[zkStateReader] operator[SEP] identifier[getClusterState] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[clusterState] operator[SEP] identifier[getCollectionOrNull] operator[SEP] identifier[collection] operator[SEP] operator[!=] Other[null] operator[SEP]
}
|
public Object remove(Serializable key) {
if(component.initialStateMarked()) {
Object retVal = deltaMap.remove(key);
if(retVal==null) {
return defaultMap.remove(key);
}
else {
defaultMap.remove(key);
return retVal;
}
}
else {
return defaultMap.remove(key);
}
}
|
class class_name[name] begin[{]
method[remove, return_type[type[Object]], modifier[public], parameter[key]] begin[{]
if[call[component.initialStateMarked, parameter[]]] begin[{]
local_variable[type[Object], retVal]
if[binary_operation[member[.retVal], ==, literal[null]]] begin[{]
return[call[defaultMap.remove, parameter[member[.key]]]]
else begin[{]
call[defaultMap.remove, parameter[member[.key]]]
return[member[.retVal]]
end[}]
else begin[{]
return[call[defaultMap.remove, parameter[member[.key]]]]
end[}]
end[}]
END[}]
|
Keyword[public] identifier[Object] identifier[remove] operator[SEP] identifier[Serializable] identifier[key] operator[SEP] {
Keyword[if] operator[SEP] identifier[component] operator[SEP] identifier[initialStateMarked] operator[SEP] operator[SEP] operator[SEP] {
identifier[Object] identifier[retVal] operator[=] identifier[deltaMap] operator[SEP] identifier[remove] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[retVal] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[defaultMap] operator[SEP] identifier[remove] operator[SEP] identifier[key] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[defaultMap] operator[SEP] identifier[remove] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[return] identifier[retVal] operator[SEP]
}
}
Keyword[else] {
Keyword[return] identifier[defaultMap] operator[SEP] identifier[remove] operator[SEP] identifier[key] operator[SEP] operator[SEP]
}
}
|
public static boolean eqv(boolean left, boolean right) {
return (left == true && right == true) || (left == false && right == false);
}
|
class class_name[name] begin[{]
method[eqv, return_type[type[boolean]], modifier[public static], parameter[left, right]] begin[{]
return[binary_operation[binary_operation[binary_operation[member[.left], ==, literal[true]], &&, binary_operation[member[.right], ==, literal[true]]], ||, binary_operation[binary_operation[member[.left], ==, literal[false]], &&, binary_operation[member[.right], ==, literal[false]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[boolean] identifier[eqv] operator[SEP] Keyword[boolean] identifier[left] , Keyword[boolean] identifier[right] operator[SEP] {
Keyword[return] operator[SEP] identifier[left] operator[==] literal[boolean] operator[&&] identifier[right] operator[==] literal[boolean] operator[SEP] operator[||] operator[SEP] identifier[left] operator[==] literal[boolean] operator[&&] identifier[right] operator[==] literal[boolean] operator[SEP] operator[SEP]
}
|
@Override public int compareTo(DateRange o)
{
int result = net.sf.mpxj.common.DateHelper.compare(m_start, o.m_start);
if (result == 0)
{
result = net.sf.mpxj.common.DateHelper.compare(m_end, o.m_end);
}
return result;
}
|
class class_name[name] begin[{]
method[compareTo, return_type[type[int]], modifier[public], parameter[o]] begin[{]
local_variable[type[int], result]
if[binary_operation[member[.result], ==, literal[0]]] begin[{]
assign[member[.result], call[net.sf.mpxj.common.DateHelper.compare, parameter[member[.m_end], member[o.m_end]]]]
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[int] identifier[compareTo] operator[SEP] identifier[DateRange] identifier[o] operator[SEP] {
Keyword[int] identifier[result] operator[=] identifier[net] operator[SEP] identifier[sf] operator[SEP] identifier[mpxj] operator[SEP] identifier[common] operator[SEP] identifier[DateHelper] operator[SEP] identifier[compare] operator[SEP] identifier[m_start] , identifier[o] operator[SEP] identifier[m_start] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[==] Other[0] operator[SEP] {
identifier[result] operator[=] identifier[net] operator[SEP] identifier[sf] operator[SEP] identifier[mpxj] operator[SEP] identifier[common] operator[SEP] identifier[DateHelper] operator[SEP] identifier[compare] operator[SEP] identifier[m_end] , identifier[o] operator[SEP] identifier[m_end] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public Long getLong(String attr) {
Number n = (Number)attrs.get(attr);
return n != null ? n.longValue() : null;
}
|
class class_name[name] begin[{]
method[getLong, return_type[type[Long]], modifier[public], parameter[attr]] begin[{]
local_variable[type[Number], n]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), if_true=MethodInvocation(arguments=[], member=longValue, postfix_operators=[], prefix_operators=[], qualifier=n, selectors=[], type_arguments=None))]
end[}]
END[}]
|
Keyword[public] identifier[Long] identifier[getLong] operator[SEP] identifier[String] identifier[attr] operator[SEP] {
identifier[Number] identifier[n] operator[=] operator[SEP] identifier[Number] operator[SEP] identifier[attrs] operator[SEP] identifier[get] operator[SEP] identifier[attr] operator[SEP] operator[SEP] Keyword[return] identifier[n] operator[!=] Other[null] operator[?] identifier[n] operator[SEP] identifier[longValue] operator[SEP] operator[SEP] operator[:] Other[null] operator[SEP]
}
|
boolean addHandle (SIMessageHandle handle,
Map ctxInfo,
final boolean canBeDeleted) {
final String methodName = "addHandle";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName, new Object [] { handle, ctxInfo, canBeDeleted });
}
boolean addedToThisToken = false;
if (_messageHandles.isEmpty())
{
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
SibTr.debug(TRACE, "No existing message handles - using current message as template <ctxInfo="
+ ctxInfo + "> <canBeDeleted=" + canBeDeleted + "> <handle= " + handle + ">");
}
_messageHandles.add (handle);
_contextInfo = ctxInfo;
_deleteMessagesWhenRead = canBeDeleted;
// Work out once whether this map is default size so we can optimize
// the matches method later on.
_contextInfoContainsDefaultEntries = (_contextInfo.size() == 2 //&&
//lohith liberty change
// _contextInfo.containsKey(WlmClassifierConstants.CONTEXT_MAP_KEY) &&
/* _contextInfo.containsKey(ExitPointConstants.TYPE_NAME)*/);
addedToThisToken = true;
} else {
if (matches (ctxInfo, canBeDeleted)) {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
SibTr.debug(TRACE, "Message matched token for supplied handle - adding handle to the token <handle=" + handle + ">");
}
_messageHandles.add (handle);
addedToThisToken = true;
}
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName, addedToThisToken);
}
return addedToThisToken;
}
|
class class_name[name] begin[{]
method[addHandle, return_type[type[boolean]], modifier[default], parameter[handle, ctxInfo, canBeDeleted]] begin[{]
local_variable[type[String], methodName]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[TRACE.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[THIS[], member[.TRACE], member[.methodName], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=handle, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ctxInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=canBeDeleted, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
else begin[{]
None
end[}]
local_variable[type[boolean], addedToThisToken]
if[call[_messageHandles.isEmpty, parameter[]]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[TRACE.isDebugEnabled, parameter[]]]] begin[{]
call[SibTr.debug, parameter[member[.TRACE], binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[literal["No existing message handles - using current message as template <ctxInfo="], +, member[.ctxInfo]], +, literal["> <canBeDeleted="]], +, member[.canBeDeleted]], +, literal["> <handle= "]], +, member[.handle]], +, literal[">"]]]]
else begin[{]
None
end[}]
call[_messageHandles.add, parameter[member[.handle]]]
assign[member[._contextInfo], member[.ctxInfo]]
assign[member[._deleteMessagesWhenRead], member[.canBeDeleted]]
assign[member[._contextInfoContainsDefaultEntries], binary_operation[call[_contextInfo.size, parameter[]], ==, literal[2]]]
assign[member[.addedToThisToken], literal[true]]
else begin[{]
if[call[.matches, parameter[member[.ctxInfo], member[.canBeDeleted]]]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[TRACE.isDebugEnabled, parameter[]]]] begin[{]
call[SibTr.debug, parameter[member[.TRACE], binary_operation[binary_operation[literal["Message matched token for supplied handle - adding handle to the token <handle="], +, member[.handle]], +, literal[">"]]]]
else begin[{]
None
end[}]
call[_messageHandles.add, parameter[member[.handle]]]
assign[member[.addedToThisToken], literal[true]]
else begin[{]
None
end[}]
end[}]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[TRACE.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[THIS[], member[.TRACE], member[.methodName], member[.addedToThisToken]]]
else begin[{]
None
end[}]
return[member[.addedToThisToken]]
end[}]
END[}]
|
Keyword[boolean] identifier[addHandle] operator[SEP] identifier[SIMessageHandle] identifier[handle] , identifier[Map] identifier[ctxInfo] , Keyword[final] Keyword[boolean] identifier[canBeDeleted] operator[SEP] {
Keyword[final] identifier[String] identifier[methodName] operator[=] literal[String] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[TRACE] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] Keyword[this] , identifier[TRACE] , identifier[methodName] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[handle] , identifier[ctxInfo] , identifier[canBeDeleted]
} operator[SEP] operator[SEP]
}
Keyword[boolean] identifier[addedToThisToken] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[_messageHandles] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[TRACE] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[SibTr] operator[SEP] identifier[debug] operator[SEP] identifier[TRACE] , literal[String] operator[+] identifier[ctxInfo] operator[+] literal[String] operator[+] identifier[canBeDeleted] operator[+] literal[String] operator[+] identifier[handle] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[_messageHandles] operator[SEP] identifier[add] operator[SEP] identifier[handle] operator[SEP] operator[SEP] identifier[_contextInfo] operator[=] identifier[ctxInfo] operator[SEP] identifier[_deleteMessagesWhenRead] operator[=] identifier[canBeDeleted] operator[SEP] identifier[_contextInfoContainsDefaultEntries] operator[=] operator[SEP] identifier[_contextInfo] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[2] operator[SEP] operator[SEP] identifier[addedToThisToken] operator[=] literal[boolean] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[matches] operator[SEP] identifier[ctxInfo] , identifier[canBeDeleted] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[TRACE] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[SibTr] operator[SEP] identifier[debug] operator[SEP] identifier[TRACE] , literal[String] operator[+] identifier[handle] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[_messageHandles] operator[SEP] identifier[add] operator[SEP] identifier[handle] operator[SEP] operator[SEP] identifier[addedToThisToken] operator[=] literal[boolean] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[TRACE] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] Keyword[this] , identifier[TRACE] , identifier[methodName] , identifier[addedToThisToken] operator[SEP] operator[SEP]
}
Keyword[return] identifier[addedToThisToken] operator[SEP]
}
|
static final public LocalRateOptions parseRateOptions(boolean rate, String spec) {
if (!rate || spec.length() < 6) {
return new LocalRateOptions();
}
String[] parts = spec.split(spec.substring(5, spec.length() - 1), ',');
if (parts.length < 1 || parts.length > 3) {
return new LocalRateOptions();
}
try {
LocalRateOptions options = new LocalRateOptions();
options.is_counter = parts[0].endsWith("counter");
options.counter_max = (parts.length >= 2 && parts[1].length() > 0 ? Long
.parseLong(parts[1]) : Long.MAX_VALUE);
options.reset_value = (parts.length >= 3 && parts[2].length() > 0 ? Long
.parseLong(parts[2]) : 0);
return options;
} catch (NumberFormatException e) {
return new LocalRateOptions();
}
}
|
class class_name[name] begin[{]
method[parseRateOptions, return_type[type[LocalRateOptions]], modifier[final public static], parameter[rate, spec]] begin[{]
if[binary_operation[member[.rate], ||, binary_operation[call[spec.length, parameter[]], <, literal[6]]]] begin[{]
return[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LocalRateOptions, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[String], parts]
if[binary_operation[binary_operation[member[parts.length], <, literal[1]], ||, binary_operation[member[parts.length], >, literal[3]]]] begin[{]
return[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LocalRateOptions, sub_type=None))]
else begin[{]
None
end[}]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LocalRateOptions, sub_type=None)), name=options)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=LocalRateOptions, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=is_counter, postfix_operators=[], prefix_operators=[], qualifier=options, selectors=[]), type==, value=MemberReference(member=parts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="counter")], member=endsWith, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=counter_max, postfix_operators=[], prefix_operators=[], qualifier=options, selectors=[]), type==, value=TernaryExpression(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=parts, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=>=), operandr=BinaryOperation(operandl=MemberReference(member=parts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)), MethodInvocation(arguments=[], member=length, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), operator=&&), if_false=MemberReference(member=MAX_VALUE, postfix_operators=[], prefix_operators=[], qualifier=Long, selectors=[]), if_true=MethodInvocation(arguments=[MemberReference(member=parts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))])], member=parseLong, postfix_operators=[], prefix_operators=[], qualifier=Long, selectors=[], type_arguments=None))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=reset_value, postfix_operators=[], prefix_operators=[], qualifier=options, selectors=[]), type==, value=TernaryExpression(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=parts, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3), operator=>=), operandr=BinaryOperation(operandl=MemberReference(member=parts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)), MethodInvocation(arguments=[], member=length, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), operator=&&), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), if_true=MethodInvocation(arguments=[MemberReference(member=parts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2))])], member=parseLong, postfix_operators=[], prefix_operators=[], qualifier=Long, selectors=[], type_arguments=None))), label=None), ReturnStatement(expression=MemberReference(member=options, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LocalRateOptions, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NumberFormatException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[static] Keyword[final] Keyword[public] identifier[LocalRateOptions] identifier[parseRateOptions] operator[SEP] Keyword[boolean] identifier[rate] , identifier[String] identifier[spec] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[rate] operator[||] identifier[spec] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[<] Other[6] operator[SEP] {
Keyword[return] Keyword[new] identifier[LocalRateOptions] operator[SEP] operator[SEP] operator[SEP]
}
identifier[String] operator[SEP] operator[SEP] identifier[parts] operator[=] identifier[spec] operator[SEP] identifier[split] operator[SEP] identifier[spec] operator[SEP] identifier[substring] operator[SEP] Other[5] , identifier[spec] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[parts] operator[SEP] identifier[length] operator[<] Other[1] operator[||] identifier[parts] operator[SEP] identifier[length] operator[>] Other[3] operator[SEP] {
Keyword[return] Keyword[new] identifier[LocalRateOptions] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[LocalRateOptions] identifier[options] operator[=] Keyword[new] identifier[LocalRateOptions] operator[SEP] operator[SEP] operator[SEP] identifier[options] operator[SEP] identifier[is_counter] operator[=] identifier[parts] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[options] operator[SEP] identifier[counter_max] operator[=] operator[SEP] identifier[parts] operator[SEP] identifier[length] operator[>=] Other[2] operator[&&] identifier[parts] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[?] identifier[Long] operator[SEP] identifier[parseLong] operator[SEP] identifier[parts] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[:] identifier[Long] operator[SEP] identifier[MAX_VALUE] operator[SEP] operator[SEP] identifier[options] operator[SEP] identifier[reset_value] operator[=] operator[SEP] identifier[parts] operator[SEP] identifier[length] operator[>=] Other[3] operator[&&] identifier[parts] operator[SEP] Other[2] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[?] identifier[Long] operator[SEP] identifier[parseLong] operator[SEP] identifier[parts] operator[SEP] Other[2] operator[SEP] operator[SEP] operator[:] Other[0] operator[SEP] operator[SEP] Keyword[return] identifier[options] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NumberFormatException] identifier[e] operator[SEP] {
Keyword[return] Keyword[new] identifier[LocalRateOptions] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public EEnum getIfcInventoryTypeEnum() {
if (ifcInventoryTypeEnumEEnum == null) {
ifcInventoryTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(849);
}
return ifcInventoryTypeEnumEEnum;
}
|
class class_name[name] begin[{]
method[getIfcInventoryTypeEnum, return_type[type[EEnum]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.ifcInventoryTypeEnumEEnum], ==, literal[null]]] begin[{]
assign[member[.ifcInventoryTypeEnumEEnum], Cast(expression=MethodInvocation(arguments=[MemberReference(member=eNS_URI, postfix_operators=[], prefix_operators=[], qualifier=Ifc2x3tc1Package, selectors=[])], member=getEPackage, postfix_operators=[], prefix_operators=[], qualifier=EPackage.Registry.INSTANCE, selectors=[MethodInvocation(arguments=[], member=getEClassifiers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=849)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=EEnum, sub_type=None))]
else begin[{]
None
end[}]
return[member[.ifcInventoryTypeEnumEEnum]]
end[}]
END[}]
|
Keyword[public] identifier[EEnum] identifier[getIfcInventoryTypeEnum] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[ifcInventoryTypeEnumEEnum] operator[==] Other[null] operator[SEP] {
identifier[ifcInventoryTypeEnumEEnum] operator[=] operator[SEP] identifier[EEnum] operator[SEP] identifier[EPackage] operator[SEP] identifier[Registry] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[getEPackage] operator[SEP] identifier[Ifc2x3tc1Package] operator[SEP] identifier[eNS_URI] operator[SEP] operator[SEP] identifier[getEClassifiers] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[849] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ifcInventoryTypeEnumEEnum] operator[SEP]
}
|
@SuppressWarnings("WeakerAccess")
@SuppressLint("RtlHardcoded")
@VisibleForTesting
static int textGravity(@NonNull Table.Alignment alignment, boolean cellTextCenterVertical) {
final int gravity;
switch (alignment) {
case LEFT:
gravity = Gravity.LEFT;
break;
case CENTER:
gravity = Gravity.CENTER_HORIZONTAL;
break;
case RIGHT:
gravity = Gravity.RIGHT;
break;
default:
throw new IllegalStateException("Unknown table alignment: " + alignment);
}
if (cellTextCenterVertical) {
return gravity | Gravity.CENTER_VERTICAL;
}
// do not center vertically
return gravity;
}
|
class class_name[name] begin[{]
method[textGravity, return_type[type[int]], modifier[static], parameter[alignment, cellTextCenterVertical]] begin[{]
local_variable[type[int], gravity]
SwitchStatement(cases=[SwitchStatementCase(case=['LEFT'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=gravity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=LEFT, postfix_operators=[], prefix_operators=[], qualifier=Gravity, selectors=[])), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['CENTER'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=gravity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=CENTER_HORIZONTAL, postfix_operators=[], prefix_operators=[], qualifier=Gravity, selectors=[])), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['RIGHT'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=gravity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=RIGHT, postfix_operators=[], prefix_operators=[], qualifier=Gravity, selectors=[])), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unknown table alignment: "), operandr=MemberReference(member=alignment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)])], expression=MemberReference(member=alignment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
if[member[.cellTextCenterVertical]] begin[{]
return[binary_operation[member[.gravity], |, member[Gravity.CENTER_VERTICAL]]]
else begin[{]
None
end[}]
return[member[.gravity]]
end[}]
END[}]
|
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] annotation[@] identifier[SuppressLint] operator[SEP] literal[String] operator[SEP] annotation[@] identifier[VisibleForTesting] Keyword[static] Keyword[int] identifier[textGravity] operator[SEP] annotation[@] identifier[NonNull] identifier[Table] operator[SEP] identifier[Alignment] identifier[alignment] , Keyword[boolean] identifier[cellTextCenterVertical] operator[SEP] {
Keyword[final] Keyword[int] identifier[gravity] operator[SEP] Keyword[switch] operator[SEP] identifier[alignment] operator[SEP] {
Keyword[case] identifier[LEFT] operator[:] identifier[gravity] operator[=] identifier[Gravity] operator[SEP] identifier[LEFT] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[CENTER] operator[:] identifier[gravity] operator[=] identifier[Gravity] operator[SEP] identifier[CENTER_HORIZONTAL] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[RIGHT] operator[:] identifier[gravity] operator[=] identifier[Gravity] operator[SEP] identifier[RIGHT] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] identifier[alignment] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[cellTextCenterVertical] operator[SEP] {
Keyword[return] identifier[gravity] operator[|] identifier[Gravity] operator[SEP] identifier[CENTER_VERTICAL] operator[SEP]
}
Keyword[return] identifier[gravity] operator[SEP]
}
|
public static int[] getRegionColsRows( GridCoverage2D gridCoverage ) {
GridGeometry2D gridGeometry = gridCoverage.getGridGeometry();
GridEnvelope2D gridRange = gridGeometry.getGridRange2D();
int height = gridRange.height;
int width = gridRange.width;
int[] params = new int[]{width, height};
return params;
}
|
class class_name[name] begin[{]
method[getRegionColsRows, return_type[type[int]], modifier[public static], parameter[gridCoverage]] begin[{]
local_variable[type[GridGeometry2D], gridGeometry]
local_variable[type[GridEnvelope2D], gridRange]
local_variable[type[int], height]
local_variable[type[int], width]
local_variable[type[int], params]
return[member[.params]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[int] operator[SEP] operator[SEP] identifier[getRegionColsRows] operator[SEP] identifier[GridCoverage2D] identifier[gridCoverage] operator[SEP] {
identifier[GridGeometry2D] identifier[gridGeometry] operator[=] identifier[gridCoverage] operator[SEP] identifier[getGridGeometry] operator[SEP] operator[SEP] operator[SEP] identifier[GridEnvelope2D] identifier[gridRange] operator[=] identifier[gridGeometry] operator[SEP] identifier[getGridRange2D] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[height] operator[=] identifier[gridRange] operator[SEP] identifier[height] operator[SEP] Keyword[int] identifier[width] operator[=] identifier[gridRange] operator[SEP] identifier[width] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[params] operator[=] Keyword[new] Keyword[int] operator[SEP] operator[SEP] {
identifier[width] , identifier[height]
} operator[SEP] Keyword[return] identifier[params] operator[SEP]
}
|
public static QueueContract create(String profile, Configuration config) {
return config.create(profile, QueueContract.class);
}
|
class class_name[name] begin[{]
method[create, return_type[type[QueueContract]], modifier[public static], parameter[profile, config]] begin[{]
return[call[config.create, parameter[member[.profile], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=QueueContract, sub_type=None))]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[QueueContract] identifier[create] operator[SEP] identifier[String] identifier[profile] , identifier[Configuration] identifier[config] operator[SEP] {
Keyword[return] identifier[config] operator[SEP] identifier[create] operator[SEP] identifier[profile] , identifier[QueueContract] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
|
public static Compress.Feature parseCompressionFeature(XmlPullParser parser)
throws IOException, XmlPullParserException {
assert (parser.getEventType() == XmlPullParser.START_TAG);
String name;
final int initialDepth = parser.getDepth();
List<String> methods = new LinkedList<>();
outerloop: while (true) {
int eventType = parser.next();
switch (eventType) {
case XmlPullParser.START_TAG:
name = parser.getName();
switch (name) {
case "method":
methods.add(parser.nextText());
break;
}
break;
case XmlPullParser.END_TAG:
name = parser.getName();
switch (name) {
case Compress.Feature.ELEMENT:
if (parser.getDepth() == initialDepth) {
break outerloop;
}
}
}
}
assert (parser.getEventType() == XmlPullParser.END_TAG);
assert (parser.getDepth() == initialDepth);
return new Compress.Feature(methods);
}
|
class class_name[name] begin[{]
method[parseCompressionFeature, return_type[type[Compress]], modifier[public static], parameter[parser]] begin[{]
AssertStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getEventType, postfix_operators=[], prefix_operators=[], qualifier=parser, selectors=[], type_arguments=None), operandr=MemberReference(member=START_TAG, postfix_operators=[], prefix_operators=[], qualifier=XmlPullParser, selectors=[]), operator===), label=None, value=None)
local_variable[type[String], name]
local_variable[type[int], initialDepth]
local_variable[type[List], methods]
while[literal[true]] begin[{]
local_variable[type[int], eventType]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=START_TAG, postfix_operators=[], prefix_operators=[], qualifier=XmlPullParser, selectors=[])], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=parser, selectors=[], type_arguments=None)), label=None), SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="method")], statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=nextText, postfix_operators=[], prefix_operators=[], qualifier=parser, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=methods, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)])], expression=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=END_TAG, postfix_operators=[], prefix_operators=[], qualifier=XmlPullParser, selectors=[])], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=parser, selectors=[], type_arguments=None)), label=None), SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=ELEMENT, postfix_operators=[], prefix_operators=[], qualifier=Compress.Feature, selectors=[])], statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getDepth, postfix_operators=[], prefix_operators=[], qualifier=parser, selectors=[], type_arguments=None), operandr=MemberReference(member=initialDepth, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[BreakStatement(goto=outerloop, label=None)]))])], expression=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)])], expression=MemberReference(member=eventType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
end[}]
AssertStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getEventType, postfix_operators=[], prefix_operators=[], qualifier=parser, selectors=[], type_arguments=None), operandr=MemberReference(member=END_TAG, postfix_operators=[], prefix_operators=[], qualifier=XmlPullParser, selectors=[]), operator===), label=None, value=None)
AssertStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getDepth, postfix_operators=[], prefix_operators=[], qualifier=parser, selectors=[], type_arguments=None), operandr=MemberReference(member=initialDepth, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), label=None, value=None)
return[ClassCreator(arguments=[MemberReference(member=methods, 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=Compress, sub_type=ReferenceType(arguments=None, dimensions=None, name=Feature, sub_type=None)))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Compress] operator[SEP] identifier[Feature] identifier[parseCompressionFeature] operator[SEP] identifier[XmlPullParser] identifier[parser] operator[SEP] Keyword[throws] identifier[IOException] , identifier[XmlPullParserException] {
Keyword[assert] operator[SEP] identifier[parser] operator[SEP] identifier[getEventType] operator[SEP] operator[SEP] operator[==] identifier[XmlPullParser] operator[SEP] identifier[START_TAG] operator[SEP] operator[SEP] identifier[String] identifier[name] operator[SEP] Keyword[final] Keyword[int] identifier[initialDepth] operator[=] identifier[parser] operator[SEP] identifier[getDepth] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[methods] operator[=] Keyword[new] identifier[LinkedList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[outerloop] operator[:] Keyword[while] operator[SEP] literal[boolean] operator[SEP] {
Keyword[int] identifier[eventType] operator[=] identifier[parser] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[switch] operator[SEP] identifier[eventType] operator[SEP] {
Keyword[case] identifier[XmlPullParser] operator[SEP] identifier[START_TAG] operator[:] identifier[name] operator[=] identifier[parser] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] Keyword[switch] operator[SEP] identifier[name] operator[SEP] {
Keyword[case] literal[String] operator[:] identifier[methods] operator[SEP] identifier[add] operator[SEP] identifier[parser] operator[SEP] identifier[nextText] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] identifier[XmlPullParser] operator[SEP] identifier[END_TAG] operator[:] identifier[name] operator[=] identifier[parser] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] Keyword[switch] operator[SEP] identifier[name] operator[SEP] {
Keyword[case] identifier[Compress] operator[SEP] identifier[Feature] operator[SEP] identifier[ELEMENT] operator[:] Keyword[if] operator[SEP] identifier[parser] operator[SEP] identifier[getDepth] operator[SEP] operator[SEP] operator[==] identifier[initialDepth] operator[SEP] {
Keyword[break] identifier[outerloop] operator[SEP]
}
}
}
}
Keyword[assert] operator[SEP] identifier[parser] operator[SEP] identifier[getEventType] operator[SEP] operator[SEP] operator[==] identifier[XmlPullParser] operator[SEP] identifier[END_TAG] operator[SEP] operator[SEP] Keyword[assert] operator[SEP] identifier[parser] operator[SEP] identifier[getDepth] operator[SEP] operator[SEP] operator[==] identifier[initialDepth] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[Compress] operator[SEP] identifier[Feature] operator[SEP] identifier[methods] operator[SEP] operator[SEP]
}
|
public void setDialogDeleteFileMode(String mode) {
CmsResourceDeleteMode deleteMode = CmsResource.DELETE_PRESERVE_SIBLINGS;
if (mode.equalsIgnoreCase(DELETEMODE_DELETE)) {
deleteMode = CmsResource.DELETE_REMOVE_SIBLINGS;
}
setDialogDeleteFileMode(deleteMode);
}
|
class class_name[name] begin[{]
method[setDialogDeleteFileMode, return_type[void], modifier[public], parameter[mode]] begin[{]
local_variable[type[CmsResourceDeleteMode], deleteMode]
if[call[mode.equalsIgnoreCase, parameter[member[.DELETEMODE_DELETE]]]] begin[{]
assign[member[.deleteMode], member[CmsResource.DELETE_REMOVE_SIBLINGS]]
else begin[{]
None
end[}]
call[.setDialogDeleteFileMode, parameter[member[.deleteMode]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setDialogDeleteFileMode] operator[SEP] identifier[String] identifier[mode] operator[SEP] {
identifier[CmsResourceDeleteMode] identifier[deleteMode] operator[=] identifier[CmsResource] operator[SEP] identifier[DELETE_PRESERVE_SIBLINGS] operator[SEP] Keyword[if] operator[SEP] identifier[mode] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[DELETEMODE_DELETE] operator[SEP] operator[SEP] {
identifier[deleteMode] operator[=] identifier[CmsResource] operator[SEP] identifier[DELETE_REMOVE_SIBLINGS] operator[SEP]
}
identifier[setDialogDeleteFileMode] operator[SEP] identifier[deleteMode] operator[SEP] operator[SEP]
}
|
@Override
public void handle(Throwable throwable, Map<String, Object> parameters) {
if (handlers.size() == 0) {
register(Exception.class, new HandlerException() {
@Override
public void handle(Throwable throwable,
Map<String, Object> parameters) {
throwable.printStackTrace();
}
});
}
if (throwable != null) {
Class<?> throwableClass = throwable.getClass();
while (throwableClass != null) {
if (handlers.containsKey(throwableClass.getName())) {
HandlerException handler = handlers.get(throwableClass.getName());
if (parameters == null) {
parameters = new HashMap<String, Object>();
}
handler.handle(throwable, parameters);
return;
} else {
throwableClass = throwableClass.getSuperclass();
}
}
}
}
|
class class_name[name] begin[{]
method[handle, return_type[void], modifier[public], parameter[throwable, parameters]] begin[{]
if[binary_operation[call[handlers.size, parameter[]], ==, literal[0]]] begin[{]
call[.register, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Exception, sub_type=None)), ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=throwable, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=handle, parameters=[FormalParameter(annotations=[], modifiers=set(), name=throwable, type=ReferenceType(arguments=None, dimensions=[], name=Throwable, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=parameters, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=[], name=Map, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=HandlerException, sub_type=None))]]
else begin[{]
None
end[}]
if[binary_operation[member[.throwable], !=, literal[null]]] begin[{]
local_variable[type[Class], throwableClass]
while[binary_operation[member[.throwableClass], !=, literal[null]]] begin[{]
if[call[handlers.containsKey, parameter[call[throwableClass.getName, parameter[]]]]] begin[{]
local_variable[type[HandlerException], handler]
if[binary_operation[member[.parameters], ==, literal[null]]] begin[{]
assign[member[.parameters], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=None, name=HashMap, sub_type=None))]
else begin[{]
None
end[}]
call[handler.handle, parameter[member[.throwable], member[.parameters]]]
return[None]
else begin[{]
assign[member[.throwableClass], call[throwableClass.getSuperclass, parameter[]]]
end[}]
end[}]
else begin[{]
None
end[}]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[handle] operator[SEP] identifier[Throwable] identifier[throwable] , identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[parameters] operator[SEP] {
Keyword[if] operator[SEP] identifier[handlers] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
identifier[register] operator[SEP] identifier[Exception] operator[SEP] Keyword[class] , Keyword[new] identifier[HandlerException] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[handle] operator[SEP] identifier[Throwable] identifier[throwable] , identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[parameters] operator[SEP] {
identifier[throwable] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[throwable] operator[!=] Other[null] operator[SEP] {
identifier[Class] operator[<] operator[?] operator[>] identifier[throwableClass] operator[=] identifier[throwable] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[throwableClass] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[handlers] operator[SEP] identifier[containsKey] operator[SEP] identifier[throwableClass] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[HandlerException] identifier[handler] operator[=] identifier[handlers] operator[SEP] identifier[get] operator[SEP] identifier[throwableClass] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[parameters] operator[==] Other[null] operator[SEP] {
identifier[parameters] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[Object] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
identifier[handler] operator[SEP] identifier[handle] operator[SEP] identifier[throwable] , identifier[parameters] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[else] {
identifier[throwableClass] operator[=] identifier[throwableClass] operator[SEP] identifier[getSuperclass] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
|
public static base_responses add(nitro_service client, responderaction resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
responderaction addresources[] = new responderaction[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new responderaction();
addresources[i].name = resources[i].name;
addresources[i].type = resources[i].type;
addresources[i].target = resources[i].target;
addresources[i].htmlpage = resources[i].htmlpage;
addresources[i].bypasssafetycheck = resources[i].bypasssafetycheck;
addresources[i].comment = resources[i].comment;
}
result = add_bulk_request(client, addresources);
}
return result;
}
|
class class_name[name] begin[{]
method[add, return_type[type[base_responses]], modifier[public static], parameter[client, resources]] begin[{]
local_variable[type[base_responses], result]
if[binary_operation[binary_operation[member[.resources], !=, literal[null]], &&, binary_operation[member[resources.length], >, literal[0]]]] begin[{]
local_variable[type[responderaction], addresources]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=addresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=responderaction, sub_type=None))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=addresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=name, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=name, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=addresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=type, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=type, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=addresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=target, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=target, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=addresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=htmlpage, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=htmlpage, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=addresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=bypasssafetycheck, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=bypasssafetycheck, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=addresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=comment, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=comment, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=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=resources, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
assign[member[.result], call[.add_bulk_request, parameter[member[.client], member[.addresources]]]]
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[base_responses] identifier[add] operator[SEP] identifier[nitro_service] identifier[client] , identifier[responderaction] identifier[resources] operator[SEP] operator[SEP] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[base_responses] identifier[result] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[resources] operator[!=] Other[null] operator[&&] identifier[resources] operator[SEP] identifier[length] operator[>] Other[0] operator[SEP] {
identifier[responderaction] identifier[addresources] operator[SEP] operator[SEP] operator[=] Keyword[new] identifier[responderaction] operator[SEP] identifier[resources] 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[resources] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[addresources] operator[SEP] identifier[i] operator[SEP] operator[=] Keyword[new] identifier[responderaction] operator[SEP] operator[SEP] operator[SEP] identifier[addresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[name] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[name] operator[SEP] identifier[addresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[type] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[type] operator[SEP] identifier[addresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[target] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[target] operator[SEP] identifier[addresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[htmlpage] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[htmlpage] operator[SEP] identifier[addresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[bypasssafetycheck] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[bypasssafetycheck] operator[SEP] identifier[addresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[comment] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[comment] operator[SEP]
}
identifier[result] operator[=] identifier[add_bulk_request] operator[SEP] identifier[client] , identifier[addresources] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public static IPAddressType getAddressType(String ipAddress)
{
if(IPAddressUtil.isIPv4LiteralAddress(ipAddress))
return IPAddressType.IPV4;
if(IPAddressUtil.isIPv6LiteralAddress(ipAddress))
return IPAddressType.IPV6;
return IPAddressType.INVALID;
}
|
class class_name[name] begin[{]
method[getAddressType, return_type[type[IPAddressType]], modifier[public static], parameter[ipAddress]] begin[{]
if[call[IPAddressUtil.isIPv4LiteralAddress, parameter[member[.ipAddress]]]] begin[{]
return[member[IPAddressType.IPV4]]
else begin[{]
None
end[}]
if[call[IPAddressUtil.isIPv6LiteralAddress, parameter[member[.ipAddress]]]] begin[{]
return[member[IPAddressType.IPV6]]
else begin[{]
None
end[}]
return[member[IPAddressType.INVALID]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[IPAddressType] identifier[getAddressType] operator[SEP] identifier[String] identifier[ipAddress] operator[SEP] {
Keyword[if] operator[SEP] identifier[IPAddressUtil] operator[SEP] identifier[isIPv4LiteralAddress] operator[SEP] identifier[ipAddress] operator[SEP] operator[SEP] Keyword[return] identifier[IPAddressType] operator[SEP] identifier[IPV4] operator[SEP] Keyword[if] operator[SEP] identifier[IPAddressUtil] operator[SEP] identifier[isIPv6LiteralAddress] operator[SEP] identifier[ipAddress] operator[SEP] operator[SEP] Keyword[return] identifier[IPAddressType] operator[SEP] identifier[IPV6] operator[SEP] Keyword[return] identifier[IPAddressType] operator[SEP] identifier[INVALID] operator[SEP]
}
|
public Class getRootDeclarationClass() {
ConfigPath res = this;
while (res.getRoot() != null) {
res = res.getRoot();
}
return res.getDeclarationClass();
}
|
class class_name[name] begin[{]
method[getRootDeclarationClass, return_type[type[Class]], modifier[public], parameter[]] begin[{]
local_variable[type[ConfigPath], res]
while[binary_operation[call[res.getRoot, parameter[]], !=, literal[null]]] begin[{]
assign[member[.res], call[res.getRoot, parameter[]]]
end[}]
return[call[res.getDeclarationClass, parameter[]]]
end[}]
END[}]
|
Keyword[public] identifier[Class] identifier[getRootDeclarationClass] operator[SEP] operator[SEP] {
identifier[ConfigPath] identifier[res] operator[=] Keyword[this] operator[SEP] Keyword[while] operator[SEP] identifier[res] operator[SEP] identifier[getRoot] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[res] operator[=] identifier[res] operator[SEP] identifier[getRoot] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[res] operator[SEP] identifier[getDeclarationClass] operator[SEP] operator[SEP] operator[SEP]
}
|
private void buildRecorderFromObject(
int opcode, String owner, String name, String signature, boolean itf) {
super.visitMethodInsn(opcode, owner, name, signature, itf);
// -> stack: ... newobj
super.visitInsn(Opcodes.DUP);
// -> stack: ... newobj newobj
super.visitInsn(Opcodes.DUP);
// -> stack: ... newobj newobj newobj
// We could be instantiating this class or a subclass, so we
// have to get the class the hard way.
super.visitMethodInsn(
Opcodes.INVOKEVIRTUAL, "java/lang/Object", "getClass", "()Ljava/lang/Class;", false);
// -> stack: ... newobj newobj Class
super.visitInsn(Opcodes.SWAP);
// -> stack: ... newobj Class newobj
super.visitMethodInsn(
Opcodes.INVOKESTATIC, recorderClass, recorderMethod, CLASS_RECORDER_SIG, false);
// -> stack: ... newobj
}
|
class class_name[name] begin[{]
method[buildRecorderFromObject, return_type[void], modifier[private], parameter[opcode, owner, name, signature, itf]] begin[{]
SuperMethodInvocation(arguments=[MemberReference(member=opcode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=owner, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=signature, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=itf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=visitMethodInsn, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
SuperMethodInvocation(arguments=[MemberReference(member=DUP, postfix_operators=[], prefix_operators=[], qualifier=Opcodes, selectors=[])], member=visitInsn, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
SuperMethodInvocation(arguments=[MemberReference(member=DUP, postfix_operators=[], prefix_operators=[], qualifier=Opcodes, selectors=[])], member=visitInsn, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
SuperMethodInvocation(arguments=[MemberReference(member=INVOKEVIRTUAL, postfix_operators=[], prefix_operators=[], qualifier=Opcodes, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="java/lang/Object"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="getClass"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="()Ljava/lang/Class;"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=visitMethodInsn, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
SuperMethodInvocation(arguments=[MemberReference(member=SWAP, postfix_operators=[], prefix_operators=[], qualifier=Opcodes, selectors=[])], member=visitInsn, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
SuperMethodInvocation(arguments=[MemberReference(member=INVOKESTATIC, postfix_operators=[], prefix_operators=[], qualifier=Opcodes, selectors=[]), MemberReference(member=recorderClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=recorderMethod, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=CLASS_RECORDER_SIG, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=visitMethodInsn, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[buildRecorderFromObject] operator[SEP] Keyword[int] identifier[opcode] , identifier[String] identifier[owner] , identifier[String] identifier[name] , identifier[String] identifier[signature] , Keyword[boolean] identifier[itf] operator[SEP] {
Keyword[super] operator[SEP] identifier[visitMethodInsn] operator[SEP] identifier[opcode] , identifier[owner] , identifier[name] , identifier[signature] , identifier[itf] operator[SEP] operator[SEP] Keyword[super] operator[SEP] identifier[visitInsn] operator[SEP] identifier[Opcodes] operator[SEP] identifier[DUP] operator[SEP] operator[SEP] Keyword[super] operator[SEP] identifier[visitInsn] operator[SEP] identifier[Opcodes] operator[SEP] identifier[DUP] operator[SEP] operator[SEP] Keyword[super] operator[SEP] identifier[visitMethodInsn] operator[SEP] identifier[Opcodes] operator[SEP] identifier[INVOKEVIRTUAL] , literal[String] , literal[String] , literal[String] , literal[boolean] operator[SEP] operator[SEP] Keyword[super] operator[SEP] identifier[visitInsn] operator[SEP] identifier[Opcodes] operator[SEP] identifier[SWAP] operator[SEP] operator[SEP] Keyword[super] operator[SEP] identifier[visitMethodInsn] operator[SEP] identifier[Opcodes] operator[SEP] identifier[INVOKESTATIC] , identifier[recorderClass] , identifier[recorderMethod] , identifier[CLASS_RECORDER_SIG] , literal[boolean] operator[SEP] operator[SEP]
}
|
public Request<ResourceServer> get(String resourceServerIdOrIdentifier) {
Asserts.assertNotNull(resourceServerIdOrIdentifier, "Resource server ID");
HttpUrl.Builder builder = baseUrl
.newBuilder()
.addPathSegments("api/v2/resource-servers")
.addPathSegment(resourceServerIdOrIdentifier);
String url = builder.build().toString();
CustomRequest<ResourceServer> request = new CustomRequest<>(client, url, "GET",
new TypeReference<ResourceServer>() {
});
request.addHeader("Authorization", "Bearer " + apiToken);
return request;
}
|
class class_name[name] begin[{]
method[get, return_type[type[Request]], modifier[public], parameter[resourceServerIdOrIdentifier]] begin[{]
call[Asserts.assertNotNull, parameter[member[.resourceServerIdOrIdentifier], literal["Resource server ID"]]]
local_variable[type[HttpUrl], builder]
local_variable[type[String], url]
local_variable[type[CustomRequest], request]
call[request.addHeader, parameter[literal["Authorization"], binary_operation[literal["Bearer "], +, member[.apiToken]]]]
return[member[.request]]
end[}]
END[}]
|
Keyword[public] identifier[Request] operator[<] identifier[ResourceServer] operator[>] identifier[get] operator[SEP] identifier[String] identifier[resourceServerIdOrIdentifier] operator[SEP] {
identifier[Asserts] operator[SEP] identifier[assertNotNull] operator[SEP] identifier[resourceServerIdOrIdentifier] , literal[String] operator[SEP] operator[SEP] identifier[HttpUrl] operator[SEP] identifier[Builder] identifier[builder] operator[=] identifier[baseUrl] operator[SEP] identifier[newBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[addPathSegments] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[addPathSegment] operator[SEP] identifier[resourceServerIdOrIdentifier] operator[SEP] operator[SEP] identifier[String] identifier[url] operator[=] identifier[builder] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[CustomRequest] operator[<] identifier[ResourceServer] operator[>] identifier[request] operator[=] Keyword[new] identifier[CustomRequest] operator[<] operator[>] operator[SEP] identifier[client] , identifier[url] , literal[String] , Keyword[new] identifier[TypeReference] operator[<] identifier[ResourceServer] operator[>] operator[SEP] operator[SEP] {
} operator[SEP] operator[SEP] identifier[request] operator[SEP] identifier[addHeader] operator[SEP] literal[String] , literal[String] operator[+] identifier[apiToken] operator[SEP] operator[SEP] Keyword[return] identifier[request] operator[SEP]
}
|
private static boolean linearPathWithinLinearPath_(MultiPath multipathA,
MultiPath multipathB, double tolerance, boolean bEnforceOrientation) {
boolean bWithin = true;
double[] scalarsA = new double[2];
double[] scalarsB = new double[2];
int ievent = 0;
AttributeStreamOfInt32 eventIndices = new AttributeStreamOfInt32(0);
RelationalOperations relOps = new RelationalOperations();
OverlapComparer overlapComparer = new OverlapComparer(relOps);
OverlapEvent overlapEvent;
Envelope2D env_a = new Envelope2D();
Envelope2D env_b = new Envelope2D();
Envelope2D envInter = new Envelope2D();
multipathA.queryEnvelope2D(env_a);
multipathB.queryEnvelope2D(env_b);
env_a.inflate(tolerance, tolerance);
env_b.inflate(tolerance, tolerance);
envInter.setCoords(env_a);
envInter.intersect(env_b);
SegmentIteratorImpl segIterA = ((MultiPathImpl) multipathA._getImpl())
.querySegmentIterator();
SegmentIteratorImpl segIterB = ((MultiPathImpl) multipathB._getImpl())
.querySegmentIterator();
QuadTreeImpl qtB = null;
QuadTreeImpl quadTreeB = null;
QuadTreeImpl quadTreePathsB = null;
GeometryAccelerators accel = ((MultiPathImpl) multipathB._getImpl())
._getAccelerators();
if (accel != null) {
quadTreeB = accel.getQuadTree();
quadTreePathsB = accel.getQuadTreeForPaths();
if (quadTreeB == null) {
qtB = InternalUtils.buildQuadTree(
(MultiPathImpl) multipathB._getImpl(), envInter);
quadTreeB = qtB;
}
} else {
qtB = InternalUtils.buildQuadTree(
(MultiPathImpl) multipathB._getImpl(), envInter);
quadTreeB = qtB;
}
QuadTreeImpl.QuadTreeIteratorImpl qtIterB = quadTreeB.getIterator();
QuadTreeImpl.QuadTreeIteratorImpl qtIterPathsB = null;
if (quadTreePathsB != null)
qtIterPathsB = quadTreePathsB.getIterator();
while (segIterA.nextPath()) {
while (segIterA.hasNextSegment()) {
boolean bStringOfSegmentAsCovered = false;
Segment segmentA = segIterA.nextSegment();
segmentA.queryEnvelope2D(env_a);
if (!env_a.isIntersecting(envInter)) {
return false; // bWithin = false
}
if (qtIterPathsB != null) {
qtIterPathsB.resetIterator(env_a, tolerance);
if (qtIterPathsB.next() == -1) {
bWithin = false;
return false;
}
}
double lengthA = segmentA.calculateLength2D();
qtIterB.resetIterator(segmentA, tolerance);
for (int elementHandleB = qtIterB.next(); elementHandleB != -1; elementHandleB = qtIterB
.next()) {
int vertex_b = quadTreeB.getElement(elementHandleB);
segIterB.resetToVertex(vertex_b);
Segment segmentB = segIterB.nextSegment();
int result = segmentA.intersect(segmentB, null, scalarsA,
scalarsB, tolerance);
if (result == 2 && (!bEnforceOrientation || scalarsB[0] <= scalarsB[1])) {
double scalar_a_0 = scalarsA[0];
double scalar_a_1 = scalarsA[1];
double scalar_b_0 = scalarsB[0];
double scalar_b_1 = scalarsB[1];
// Performance enhancement for nice cases where
// localization occurs. Increment segIterA as far as we
// can while the current segmentA is covered.
if (scalar_a_0 * lengthA <= tolerance
&& (1.0 - scalar_a_1) * lengthA <= tolerance) {
bStringOfSegmentAsCovered = true;
ievent = 0;
eventIndices.resize(0);
relOps.m_overlap_events.clear();
int ivertex_a = segIterA.getStartPointIndex();
boolean bSegmentACovered = true;
while (bSegmentACovered) {// keep going while the
// current segmentA is
// covered.
if (segIterA.hasNextSegment()) {
segmentA = segIterA.nextSegment();
lengthA = segmentA.calculateLength2D();
result = segmentA.intersect(segmentB, null,
scalarsA, scalarsB, tolerance);
if (result == 2 && (!bEnforceOrientation || scalarsB[0] <= scalarsB[1])) {
scalar_a_0 = scalarsA[0];
scalar_a_1 = scalarsA[1];
if (scalar_a_0 * lengthA <= tolerance
&& (1.0 - scalar_a_1) * lengthA <= tolerance) {
ivertex_a = segIterA
.getStartPointIndex();
continue;
}
}
if (segIterB.hasNextSegment()) {
segmentB = segIterB.nextSegment();
result = segmentA.intersect(segmentB,
null, scalarsA, scalarsB,
tolerance);
if (result == 2 && (!bEnforceOrientation || scalarsB[0] <= scalarsB[1])) {
scalar_a_0 = scalarsA[0];
scalar_a_1 = scalarsA[1];
if (scalar_a_0 * lengthA <= tolerance
&& (1.0 - scalar_a_1)
* lengthA <= tolerance) {
ivertex_a = segIterA
.getStartPointIndex();
continue;
}
}
}
}
bSegmentACovered = false;
}
if (ivertex_a != segIterA.getStartPointIndex()) {
segIterA.resetToVertex(ivertex_a);
segIterA.nextSegment();
}
break;
} else {
int ivertex_a = segIterA.getStartPointIndex();
int ipath_a = segIterA.getPathIndex();
int ivertex_b = segIterB.getStartPointIndex();
int ipath_b = segIterB.getPathIndex();
overlapEvent = OverlapEvent.construct(ivertex_a,
ipath_a, scalar_a_0, scalar_a_1, ivertex_b,
ipath_b, scalar_b_0, scalar_b_1);
relOps.m_overlap_events.add(overlapEvent);
eventIndices.add(eventIndices.size());
}
}
}
if (bStringOfSegmentAsCovered) {
continue; // no need to check that segmentA is covered
}
if (ievent == relOps.m_overlap_events.size()) {
return false; // bWithin = false
}
if (eventIndices.size() - ievent > 1) {
eventIndices.Sort(ievent, eventIndices.size(),
overlapComparer);
}
double lastScalar = 0.0;
for (int i = ievent; i < relOps.m_overlap_events.size(); i++) {
overlapEvent = relOps.m_overlap_events.get(eventIndices
.get(i));
if (overlapEvent.m_scalar_a_0 < lastScalar
&& overlapEvent.m_scalar_a_1 < lastScalar) {
continue;
}
if (lengthA * (overlapEvent.m_scalar_a_0 - lastScalar) > tolerance) {
return false; // bWithin = false
} else {
lastScalar = overlapEvent.m_scalar_a_1;
if (lengthA * (1.0 - lastScalar) <= tolerance
|| lastScalar == 1.0) {
break;
}
}
}
if (lengthA * (1.0 - lastScalar) > tolerance) {
return false; // bWithin = false
}
ievent = 0;
eventIndices.resize(0);
relOps.m_overlap_events.clear();
}
}
return bWithin;
}
|
class class_name[name] begin[{]
method[linearPathWithinLinearPath_, return_type[type[boolean]], modifier[private static], parameter[multipathA, multipathB, tolerance, bEnforceOrientation]] begin[{]
local_variable[type[boolean], bWithin]
local_variable[type[double], scalarsA]
local_variable[type[double], scalarsB]
local_variable[type[int], ievent]
local_variable[type[AttributeStreamOfInt32], eventIndices]
local_variable[type[RelationalOperations], relOps]
local_variable[type[OverlapComparer], overlapComparer]
local_variable[type[OverlapEvent], overlapEvent]
local_variable[type[Envelope2D], env_a]
local_variable[type[Envelope2D], env_b]
local_variable[type[Envelope2D], envInter]
call[multipathA.queryEnvelope2D, parameter[member[.env_a]]]
call[multipathB.queryEnvelope2D, parameter[member[.env_b]]]
call[env_a.inflate, parameter[member[.tolerance], member[.tolerance]]]
call[env_b.inflate, parameter[member[.tolerance], member[.tolerance]]]
call[envInter.setCoords, parameter[member[.env_a]]]
call[envInter.intersect, parameter[member[.env_b]]]
local_variable[type[SegmentIteratorImpl], segIterA]
local_variable[type[SegmentIteratorImpl], segIterB]
local_variable[type[QuadTreeImpl], qtB]
local_variable[type[QuadTreeImpl], quadTreeB]
local_variable[type[QuadTreeImpl], quadTreePathsB]
local_variable[type[GeometryAccelerators], accel]
if[binary_operation[member[.accel], !=, literal[null]]] begin[{]
assign[member[.quadTreeB], call[accel.getQuadTree, parameter[]]]
assign[member[.quadTreePathsB], call[accel.getQuadTreeForPaths, parameter[]]]
if[binary_operation[member[.quadTreeB], ==, literal[null]]] begin[{]
assign[member[.qtB], call[InternalUtils.buildQuadTree, parameter[Cast(expression=MethodInvocation(arguments=[], member=_getImpl, postfix_operators=[], prefix_operators=[], qualifier=multipathB, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=MultiPathImpl, sub_type=None)), member[.envInter]]]]
assign[member[.quadTreeB], member[.qtB]]
else begin[{]
None
end[}]
else begin[{]
assign[member[.qtB], call[InternalUtils.buildQuadTree, parameter[Cast(expression=MethodInvocation(arguments=[], member=_getImpl, postfix_operators=[], prefix_operators=[], qualifier=multipathB, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=MultiPathImpl, sub_type=None)), member[.envInter]]]]
assign[member[.quadTreeB], member[.qtB]]
end[}]
local_variable[type[QuadTreeImpl], qtIterB]
local_variable[type[QuadTreeImpl], qtIterPathsB]
if[binary_operation[member[.quadTreePathsB], !=, literal[null]]] begin[{]
assign[member[.qtIterPathsB], call[quadTreePathsB.getIterator, parameter[]]]
else begin[{]
None
end[}]
while[call[segIterA.nextPath, parameter[]]] begin[{]
while[call[segIterA.hasNextSegment, parameter[]]] begin[{]
local_variable[type[boolean], bStringOfSegmentAsCovered]
local_variable[type[Segment], segmentA]
call[segmentA.queryEnvelope2D, parameter[member[.env_a]]]
if[call[env_a.isIntersecting, parameter[member[.envInter]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[member[.qtIterPathsB], !=, literal[null]]] begin[{]
call[qtIterPathsB.resetIterator, parameter[member[.env_a], member[.tolerance]]]
if[binary_operation[call[qtIterPathsB.next, parameter[]], ==, literal[1]]] begin[{]
assign[member[.bWithin], literal[false]]
return[literal[false]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
local_variable[type[double], lengthA]
call[qtIterB.resetIterator, parameter[member[.segmentA], member[.tolerance]]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=elementHandleB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getElement, postfix_operators=[], prefix_operators=[], qualifier=quadTreeB, selectors=[], type_arguments=None), name=vertex_b)], modifiers=set(), type=BasicType(dimensions=[], name=int)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=vertex_b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=resetToVertex, postfix_operators=[], prefix_operators=[], qualifier=segIterB, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=nextSegment, postfix_operators=[], prefix_operators=[], qualifier=segIterB, selectors=[], type_arguments=None), name=segmentB)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Segment, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=segmentB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=scalarsA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=scalarsB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tolerance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=intersect, postfix_operators=[], prefix_operators=[], qualifier=segmentA, selectors=[], type_arguments=None), name=result)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator===), operandr=BinaryOperation(operandl=MemberReference(member=bEnforceOrientation, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=scalarsB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), operandr=MemberReference(member=scalarsB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))]), operator=<=), operator=||), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=scalarsA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), name=scalar_a_0)], modifiers=set(), type=BasicType(dimensions=[], name=double)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=scalarsA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))]), name=scalar_a_1)], modifiers=set(), type=BasicType(dimensions=[], name=double)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=scalarsB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), name=scalar_b_0)], modifiers=set(), type=BasicType(dimensions=[], name=double)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=scalarsB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))]), name=scalar_b_1)], modifiers=set(), type=BasicType(dimensions=[], name=double)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=scalar_a_0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=lengthA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operandr=MemberReference(member=tolerance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), operandr=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1.0), operandr=MemberReference(member=scalar_a_1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), operandr=MemberReference(member=lengthA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operandr=MemberReference(member=tolerance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), operator=&&), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getStartPointIndex, postfix_operators=[], prefix_operators=[], qualifier=segIterA, selectors=[], type_arguments=None), name=ivertex_a)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getPathIndex, postfix_operators=[], prefix_operators=[], qualifier=segIterA, selectors=[], type_arguments=None), name=ipath_a)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getStartPointIndex, postfix_operators=[], prefix_operators=[], qualifier=segIterB, selectors=[], type_arguments=None), name=ivertex_b)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getPathIndex, postfix_operators=[], prefix_operators=[], qualifier=segIterB, selectors=[], type_arguments=None), name=ipath_b)], modifiers=set(), type=BasicType(dimensions=[], name=int)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=overlapEvent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=ivertex_a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ipath_a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=scalar_a_0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=scalar_a_1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ivertex_b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ipath_b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=scalar_b_0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=scalar_b_1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=construct, postfix_operators=[], prefix_operators=[], qualifier=OverlapEvent, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=overlapEvent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=relOps.m_overlap_events, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=eventIndices, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=eventIndices, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=bStringOfSegmentAsCovered, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=ievent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=resize, postfix_operators=[], prefix_operators=[], qualifier=eventIndices, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=clear, postfix_operators=[], prefix_operators=[], qualifier=relOps.m_overlap_events, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getStartPointIndex, postfix_operators=[], prefix_operators=[], qualifier=segIterA, selectors=[], type_arguments=None), name=ivertex_a)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), name=bSegmentACovered)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), WhileStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=hasNextSegment, postfix_operators=[], prefix_operators=[], qualifier=segIterA, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=segmentA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=nextSegment, postfix_operators=[], prefix_operators=[], qualifier=segIterA, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=lengthA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=calculateLength2D, postfix_operators=[], prefix_operators=[], qualifier=segmentA, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=segmentB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=scalarsA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=scalarsB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tolerance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=intersect, postfix_operators=[], prefix_operators=[], qualifier=segmentA, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator===), operandr=BinaryOperation(operandl=MemberReference(member=bEnforceOrientation, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=scalarsB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), operandr=MemberReference(member=scalarsB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))]), operator=<=), operator=||), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=scalar_a_0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=scalarsA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=scalar_a_1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=scalarsA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))])), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=scalar_a_0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=lengthA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operandr=MemberReference(member=tolerance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), operandr=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1.0), operandr=MemberReference(member=scalar_a_1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), operandr=MemberReference(member=lengthA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operandr=MemberReference(member=tolerance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=ivertex_a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getStartPointIndex, postfix_operators=[], prefix_operators=[], qualifier=segIterA, selectors=[], type_arguments=None)), label=None), ContinueStatement(goto=None, label=None)]))])), IfStatement(condition=MethodInvocation(arguments=[], member=hasNextSegment, postfix_operators=[], prefix_operators=[], qualifier=segIterB, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=segmentB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=nextSegment, postfix_operators=[], prefix_operators=[], qualifier=segIterB, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=segmentB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=scalarsA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=scalarsB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tolerance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=intersect, postfix_operators=[], prefix_operators=[], qualifier=segmentA, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator===), operandr=BinaryOperation(operandl=MemberReference(member=bEnforceOrientation, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=scalarsB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), operandr=MemberReference(member=scalarsB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))]), operator=<=), operator=||), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=scalar_a_0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=scalarsA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=scalar_a_1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=scalarsA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))])), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=scalar_a_0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=lengthA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operandr=MemberReference(member=tolerance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), operandr=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1.0), operandr=MemberReference(member=scalar_a_1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), operandr=MemberReference(member=lengthA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operandr=MemberReference(member=tolerance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=ivertex_a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getStartPointIndex, postfix_operators=[], prefix_operators=[], qualifier=segIterA, selectors=[], type_arguments=None)), label=None), ContinueStatement(goto=None, label=None)]))]))]))])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=bSegmentACovered, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)]), condition=MemberReference(member=bSegmentACovered, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=ivertex_a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getStartPointIndex, postfix_operators=[], prefix_operators=[], qualifier=segIterA, selectors=[], type_arguments=None), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ivertex_a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=resetToVertex, postfix_operators=[], prefix_operators=[], qualifier=segIterA, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=nextSegment, postfix_operators=[], prefix_operators=[], qualifier=segIterA, selectors=[], type_arguments=None), label=None)])), BreakStatement(goto=None, label=None)]))]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=elementHandleB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator=!=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=qtIterB, selectors=[], type_arguments=None), name=elementHandleB)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[Assignment(expressionl=MemberReference(member=elementHandleB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=qtIterB, selectors=[], type_arguments=None))]), label=None)
if[member[.bStringOfSegmentAsCovered]] begin[{]
ContinueStatement(goto=None, label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.ievent], ==, call[relOps.m_overlap_events.size, parameter[]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[call[eventIndices.size, parameter[]], -, member[.ievent]], >, literal[1]]] begin[{]
call[eventIndices.Sort, parameter[member[.ievent], call[eventIndices.size, parameter[]], member[.overlapComparer]]]
else begin[{]
None
end[}]
local_variable[type[double], lastScalar]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=overlapEvent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=eventIndices, selectors=[], type_arguments=None)], member=get, postfix_operators=[], prefix_operators=[], qualifier=relOps.m_overlap_events, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=m_scalar_a_0, postfix_operators=[], prefix_operators=[], qualifier=overlapEvent, selectors=[]), operandr=MemberReference(member=lastScalar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), operandr=BinaryOperation(operandl=MemberReference(member=m_scalar_a_1, postfix_operators=[], prefix_operators=[], qualifier=overlapEvent, selectors=[]), operandr=MemberReference(member=lastScalar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=lengthA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=m_scalar_a_0, postfix_operators=[], prefix_operators=[], qualifier=overlapEvent, selectors=[]), operandr=MemberReference(member=lastScalar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), operator=*), operandr=MemberReference(member=tolerance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=lastScalar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=m_scalar_a_1, postfix_operators=[], prefix_operators=[], qualifier=overlapEvent, selectors=[])), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=lengthA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1.0), operandr=MemberReference(member=lastScalar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), operator=*), operandr=MemberReference(member=tolerance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), operandr=BinaryOperation(operandl=MemberReference(member=lastScalar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1.0), operator===), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[BreakStatement(goto=None, label=None)]))]), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=relOps.m_overlap_events, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=ievent, 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)
if[binary_operation[binary_operation[member[.lengthA], *, binary_operation[literal[1.0], -, member[.lastScalar]]], >, member[.tolerance]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
assign[member[.ievent], literal[0]]
call[eventIndices.resize, parameter[literal[0]]]
call[relOps.m_overlap_events.clear, parameter[]]
end[}]
end[}]
return[member[.bWithin]]
end[}]
END[}]
|
Keyword[private] Keyword[static] Keyword[boolean] identifier[linearPathWithinLinearPath_] operator[SEP] identifier[MultiPath] identifier[multipathA] , identifier[MultiPath] identifier[multipathB] , Keyword[double] identifier[tolerance] , Keyword[boolean] identifier[bEnforceOrientation] operator[SEP] {
Keyword[boolean] identifier[bWithin] operator[=] literal[boolean] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[scalarsA] operator[=] Keyword[new] Keyword[double] operator[SEP] Other[2] operator[SEP] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[scalarsB] operator[=] Keyword[new] Keyword[double] operator[SEP] Other[2] operator[SEP] operator[SEP] Keyword[int] identifier[ievent] operator[=] Other[0] operator[SEP] identifier[AttributeStreamOfInt32] identifier[eventIndices] operator[=] Keyword[new] identifier[AttributeStreamOfInt32] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[RelationalOperations] identifier[relOps] operator[=] Keyword[new] identifier[RelationalOperations] operator[SEP] operator[SEP] operator[SEP] identifier[OverlapComparer] identifier[overlapComparer] operator[=] Keyword[new] identifier[OverlapComparer] operator[SEP] identifier[relOps] operator[SEP] operator[SEP] identifier[OverlapEvent] identifier[overlapEvent] operator[SEP] identifier[Envelope2D] identifier[env_a] operator[=] Keyword[new] identifier[Envelope2D] operator[SEP] operator[SEP] operator[SEP] identifier[Envelope2D] identifier[env_b] operator[=] Keyword[new] identifier[Envelope2D] operator[SEP] operator[SEP] operator[SEP] identifier[Envelope2D] identifier[envInter] operator[=] Keyword[new] identifier[Envelope2D] operator[SEP] operator[SEP] operator[SEP] identifier[multipathA] operator[SEP] identifier[queryEnvelope2D] operator[SEP] identifier[env_a] operator[SEP] operator[SEP] identifier[multipathB] operator[SEP] identifier[queryEnvelope2D] operator[SEP] identifier[env_b] operator[SEP] operator[SEP] identifier[env_a] operator[SEP] identifier[inflate] operator[SEP] identifier[tolerance] , identifier[tolerance] operator[SEP] operator[SEP] identifier[env_b] operator[SEP] identifier[inflate] operator[SEP] identifier[tolerance] , identifier[tolerance] operator[SEP] operator[SEP] identifier[envInter] operator[SEP] identifier[setCoords] operator[SEP] identifier[env_a] operator[SEP] operator[SEP] identifier[envInter] operator[SEP] identifier[intersect] operator[SEP] identifier[env_b] operator[SEP] operator[SEP] identifier[SegmentIteratorImpl] identifier[segIterA] operator[=] operator[SEP] operator[SEP] identifier[MultiPathImpl] operator[SEP] identifier[multipathA] operator[SEP] identifier[_getImpl] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[querySegmentIterator] operator[SEP] operator[SEP] operator[SEP] identifier[SegmentIteratorImpl] identifier[segIterB] operator[=] operator[SEP] operator[SEP] identifier[MultiPathImpl] operator[SEP] identifier[multipathB] operator[SEP] identifier[_getImpl] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[querySegmentIterator] operator[SEP] operator[SEP] operator[SEP] identifier[QuadTreeImpl] identifier[qtB] operator[=] Other[null] operator[SEP] identifier[QuadTreeImpl] identifier[quadTreeB] operator[=] Other[null] operator[SEP] identifier[QuadTreeImpl] identifier[quadTreePathsB] operator[=] Other[null] operator[SEP] identifier[GeometryAccelerators] identifier[accel] operator[=] operator[SEP] operator[SEP] identifier[MultiPathImpl] operator[SEP] identifier[multipathB] operator[SEP] identifier[_getImpl] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[_getAccelerators] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[accel] operator[!=] Other[null] operator[SEP] {
identifier[quadTreeB] operator[=] identifier[accel] operator[SEP] identifier[getQuadTree] operator[SEP] operator[SEP] operator[SEP] identifier[quadTreePathsB] operator[=] identifier[accel] operator[SEP] identifier[getQuadTreeForPaths] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[quadTreeB] operator[==] Other[null] operator[SEP] {
identifier[qtB] operator[=] identifier[InternalUtils] operator[SEP] identifier[buildQuadTree] operator[SEP] operator[SEP] identifier[MultiPathImpl] operator[SEP] identifier[multipathB] operator[SEP] identifier[_getImpl] operator[SEP] operator[SEP] , identifier[envInter] operator[SEP] operator[SEP] identifier[quadTreeB] operator[=] identifier[qtB] operator[SEP]
}
}
Keyword[else] {
identifier[qtB] operator[=] identifier[InternalUtils] operator[SEP] identifier[buildQuadTree] operator[SEP] operator[SEP] identifier[MultiPathImpl] operator[SEP] identifier[multipathB] operator[SEP] identifier[_getImpl] operator[SEP] operator[SEP] , identifier[envInter] operator[SEP] operator[SEP] identifier[quadTreeB] operator[=] identifier[qtB] operator[SEP]
}
identifier[QuadTreeImpl] operator[SEP] identifier[QuadTreeIteratorImpl] identifier[qtIterB] operator[=] identifier[quadTreeB] operator[SEP] identifier[getIterator] operator[SEP] operator[SEP] operator[SEP] identifier[QuadTreeImpl] operator[SEP] identifier[QuadTreeIteratorImpl] identifier[qtIterPathsB] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[quadTreePathsB] operator[!=] Other[null] operator[SEP] identifier[qtIterPathsB] operator[=] identifier[quadTreePathsB] operator[SEP] identifier[getIterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[segIterA] operator[SEP] identifier[nextPath] operator[SEP] operator[SEP] operator[SEP] {
Keyword[while] operator[SEP] identifier[segIterA] operator[SEP] identifier[hasNextSegment] operator[SEP] operator[SEP] operator[SEP] {
Keyword[boolean] identifier[bStringOfSegmentAsCovered] operator[=] literal[boolean] operator[SEP] identifier[Segment] identifier[segmentA] operator[=] identifier[segIterA] operator[SEP] identifier[nextSegment] operator[SEP] operator[SEP] operator[SEP] identifier[segmentA] operator[SEP] identifier[queryEnvelope2D] operator[SEP] identifier[env_a] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[env_a] operator[SEP] identifier[isIntersecting] operator[SEP] identifier[envInter] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[qtIterPathsB] operator[!=] Other[null] operator[SEP] {
identifier[qtIterPathsB] operator[SEP] identifier[resetIterator] operator[SEP] identifier[env_a] , identifier[tolerance] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[qtIterPathsB] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[==] operator[-] Other[1] operator[SEP] {
identifier[bWithin] operator[=] literal[boolean] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[double] identifier[lengthA] operator[=] identifier[segmentA] operator[SEP] identifier[calculateLength2D] operator[SEP] operator[SEP] operator[SEP] identifier[qtIterB] operator[SEP] identifier[resetIterator] operator[SEP] identifier[segmentA] , identifier[tolerance] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[elementHandleB] operator[=] identifier[qtIterB] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[elementHandleB] operator[!=] operator[-] Other[1] operator[SEP] identifier[elementHandleB] operator[=] identifier[qtIterB] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] {
Keyword[int] identifier[vertex_b] operator[=] identifier[quadTreeB] operator[SEP] identifier[getElement] operator[SEP] identifier[elementHandleB] operator[SEP] operator[SEP] identifier[segIterB] operator[SEP] identifier[resetToVertex] operator[SEP] identifier[vertex_b] operator[SEP] operator[SEP] identifier[Segment] identifier[segmentB] operator[=] identifier[segIterB] operator[SEP] identifier[nextSegment] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[result] operator[=] identifier[segmentA] operator[SEP] identifier[intersect] operator[SEP] identifier[segmentB] , Other[null] , identifier[scalarsA] , identifier[scalarsB] , identifier[tolerance] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[==] Other[2] operator[&&] operator[SEP] operator[!] identifier[bEnforceOrientation] operator[||] identifier[scalarsB] operator[SEP] Other[0] operator[SEP] operator[<=] identifier[scalarsB] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP] {
Keyword[double] identifier[scalar_a_0] operator[=] identifier[scalarsA] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[double] identifier[scalar_a_1] operator[=] identifier[scalarsA] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[double] identifier[scalar_b_0] operator[=] identifier[scalarsB] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[double] identifier[scalar_b_1] operator[=] identifier[scalarsB] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[scalar_a_0] operator[*] identifier[lengthA] operator[<=] identifier[tolerance] operator[&&] operator[SEP] literal[Float] operator[-] identifier[scalar_a_1] operator[SEP] operator[*] identifier[lengthA] operator[<=] identifier[tolerance] operator[SEP] {
identifier[bStringOfSegmentAsCovered] operator[=] literal[boolean] operator[SEP] identifier[ievent] operator[=] Other[0] operator[SEP] identifier[eventIndices] operator[SEP] identifier[resize] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[relOps] operator[SEP] identifier[m_overlap_events] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[ivertex_a] operator[=] identifier[segIterA] operator[SEP] identifier[getStartPointIndex] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[bSegmentACovered] operator[=] literal[boolean] operator[SEP] Keyword[while] operator[SEP] identifier[bSegmentACovered] operator[SEP] {
Keyword[if] operator[SEP] identifier[segIterA] operator[SEP] identifier[hasNextSegment] operator[SEP] operator[SEP] operator[SEP] {
identifier[segmentA] operator[=] identifier[segIterA] operator[SEP] identifier[nextSegment] operator[SEP] operator[SEP] operator[SEP] identifier[lengthA] operator[=] identifier[segmentA] operator[SEP] identifier[calculateLength2D] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[=] identifier[segmentA] operator[SEP] identifier[intersect] operator[SEP] identifier[segmentB] , Other[null] , identifier[scalarsA] , identifier[scalarsB] , identifier[tolerance] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[==] Other[2] operator[&&] operator[SEP] operator[!] identifier[bEnforceOrientation] operator[||] identifier[scalarsB] operator[SEP] Other[0] operator[SEP] operator[<=] identifier[scalarsB] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP] {
identifier[scalar_a_0] operator[=] identifier[scalarsA] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[scalar_a_1] operator[=] identifier[scalarsA] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[scalar_a_0] operator[*] identifier[lengthA] operator[<=] identifier[tolerance] operator[&&] operator[SEP] literal[Float] operator[-] identifier[scalar_a_1] operator[SEP] operator[*] identifier[lengthA] operator[<=] identifier[tolerance] operator[SEP] {
identifier[ivertex_a] operator[=] identifier[segIterA] operator[SEP] identifier[getStartPointIndex] operator[SEP] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[segIterB] operator[SEP] identifier[hasNextSegment] operator[SEP] operator[SEP] operator[SEP] {
identifier[segmentB] operator[=] identifier[segIterB] operator[SEP] identifier[nextSegment] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[=] identifier[segmentA] operator[SEP] identifier[intersect] operator[SEP] identifier[segmentB] , Other[null] , identifier[scalarsA] , identifier[scalarsB] , identifier[tolerance] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[==] Other[2] operator[&&] operator[SEP] operator[!] identifier[bEnforceOrientation] operator[||] identifier[scalarsB] operator[SEP] Other[0] operator[SEP] operator[<=] identifier[scalarsB] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP] {
identifier[scalar_a_0] operator[=] identifier[scalarsA] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[scalar_a_1] operator[=] identifier[scalarsA] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[scalar_a_0] operator[*] identifier[lengthA] operator[<=] identifier[tolerance] operator[&&] operator[SEP] literal[Float] operator[-] identifier[scalar_a_1] operator[SEP] operator[*] identifier[lengthA] operator[<=] identifier[tolerance] operator[SEP] {
identifier[ivertex_a] operator[=] identifier[segIterA] operator[SEP] identifier[getStartPointIndex] operator[SEP] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
}
}
}
identifier[bSegmentACovered] operator[=] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[ivertex_a] operator[!=] identifier[segIterA] operator[SEP] identifier[getStartPointIndex] operator[SEP] operator[SEP] operator[SEP] {
identifier[segIterA] operator[SEP] identifier[resetToVertex] operator[SEP] identifier[ivertex_a] operator[SEP] operator[SEP] identifier[segIterA] operator[SEP] identifier[nextSegment] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[break] operator[SEP]
}
Keyword[else] {
Keyword[int] identifier[ivertex_a] operator[=] identifier[segIterA] operator[SEP] identifier[getStartPointIndex] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[ipath_a] operator[=] identifier[segIterA] operator[SEP] identifier[getPathIndex] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[ivertex_b] operator[=] identifier[segIterB] operator[SEP] identifier[getStartPointIndex] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[ipath_b] operator[=] identifier[segIterB] operator[SEP] identifier[getPathIndex] operator[SEP] operator[SEP] operator[SEP] identifier[overlapEvent] operator[=] identifier[OverlapEvent] operator[SEP] identifier[construct] operator[SEP] identifier[ivertex_a] , identifier[ipath_a] , identifier[scalar_a_0] , identifier[scalar_a_1] , identifier[ivertex_b] , identifier[ipath_b] , identifier[scalar_b_0] , identifier[scalar_b_1] operator[SEP] operator[SEP] identifier[relOps] operator[SEP] identifier[m_overlap_events] operator[SEP] identifier[add] operator[SEP] identifier[overlapEvent] operator[SEP] operator[SEP] identifier[eventIndices] operator[SEP] identifier[add] operator[SEP] identifier[eventIndices] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[if] operator[SEP] identifier[bStringOfSegmentAsCovered] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[if] operator[SEP] identifier[ievent] operator[==] identifier[relOps] operator[SEP] identifier[m_overlap_events] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[eventIndices] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[-] identifier[ievent] operator[>] Other[1] operator[SEP] {
identifier[eventIndices] operator[SEP] identifier[Sort] operator[SEP] identifier[ievent] , identifier[eventIndices] operator[SEP] identifier[size] operator[SEP] operator[SEP] , identifier[overlapComparer] operator[SEP] operator[SEP]
}
Keyword[double] identifier[lastScalar] operator[=] literal[Float] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[ievent] operator[SEP] identifier[i] operator[<] identifier[relOps] operator[SEP] identifier[m_overlap_events] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[overlapEvent] operator[=] identifier[relOps] operator[SEP] identifier[m_overlap_events] operator[SEP] identifier[get] operator[SEP] identifier[eventIndices] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[overlapEvent] operator[SEP] identifier[m_scalar_a_0] operator[<] identifier[lastScalar] operator[&&] identifier[overlapEvent] operator[SEP] identifier[m_scalar_a_1] operator[<] identifier[lastScalar] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[if] operator[SEP] identifier[lengthA] operator[*] operator[SEP] identifier[overlapEvent] operator[SEP] identifier[m_scalar_a_0] operator[-] identifier[lastScalar] operator[SEP] operator[>] identifier[tolerance] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] {
identifier[lastScalar] operator[=] identifier[overlapEvent] operator[SEP] identifier[m_scalar_a_1] operator[SEP] Keyword[if] operator[SEP] identifier[lengthA] operator[*] operator[SEP] literal[Float] operator[-] identifier[lastScalar] operator[SEP] operator[<=] identifier[tolerance] operator[||] identifier[lastScalar] operator[==] literal[Float] operator[SEP] {
Keyword[break] operator[SEP]
}
}
}
Keyword[if] operator[SEP] identifier[lengthA] operator[*] operator[SEP] literal[Float] operator[-] identifier[lastScalar] operator[SEP] operator[>] identifier[tolerance] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[ievent] operator[=] Other[0] operator[SEP] identifier[eventIndices] operator[SEP] identifier[resize] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[relOps] operator[SEP] identifier[m_overlap_events] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[bWithin] operator[SEP]
}
|
@NotNull
public static InstanceSetter[] instanceFields2ValueSetters(final List<? extends Attribute> instanceFields, final InstanceType type) throws FOSException {
InstanceSetter[] instanceSetters = new InstanceSetter[instanceFields.size()];
for (int idx = 0; idx < instanceFields.size(); idx++) {
final Attribute att = instanceFields.get(idx);
instanceSetters[idx] = new InstanceSetter() {
@Override
public void set(Instance instance, weka.core.Attribute attribute, Object value) throws FOSException {
instance.setValue(attribute, att.parseOrMissing(value));
}
};
}
return instanceSetters;
}
|
class class_name[name] begin[{]
method[instanceFields2ValueSetters, return_type[type[InstanceSetter]], modifier[public static], parameter[instanceFields, type]] begin[{]
local_variable[type[InstanceSetter], instanceSetters]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=idx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=instanceFields, selectors=[], type_arguments=None), name=att)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Attribute, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=instanceSetters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=idx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=attribute, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parseOrMissing, postfix_operators=[], prefix_operators=[], qualifier=att, selectors=[], type_arguments=None)], member=setValue, postfix_operators=[], prefix_operators=[], qualifier=instance, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=set, parameters=[FormalParameter(annotations=[], modifiers=set(), name=instance, type=ReferenceType(arguments=None, dimensions=[], name=Instance, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=attribute, type=ReferenceType(arguments=None, dimensions=[], name=weka, sub_type=ReferenceType(arguments=None, dimensions=None, name=core, sub_type=ReferenceType(arguments=None, dimensions=None, name=Attribute, sub_type=None))), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=value, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None), varargs=False)], return_type=None, throws=['FOSException'], type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InstanceSetter, sub_type=None))), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=idx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=instanceFields, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=idx)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=idx, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.instanceSetters]]
end[}]
END[}]
|
annotation[@] identifier[NotNull] Keyword[public] Keyword[static] identifier[InstanceSetter] operator[SEP] operator[SEP] identifier[instanceFields2ValueSetters] operator[SEP] Keyword[final] identifier[List] operator[<] operator[?] Keyword[extends] identifier[Attribute] operator[>] identifier[instanceFields] , Keyword[final] identifier[InstanceType] identifier[type] operator[SEP] Keyword[throws] identifier[FOSException] {
identifier[InstanceSetter] operator[SEP] operator[SEP] identifier[instanceSetters] operator[=] Keyword[new] identifier[InstanceSetter] operator[SEP] identifier[instanceFields] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[idx] operator[=] Other[0] operator[SEP] identifier[idx] operator[<] identifier[instanceFields] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[idx] operator[++] operator[SEP] {
Keyword[final] identifier[Attribute] identifier[att] operator[=] identifier[instanceFields] operator[SEP] identifier[get] operator[SEP] identifier[idx] operator[SEP] operator[SEP] identifier[instanceSetters] operator[SEP] identifier[idx] operator[SEP] operator[=] Keyword[new] identifier[InstanceSetter] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[set] operator[SEP] identifier[Instance] identifier[instance] , identifier[weka] operator[SEP] identifier[core] operator[SEP] identifier[Attribute] identifier[attribute] , identifier[Object] identifier[value] operator[SEP] Keyword[throws] identifier[FOSException] {
identifier[instance] operator[SEP] identifier[setValue] operator[SEP] identifier[attribute] , identifier[att] operator[SEP] identifier[parseOrMissing] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP]
}
Keyword[return] identifier[instanceSetters] operator[SEP]
}
|
public Long getProcessInstanceByCorrelationKey(CorrelationKey correlationKey) {
Query processInstancesForEvent = getEntityManager().createNamedQuery( "GetProcessInstanceIdByCorrelation" );
processInstancesForEvent.setParameter( "ckey", correlationKey.toExternalForm());
try {
return (Long) processInstancesForEvent.getSingleResult();
} catch (NonUniqueResultException e) {
return null;
} catch (NoResultException e) {
return null;
}
}
|
class class_name[name] begin[{]
method[getProcessInstanceByCorrelationKey, return_type[type[Long]], modifier[public], parameter[correlationKey]] begin[{]
local_variable[type[Query], processInstancesForEvent]
call[processInstancesForEvent.setParameter, parameter[literal["ckey"], call[correlationKey.toExternalForm, parameter[]]]]
TryStatement(block=[ReturnStatement(expression=Cast(expression=MethodInvocation(arguments=[], member=getSingleResult, postfix_operators=[], prefix_operators=[], qualifier=processInstancesForEvent, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Long, sub_type=None)), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NonUniqueResultException'])), CatchClause(block=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NoResultException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[public] identifier[Long] identifier[getProcessInstanceByCorrelationKey] operator[SEP] identifier[CorrelationKey] identifier[correlationKey] operator[SEP] {
identifier[Query] identifier[processInstancesForEvent] operator[=] identifier[getEntityManager] operator[SEP] operator[SEP] operator[SEP] identifier[createNamedQuery] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[processInstancesForEvent] operator[SEP] identifier[setParameter] operator[SEP] literal[String] , identifier[correlationKey] operator[SEP] identifier[toExternalForm] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[return] operator[SEP] identifier[Long] operator[SEP] identifier[processInstancesForEvent] operator[SEP] identifier[getSingleResult] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NonUniqueResultException] identifier[e] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NoResultException] identifier[e] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
}
|
@Override
public final boolean filter() {
boolean filterResult = true;
for (final AbsFilter filter : mFilter) {
filterResult = filterResult && filter.filter();
}
return filterResult;
}
|
class class_name[name] begin[{]
method[filter, return_type[type[boolean]], modifier[final public], parameter[]] begin[{]
local_variable[type[boolean], filterResult]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=filterResult, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=filterResult, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=filter, postfix_operators=[], prefix_operators=[], qualifier=filter, selectors=[], type_arguments=None), operator=&&)), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=mFilter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=filter)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=AbsFilter, sub_type=None))), label=None)
return[member[.filterResult]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[final] Keyword[boolean] identifier[filter] operator[SEP] operator[SEP] {
Keyword[boolean] identifier[filterResult] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[AbsFilter] identifier[filter] operator[:] identifier[mFilter] operator[SEP] {
identifier[filterResult] operator[=] identifier[filterResult] operator[&&] identifier[filter] operator[SEP] identifier[filter] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[filterResult] operator[SEP]
}
|
public static <R> R getStaticField(Class<?> clazz, String fieldName) {
try {
return getStaticField(clazz.getDeclaredField(fieldName));
} catch (Exception e) {
throw new RuntimeException(e);
}
}
|
class class_name[name] begin[{]
method[getStaticField, return_type[type[R]], modifier[public static], parameter[clazz, fieldName]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=fieldName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getDeclaredField, postfix_operators=[], prefix_operators=[], qualifier=clazz, selectors=[], type_arguments=None)], member=getStaticField, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=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=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[public] Keyword[static] operator[<] identifier[R] operator[>] identifier[R] identifier[getStaticField] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[clazz] , identifier[String] identifier[fieldName] operator[SEP] {
Keyword[try] {
Keyword[return] identifier[getStaticField] operator[SEP] identifier[clazz] operator[SEP] identifier[getDeclaredField] operator[SEP] identifier[fieldName] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
public Form getSearchForm(DomainBareJid serviceJID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
TranscriptSearch search = new TranscriptSearch();
search.setType(IQ.Type.get);
search.setTo(serviceJID);
TranscriptSearch response = connection.createStanzaCollectorAndSend(
search).nextResultOrThrow();
return Form.getFormFrom(response);
}
|
class class_name[name] begin[{]
method[getSearchForm, return_type[type[Form]], modifier[public], parameter[serviceJID]] begin[{]
local_variable[type[TranscriptSearch], search]
call[search.setType, parameter[member[IQ.Type.get]]]
call[search.setTo, parameter[member[.serviceJID]]]
local_variable[type[TranscriptSearch], response]
return[call[Form.getFormFrom, parameter[member[.response]]]]
end[}]
END[}]
|
Keyword[public] identifier[Form] identifier[getSearchForm] operator[SEP] identifier[DomainBareJid] identifier[serviceJID] operator[SEP] Keyword[throws] identifier[NoResponseException] , identifier[XMPPErrorException] , identifier[NotConnectedException] , identifier[InterruptedException] {
identifier[TranscriptSearch] identifier[search] operator[=] Keyword[new] identifier[TranscriptSearch] operator[SEP] operator[SEP] operator[SEP] identifier[search] operator[SEP] identifier[setType] operator[SEP] identifier[IQ] operator[SEP] identifier[Type] operator[SEP] identifier[get] operator[SEP] operator[SEP] identifier[search] operator[SEP] identifier[setTo] operator[SEP] identifier[serviceJID] operator[SEP] operator[SEP] identifier[TranscriptSearch] identifier[response] operator[=] identifier[connection] operator[SEP] identifier[createStanzaCollectorAndSend] operator[SEP] identifier[search] operator[SEP] operator[SEP] identifier[nextResultOrThrow] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[Form] operator[SEP] identifier[getFormFrom] operator[SEP] identifier[response] operator[SEP] operator[SEP]
}
|
public static Channel newJVM(String displayName, TaskListener listener, FilePath workDir, ClasspathBuilder classpath, Map<String,String> systemProperties) throws IOException {
JVMBuilder vmb = new JVMBuilder();
vmb.systemProperties(systemProperties);
return newJVM(displayName,listener,vmb,workDir,classpath);
}
|
class class_name[name] begin[{]
method[newJVM, return_type[type[Channel]], modifier[public static], parameter[displayName, listener, workDir, classpath, systemProperties]] begin[{]
local_variable[type[JVMBuilder], vmb]
call[vmb.systemProperties, parameter[member[.systemProperties]]]
return[call[.newJVM, parameter[member[.displayName], member[.listener], member[.vmb], member[.workDir], member[.classpath]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Channel] identifier[newJVM] operator[SEP] identifier[String] identifier[displayName] , identifier[TaskListener] identifier[listener] , identifier[FilePath] identifier[workDir] , identifier[ClasspathBuilder] identifier[classpath] , identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[systemProperties] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[JVMBuilder] identifier[vmb] operator[=] Keyword[new] identifier[JVMBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[vmb] operator[SEP] identifier[systemProperties] operator[SEP] identifier[systemProperties] operator[SEP] operator[SEP] Keyword[return] identifier[newJVM] operator[SEP] identifier[displayName] , identifier[listener] , identifier[vmb] , identifier[workDir] , identifier[classpath] operator[SEP] operator[SEP]
}
|
public static long parseLong(final CharSequence s) {
final int n = s.length(); // Will NPE if necessary.
if (n == 0) {
throw new NumberFormatException("Empty string");
}
char c = s.charAt(0); // Current character.
int i = 1; // index in `s'.
if (c < '0' && (c == '+' || c == '-')) { // Only 1 test in common case.
if (n == 1) {
throw new NumberFormatException("Just a sign, no value: " + s);
} else if (n > 20) { // "+9223372036854775807" or "-9223372036854775808"
throw new NumberFormatException("Value too long: " + s);
}
c = s.charAt(1);
i = 2; // Skip over the sign.
} else if (n > 19) { // "9223372036854775807"
throw new NumberFormatException("Value too long: " + s);
}
long v = 0; // The result (negated to easily handle MIN_VALUE).
do {
if ('0' <= c && c <= '9') {
v -= c - '0';
} else {
throw new NumberFormatException("Invalid character '" + c
+ "' in " + s);
}
if (i == n) {
break;
}
v *= 10;
c = s.charAt(i++);
} while (true);
if (v > 0) {
throw new NumberFormatException("Overflow in " + s);
} else if (s.charAt(0) == '-') {
return v; // Value is already negative, return unchanged.
} else if (v == Long.MIN_VALUE) {
throw new NumberFormatException("Overflow in " + s);
} else {
return -v; // Positive value, need to fix the sign.
}
}
|
class class_name[name] begin[{]
method[parseLong, return_type[type[long]], modifier[public static], parameter[s]] begin[{]
local_variable[type[int], n]
if[binary_operation[member[.n], ==, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Empty string")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NumberFormatException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[char], c]
local_variable[type[int], i]
if[binary_operation[binary_operation[member[.c], <, literal['0']], &&, binary_operation[binary_operation[member[.c], ==, literal['+']], ||, binary_operation[member[.c], ==, literal['-']]]]] begin[{]
if[binary_operation[member[.n], ==, literal[1]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Just a sign, no value: "), operandr=MemberReference(member=s, 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=NumberFormatException, sub_type=None)), label=None)
else begin[{]
if[binary_operation[member[.n], >, literal[20]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Value too long: "), operandr=MemberReference(member=s, 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=NumberFormatException, sub_type=None)), label=None)
else begin[{]
None
end[}]
end[}]
assign[member[.c], call[s.charAt, parameter[literal[1]]]]
assign[member[.i], literal[2]]
else begin[{]
if[binary_operation[member[.n], >, literal[19]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Value too long: "), operandr=MemberReference(member=s, 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=NumberFormatException, sub_type=None)), label=None)
else begin[{]
None
end[}]
end[}]
local_variable[type[long], v]
do[literal[true]] begin[{]
if[binary_operation[binary_operation[literal['0'], <=, member[.c]], &&, binary_operation[member[.c], <=, literal['9']]]] begin[{]
assign[member[.v], binary_operation[member[.c], -, literal['0']]]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid character '"), operandr=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' in "), operator=+), operandr=MemberReference(member=s, 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=NumberFormatException, sub_type=None)), label=None)
end[}]
if[binary_operation[member[.i], ==, member[.n]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
assign[member[.v], literal[10]]
assign[member[.c], call[s.charAt, parameter[member[.i]]]]
end[}]
if[binary_operation[member[.v], >, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Overflow in "), operandr=MemberReference(member=s, 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=NumberFormatException, sub_type=None)), label=None)
else begin[{]
if[binary_operation[call[s.charAt, parameter[literal[0]]], ==, literal['-']]] begin[{]
return[member[.v]]
else begin[{]
if[binary_operation[member[.v], ==, member[Long.MIN_VALUE]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Overflow in "), operandr=MemberReference(member=s, 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=NumberFormatException, sub_type=None)), label=None)
else begin[{]
return[member[.v]]
end[}]
end[}]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[long] identifier[parseLong] operator[SEP] Keyword[final] identifier[CharSequence] identifier[s] operator[SEP] {
Keyword[final] Keyword[int] identifier[n] operator[=] identifier[s] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[n] operator[==] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NumberFormatException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[char] identifier[c] operator[=] identifier[s] operator[SEP] identifier[charAt] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[int] identifier[i] operator[=] Other[1] operator[SEP] Keyword[if] operator[SEP] identifier[c] operator[<] literal[String] operator[&&] operator[SEP] identifier[c] operator[==] literal[String] operator[||] identifier[c] operator[==] literal[String] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[n] operator[==] Other[1] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NumberFormatException] operator[SEP] literal[String] operator[+] identifier[s] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[n] operator[>] Other[20] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NumberFormatException] operator[SEP] literal[String] operator[+] identifier[s] operator[SEP] operator[SEP]
}
identifier[c] operator[=] identifier[s] operator[SEP] identifier[charAt] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[i] operator[=] Other[2] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[n] operator[>] Other[19] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NumberFormatException] operator[SEP] literal[String] operator[+] identifier[s] operator[SEP] operator[SEP]
}
Keyword[long] identifier[v] operator[=] Other[0] operator[SEP] Keyword[do] {
Keyword[if] operator[SEP] literal[String] operator[<=] identifier[c] operator[&&] identifier[c] operator[<=] literal[String] operator[SEP] {
identifier[v] operator[-=] identifier[c] operator[-] literal[String] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[NumberFormatException] operator[SEP] literal[String] operator[+] identifier[c] operator[+] literal[String] operator[+] identifier[s] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[i] operator[==] identifier[n] operator[SEP] {
Keyword[break] operator[SEP]
}
identifier[v] operator[*=] Other[10] operator[SEP] identifier[c] operator[=] identifier[s] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[++] operator[SEP] operator[SEP]
}
Keyword[while] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[v] operator[>] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NumberFormatException] operator[SEP] literal[String] operator[+] identifier[s] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[s] operator[SEP] identifier[charAt] operator[SEP] Other[0] operator[SEP] operator[==] literal[String] operator[SEP] {
Keyword[return] identifier[v] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[v] operator[==] identifier[Long] operator[SEP] identifier[MIN_VALUE] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NumberFormatException] operator[SEP] literal[String] operator[+] identifier[s] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] operator[-] identifier[v] operator[SEP]
}
}
|
@Override
public ContentProviderResult[] applyBatch(ArrayList<ContentProviderOperation> operations) throws OperationApplicationException {
ContentProviderResult[] result = null;
SQLiteDatabase db = this.getHelper().getWritableDatabase();
db.beginTransaction();
try {
result = super.applyBatch(operations);
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
return result;
}
|
class class_name[name] begin[{]
method[applyBatch, return_type[type[ContentProviderResult]], modifier[public], parameter[operations]] begin[{]
local_variable[type[ContentProviderResult], result]
local_variable[type[SQLiteDatabase], db]
call[db.beginTransaction, parameter[]]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=SuperMethodInvocation(arguments=[MemberReference(member=operations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=applyBatch, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=setTransactionSuccessful, postfix_operators=[], prefix_operators=[], qualifier=db, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=endTransaction, postfix_operators=[], prefix_operators=[], qualifier=db, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
return[member[.result]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[ContentProviderResult] operator[SEP] operator[SEP] identifier[applyBatch] operator[SEP] identifier[ArrayList] operator[<] identifier[ContentProviderOperation] operator[>] identifier[operations] operator[SEP] Keyword[throws] identifier[OperationApplicationException] {
identifier[ContentProviderResult] operator[SEP] operator[SEP] identifier[result] operator[=] Other[null] operator[SEP] identifier[SQLiteDatabase] identifier[db] operator[=] Keyword[this] operator[SEP] identifier[getHelper] operator[SEP] operator[SEP] operator[SEP] identifier[getWritableDatabase] operator[SEP] operator[SEP] operator[SEP] identifier[db] operator[SEP] identifier[beginTransaction] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[result] operator[=] Keyword[super] operator[SEP] identifier[applyBatch] operator[SEP] identifier[operations] operator[SEP] operator[SEP] identifier[db] operator[SEP] identifier[setTransactionSuccessful] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[db] operator[SEP] identifier[endTransaction] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public void eInit(XtendTypeDeclaration container, String name, IJvmTypeProvider context) {
if (this.sarlInterface == null) {
this.container = container;
this.sarlInterface = SarlFactory.eINSTANCE.createSarlInterface();
container.getMembers().add(this.sarlInterface);
if (!Strings.isEmpty(name)) {
this.sarlInterface.setName(name);
}
}
}
|
class class_name[name] begin[{]
method[eInit, return_type[void], modifier[public], parameter[container, name, context]] begin[{]
if[binary_operation[THIS[member[None.sarlInterface]], ==, literal[null]]] begin[{]
assign[THIS[member[None.container]], member[.container]]
assign[THIS[member[None.sarlInterface]], call[SarlFactory.eINSTANCE.createSarlInterface, parameter[]]]
call[container.getMembers, parameter[]]
if[call[Strings.isEmpty, parameter[member[.name]]]] begin[{]
THIS[member[None.sarlInterface]call[None.setName, parameter[member[.name]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[eInit] operator[SEP] identifier[XtendTypeDeclaration] identifier[container] , identifier[String] identifier[name] , identifier[IJvmTypeProvider] identifier[context] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[sarlInterface] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[container] operator[=] identifier[container] operator[SEP] Keyword[this] operator[SEP] identifier[sarlInterface] operator[=] identifier[SarlFactory] operator[SEP] identifier[eINSTANCE] operator[SEP] identifier[createSarlInterface] operator[SEP] operator[SEP] operator[SEP] identifier[container] operator[SEP] identifier[getMembers] operator[SEP] operator[SEP] operator[SEP] identifier[add] operator[SEP] Keyword[this] operator[SEP] identifier[sarlInterface] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[Strings] operator[SEP] identifier[isEmpty] operator[SEP] identifier[name] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[sarlInterface] operator[SEP] identifier[setName] operator[SEP] identifier[name] operator[SEP] operator[SEP]
}
}
}
|
@EventHandler("action")
private void onAction(PluginEvent event) {
PluginException exception = null;
PluginAction action = event.getAction();
boolean debug = log.isDebugEnabled();
if (pluginEventListeners1 != null) {
for (IPluginEvent listener : new ArrayList<>(pluginEventListeners1)) {
try {
if (debug) {
log.debug("Invoking IPluginEvent.on" + WordUtils.capitalizeFully(action.name()) + " for listener "
+ listener);
}
switch (action) {
case LOAD:
listener.onLoad(this);
continue;
case UNLOAD:
listener.onUnload();
continue;
case ACTIVATE:
listener.onActivate();
continue;
case INACTIVATE:
listener.onInactivate();
continue;
}
} catch (Throwable e) {
exception = createChainedException(action.name(), e, exception);
}
}
}
if (pluginEventListeners2 != null) {
for (IPluginEventListener listener : new ArrayList<>(pluginEventListeners2)) {
try {
if (debug) {
log.debug("Delivering " + action.name() + " event to IPluginEventListener listener " + listener);
}
listener.onPluginEvent(event);
} catch (Throwable e) {
exception = createChainedException(action.name(), e, exception);
}
}
}
if (action == PluginAction.LOAD) {
doAfterLoad();
}
if (exception != null) {
throw exception;
}
}
|
class class_name[name] begin[{]
method[onAction, return_type[void], modifier[private], parameter[event]] begin[{]
local_variable[type[PluginException], exception]
local_variable[type[PluginAction], action]
local_variable[type[boolean], debug]
if[binary_operation[member[.pluginEventListeners1], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[TryStatement(block=[IfStatement(condition=MemberReference(member=debug, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invoking IPluginEvent.on"), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=action, selectors=[], type_arguments=None)], member=capitalizeFully, postfix_operators=[], prefix_operators=[], qualifier=WordUtils, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" for listener "), operator=+), operandr=MemberReference(member=listener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)])), SwitchStatement(cases=[SwitchStatementCase(case=['LOAD'], statements=[StatementExpression(expression=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=onLoad, postfix_operators=[], prefix_operators=[], qualifier=listener, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=None, label=None)]), SwitchStatementCase(case=['UNLOAD'], statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=onUnload, postfix_operators=[], prefix_operators=[], qualifier=listener, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=None, label=None)]), SwitchStatementCase(case=['ACTIVATE'], statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=onActivate, postfix_operators=[], prefix_operators=[], qualifier=listener, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=None, label=None)]), SwitchStatementCase(case=['INACTIVATE'], statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=onInactivate, postfix_operators=[], prefix_operators=[], qualifier=listener, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=None, label=None)])], expression=MemberReference(member=action, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=exception, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=action, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=exception, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createChainedException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Throwable']))], finally_block=None, label=None, resources=None)]), control=EnhancedForControl(iterable=ClassCreator(arguments=[MemberReference(member=pluginEventListeners1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ArrayList, sub_type=None)), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=listener)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IPluginEvent, sub_type=None))), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.pluginEventListeners2], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[TryStatement(block=[IfStatement(condition=MemberReference(member=debug, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Delivering "), operandr=MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=action, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" event to IPluginEventListener listener "), operator=+), operandr=MemberReference(member=listener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=event, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=onPluginEvent, postfix_operators=[], prefix_operators=[], qualifier=listener, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=exception, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=action, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=exception, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createChainedException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Throwable']))], finally_block=None, label=None, resources=None)]), control=EnhancedForControl(iterable=ClassCreator(arguments=[MemberReference(member=pluginEventListeners2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ArrayList, sub_type=None)), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=listener)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IPluginEventListener, sub_type=None))), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.action], ==, member[PluginAction.LOAD]]] begin[{]
call[.doAfterLoad, parameter[]]
else begin[{]
None
end[}]
if[binary_operation[member[.exception], !=, literal[null]]] begin[{]
ThrowStatement(expression=MemberReference(member=exception, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
else begin[{]
None
end[}]
end[}]
END[}]
|
annotation[@] identifier[EventHandler] operator[SEP] literal[String] operator[SEP] Keyword[private] Keyword[void] identifier[onAction] operator[SEP] identifier[PluginEvent] identifier[event] operator[SEP] {
identifier[PluginException] identifier[exception] operator[=] Other[null] operator[SEP] identifier[PluginAction] identifier[action] operator[=] identifier[event] operator[SEP] identifier[getAction] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[debug] operator[=] identifier[log] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[pluginEventListeners1] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[IPluginEvent] identifier[listener] operator[:] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] identifier[pluginEventListeners1] operator[SEP] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[debug] operator[SEP] {
identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[WordUtils] operator[SEP] identifier[capitalizeFully] operator[SEP] identifier[action] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[listener] operator[SEP] operator[SEP]
}
Keyword[switch] operator[SEP] identifier[action] operator[SEP] {
Keyword[case] identifier[LOAD] operator[:] identifier[listener] operator[SEP] identifier[onLoad] operator[SEP] Keyword[this] operator[SEP] operator[SEP] Keyword[continue] operator[SEP] Keyword[case] identifier[UNLOAD] operator[:] identifier[listener] operator[SEP] identifier[onUnload] operator[SEP] operator[SEP] operator[SEP] Keyword[continue] operator[SEP] Keyword[case] identifier[ACTIVATE] operator[:] identifier[listener] operator[SEP] identifier[onActivate] operator[SEP] operator[SEP] operator[SEP] Keyword[continue] operator[SEP] Keyword[case] identifier[INACTIVATE] operator[:] identifier[listener] operator[SEP] identifier[onInactivate] operator[SEP] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[e] operator[SEP] {
identifier[exception] operator[=] identifier[createChainedException] operator[SEP] identifier[action] operator[SEP] identifier[name] operator[SEP] operator[SEP] , identifier[e] , identifier[exception] operator[SEP] operator[SEP]
}
}
}
Keyword[if] operator[SEP] identifier[pluginEventListeners2] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[IPluginEventListener] identifier[listener] operator[:] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] identifier[pluginEventListeners2] operator[SEP] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[debug] operator[SEP] {
identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[action] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[listener] operator[SEP] operator[SEP]
}
identifier[listener] operator[SEP] identifier[onPluginEvent] operator[SEP] identifier[event] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[e] operator[SEP] {
identifier[exception] operator[=] identifier[createChainedException] operator[SEP] identifier[action] operator[SEP] identifier[name] operator[SEP] operator[SEP] , identifier[e] , identifier[exception] operator[SEP] operator[SEP]
}
}
}
Keyword[if] operator[SEP] identifier[action] operator[==] identifier[PluginAction] operator[SEP] identifier[LOAD] operator[SEP] {
identifier[doAfterLoad] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[exception] operator[!=] Other[null] operator[SEP] {
Keyword[throw] identifier[exception] operator[SEP]
}
}
|
public static ServerSocketPredicate tag(String... tags) {
return socket -> socket.tags().containsAll(Arrays.asList(tags));
}
|
class class_name[name] begin[{]
method[tag, return_type[type[ServerSocketPredicate]], modifier[public static], parameter[tags]] begin[{]
return[LambdaExpression(body=MethodInvocation(arguments=[], member=tags, postfix_operators=[], prefix_operators=[], qualifier=socket, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=tags, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=asList, postfix_operators=[], prefix_operators=[], qualifier=Arrays, selectors=[], type_arguments=None)], member=containsAll, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), parameters=[MemberReference(member=socket, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[ServerSocketPredicate] identifier[tag] operator[SEP] identifier[String] operator[...] identifier[tags] operator[SEP] {
Keyword[return] identifier[socket] operator[->] identifier[socket] operator[SEP] identifier[tags] operator[SEP] operator[SEP] operator[SEP] identifier[containsAll] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[tags] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public ByteArrayInputStream compare(String jsonModels) throws JsonProcessingException, ApiException {
return compare(null, null, jsonModels);
}
|
class class_name[name] begin[{]
method[compare, return_type[type[ByteArrayInputStream]], modifier[public], parameter[jsonModels]] begin[{]
return[call[.compare, parameter[literal[null], literal[null], member[.jsonModels]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[ByteArrayInputStream] identifier[compare] operator[SEP] identifier[String] identifier[jsonModels] operator[SEP] Keyword[throws] identifier[JsonProcessingException] , identifier[ApiException] {
Keyword[return] identifier[compare] operator[SEP] Other[null] , Other[null] , identifier[jsonModels] operator[SEP] operator[SEP]
}
|
public void fixupVariables(java.util.Vector vars, int globalsSize)
{
super.fixupVariables(vars, globalsSize);
m_expr.fixupVariables(vars, globalsSize);
}
|
class class_name[name] begin[{]
method[fixupVariables, return_type[void], modifier[public], parameter[vars, globalsSize]] begin[{]
SuperMethodInvocation(arguments=[MemberReference(member=vars, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=globalsSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=fixupVariables, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
call[m_expr.fixupVariables, parameter[member[.vars], member[.globalsSize]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[fixupVariables] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Vector] identifier[vars] , Keyword[int] identifier[globalsSize] operator[SEP] {
Keyword[super] operator[SEP] identifier[fixupVariables] operator[SEP] identifier[vars] , identifier[globalsSize] operator[SEP] operator[SEP] identifier[m_expr] operator[SEP] identifier[fixupVariables] operator[SEP] identifier[vars] , identifier[globalsSize] operator[SEP] operator[SEP]
}
|
@Override
public XMLEventReader createXMLEventReader(InputStream in)
throws XMLStreamException
{
// false for auto-close, since caller has access to the input stream
return new WstxEventReader(createEventAllocator(),
createSR(null, in, null, true, false));
}
|
class class_name[name] begin[{]
method[createXMLEventReader, return_type[type[XMLEventReader]], modifier[public], parameter[in]] begin[{]
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=createEventAllocator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=createSR, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=WstxEventReader, sub_type=None))]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[XMLEventReader] identifier[createXMLEventReader] operator[SEP] identifier[InputStream] identifier[in] operator[SEP] Keyword[throws] identifier[XMLStreamException] {
Keyword[return] Keyword[new] identifier[WstxEventReader] operator[SEP] identifier[createEventAllocator] operator[SEP] operator[SEP] , identifier[createSR] operator[SEP] Other[null] , identifier[in] , Other[null] , literal[boolean] , literal[boolean] operator[SEP] operator[SEP] operator[SEP]
}
|
public static boolean isCropAvailable(Context context) {
Intent intent = new Intent("com.android.camera.action.CROP");
intent.setType("image/*");
return IntentUtils.isIntentAvailable(context, intent);
}
|
class class_name[name] begin[{]
method[isCropAvailable, return_type[type[boolean]], modifier[public static], parameter[context]] begin[{]
local_variable[type[Intent], intent]
call[intent.setType, parameter[literal["image/*"]]]
return[call[IntentUtils.isIntentAvailable, parameter[member[.context], member[.intent]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[boolean] identifier[isCropAvailable] operator[SEP] identifier[Context] identifier[context] operator[SEP] {
identifier[Intent] identifier[intent] operator[=] Keyword[new] identifier[Intent] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[intent] operator[SEP] identifier[setType] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[IntentUtils] operator[SEP] identifier[isIntentAvailable] operator[SEP] identifier[context] , identifier[intent] operator[SEP] operator[SEP]
}
|
public List<MasterBlockLocation> getBlockLocations() {
List<MasterBlockLocation> ret = new ArrayList<>(mWorkerIdToAlias.size());
for (Map.Entry<Long, String> entry : mWorkerIdToAlias.entrySet()) {
ret.add(new MasterBlockLocation(entry.getKey(), entry.getValue()));
}
return ret;
}
|
class class_name[name] begin[{]
method[getBlockLocations, return_type[type[List]], modifier[public], parameter[]] begin[{]
local_variable[type[List], ret]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MasterBlockLocation, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=ret, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=mWorkerIdToAlias, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Long, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
return[member[.ret]]
end[}]
END[}]
|
Keyword[public] identifier[List] operator[<] identifier[MasterBlockLocation] operator[>] identifier[getBlockLocations] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[MasterBlockLocation] operator[>] identifier[ret] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] identifier[mWorkerIdToAlias] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[Long] , identifier[String] operator[>] identifier[entry] operator[:] identifier[mWorkerIdToAlias] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[ret] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[MasterBlockLocation] operator[SEP] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ret] operator[SEP]
}
|
private void cleanupIfNeccessary(JsonGetterContext excluded) {
int cacheCount;
while ((cacheCount = internalCache.size()) > maxContexts) {
int sampleCount = Math.max(cacheCount - maxContexts, cleanupRemoveAtLeastItems) + 1;
for (SamplingEntry sample: internalCache.getRandomSamples(sampleCount)) {
if (excluded != sample.getEntryValue()) {
internalCache.remove(sample.getEntryKey());
}
}
}
}
|
class class_name[name] begin[{]
method[cleanupIfNeccessary, return_type[void], modifier[private], parameter[excluded]] begin[{]
local_variable[type[int], cacheCount]
while[binary_operation[assign[member[.cacheCount], call[internalCache.size, parameter[]]], >, member[.maxContexts]]] begin[{]
local_variable[type[int], sampleCount]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=excluded, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getEntryValue, postfix_operators=[], prefix_operators=[], qualifier=sample, selectors=[], type_arguments=None), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getEntryKey, postfix_operators=[], prefix_operators=[], qualifier=sample, selectors=[], type_arguments=None)], member=remove, postfix_operators=[], prefix_operators=[], qualifier=internalCache, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MemberReference(member=sampleCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getRandomSamples, postfix_operators=[], prefix_operators=[], qualifier=internalCache, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=sample)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SamplingEntry, sub_type=None))), label=None)
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[cleanupIfNeccessary] operator[SEP] identifier[JsonGetterContext] identifier[excluded] operator[SEP] {
Keyword[int] identifier[cacheCount] operator[SEP] Keyword[while] operator[SEP] operator[SEP] identifier[cacheCount] operator[=] identifier[internalCache] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[>] identifier[maxContexts] operator[SEP] {
Keyword[int] identifier[sampleCount] operator[=] identifier[Math] operator[SEP] identifier[max] operator[SEP] identifier[cacheCount] operator[-] identifier[maxContexts] , identifier[cleanupRemoveAtLeastItems] operator[SEP] operator[+] Other[1] operator[SEP] Keyword[for] operator[SEP] identifier[SamplingEntry] identifier[sample] operator[:] identifier[internalCache] operator[SEP] identifier[getRandomSamples] operator[SEP] identifier[sampleCount] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[excluded] operator[!=] identifier[sample] operator[SEP] identifier[getEntryValue] operator[SEP] operator[SEP] operator[SEP] {
identifier[internalCache] operator[SEP] identifier[remove] operator[SEP] identifier[sample] operator[SEP] identifier[getEntryKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
|
public static Map<String, String> splitUrlQuery(String query) {
Map<String, String> result = new HashMap<String, String>();
String[] pairs = query.split("&");
if (pairs != null && pairs.length > 0) {
for (String pair : pairs) {
String[] param = pair.split("=", 2);
if (param != null && param.length == 2) {
result.put(param[0], param[1]);
}
}
}
return result;
}
|
class class_name[name] begin[{]
method[splitUrlQuery, return_type[type[Map]], modifier[public static], parameter[query]] begin[{]
local_variable[type[Map], result]
local_variable[type[String], pairs]
if[binary_operation[binary_operation[member[.pairs], !=, literal[null]], &&, binary_operation[member[pairs.length], >, literal[0]]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="="), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], member=split, postfix_operators=[], prefix_operators=[], qualifier=pair, selectors=[], type_arguments=None), name=param)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=param, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=param, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator===), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=param, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), MemberReference(member=param, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))])], member=put, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=pairs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=pair)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[splitUrlQuery] operator[SEP] identifier[String] identifier[query] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[result] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[pairs] operator[=] identifier[query] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[pairs] operator[!=] Other[null] operator[&&] identifier[pairs] operator[SEP] identifier[length] operator[>] Other[0] operator[SEP] {
Keyword[for] operator[SEP] identifier[String] identifier[pair] operator[:] identifier[pairs] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] identifier[param] operator[=] identifier[pair] operator[SEP] identifier[split] operator[SEP] literal[String] , Other[2] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[param] operator[!=] Other[null] operator[&&] identifier[param] operator[SEP] identifier[length] operator[==] Other[2] operator[SEP] {
identifier[result] operator[SEP] identifier[put] operator[SEP] identifier[param] operator[SEP] Other[0] operator[SEP] , identifier[param] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[result] operator[SEP]
}
|
public static BigDecimal toBigDecimal(byte[] bytes, int offset, final int length) {
if (bytes == null || length < SIZEOF_INT + 1 ||
(offset + length > bytes.length)) {
return null;
}
int scale = toInt(bytes, offset);
byte[] tcBytes = new byte[length - SIZEOF_INT];
System.arraycopy(bytes, offset + SIZEOF_INT, tcBytes, 0, length - SIZEOF_INT);
return new BigDecimal(new BigInteger(tcBytes), scale);
}
|
class class_name[name] begin[{]
method[toBigDecimal, return_type[type[BigDecimal]], modifier[public static], parameter[bytes, offset, length]] begin[{]
if[binary_operation[binary_operation[binary_operation[member[.bytes], ==, literal[null]], ||, binary_operation[member[.length], <, binary_operation[member[.SIZEOF_INT], +, literal[1]]]], ||, binary_operation[binary_operation[member[.offset], +, member[.length]], >, member[bytes.length]]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[int], scale]
local_variable[type[byte], tcBytes]
call[System.arraycopy, parameter[member[.bytes], binary_operation[member[.offset], +, member[.SIZEOF_INT]], member[.tcBytes], literal[0], binary_operation[member[.length], -, member[.SIZEOF_INT]]]]
return[ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=tcBytes, 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=BigInteger, sub_type=None)), MemberReference(member=scale, 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=BigDecimal, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[BigDecimal] identifier[toBigDecimal] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[bytes] , Keyword[int] identifier[offset] , Keyword[final] Keyword[int] identifier[length] operator[SEP] {
Keyword[if] operator[SEP] identifier[bytes] operator[==] Other[null] operator[||] identifier[length] operator[<] identifier[SIZEOF_INT] operator[+] Other[1] operator[||] operator[SEP] identifier[offset] operator[+] identifier[length] operator[>] identifier[bytes] operator[SEP] identifier[length] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[int] identifier[scale] operator[=] identifier[toInt] operator[SEP] identifier[bytes] , identifier[offset] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[tcBytes] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[length] operator[-] identifier[SIZEOF_INT] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[bytes] , identifier[offset] operator[+] identifier[SIZEOF_INT] , identifier[tcBytes] , Other[0] , identifier[length] operator[-] identifier[SIZEOF_INT] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[BigDecimal] operator[SEP] Keyword[new] identifier[BigInteger] operator[SEP] identifier[tcBytes] operator[SEP] , identifier[scale] operator[SEP] operator[SEP]
}
|
Boolean isFixedPrecisionScale() {
switch (type) {
case Types.SQL_BIGINT :
case Types.SQL_DECIMAL :
case Types.SQL_DOUBLE :
case Types.SQL_FLOAT :
case Types.SQL_INTEGER :
case Types.SQL_NUMERIC :
case Types.SQL_REAL :
case Types.SQL_SMALLINT :
case Types.TINYINT :
return Boolean.FALSE;
default :
return null;
}
}
|
class class_name[name] begin[{]
method[isFixedPrecisionScale, return_type[type[Boolean]], modifier[default], parameter[]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=SQL_BIGINT, postfix_operators=[], prefix_operators=[], qualifier=Types, selectors=[]), MemberReference(member=SQL_DECIMAL, postfix_operators=[], prefix_operators=[], qualifier=Types, selectors=[]), MemberReference(member=SQL_DOUBLE, postfix_operators=[], prefix_operators=[], qualifier=Types, selectors=[]), MemberReference(member=SQL_FLOAT, postfix_operators=[], prefix_operators=[], qualifier=Types, selectors=[]), MemberReference(member=SQL_INTEGER, postfix_operators=[], prefix_operators=[], qualifier=Types, selectors=[]), MemberReference(member=SQL_NUMERIC, postfix_operators=[], prefix_operators=[], qualifier=Types, selectors=[]), MemberReference(member=SQL_REAL, postfix_operators=[], prefix_operators=[], qualifier=Types, selectors=[]), MemberReference(member=SQL_SMALLINT, postfix_operators=[], prefix_operators=[], qualifier=Types, selectors=[]), MemberReference(member=TINYINT, postfix_operators=[], prefix_operators=[], qualifier=Types, selectors=[])], statements=[ReturnStatement(expression=MemberReference(member=FALSE, postfix_operators=[], prefix_operators=[], qualifier=Boolean, selectors=[]), label=None)]), SwitchStatementCase(case=[], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)])], expression=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
end[}]
END[}]
|
identifier[Boolean] identifier[isFixedPrecisionScale] operator[SEP] operator[SEP] {
Keyword[switch] operator[SEP] identifier[type] operator[SEP] {
Keyword[case] identifier[Types] operator[SEP] identifier[SQL_BIGINT] operator[:] Keyword[case] identifier[Types] operator[SEP] identifier[SQL_DECIMAL] operator[:] Keyword[case] identifier[Types] operator[SEP] identifier[SQL_DOUBLE] operator[:] Keyword[case] identifier[Types] operator[SEP] identifier[SQL_FLOAT] operator[:] Keyword[case] identifier[Types] operator[SEP] identifier[SQL_INTEGER] operator[:] Keyword[case] identifier[Types] operator[SEP] identifier[SQL_NUMERIC] operator[:] Keyword[case] identifier[Types] operator[SEP] identifier[SQL_REAL] operator[:] Keyword[case] identifier[Types] operator[SEP] identifier[SQL_SMALLINT] operator[:] Keyword[case] identifier[Types] operator[SEP] identifier[TINYINT] operator[:] Keyword[return] identifier[Boolean] operator[SEP] identifier[FALSE] operator[SEP] Keyword[default] operator[:] Keyword[return] Other[null] operator[SEP]
}
}
|
@Indexable(type = IndexableType.DELETE)
@Override
public CPRuleAssetCategoryRel deleteCPRuleAssetCategoryRel(
long CPRuleAssetCategoryRelId) throws PortalException {
return cpRuleAssetCategoryRelPersistence.remove(CPRuleAssetCategoryRelId);
}
|
class class_name[name] begin[{]
method[deleteCPRuleAssetCategoryRel, return_type[type[CPRuleAssetCategoryRel]], modifier[public], parameter[CPRuleAssetCategoryRelId]] begin[{]
return[call[cpRuleAssetCategoryRelPersistence.remove, parameter[member[.CPRuleAssetCategoryRelId]]]]
end[}]
END[}]
|
annotation[@] identifier[Indexable] operator[SEP] identifier[type] operator[=] identifier[IndexableType] operator[SEP] identifier[DELETE] operator[SEP] annotation[@] identifier[Override] Keyword[public] identifier[CPRuleAssetCategoryRel] identifier[deleteCPRuleAssetCategoryRel] operator[SEP] Keyword[long] identifier[CPRuleAssetCategoryRelId] operator[SEP] Keyword[throws] identifier[PortalException] {
Keyword[return] identifier[cpRuleAssetCategoryRelPersistence] operator[SEP] identifier[remove] operator[SEP] identifier[CPRuleAssetCategoryRelId] operator[SEP] operator[SEP]
}
|
protected PropertyData updatePropertyData(InternalQName name, List<ValueData> values) throws RepositoryException
{
PropertyData existed =
(PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(name, 0), ItemType.PROPERTY);
if (existed == null)
{
throw new RepositoryException("Property data is not found " + name.getAsString() + " for node "
+ nodeData().getQPath().getAsString());
}
if (!existed.isMultiValued())
{
throw new ValueFormatException("An existed property is single-valued " + name.getAsString());
}
TransientPropertyData tdata =
new TransientPropertyData(QPath.makeChildPath(getInternalPath(), name), existed.getIdentifier(), existed
.getPersistedVersion(), existed.getType(), existed.getParentIdentifier(), existed.isMultiValued(), values);
return tdata;
}
|
class class_name[name] begin[{]
method[updatePropertyData, return_type[type[PropertyData]], modifier[protected], parameter[name, values]] begin[{]
local_variable[type[PropertyData], existed]
if[binary_operation[member[.existed], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Property data is not found "), operandr=MethodInvocation(arguments=[], member=getAsString, postfix_operators=[], prefix_operators=[], qualifier=name, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" for node "), operator=+), operandr=MethodInvocation(arguments=[], member=nodeData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getQPath, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getAsString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RepositoryException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[call[existed.isMultiValued, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="An existed property is single-valued "), operandr=MethodInvocation(arguments=[], member=getAsString, postfix_operators=[], prefix_operators=[], qualifier=name, selectors=[], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ValueFormatException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[TransientPropertyData], tdata]
return[member[.tdata]]
end[}]
END[}]
|
Keyword[protected] identifier[PropertyData] identifier[updatePropertyData] operator[SEP] identifier[InternalQName] identifier[name] , identifier[List] operator[<] identifier[ValueData] operator[>] identifier[values] operator[SEP] Keyword[throws] identifier[RepositoryException] {
identifier[PropertyData] identifier[existed] operator[=] operator[SEP] identifier[PropertyData] operator[SEP] identifier[dataManager] operator[SEP] identifier[getItemData] operator[SEP] identifier[nodeData] operator[SEP] operator[SEP] , Keyword[new] identifier[QPathEntry] operator[SEP] identifier[name] , Other[0] operator[SEP] , identifier[ItemType] operator[SEP] identifier[PROPERTY] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[existed] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RepositoryException] operator[SEP] literal[String] operator[+] identifier[name] operator[SEP] identifier[getAsString] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[nodeData] operator[SEP] operator[SEP] operator[SEP] identifier[getQPath] operator[SEP] operator[SEP] operator[SEP] identifier[getAsString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[existed] operator[SEP] identifier[isMultiValued] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ValueFormatException] operator[SEP] literal[String] operator[+] identifier[name] operator[SEP] identifier[getAsString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[TransientPropertyData] identifier[tdata] operator[=] Keyword[new] identifier[TransientPropertyData] operator[SEP] identifier[QPath] operator[SEP] identifier[makeChildPath] operator[SEP] identifier[getInternalPath] operator[SEP] operator[SEP] , identifier[name] operator[SEP] , identifier[existed] operator[SEP] identifier[getIdentifier] operator[SEP] operator[SEP] , identifier[existed] operator[SEP] identifier[getPersistedVersion] operator[SEP] operator[SEP] , identifier[existed] operator[SEP] identifier[getType] operator[SEP] operator[SEP] , identifier[existed] operator[SEP] identifier[getParentIdentifier] operator[SEP] operator[SEP] , identifier[existed] operator[SEP] identifier[isMultiValued] operator[SEP] operator[SEP] , identifier[values] operator[SEP] operator[SEP] Keyword[return] identifier[tdata] operator[SEP]
}
|
private Matrix buildMatrix(int maxWords, int maxDimensions) {
// Convert the vectors in the semantic map to a matrix.
SparseDoubleVector[] vectorList =
new SparseDoubleVector[wordToSemantics.size()];
for (Map.Entry<String, SparseDoubleVector> e :
wordToSemantics.entrySet())
vectorList[getIndexFor(e.getKey())] = e.getValue();
SparseMatrix matrix = Matrices.asSparseMatrix(
Arrays.asList(vectorList));
// If maxwords was set to 0, save all words.
if (maxWords == 0 || maxWords > wordToSemantics.size())
maxWords = wordToSemantics.size();
COALS_LOGGER.info("Forming the inverse mapping from terms to indices.");
// Calculate an inverse mapping from index to word since the binary file
// stores things by index number.
String[] indexToTerm = new String[termToIndex.size()];
for (Map.Entry<String, Integer> entry : termToIndex.entrySet())
indexToTerm[entry.getValue()] = entry.getKey();
COALS_LOGGER.info("Sorting the terms based on frequency.");
// Calculate the new indices for each word that will be kept based on
// the frequency count, where the most frequent word will be first.
ArrayList<Map.Entry<String, AtomicInteger>> wordCountList =
new ArrayList<Map.Entry<String, AtomicInteger>>(
totalWordFreq.entrySet());
Collections.sort(wordCountList, new EntryComp());
// Calculate the new term to index mapping based on the order of the
// word frequencies.
COALS_LOGGER.info("Generating the index masks.");
// Compute the number of dimensions to maintain.
int wordCount = (wordCountList.size() > maxDimensions)
? maxDimensions
: wordCountList.size();
int[] rowMask = new int[maxWords];
int[] colMask = new int[wordCount];
// Create a new vector list to store the word semantics that will be
// retained. When this method exits, it will throw away all the other
// vectors.
SparseDoubleVector[] newVectorList = new SparseDoubleVector[maxWords];
// For each of the terms that we have a mapping, add row and column
// maskings for the indices of the first maxWords terms. For all other
// terms, remove the term to index mapping.
int termCount = 0;
for (Map.Entry<String, AtomicInteger> entry : wordCountList) {
Integer oldIndex = termToIndex.get(entry.getKey());
// Skip any non mapped terms.
if (oldIndex == null)
continue;
// Add a row and/or column mask from the index of this word to it's
// index in the original matrix.
if (termCount < maxWords) {
if (termCount < wordCount)
colMask[termCount] = oldIndex;
// Add the vector for this reserved word to the new vector list.
newVectorList[termCount] = vectorList[oldIndex];
// Record the new dimension for this term.
rowMask[termCount] = termCount;
termToIndex.put(entry.getKey(), termCount);
termCount++;
}
// Drop all other mappings.
else
termToIndex.remove(entry.getKey());
}
wordToSemantics = null;
matrix = Matrices.asSparseMatrix(Arrays.asList(newVectorList));
// Return a masked version of the original matrix.
return new CellMaskedSparseMatrix(matrix, rowMask, colMask);
}
|
class class_name[name] begin[{]
method[buildMatrix, return_type[type[Matrix]], modifier[private], parameter[maxWords, maxDimensions]] begin[{]
local_variable[type[SparseDoubleVector], vectorList]
ForStatement(body=StatementExpression(expression=Assignment(expressionl=MemberReference(member=vectorList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], member=getIndexFor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None))]), type==, value=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)), label=None), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=wordToSemantics, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=e)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=SparseDoubleVector, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
local_variable[type[SparseMatrix], matrix]
if[binary_operation[binary_operation[member[.maxWords], ==, literal[0]], ||, binary_operation[member[.maxWords], >, call[wordToSemantics.size, parameter[]]]]] begin[{]
assign[member[.maxWords], call[wordToSemantics.size, parameter[]]]
else begin[{]
None
end[}]
call[COALS_LOGGER.info, parameter[literal["Forming the inverse mapping from terms to indices."]]]
local_variable[type[String], indexToTerm]
ForStatement(body=StatementExpression(expression=Assignment(expressionl=MemberReference(member=indexToTerm, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None))]), type==, value=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None)), label=None), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=termToIndex, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
call[COALS_LOGGER.info, parameter[literal["Sorting the terms based on frequency."]]]
local_variable[type[ArrayList], wordCountList]
call[Collections.sort, parameter[member[.wordCountList], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=EntryComp, sub_type=None))]]
call[COALS_LOGGER.info, parameter[literal["Generating the index masks."]]]
local_variable[type[int], wordCount]
local_variable[type[int], rowMask]
local_variable[type[int], colMask]
local_variable[type[SparseDoubleVector], newVectorList]
local_variable[type[int], termCount]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None)], member=get, postfix_operators=[], prefix_operators=[], qualifier=termToIndex, selectors=[], type_arguments=None), name=oldIndex)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=oldIndex, 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=ContinueStatement(goto=None, label=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=termCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=maxWords, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), else_statement=StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None)], member=remove, postfix_operators=[], prefix_operators=[], qualifier=termToIndex, selectors=[], type_arguments=None), label=None), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=termCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=wordCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=colMask, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=termCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=oldIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=newVectorList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=termCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=vectorList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=oldIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=rowMask, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=termCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=termCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), MemberReference(member=termCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=termToIndex, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MemberReference(member=termCount, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=wordCountList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=AtomicInteger, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
assign[member[.wordToSemantics], literal[null]]
assign[member[.matrix], call[Matrices.asSparseMatrix, parameter[call[Arrays.asList, parameter[member[.newVectorList]]]]]]
return[ClassCreator(arguments=[MemberReference(member=matrix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=rowMask, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=colMask, 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=CellMaskedSparseMatrix, sub_type=None))]
end[}]
END[}]
|
Keyword[private] identifier[Matrix] identifier[buildMatrix] operator[SEP] Keyword[int] identifier[maxWords] , Keyword[int] identifier[maxDimensions] operator[SEP] {
identifier[SparseDoubleVector] operator[SEP] operator[SEP] identifier[vectorList] operator[=] Keyword[new] identifier[SparseDoubleVector] operator[SEP] identifier[wordToSemantics] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[SparseDoubleVector] operator[>] identifier[e] operator[:] identifier[wordToSemantics] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] identifier[vectorList] operator[SEP] identifier[getIndexFor] operator[SEP] identifier[e] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[=] identifier[e] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[SparseMatrix] identifier[matrix] operator[=] identifier[Matrices] operator[SEP] identifier[asSparseMatrix] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[vectorList] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[maxWords] operator[==] Other[0] operator[||] identifier[maxWords] operator[>] identifier[wordToSemantics] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[maxWords] operator[=] identifier[wordToSemantics] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[COALS_LOGGER] operator[SEP] identifier[info] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[indexToTerm] operator[=] Keyword[new] identifier[String] operator[SEP] identifier[termToIndex] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[Integer] operator[>] identifier[entry] operator[:] identifier[termToIndex] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] identifier[indexToTerm] operator[SEP] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[=] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[COALS_LOGGER] operator[SEP] identifier[info] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[ArrayList] operator[<] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[AtomicInteger] operator[>] operator[>] identifier[wordCountList] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[AtomicInteger] operator[>] operator[>] operator[SEP] identifier[totalWordFreq] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Collections] operator[SEP] identifier[sort] operator[SEP] identifier[wordCountList] , Keyword[new] identifier[EntryComp] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[COALS_LOGGER] operator[SEP] identifier[info] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[int] identifier[wordCount] operator[=] operator[SEP] identifier[wordCountList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] identifier[maxDimensions] operator[SEP] operator[?] identifier[maxDimensions] operator[:] identifier[wordCountList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[rowMask] operator[=] Keyword[new] Keyword[int] operator[SEP] identifier[maxWords] operator[SEP] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[colMask] operator[=] Keyword[new] Keyword[int] operator[SEP] identifier[wordCount] operator[SEP] operator[SEP] identifier[SparseDoubleVector] operator[SEP] operator[SEP] identifier[newVectorList] operator[=] Keyword[new] identifier[SparseDoubleVector] operator[SEP] identifier[maxWords] operator[SEP] operator[SEP] Keyword[int] identifier[termCount] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[AtomicInteger] operator[>] identifier[entry] operator[:] identifier[wordCountList] operator[SEP] {
identifier[Integer] identifier[oldIndex] operator[=] identifier[termToIndex] operator[SEP] identifier[get] operator[SEP] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[oldIndex] operator[==] Other[null] operator[SEP] Keyword[continue] operator[SEP] Keyword[if] operator[SEP] identifier[termCount] operator[<] identifier[maxWords] operator[SEP] {
Keyword[if] operator[SEP] identifier[termCount] operator[<] identifier[wordCount] operator[SEP] identifier[colMask] operator[SEP] identifier[termCount] operator[SEP] operator[=] identifier[oldIndex] operator[SEP] identifier[newVectorList] operator[SEP] identifier[termCount] operator[SEP] operator[=] identifier[vectorList] operator[SEP] identifier[oldIndex] operator[SEP] operator[SEP] identifier[rowMask] operator[SEP] identifier[termCount] operator[SEP] operator[=] identifier[termCount] operator[SEP] identifier[termToIndex] operator[SEP] identifier[put] operator[SEP] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[termCount] operator[SEP] operator[SEP] identifier[termCount] operator[++] operator[SEP]
}
Keyword[else] identifier[termToIndex] operator[SEP] identifier[remove] operator[SEP] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[wordToSemantics] operator[=] Other[null] operator[SEP] identifier[matrix] operator[=] identifier[Matrices] operator[SEP] identifier[asSparseMatrix] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[newVectorList] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[CellMaskedSparseMatrix] operator[SEP] identifier[matrix] , identifier[rowMask] , identifier[colMask] operator[SEP] operator[SEP]
}
|
private ComparisonState
compareDocTypes(DocumentType control,
XPathContext controlContext,
DocumentType test,
XPathContext testContext) {
return compare(new Comparison(ComparisonType.DOCTYPE_NAME,
control, getXPath(controlContext),
control.getName(), getParentXPath(controlContext),
test, getXPath(testContext),
test.getName(), getParentXPath(testContext)))
.andThen(new Comparison(ComparisonType.DOCTYPE_PUBLIC_ID,
control, getXPath(controlContext),
control.getPublicId(), getParentXPath(controlContext),
test, getXPath(testContext),
test.getPublicId(), getParentXPath(testContext)))
.andThen(new Comparison(ComparisonType.DOCTYPE_SYSTEM_ID,
control, null, control.getSystemId(), null,
test, null, test.getSystemId(), null));
}
|
class class_name[name] begin[{]
method[compareDocTypes, return_type[type[ComparisonState]], modifier[private], parameter[control, controlContext, test, testContext]] begin[{]
return[call[.compare, parameter[ClassCreator(arguments=[MemberReference(member=DOCTYPE_NAME, postfix_operators=[], prefix_operators=[], qualifier=ComparisonType, selectors=[]), MemberReference(member=control, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=controlContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getXPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=control, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=controlContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getParentXPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=test, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=testContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getXPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=test, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=testContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getParentXPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Comparison, sub_type=None))]]]
end[}]
END[}]
|
Keyword[private] identifier[ComparisonState] identifier[compareDocTypes] operator[SEP] identifier[DocumentType] identifier[control] , identifier[XPathContext] identifier[controlContext] , identifier[DocumentType] identifier[test] , identifier[XPathContext] identifier[testContext] operator[SEP] {
Keyword[return] identifier[compare] operator[SEP] Keyword[new] identifier[Comparison] operator[SEP] identifier[ComparisonType] operator[SEP] identifier[DOCTYPE_NAME] , identifier[control] , identifier[getXPath] operator[SEP] identifier[controlContext] operator[SEP] , identifier[control] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[getParentXPath] operator[SEP] identifier[controlContext] operator[SEP] , identifier[test] , identifier[getXPath] operator[SEP] identifier[testContext] operator[SEP] , identifier[test] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[getParentXPath] operator[SEP] identifier[testContext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[andThen] operator[SEP] Keyword[new] identifier[Comparison] operator[SEP] identifier[ComparisonType] operator[SEP] identifier[DOCTYPE_PUBLIC_ID] , identifier[control] , identifier[getXPath] operator[SEP] identifier[controlContext] operator[SEP] , identifier[control] operator[SEP] identifier[getPublicId] operator[SEP] operator[SEP] , identifier[getParentXPath] operator[SEP] identifier[controlContext] operator[SEP] , identifier[test] , identifier[getXPath] operator[SEP] identifier[testContext] operator[SEP] , identifier[test] operator[SEP] identifier[getPublicId] operator[SEP] operator[SEP] , identifier[getParentXPath] operator[SEP] identifier[testContext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[andThen] operator[SEP] Keyword[new] identifier[Comparison] operator[SEP] identifier[ComparisonType] operator[SEP] identifier[DOCTYPE_SYSTEM_ID] , identifier[control] , Other[null] , identifier[control] operator[SEP] identifier[getSystemId] operator[SEP] operator[SEP] , Other[null] , identifier[test] , Other[null] , identifier[test] operator[SEP] identifier[getSystemId] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public BatchUpdateUserResult batchUpdateUser(BatchUpdateUserRequest request) {
request = beforeClientExecution(request);
return executeBatchUpdateUser(request);
}
|
class class_name[name] begin[{]
method[batchUpdateUser, return_type[type[BatchUpdateUserResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeBatchUpdateUser, parameter[member[.request]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[BatchUpdateUserResult] identifier[batchUpdateUser] operator[SEP] identifier[BatchUpdateUserRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeBatchUpdateUser] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
public boolean isWritable(int column) throws SQLException {
checkColumn(column);
return resultMetaData.colIndexes != null
&& resultMetaData.colIndexes[--column] > -1;
}
|
class class_name[name] begin[{]
method[isWritable, return_type[type[boolean]], modifier[public], parameter[column]] begin[{]
call[.checkColumn, parameter[member[.column]]]
return[binary_operation[binary_operation[member[resultMetaData.colIndexes], !=, literal[null]], &&, binary_operation[member[resultMetaData.colIndexes], >, literal[1]]]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[isWritable] operator[SEP] Keyword[int] identifier[column] operator[SEP] Keyword[throws] identifier[SQLException] {
identifier[checkColumn] operator[SEP] identifier[column] operator[SEP] operator[SEP] Keyword[return] identifier[resultMetaData] operator[SEP] identifier[colIndexes] operator[!=] Other[null] operator[&&] identifier[resultMetaData] operator[SEP] identifier[colIndexes] operator[SEP] operator[--] identifier[column] operator[SEP] operator[>] operator[-] Other[1] operator[SEP]
}
|
public static float fieldOfView(float focalLength, float sensorWidth) {
double fov = 2 * Math.atan(.5 * sensorWidth / focalLength);
return (float) Math.toDegrees(fov);
}
|
class class_name[name] begin[{]
method[fieldOfView, return_type[type[float]], modifier[public static], parameter[focalLength, sensorWidth]] begin[{]
local_variable[type[double], fov]
return[Cast(expression=MethodInvocation(arguments=[MemberReference(member=fov, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toDegrees, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=float))]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[float] identifier[fieldOfView] operator[SEP] Keyword[float] identifier[focalLength] , Keyword[float] identifier[sensorWidth] operator[SEP] {
Keyword[double] identifier[fov] operator[=] Other[2] operator[*] identifier[Math] operator[SEP] identifier[atan] operator[SEP] literal[Float] operator[*] identifier[sensorWidth] operator[/] identifier[focalLength] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[float] operator[SEP] identifier[Math] operator[SEP] identifier[toDegrees] operator[SEP] identifier[fov] operator[SEP] operator[SEP]
}
|
Rule IfieldOrigin() {
return Sequence(String("[O:"),
ZeroOrMore(WSP()).suppressNode(),
TexTextIfield(),
String("]"))
.label(IfieldOrigin);
}
|
class class_name[name] begin[{]
method[IfieldOrigin, return_type[type[Rule]], modifier[default], parameter[]] begin[{]
return[call[.Sequence, parameter[call[.String, parameter[literal["[O:"]]], call[.ZeroOrMore, parameter[call[.WSP, parameter[]]]], call[.TexTextIfield, parameter[]], call[.String, parameter[literal["]"]]]]]]
end[}]
END[}]
|
identifier[Rule] identifier[IfieldOrigin] operator[SEP] operator[SEP] {
Keyword[return] identifier[Sequence] operator[SEP] identifier[String] operator[SEP] literal[String] operator[SEP] , identifier[ZeroOrMore] operator[SEP] identifier[WSP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[suppressNode] operator[SEP] operator[SEP] , identifier[TexTextIfield] operator[SEP] operator[SEP] , identifier[String] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[label] operator[SEP] identifier[IfieldOrigin] operator[SEP] operator[SEP]
}
|
protected void bindLiteral(int paramIndex, String s, int oid) throws SQLException {
preparedParameters.setLiteralParameter(paramIndex, s, oid);
}
|
class class_name[name] begin[{]
method[bindLiteral, return_type[void], modifier[protected], parameter[paramIndex, s, oid]] begin[{]
call[preparedParameters.setLiteralParameter, parameter[member[.paramIndex], member[.s], member[.oid]]]
end[}]
END[}]
|
Keyword[protected] Keyword[void] identifier[bindLiteral] operator[SEP] Keyword[int] identifier[paramIndex] , identifier[String] identifier[s] , Keyword[int] identifier[oid] operator[SEP] Keyword[throws] identifier[SQLException] {
identifier[preparedParameters] operator[SEP] identifier[setLiteralParameter] operator[SEP] identifier[paramIndex] , identifier[s] , identifier[oid] operator[SEP] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.